Skip to content

Commit

Permalink
chore(rln-keystore-generator): log out the membership index upon regi…
Browse files Browse the repository at this point in the history
…stration (#1963)
  • Loading branch information
rymnc committed Aug 30, 2023
1 parent 9b1d290 commit 7d53aec
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tools/rln_keystore_generator/rln_keystore_generator.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ when isMainModule:
quit(1)

let conf = confRes.get()
debug "configuration", conf = $conf

trace "configuration", conf = $conf

# 2. initialize rlnInstance
let rlnInstanceRes = createRLNInstance(d=20,
let rlnInstanceRes = createRLNInstance(d=20,
tree_path = genTempPath("rln_tree", "rln_keystore_generator"))
if rlnInstanceRes.isErr():
error "failure while creating RLN instance", error=rlnInstanceRes.error
Expand All @@ -46,12 +46,12 @@ when isMainModule:
quit(1)

let credential = credentialRes.get()
debug "credentials", idTrapdoor = credential.idTrapdoor.inHex(),
debug "credentials", idTrapdoor = credential.idTrapdoor.inHex(),
idNullifier = credential.idNullifier.inHex(),
idSecretHash = credential.idSecretHash.inHex(),
idCommitment = credential.idCommitment.inHex()


if not conf.execute:
info "not executing, exiting"
quit(0)
Expand All @@ -78,6 +78,10 @@ when isMainModule:

debug "Transaction hash", txHash = groupManager.registrationTxHash.get()

info "Your membership has been registered on-chain.", chainId = $groupManager.chainId.get(),
contractAddress = conf.rlnRelayEthContractAddress,
membershipIndex = groupManager.membershipIndex.get()

# 6. write to keystore
let keystoreCred = KeystoreMembership(
membershipContract: MembershipContract(
Expand All @@ -88,14 +92,14 @@ when isMainModule:
identityCredential: credential,
)

let persistRes = addMembershipCredentials(conf.rlnRelayCredPath,
keystoreCred,
conf.rlnRelayCredPassword,
let persistRes = addMembershipCredentials(conf.rlnRelayCredPath,
keystoreCred,
conf.rlnRelayCredPassword,
RLNAppInfo)
if persistRes.isErr():
error "failed to persist credentials", error=persistRes.error
quit(1)

info "credentials persisted", path = conf.rlnRelayCredPath

waitFor groupManager.stop()
Expand Down

0 comments on commit 7d53aec

Please sign in to comment.