Files
js-crypto/index.html
Dimasik Kolezhniuk 116bdb3a57 ESM module migration (#21)
* 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
2025-02-18 14:31:36 +01:00

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>