@waku/rln 0.1.5-9901863.0 → 0.1.5-a8ff776.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/bundle/index.js +0 -2
  2. package/bundle/packages/rln/dist/contract/constants.js +1 -1
  3. package/bundle/packages/rln/dist/contract/rln_contract.js +419 -9
  4. package/bundle/packages/rln/dist/create.js +1 -1
  5. package/bundle/packages/rln/dist/identity.js +0 -8
  6. package/bundle/packages/rln/dist/keystore/keystore.js +28 -19
  7. package/bundle/packages/rln/dist/rln.js +166 -56
  8. package/dist/.tsbuildinfo +1 -1
  9. package/dist/contract/constants.d.ts +1 -1
  10. package/dist/contract/constants.js +1 -1
  11. package/dist/contract/constants.js.map +1 -1
  12. package/dist/contract/rln_contract.d.ts +122 -5
  13. package/dist/contract/rln_contract.js +417 -8
  14. package/dist/contract/rln_contract.js.map +1 -1
  15. package/dist/create.js +1 -1
  16. package/dist/create.js.map +1 -1
  17. package/dist/identity.d.ts +0 -1
  18. package/dist/identity.js +0 -8
  19. package/dist/identity.js.map +1 -1
  20. package/dist/index.d.ts +1 -3
  21. package/dist/index.js +1 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/keystore/keystore.d.ts +1 -0
  24. package/dist/keystore/keystore.js +28 -19
  25. package/dist/keystore/keystore.js.map +1 -1
  26. package/dist/keystore/types.d.ts +1 -1
  27. package/dist/rln.d.ts +52 -9
  28. package/dist/rln.js +163 -54
  29. package/dist/rln.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/contract/constants.ts +1 -1
  32. package/src/contract/rln_contract.ts +663 -9
  33. package/src/create.ts +1 -1
  34. package/src/identity.ts +0 -9
  35. package/src/index.ts +0 -4
  36. package/src/keystore/keystore.ts +46 -31
  37. package/src/keystore/types.ts +1 -1
  38. package/src/rln.ts +259 -67
  39. package/bundle/packages/rln/dist/contract/rln_base_contract.js +0 -477
  40. package/bundle/packages/rln/dist/contract/types.js +0 -9
  41. package/bundle/packages/rln/dist/credentials_manager.js +0 -233
  42. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_assert.js +0 -43
  43. package/bundle/packages/rln/node_modules/@noble/hashes/esm/_sha2.js +0 -116
  44. package/bundle/packages/rln/node_modules/@noble/hashes/esm/hmac.js +0 -79
  45. package/bundle/packages/rln/node_modules/@noble/hashes/esm/sha256.js +0 -126
  46. package/bundle/packages/rln/node_modules/@noble/hashes/esm/utils.js +0 -43
  47. package/dist/contract/rln_base_contract.d.ts +0 -96
  48. package/dist/contract/rln_base_contract.js +0 -460
  49. package/dist/contract/rln_base_contract.js.map +0 -1
  50. package/dist/contract/types.d.ts +0 -40
  51. package/dist/contract/types.js +0 -8
  52. package/dist/contract/types.js.map +0 -1
  53. package/dist/credentials_manager.d.ts +0 -50
  54. package/dist/credentials_manager.js +0 -215
  55. package/dist/credentials_manager.js.map +0 -1
  56. package/dist/types.d.ts +0 -27
  57. package/dist/types.js +0 -2
  58. package/dist/types.js.map +0 -1
  59. package/src/contract/rln_base_contract.ts +0 -707
  60. package/src/contract/types.ts +0 -48
  61. package/src/credentials_manager.ts +0 -306
  62. package/src/types.ts +0 -31
@@ -1,50 +0,0 @@
1
- import { ethers } from "ethers";
2
- import { RLNBaseContract } from "./contract/rln_base_contract.js";
3
- import { Keystore } from "./keystore/index.js";
4
- import type { DecryptedCredentials, EncryptedCredentials } from "./keystore/index.js";
5
- import { KeystoreEntity, Password } from "./keystore/types.js";
6
- import { RegisterMembershipOptions, StartRLNOptions } from "./types.js";
7
- import { Zerokit } from "./zerokit.js";
8
- /**
9
- * Manages credentials for RLN
10
- * This is a lightweight implementation of the RLN contract that doesn't require Zerokit
11
- * It is used to register membership and generate identity credentials
12
- */
13
- export declare class RLNCredentialsManager {
14
- protected started: boolean;
15
- protected starting: boolean;
16
- private _contract;
17
- private _signer;
18
- protected keystore: Keystore;
19
- private _credentials;
20
- zerokit: undefined | Zerokit;
21
- constructor(zerokit?: Zerokit);
22
- get contract(): undefined | RLNBaseContract;
23
- set contract(contract: RLNBaseContract | undefined);
24
- get signer(): undefined | ethers.Signer;
25
- set signer(signer: ethers.Signer | undefined);
26
- get credentials(): undefined | DecryptedCredentials;
27
- set credentials(credentials: DecryptedCredentials | undefined);
28
- get provider(): undefined | ethers.providers.Provider;
29
- start(options?: StartRLNOptions): Promise<void>;
30
- registerMembership(options: RegisterMembershipOptions): Promise<undefined | DecryptedCredentials>;
31
- /**
32
- * Changes credentials in use by relying on provided Keystore earlier in rln.start
33
- * @param id: string, hash of credentials to select from Keystore
34
- * @param password: string or bytes to use to decrypt credentials from Keystore
35
- */
36
- useCredentials(id: string, password: Password): Promise<void>;
37
- protected determineStartOptions(options: StartRLNOptions, credentials: KeystoreEntity | undefined): Promise<StartRLNOptions>;
38
- protected static decryptCredentialsIfNeeded(credentials?: EncryptedCredentials | DecryptedCredentials): Promise<{
39
- credentials?: DecryptedCredentials;
40
- keystore?: Keystore;
41
- }>;
42
- protected verifyCredentialsAgainstContract(credentials: KeystoreEntity): Promise<void>;
43
- /**
44
- * Generates an identity credential from a seed string
45
- * This is a pure implementation that doesn't rely on Zerokit
46
- * @param seed A string seed to generate the identity from
47
- * @returns IdentityCredential
48
- */
49
- private generateSeededIdentityCredential;
50
- }
@@ -1,215 +0,0 @@
1
- import { hmac } from "@noble/hashes/hmac";
2
- import { sha256 } from "@noble/hashes/sha256";
3
- import { Logger } from "@waku/utils";
4
- import { LINEA_CONTRACT } from "./contract/constants.js";
5
- import { RLNBaseContract } from "./contract/rln_base_contract.js";
6
- import { IdentityCredential } from "./identity.js";
7
- import { Keystore } from "./keystore/index.js";
8
- import { buildBigIntFromUint8Array, extractMetaMaskSigner } from "./utils/index.js";
9
- const log = new Logger("waku:credentials");
10
- /**
11
- * Manages credentials for RLN
12
- * This is a lightweight implementation of the RLN contract that doesn't require Zerokit
13
- * It is used to register membership and generate identity credentials
14
- */
15
- export class RLNCredentialsManager {
16
- started = false;
17
- starting = false;
18
- _contract;
19
- _signer;
20
- keystore = Keystore.create();
21
- _credentials;
22
- zerokit;
23
- constructor(zerokit) {
24
- log.info("RLNCredentialsManager initialized");
25
- this.zerokit = zerokit;
26
- }
27
- get contract() {
28
- return this._contract;
29
- }
30
- set contract(contract) {
31
- this._contract = contract;
32
- }
33
- get signer() {
34
- return this._signer;
35
- }
36
- set signer(signer) {
37
- this._signer = signer;
38
- }
39
- get credentials() {
40
- return this._credentials;
41
- }
42
- set credentials(credentials) {
43
- this._credentials = credentials;
44
- }
45
- get provider() {
46
- return this.contract?.provider;
47
- }
48
- async start(options = {}) {
49
- if (this.started || this.starting) {
50
- log.info("RLNCredentialsManager already started or starting");
51
- return;
52
- }
53
- log.info("Starting RLNCredentialsManager");
54
- this.starting = true;
55
- try {
56
- const { credentials, keystore } = await RLNCredentialsManager.decryptCredentialsIfNeeded(options.credentials);
57
- if (credentials) {
58
- log.info("Credentials successfully decrypted");
59
- }
60
- const { signer, address, rateLimit } = await this.determineStartOptions(options, credentials);
61
- log.info(`Using contract address: ${address}`);
62
- if (keystore) {
63
- this.keystore = keystore;
64
- log.info("Using provided keystore");
65
- }
66
- this._credentials = credentials;
67
- this._signer = signer;
68
- this._contract = new RLNBaseContract({
69
- address: address,
70
- signer: signer,
71
- rateLimit: rateLimit ?? this.zerokit?.getRateLimit
72
- });
73
- log.info("RLNCredentialsManager successfully started");
74
- this.started = true;
75
- }
76
- catch (error) {
77
- log.error("Failed to start RLNCredentialsManager", error);
78
- throw error;
79
- }
80
- finally {
81
- this.starting = false;
82
- }
83
- }
84
- async registerMembership(options) {
85
- if (!this.contract) {
86
- log.error("RLN Contract is not initialized");
87
- throw Error("RLN Contract is not initialized.");
88
- }
89
- log.info("Registering membership");
90
- let identity = "identity" in options && options.identity;
91
- if ("signature" in options) {
92
- log.info("Generating identity from signature");
93
- if (this.zerokit) {
94
- log.info("Using Zerokit to generate identity");
95
- identity = this.zerokit.generateSeededIdentityCredential(options.signature);
96
- }
97
- else {
98
- log.info("Using local implementation to generate identity");
99
- identity = this.generateSeededIdentityCredential(options.signature);
100
- }
101
- }
102
- if (!identity) {
103
- log.error("Missing signature or identity to register membership");
104
- throw Error("Missing signature or identity to register membership.");
105
- }
106
- log.info("Registering identity with contract");
107
- return this.contract.registerWithIdentity(identity);
108
- }
109
- /**
110
- * Changes credentials in use by relying on provided Keystore earlier in rln.start
111
- * @param id: string, hash of credentials to select from Keystore
112
- * @param password: string or bytes to use to decrypt credentials from Keystore
113
- */
114
- async useCredentials(id, password) {
115
- log.info(`Attempting to use credentials with ID: ${id}`);
116
- this._credentials = await this.keystore?.readCredential(id, password);
117
- if (this._credentials) {
118
- log.info("Successfully loaded credentials");
119
- }
120
- else {
121
- log.warn("Failed to load credentials");
122
- }
123
- }
124
- async determineStartOptions(options, credentials) {
125
- let chainId = credentials?.membership.chainId;
126
- const address = credentials?.membership.address ||
127
- options.address ||
128
- LINEA_CONTRACT.address;
129
- if (address === LINEA_CONTRACT.address) {
130
- chainId = LINEA_CONTRACT.chainId;
131
- log.info(`Using Linea contract with chainId: ${chainId}`);
132
- }
133
- const signer = options.signer || (await extractMetaMaskSigner());
134
- const currentChainId = await signer.getChainId();
135
- log.info(`Current chain ID: ${currentChainId}`);
136
- if (chainId && chainId !== currentChainId.toString()) {
137
- log.error(`Chain ID mismatch: contract=${chainId}, current=${currentChainId}`);
138
- throw Error(`Failed to start RLN contract, chain ID of contract is different from current one: contract-${chainId}, current network-${currentChainId}`);
139
- }
140
- return {
141
- signer,
142
- address
143
- };
144
- }
145
- static async decryptCredentialsIfNeeded(credentials) {
146
- if (!credentials) {
147
- log.info("No credentials provided");
148
- return {};
149
- }
150
- if ("identity" in credentials) {
151
- log.info("Using already decrypted credentials");
152
- return { credentials };
153
- }
154
- log.info("Attempting to decrypt credentials");
155
- const keystore = Keystore.fromString(credentials.keystore);
156
- if (!keystore) {
157
- log.warn("Failed to create keystore from string");
158
- return {};
159
- }
160
- try {
161
- const decryptedCredentials = await keystore.readCredential(credentials.id, credentials.password);
162
- log.info(`Successfully decrypted credentials with ID: ${credentials.id}`);
163
- return {
164
- keystore,
165
- credentials: decryptedCredentials
166
- };
167
- }
168
- catch (error) {
169
- log.error("Failed to decrypt credentials", error);
170
- throw error;
171
- }
172
- }
173
- async verifyCredentialsAgainstContract(credentials) {
174
- if (!this.contract) {
175
- throw Error("Failed to verify chain coordinates: no contract initialized.");
176
- }
177
- const registryAddress = credentials.membership.address;
178
- const currentRegistryAddress = this.contract.address;
179
- if (registryAddress !== currentRegistryAddress) {
180
- throw Error(`Failed to verify chain coordinates: credentials contract address=${registryAddress} is not equal to registryContract address=${currentRegistryAddress}`);
181
- }
182
- const chainId = credentials.membership.chainId;
183
- const network = await this.contract.provider.getNetwork();
184
- const currentChainId = network.chainId;
185
- if (chainId !== currentChainId.toString()) {
186
- throw Error(`Failed to verify chain coordinates: credentials chainID=${chainId} is not equal to registryContract chainID=${currentChainId}`);
187
- }
188
- }
189
- /**
190
- * Generates an identity credential from a seed string
191
- * This is a pure implementation that doesn't rely on Zerokit
192
- * @param seed A string seed to generate the identity from
193
- * @returns IdentityCredential
194
- */
195
- generateSeededIdentityCredential(seed) {
196
- log.info("Generating seeded identity credential");
197
- // Convert the seed to bytes
198
- const encoder = new TextEncoder();
199
- const seedBytes = encoder.encode(seed);
200
- // Generate deterministic values using HMAC-SHA256
201
- // We use different context strings for each component to ensure they're different
202
- const idTrapdoor = hmac(sha256, seedBytes, encoder.encode("IDTrapdoor"));
203
- const idNullifier = hmac(sha256, seedBytes, encoder.encode("IDNullifier"));
204
- // Generate IDSecretHash as a hash of IDTrapdoor and IDNullifier
205
- const combinedBytes = new Uint8Array([...idTrapdoor, ...idNullifier]);
206
- const idSecretHash = sha256(combinedBytes);
207
- // Generate IDCommitment as a hash of IDSecretHash
208
- const idCommitment = sha256(idSecretHash);
209
- // Convert IDCommitment to BigInt
210
- const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment);
211
- log.info("Successfully generated identity credential");
212
- return new IdentityCredential(idTrapdoor, idNullifier, idSecretHash, idCommitment, idCommitmentBigInt);
213
- }
214
- }
215
- //# sourceMappingURL=credentials_manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credentials_manager.js","sourceRoot":"","sources":["../src/credentials_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAO/C,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAE3C;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IACtB,OAAO,GAAG,KAAK,CAAC;IAChB,QAAQ,GAAG,KAAK,CAAC;IAEnB,SAAS,CAA8B;IACvC,OAAO,CAA4B;IAEjC,QAAQ,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC/B,YAAY,CAAmC;IAEhD,OAAO,CAAsB;IAEpC,YAAmB,OAAiB;QAClC,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,QAAQ,CAAC,QAAqC;QACvD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IAC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CAAC,YAAY,CAAC,CAAC,CAAC;QACzE,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAE3E,gEAAgE;QAChE,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,UAAU,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;QACtE,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QAE3C,kDAAkD;QAClD,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QAE1C,iCAAiC;QACjC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;QAEnE,GAAG,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACvD,OAAO,IAAI,kBAAkB,CAC3B,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,CACnB,CAAC;IACJ,CAAC;CACF"}
package/dist/types.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import { ethers } from "ethers";
2
- import { IdentityCredential } from "./identity.js";
3
- import { DecryptedCredentials, EncryptedCredentials } from "./keystore/types.js";
4
- export type StartRLNOptions = {
5
- /**
6
- * If not set - will extract MetaMask account and get signer from it.
7
- */
8
- signer?: ethers.Signer;
9
- /**
10
- * If not set - will use default SEPOLIA_CONTRACT address.
11
- */
12
- address?: string;
13
- /**
14
- * Credentials to use for generating proofs and connecting to the contract and network.
15
- * If provided used for validating the network chainId and connecting to registry contract.
16
- */
17
- credentials?: EncryptedCredentials | DecryptedCredentials;
18
- /**
19
- * Rate limit for the member.
20
- */
21
- rateLimit?: number;
22
- };
23
- export type RegisterMembershipOptions = {
24
- signature: string;
25
- } | {
26
- identity: IdentityCredential;
27
- };
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}