This commit is contained in:
Danish Arora 2025-04-02 20:19:15 +05:30
parent f39d215cca
commit ad0e277525
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
2 changed files with 8 additions and 8 deletions

View File

@ -29,13 +29,12 @@ export class IdentityCredential {
);
}
public toJSON(): Record<string, number[] | string> {
public toJSON(): Record<string, number[]> {
return {
idTrapdoor: Array.from(this.IDTrapdoor),
idNullifier: Array.from(this.IDNullifier),
idSecretHash: Array.from(this.IDSecretHash),
idCommitment: Array.from(this.IDCommitment),
idCommitmentBigInt: this.IDCommitmentBigInt.toString()
idCommitment: Array.from(this.IDCommitment)
};
}
}

View File

@ -276,7 +276,7 @@ export class Keystore {
treeIndex: _.get(obj, "treeIndex"),
chainId: _.get(obj, "membershipContract.chainId"),
address: _.get(obj, "membershipContract.address"),
rateLimit: _.get(obj, "membershipContract.rateLimit")
rateLimit: _.get(obj, "userMessageLimit")
}
};
} catch (err) {
@ -298,6 +298,10 @@ export class Keystore {
private static fromIdentityToBytes(options: KeystoreEntity): Uint8Array {
return utf8ToBytes(
JSON.stringify({
membershipContract: {
chainId: options.membership.chainId,
address: options.membership.address
},
treeIndex: options.membership.treeIndex,
identityCredential: {
idTrapdoor: Array.from(options.identity.IDTrapdoor),
@ -305,10 +309,7 @@ export class Keystore {
idSecretHash: Array.from(options.identity.IDSecretHash),
idCommitment: Array.from(options.identity.IDCommitment)
},
membershipContract: {
chainId: options.membership.chainId,
address: options.membership.address
}
userMessageLimit: options.membership.rateLimit
})
);
}