feat: use @waku/sdk for basic examples (#241)

* use @waku/sdk for light-js

* use sdk and latest utils

* fix import

* use sdk and utils for noise-rtc

* migrate relay-js

* migrate rln-js
This commit is contained in:
Sasha 2023-06-21 00:25:25 +02:00 committed by GitHub
parent cb8fbe854b
commit 9190da0e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1207 additions and 1100 deletions

View File

@ -42,13 +42,14 @@
<script src="https://unpkg.com/@multiformats/multiaddr@12.1.1/dist/index.min.js"></script> <script src="https://unpkg.com/@multiformats/multiaddr@12.1.1/dist/index.min.js"></script>
<script type="module"> <script type="module">
import * as utils from "https://unpkg.com/@waku/utils@0.0.5/bundle/bytes.js";
import { createLightNode } from "https://unpkg.com/@waku/create@0.0.13/bundle/index.js";
import { import {
createLightNode,
waitForRemotePeer, waitForRemotePeer,
createEncoder, createEncoder,
createDecoder, createDecoder,
} from "https://unpkg.com/@waku/core@0.0.17/bundle/index.js"; utf8ToBytes,
bytesToUtf8,
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
const peerIdDiv = document.getElementById("peer-id"); const peerIdDiv = document.getElementById("peer-id");
const remotePeerIdDiv = document.getElementById("remote-peer-id"); const remotePeerIdDiv = document.getElementById("remote-peer-id");
@ -101,7 +102,7 @@
}; };
const callback = (wakuMessage) => { const callback = (wakuMessage) => {
const text = utils.bytesToUtf8(wakuMessage.payload); const text = bytesToUtf8(wakuMessage.payload);
const timestamp = wakuMessage.timestamp.toString(); const timestamp = wakuMessage.timestamp.toString();
messages.push(text + " - " + timestamp); messages.push(text + " - " + timestamp);
updateMessages(messages, messagesDiv); updateMessages(messages, messagesDiv);
@ -124,7 +125,7 @@
const text = textInput.value; const text = textInput.value;
await node.lightPush.send(encoder, { await node.lightPush.send(encoder, {
payload: utils.utf8ToBytes(text), payload: utf8ToBytes(text),
}); });
console.log("Message sent!"); console.log("Message sent!");
textInput.value = null; textInput.value = null;

View File

@ -1,6 +1,5 @@
import { createLightNode } from "@waku/create"; import { createLightNode, waitForRemotePeer } from "@waku/sdk";
import * as utils from "@waku/utils/bytes"; import * as utils from "@waku/utils/bytes";
import { waitForRemotePeer } from "@waku/core";
import * as noise from "@waku/noise"; import * as noise from "@waku/noise";
import protobuf from "protobufjs"; import protobuf from "protobufjs";
import QRCode from "qrcode"; import QRCode from "qrcode";

View File

@ -8,10 +8,9 @@
"name": "@waku/noise-example", "name": "@waku/noise-example",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@waku/core": "0.0.19",
"@waku/create": "0.0.15",
"@waku/noise": "0.0.3-31510da", "@waku/noise": "0.0.3-31510da",
"@waku/utils": "0.0.6", "@waku/sdk": "0.0.16",
"@waku/utils": "0.0.8",
"protobufjs": "^7.1.2", "protobufjs": "^7.1.2",
"qrcode": "^1.5.1" "qrcode": "^1.5.1"
}, },
@ -1754,144 +1753,6 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@waku/core": {
"version": "0.0.19",
"resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.19.tgz",
"integrity": "sha512-rmgoX7Qx5UI73BMF58UUBaQv5JkHY00es+4Ig+OGQvPrY64jKno5ZLFUVhKzMF3n6WlRNf5kfdCr5MjQXrDygA==",
"dependencies": {
"@noble/hashes": "^1.3.0",
"@waku/interfaces": "0.0.14",
"@waku/proto": "0.0.5",
"@waku/utils": "0.0.7",
"debug": "^4.3.4",
"it-all": "^3.0.1",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^2.0.5",
"p-event": "^5.0.1",
"uint8arraylist": "^2.4.3",
"uuid": "^9.0.0"
},
"engines": {
"node": ">=16"
},
"peerDependencies": {
"@multiformats/multiaddr": "^12.0.0",
"libp2p": "^0.42.2"
},
"peerDependenciesMeta": {
"@multiformats/multiaddr": {
"optional": true
}
}
},
"node_modules/@waku/core/node_modules/@waku/proto": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.5.tgz",
"integrity": "sha512-td0WKhUm+pcnpkbhuu5XV79ZcuM+f7b5swNIHHcqCaW5FaJeCtEhXsG8kNrt97kcDAHdr41lxFgQTRDlmAns4A==",
"dependencies": {
"protons-runtime": "^5.0.0"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/core/node_modules/@waku/utils": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.7.tgz",
"integrity": "sha512-qo9B807Fp8Sg5QHK47WewIsQbnDvgCtBs/nlQWqwWLg5HfAfISRpnfQ6tLQYvzXD+0OAPwcsSqYIiQ7rIOm0kA==",
"dependencies": {
"debug": "^4.3.4",
"uint8arrays": "^4.0.3"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/create": {
"version": "0.0.15",
"resolved": "https://registry.npmjs.org/@waku/create/-/create-0.0.15.tgz",
"integrity": "sha512-4O977FrFeToxagVAHMJtM1dPWZez8dpUaQB9ZqXsBD7LgC8Jh1IgPjgdDUv0141X/+b6QxiNDJZQAnTmTt8dNQ==",
"dependencies": {
"@chainsafe/libp2p-noise": "^11.0.0",
"@libp2p/mplex": "^7.1.1",
"@libp2p/websockets": "^5.0.3",
"@waku/core": "0.0.19",
"@waku/dns-discovery": "0.0.13",
"@waku/relay": "0.0.2",
"libp2p": "^0.42.2"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/dns-discovery": {
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/@waku/dns-discovery/-/dns-discovery-0.0.13.tgz",
"integrity": "sha512-HuyYs9iHfu8DIhJKxu1CDEVnwkQOAQtVQK+da52J9YIU1q2H4qM5UgVgEkIC7+L1jJgR7OZFvqrm3EhSuQ4AwA==",
"dependencies": {
"@libp2p/interface-peer-discovery": "^1.0.5",
"@libp2p/interfaces": "^3.3.1",
"@waku/enr": "0.0.13",
"@waku/utils": "0.0.7",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
"uint8arrays": "^4.0.3"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/dns-discovery/node_modules/@waku/utils": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.7.tgz",
"integrity": "sha512-qo9B807Fp8Sg5QHK47WewIsQbnDvgCtBs/nlQWqwWLg5HfAfISRpnfQ6tLQYvzXD+0OAPwcsSqYIiQ7rIOm0kA==",
"dependencies": {
"debug": "^4.3.4",
"uint8arrays": "^4.0.3"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/enr": {
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/@waku/enr/-/enr-0.0.13.tgz",
"integrity": "sha512-nyHKYAkpYixtS//Wef/tHTvDkF/ZWydKx9+TfK9wH3nP9/FLBqFKuqDSNoxvaA7BliFicLvNRaGqmRdEQee0/g==",
"dependencies": {
"@ethersproject/rlp": "^5.7.0",
"@libp2p/crypto": "^1.0.15",
"@libp2p/peer-id": "^2.0.3",
"@multiformats/multiaddr": "^12.0.0",
"@noble/secp256k1": "^1.7.1",
"@waku/utils": "0.0.7",
"debug": "^4.3.4",
"js-sha3": "^0.8.0"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/enr/node_modules/@waku/utils": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.7.tgz",
"integrity": "sha512-qo9B807Fp8Sg5QHK47WewIsQbnDvgCtBs/nlQWqwWLg5HfAfISRpnfQ6tLQYvzXD+0OAPwcsSqYIiQ7rIOm0kA==",
"dependencies": {
"debug": "^4.3.4",
"uint8arrays": "^4.0.3"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/interfaces": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@waku/interfaces/-/interfaces-0.0.14.tgz",
"integrity": "sha512-YatgPAUCwtVmKkg+DJY7Q0oxfCiPn45OaK5RE+oJVoOEgLHcy1Ty4e6uIw+y3X9j7hcyWnZUAci836xPNo+/Lw==",
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/noise": { "node_modules/@waku/noise": {
"version": "0.0.3-31510da", "version": "0.0.3-31510da",
"resolved": "https://registry.npmjs.org/@waku/noise/-/noise-0.0.3-31510da.tgz", "resolved": "https://registry.npmjs.org/@waku/noise/-/noise-0.0.3-31510da.tgz",
@ -1979,26 +1840,99 @@
"node": ">=16" "node": ">=16"
} }
}, },
"node_modules/@waku/relay": { "node_modules/@waku/sdk": {
"version": "0.0.2", "version": "0.0.16",
"resolved": "https://registry.npmjs.org/@waku/relay/-/relay-0.0.2.tgz", "resolved": "https://registry.npmjs.org/@waku/sdk/-/sdk-0.0.16.tgz",
"integrity": "sha512-z2/wuqjUxv9WyYXDwPN3Rp0QUD/qiVlHaPJMQw0i3XsY1hfbR4QAvONDswnc91ikPhGKP3LzXA2kAqADPpRnqQ==", "integrity": "sha512-G9R+2rwOf8DE+lzLfcM5d5IICeRmktyfH4g77aWkgsBA5GvBJoMY5vnIS1j1tqJ+J4UfGp+CggHmHW+x9li1mA==",
"dependencies": { "dependencies": {
"@chainsafe/libp2p-gossipsub": "^6.1.0", "@chainsafe/libp2p-noise": "^11.0.0",
"@noble/hashes": "^1.3.0", "@libp2p/mplex": "^7.1.1",
"@waku/core": "0.0.19", "@libp2p/websockets": "^5.0.3",
"@waku/interfaces": "0.0.14", "@waku/core": "0.0.20",
"@waku/proto": "0.0.5", "@waku/dns-discovery": "0.0.14",
"@waku/utils": "0.0.7", "@waku/relay": "0.0.3",
"chai": "^4.3.7", "@waku/utils": "0.0.8",
"debug": "^4.3.4", "libp2p": "^0.42.2"
"fast-check": "^3.8.1"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=16"
} }
}, },
"node_modules/@waku/relay/node_modules/@waku/proto": { "node_modules/@waku/sdk/node_modules/@waku/core": {
"version": "0.0.20",
"resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.20.tgz",
"integrity": "sha512-1p8TmOvbGhUQZHKE+w1FQtmp+EDTNQEsSgrsMoSjzGVdI+XuQQ/l2aefwOuBQHIHh99+VZBQ9ut+ArstFHks/A==",
"dependencies": {
"@noble/hashes": "^1.3.0",
"@waku/interfaces": "0.0.15",
"@waku/proto": "0.0.5",
"@waku/utils": "0.0.8",
"debug": "^4.3.4",
"it-all": "^3.0.2",
"it-length-prefixed": "^9.0.1",
"it-pipe": "^3.0.1",
"p-event": "^5.0.1",
"uint8arraylist": "^2.4.3",
"uuid": "^9.0.0"
},
"engines": {
"node": ">=16"
},
"peerDependencies": {
"@multiformats/multiaddr": "^12.0.0",
"libp2p": "^0.42.2"
},
"peerDependenciesMeta": {
"@multiformats/multiaddr": {
"optional": true
}
}
},
"node_modules/@waku/sdk/node_modules/@waku/dns-discovery": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@waku/dns-discovery/-/dns-discovery-0.0.14.tgz",
"integrity": "sha512-S8kzLUvmqIuqLGcPAT6JAYFDrxB/TeMEihU4tsWWg7UBnxyQVH2lqkjzGxnqClrQ9XFukvlH1fhvn0AIkKg25A==",
"dependencies": {
"@libp2p/interface-peer-discovery": "^1.0.5",
"@libp2p/interfaces": "^3.3.1",
"@waku/enr": "0.0.14",
"@waku/utils": "0.0.8",
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
"uint8arrays": "^4.0.3"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/sdk/node_modules/@waku/enr": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@waku/enr/-/enr-0.0.14.tgz",
"integrity": "sha512-oujSa7lVZoVEL2A/xA1UQqkktkeSL7I1ivt6hsMfK/3BbsQPt4d4LchY5QG7Vahrebv2BZ+/tvckhQ2mkF3azg==",
"dependencies": {
"@ethersproject/rlp": "^5.7.0",
"@libp2p/crypto": "^1.0.17",
"@libp2p/peer-id": "^2.0.3",
"@multiformats/multiaddr": "^12.0.0",
"@noble/secp256k1": "^1.7.1",
"@waku/utils": "0.0.8",
"debug": "^4.3.4",
"js-sha3": "^0.8.0"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/sdk/node_modules/@waku/interfaces": {
"version": "0.0.15",
"resolved": "https://registry.npmjs.org/@waku/interfaces/-/interfaces-0.0.15.tgz",
"integrity": "sha512-l8MDtMtA51nWeeU36lZV07JWMLHmnn7Dm93ihS2lgqWACbhzwOEDZ3alox4T8Um7A3RmnK/WZ5U2Cprs3ukt8w==",
"engines": {
"node": ">=16"
}
},
"node_modules/@waku/sdk/node_modules/@waku/proto": {
"version": "0.0.5", "version": "0.0.5",
"resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.5.tgz", "resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.5.tgz",
"integrity": "sha512-td0WKhUm+pcnpkbhuu5XV79ZcuM+f7b5swNIHHcqCaW5FaJeCtEhXsG8kNrt97kcDAHdr41lxFgQTRDlmAns4A==", "integrity": "sha512-td0WKhUm+pcnpkbhuu5XV79ZcuM+f7b5swNIHHcqCaW5FaJeCtEhXsG8kNrt97kcDAHdr41lxFgQTRDlmAns4A==",
@ -2009,22 +1943,64 @@
"node": ">=16" "node": ">=16"
} }
}, },
"node_modules/@waku/relay/node_modules/@waku/utils": { "node_modules/@waku/sdk/node_modules/@waku/relay": {
"version": "0.0.7", "version": "0.0.3",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.7.tgz", "resolved": "https://registry.npmjs.org/@waku/relay/-/relay-0.0.3.tgz",
"integrity": "sha512-qo9B807Fp8Sg5QHK47WewIsQbnDvgCtBs/nlQWqwWLg5HfAfISRpnfQ6tLQYvzXD+0OAPwcsSqYIiQ7rIOm0kA==", "integrity": "sha512-KDcfuOnTu/8HjNTwPXeVyd+qEIPZ7AXH0p4EwbfiucHbYWy7ahpljYz1fExwG7nKFsZ9uKtB7QGBBDy1ghKMCA==",
"dependencies": { "dependencies": {
"@chainsafe/libp2p-gossipsub": "^6.1.0",
"@noble/hashes": "^1.3.0",
"@waku/core": "0.0.20",
"@waku/interfaces": "0.0.15",
"@waku/proto": "0.0.5",
"@waku/utils": "0.0.8",
"chai": "^4.3.7",
"debug": "^4.3.4", "debug": "^4.3.4",
"uint8arrays": "^4.0.3" "fast-check": "^3.8.1"
}, },
"engines": { "engines": {
"node": ">=16" "node": ">=16"
} }
}, },
"node_modules/@waku/sdk/node_modules/it-merge": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/it-merge/-/it-merge-3.0.1.tgz",
"integrity": "sha512-I6hjU1ABO+k3xY1H6JtCSDXvUME88pxIXSgKeT4WI5rPYbQzpr98ldacVuG95WbjaJxKl6Qot6lUdxduLBQPHA==",
"dependencies": {
"it-pushable": "^3.1.0"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@waku/sdk/node_modules/it-pipe": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-3.0.1.tgz",
"integrity": "sha512-sIoNrQl1qSRg2seYSBH/3QxWhJFn9PKYvOf/bHdtCBF0bnghey44VyASsWzn5dAx0DCDDABq1hZIuzKmtBZmKA==",
"dependencies": {
"it-merge": "^3.0.0",
"it-pushable": "^3.1.2",
"it-stream-types": "^2.0.1"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@waku/sdk/node_modules/it-stream-types": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/it-stream-types/-/it-stream-types-2.0.1.tgz",
"integrity": "sha512-6DmOs5r7ERDbvS4q8yLKENcj6Yecr7QQTqWApbZdfAUTEC947d+PEha7PCqhm//9oxaLYL7TWRekwhoXl2s6fg==",
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@waku/utils": { "node_modules/@waku/utils": {
"version": "0.0.6", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.6.tgz", "resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.8.tgz",
"integrity": "sha512-hyHeP3PLMoxWzg/ghQpagNZAm5G0nncuJSE1n/ml+4oeY5+oimF4Qh6PGXxakjJYKY5+JWN7Y3OHj+CO2cbKnA==", "integrity": "sha512-pMs06f+P+jBq8v4Hyek7VTkCB0Suxc+baXqNfqTdM7xqzmwnCjfi1q9ummCln17Q3+6lVsbwHzUfikGTyoMeow==",
"dependencies": { "dependencies": {
"debug": "^4.3.4", "debug": "^4.3.4",
"uint8arrays": "^4.0.3" "uint8arrays": "^4.0.3"

View File

@ -9,10 +9,9 @@
"start": "webpack-dev-server" "start": "webpack-dev-server"
}, },
"dependencies": { "dependencies": {
"@waku/core": "0.0.19", "@waku/sdk": "0.0.16",
"@waku/create": "0.0.15",
"@waku/noise": "0.0.3-31510da", "@waku/noise": "0.0.3-31510da",
"@waku/utils": "0.0.6", "@waku/utils": "0.0.8",
"protobufjs": "^7.1.2", "protobufjs": "^7.1.2",
"qrcode": "^1.5.1" "qrcode": "^1.5.1"
}, },

View File

@ -1,6 +1,5 @@
import { createLightNode } from "@waku/create"; import { createLightNode, waitForRemotePeer } from "@waku/sdk";
import * as utils from "@waku/utils/bytes"; import * as utils from "@waku/utils/bytes";
import { waitForRemotePeer } from "@waku/core";
import * as noise from "@waku/noise"; import * as noise from "@waku/noise";
import protobuf from "protobufjs"; import protobuf from "protobufjs";
import QRCode from "qrcode"; import QRCode from "qrcode";

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,9 @@
"start": "webpack-dev-server" "start": "webpack-dev-server"
}, },
"dependencies": { "dependencies": {
"@waku/core": "0.0.19", "@waku/sdk": "0.0.16",
"@waku/create": "0.0.15",
"@waku/noise": "0.0.3-31510da", "@waku/noise": "0.0.3-31510da",
"@waku/utils": "0.0.6", "@waku/utils": "0.0.8",
"protobufjs": "^7.1.2", "protobufjs": "^7.1.2",
"qrcode": "^1.5.1" "qrcode": "^1.5.1"
}, },

View File

@ -33,16 +33,14 @@
* Recommended payload is protobuf. Using simple utf-8 string for demo purposes only. * Recommended payload is protobuf. Using simple utf-8 string for demo purposes only.
*/ */
import {
bytesToUtf8,
utf8ToBytes,
} from "https://unpkg.com/@waku/utils@0.0.5/bundle/bytes.js";
import { createRelayNode } from "https://unpkg.com/@waku/create@0.0.13/bundle/index.js";
import { import {
waitForRemotePeer, waitForRemotePeer,
createDecoder, createDecoder,
createEncoder, createEncoder,
} from "https://unpkg.com/@waku/core@0.0.17/bundle/index.js"; bytesToUtf8,
utf8ToBytes,
createRelayNode,
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
const statusDiv = document.getElementById("status"); const statusDiv = document.getElementById("status");
const messagesDiv = document.getElementById("messages"); const messagesDiv = document.getElementById("messages");

View File

@ -1,10 +1,10 @@
import * as utils from "https://unpkg.com/@waku/utils@0.0.4/bundle/bytes.js"; import * as utils from "https://unpkg.com/@waku/utils@0.0.8/bundle/bytes.js";
import { createLightNode } from "https://unpkg.com/@waku/create@0.0.12/bundle/index.js";
import { import {
createEncoder, createEncoder,
createDecoder, createDecoder,
waitForRemotePeer, waitForRemotePeer,
} from "https://unpkg.com/@waku/core@0.0.16/bundle/index.js"; createLightNode,
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
import { protobuf } from "https://taisukef.github.io/protobuf-es.js/dist/protobuf-es.js"; import { protobuf } from "https://taisukef.github.io/protobuf-es.js/dist/protobuf-es.js";
import { import {
create, create,
@ -284,8 +284,8 @@ function initUI() {
const membershipIdInput = document.getElementById("membership-id"); const membershipIdInput = document.getElementById("membership-id");
const idSecretHashInput = document.getElementById("id-secret-hash"); const idSecretHashInput = document.getElementById("id-secret-hash");
const commitmentKeyInput = document.getElementById("commitment-key"); const commitmentKeyInput = document.getElementById("commitment-key");
const idTrapdoorInput = document.getElementById("id-trapdoor") const idTrapdoorInput = document.getElementById("id-trapdoor");
const idNullifierInput = document.getElementById("id-nullifier") const idNullifierInput = document.getElementById("id-nullifier");
const importManually = document.getElementById("import-manually-button"); const importManually = document.getElementById("import-manually-button");
const importFromWalletButton = document.getElementById( const importFromWalletButton = document.getElementById(
"import-from-wallet-button" "import-from-wallet-button"
@ -418,9 +418,13 @@ function initUI() {
const idCommitment = utils.hexToBytes(commitmentKeyInput.value); const idCommitment = utils.hexToBytes(commitmentKeyInput.value);
const idSecretHash = utils.hexToBytes(idSecretHashInput.value); const idSecretHash = utils.hexToBytes(idSecretHashInput.value);
const membershipId = membershipIdInput.value; const membershipId = membershipIdInput.value;
const credentials = new IdentityCredential(idTrapdoor, idNullifier, idSecretHash, idCommitment); const credentials = new IdentityCredential(
idTrapdoor,
idNullifier,
idSecretHash,
idCommitment
);
fn(membershipId, credentials); fn(membershipId, credentials);
}); });