-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
38 lines (29 loc) · 1.02 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="./dist/browser/umd/index.js"></script>
<title>Test</title>
</head>
<body>
Test browser
</body>
<script>
const { PrivateKey, Signature, utils, ffUtils, Hex } = IdenJsCrypto;
const msgBuf = Hex.decodeString('000102030405060708090000');
const msg = ffUtils.leBuff2int(msgBuf);
const skBuff = Hex.decodeString(
'0001020304050607080900010203040506070809000102030405060708090001'
);
const privateKey = new PrivateKey(skBuff);
const pubKey = privateKey.public();
const pPubKey = pubKey.compress();
console.log(pPubKey);
const signature = privateKey.signPoseidon(msg);
const pSignature = signature.compress();
const uSignature = Signature.newFromCompressed(pSignature);
console.assert(pubKey.verifyPoseidon(msg, uSignature));
</script>
</html>