diff --git a/examples/keystore-management/src/components/RLNMembershipRegistration.tsx b/examples/keystore-management/src/components/RLNMembershipRegistration.tsx index 842cbc2..bb25ce8 100644 --- a/examples/keystore-management/src/components/RLNMembershipRegistration.tsx +++ b/examples/keystore-management/src/components/RLNMembershipRegistration.tsx @@ -247,6 +247,41 @@ export default function RLNMembershipRegistration() { )} + +{identity && ( +
+

Your RLN Credentials:

+
+

Identity:

+

+ ID Commitment: {Buffer.from(identity.IDCommitment).toString('hex')} +

+

+ ID Secret Hash: {Buffer.from(identity.IDSecretHash).toString('hex')} +

+

+ ID Nullifier: {Buffer.from(identity.IDNullifier).toString('hex')} +

+

+ ID Trapdoor: {Buffer.from(identity.IDTrapdoor).toString('hex')} +

+ + {/*

Membership:

+

+ Chain ID: {registrationResult.credentials.membership.chainId} +

+

+ Contract Address: {registrationResult.credentials.membership.address} +

+

+ Tree Index: {registrationResult.credentials.membership.treeIndex} +

*/} +
+

+ These credentials are your proof of membership. Store them securely. +

+
+ )} {registrationResult.success === true && (
@@ -279,7 +314,7 @@ export default function RLNMembershipRegistration() { Your RLN membership is now registered and can be used with your Waku node.

- {(registrationResult.credentials && !hasPasskey()) && ( + {(registrationResult.credentials) && (

Your RLN Credentials:

@@ -313,41 +348,6 @@ export default function RLNMembershipRegistration() {

)} - - {identity && ( -
-

Your RLN Credentials:

-
-

Identity:

-

- ID Commitment: {Buffer.from(identity.IDCommitment).toString('hex')} -

-

- ID Secret Hash: {Buffer.from(identity.IDSecretHash).toString('hex')} -

-

- ID Nullifier: {Buffer.from(identity.IDNullifier).toString('hex')} -

-

- ID Trapdoor: {Buffer.from(identity.IDTrapdoor).toString('hex')} -

- - {/*

Membership:

-

- Chain ID: {registrationResult.credentials.membership.chainId} -

-

- Contract Address: {registrationResult.credentials.membership.address} -

-

- Tree Index: {registrationResult.credentials.membership.treeIndex} -

*/} -
-

- These credentials are your proof of membership. Store them securely. -

-
- )}
)} diff --git a/examples/keystore-management/src/contexts/RLNContext.tsx b/examples/keystore-management/src/contexts/RLNContext.tsx index 4994b4d..c2f02d2 100644 --- a/examples/keystore-management/src/contexts/RLNContext.tsx +++ b/examples/keystore-management/src/contexts/RLNContext.tsx @@ -225,18 +225,18 @@ export function RLNProvider({ children }: { children: ReactNode }) { const seed = await createPasskey(signer); - // const _credentials = await rln.registerMembership({signature: seed}); - // if (!_credentials) { - // throw new Error("Failed to register membership: No credentials returned"); - // } - // if (!_credentials.identity) { - // throw new Error("Failed to register membership: Missing identity information"); - // } - // if (!_credentials.membership) { - // throw new Error("Failed to register membership: Missing membership information"); - // } + const _credentials = await rln.registerMembership({signature: seed}); + if (!_credentials) { + throw new Error("Failed to register membership: No credentials returned"); + } + if (!_credentials.identity) { + throw new Error("Failed to register membership: Missing identity information"); + } + if (!_credentials.membership) { + throw new Error("Failed to register membership: Missing membership information"); + } - return { success: true, credentials: null }; + return { success: true, credentials: _credentials }; } catch (err) { let errorMsg = "Failed to register membership"; if (err instanceof Error) {