mirror of
https://github.com/status-im/js-waku-examples.git
synced 2025-02-03 18:53:34 +00:00
chore: update signature message and use single const
This commit is contained in:
parent
aadcefc07a
commit
05e8308ef0
@ -83,7 +83,6 @@
|
|||||||
<div class="row rcenter">
|
<div class="row rcenter">
|
||||||
<h4>Key</h4>
|
<h4>Key</h4>
|
||||||
<code class="value" id="key">none</code>
|
<code class="value" id="key">none</code>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row rcenter">
|
<div class="row rcenter">
|
||||||
<h4>Commitment</h4>
|
<h4>Commitment</h4>
|
||||||
@ -209,6 +208,9 @@
|
|||||||
let retrievedRLNEvents = false;
|
let retrievedRLNEvents = false;
|
||||||
const rlnInstancePromise = create();
|
const rlnInstancePromise = create();
|
||||||
|
|
||||||
|
const signatureMessage =
|
||||||
|
"The signature of this message will be used to generate your RLN credentials. Anyone accessing it may send messages on your behalf, please only share with the RLN dApp";
|
||||||
|
|
||||||
// Load zero-kit WASM blob.
|
// Load zero-kit WASM blob.
|
||||||
|
|
||||||
statusSpan.innerText = "WASM Blob download in progress...";
|
statusSpan.innerText = "WASM Blob download in progress...";
|
||||||
@ -254,7 +256,6 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
importManually.disabled = !(
|
importManually.disabled = !(
|
||||||
|
|
||||||
membershipIdInput.value &&
|
membershipIdInput.value &&
|
||||||
identityKeyInput.value &&
|
identityKeyInput.value &&
|
||||||
commitmentKeyInput.value
|
commitmentKeyInput.value
|
||||||
@ -275,10 +276,9 @@
|
|||||||
generateCredsButton.onclick = async () => {
|
generateCredsButton.onclick = async () => {
|
||||||
// sign message with ethers
|
// sign message with ethers
|
||||||
const signer = provider.getSigner();
|
const signer = provider.getSigner();
|
||||||
const message =
|
|
||||||
"The signature of this message will be used to generate your RLN credentials. Ensure that this signature is only shared with the RLN dApp.";
|
const signature = await signer.signMessage(signatureMessage);
|
||||||
const signature = await signer.signMessage(message);
|
|
||||||
console.log({ signature });
|
|
||||||
// provide the signature as a seed
|
// provide the signature as a seed
|
||||||
membershipKey = rlnInstance.generateSeededMembershipKey(signature);
|
membershipKey = rlnInstance.generateSeededMembershipKey(signature);
|
||||||
|
|
||||||
@ -290,7 +290,6 @@
|
|||||||
commitmentKeyInput.onchange = updateFields;
|
commitmentKeyInput.onchange = updateFields;
|
||||||
|
|
||||||
importManually.onclick = () => {
|
importManually.onclick = () => {
|
||||||
|
|
||||||
const idKey = utils.hexToBytes(identityKeyInput.value);
|
const idKey = utils.hexToBytes(identityKeyInput.value);
|
||||||
const idCommitment = utils.hexToBytes(commitmentKeyInput.value);
|
const idCommitment = utils.hexToBytes(commitmentKeyInput.value);
|
||||||
membershipKey = new MembershipKey(idKey, idCommitment);
|
membershipKey = new MembershipKey(idKey, idCommitment);
|
||||||
@ -301,9 +300,7 @@
|
|||||||
importFromWalletButton.onclick = async () => {
|
importFromWalletButton.onclick = async () => {
|
||||||
const signer = provider.getSigner();
|
const signer = provider.getSigner();
|
||||||
|
|
||||||
const message =
|
const signature = await signer.signMessage(signatureMessage);
|
||||||
"The signature of this message will be used to generate your RLN credentials. Ensure that this signature is only shared with the RLN dApp.";
|
|
||||||
const signature = await signer.signMessage(message);
|
|
||||||
|
|
||||||
membershipKey = await rlnInstance.generateSeededMembershipKey(
|
membershipKey = await rlnInstance.generateSeededMembershipKey(
|
||||||
signature
|
signature
|
||||||
@ -386,7 +383,6 @@
|
|||||||
checkChain(network.chainId);
|
checkChain(network.chainId);
|
||||||
|
|
||||||
importFromWalletButton.disabled = false;
|
importFromWalletButton.disabled = false;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("No web3 provider available", e);
|
console.log("No web3 provider available", e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user