Skip to content

Commit 116bdb3

Browse files
authored
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
1 parent 5efe996 commit 116bdb3

24 files changed

+3385
-3800
lines changed

.eslintrc.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/node_modules
2-
coverage
2+
/coverage
33
dist
44
.DS_Store
55
.idea
6-
.vscode
6+
.vscode

config/tsconfig.esm.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from '@iden3/eslint-config';
2+
3+
export default config;

index.html

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
4-
<head>
5-
<meta charset="UTF-8">
6-
<meta http-equiv="X-UA-Compatible"
7-
content="IE=edge">
8-
<meta name="viewport"
9-
content="width=device-width, initial-scale=1.0">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
107
<script src="./dist/browser/umd/index.js"></script>
118
<title>Test</title>
12-
</head>
9+
</head>
1310

14-
<body>
11+
<body>
1512
Test browser
16-
</body>
17-
<script>
18-
// Function to convert hex to base64
19-
function base64FromHex(hex) {
20-
hex = hex.replace(/^0x/, '');
21-
hex = hex.length % 2 != 0 ? '0' + hex : hex;
22-
const buffer = new Uint8Array(hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
23-
return btoa(String.fromCharCode(...buffer));
24-
}
25-
26-
const { poseidon, PrivateKey, Signature, utils, ffUtils, Hex } = IdenJsCrypto;
13+
</body>
14+
<script>
15+
const { PrivateKey, Signature, utils, ffUtils, Hex } = IdenJsCrypto;
2716
const msgBuf = Hex.decodeString('000102030405060708090000');
2817
const msg = ffUtils.leBuff2int(msgBuf);
2918

30-
const skBuff = Hex.decodeString('0001020304050607080900010203040506070809000102030405060708090001');
19+
const skBuff = Hex.decodeString(
20+
'0001020304050607080900010203040506070809000102030405060708090001'
21+
);
3122

3223
const privateKey = new PrivateKey(skBuff);
3324

@@ -38,12 +29,10 @@
3829

3930
const signature = privateKey.signPoseidon(msg);
4031

41-
4232
const pSignature = signature.compress();
4333

4434
const uSignature = Signature.newFromCompressed(pSignature);
4535

4636
console.assert(pubKey.verifyPoseidon(msg, uSignature));
47-
</script>
48-
37+
</script>
4938
</html>

jest.config.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)