mirror of
https://github.com/iden3/js-crypto.git
synced 2026-01-11 14:57:58 -05:00
* ESM module migration * Update typescript * Add to bigInt function for PK * 1.2.0 * Format * Renaming. Fix lint * Update package version * Update package lock * Update package lock * Update package lock * add audited blake hash. Fix esm for node * Fixes
39 lines
1.0 KiB
HTML
39 lines
1.0 KiB
HTML
<!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>
|