Skip to content

Commit

Permalink
Multi platform build. Removed Dependencies. Make build 2.2 times smal…
Browse files Browse the repository at this point in the history
…ler (#14)

* Multi platform build. Removed Dependencies. Make build 2.2 times smaller

* Add compressing function

* Remove prebuild function

* FIx comments
  • Loading branch information
Kolezhniuk committed Aug 31, 2023
1 parent cfe9b3a commit eba4324
Show file tree
Hide file tree
Showing 27 changed files with 1,646 additions and 25,161 deletions.
2 changes: 1 addition & 1 deletion config/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"extends": "../tsconfig",
"compilerOptions": {
"module": "ES2020",
"outDir": "../dist/esm"
"outDir": "../dist/node/esm",
}
}
12 changes: 10 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@
content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<script src="./dist/umd/index.js"></script>
<script src="./dist/browser/umd/index.js"></script>
<title>Test</title>
</head>

<body>
Test browser
</body>
<script>
// Function to convert hex to base64
function base64FromHex(hex) {
hex = hex.replace(/^0x/, '');
hex = hex.length % 2 != 0 ? '0' + hex : hex;
const buffer = new Uint8Array(hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
return btoa(String.fromCharCode(...buffer));
}

const { poseidon, PrivateKey, Signature, utils, ffUtils, Hex } = IdenJsCrypto;
const msgBuf = Hex.decodeString('000102030405060708090000');
const msg = ffUtils.leBuff2int(msgBuf);
Expand All @@ -35,7 +43,7 @@

const uSignature = Signature.newFromCompressed(pSignature);

console.log(pubKey.verifyPoseidon(msg, uSignature));
console.assert(pubKey.verifyPoseidon(msg, uSignature));
</script>

</html>
Loading

0 comments on commit eba4324

Please sign in to comment.