@waku/rln 0.1.6-b0a2e39.0 → 0.1.6-b4748fd.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 (69) hide show
  1. package/bundle/_virtual/utils.js +2 -2
  2. package/bundle/_virtual/utils2.js +2 -2
  3. package/bundle/index.js +1 -1
  4. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/_sha2.js +1 -1
  5. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/hmac.js +1 -1
  6. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/pbkdf2.js +1 -1
  7. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/scrypt.js +1 -1
  8. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha256.js +1 -1
  9. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/sha512.js +1 -1
  10. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/@noble/hashes/utils.js +1 -1
  11. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
  12. package/bundle/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
  13. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +0 -1
  14. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +0 -1
  15. package/bundle/packages/core/dist/lib/filter/filter.js +0 -2
  16. package/bundle/packages/core/dist/lib/light_push/light_push.js +9 -12
  17. package/bundle/packages/core/dist/lib/message/version_0.js +0 -1
  18. package/bundle/packages/core/dist/lib/metadata/metadata.js +0 -2
  19. package/bundle/packages/core/dist/lib/store/store.js +0 -2
  20. package/bundle/packages/interfaces/dist/protocols.js +0 -10
  21. package/bundle/packages/proto/dist/generated/light_push.js +3 -3
  22. package/bundle/packages/rln/dist/codec.js +0 -1
  23. package/bundle/packages/rln/dist/contract/constants.js +7 -1
  24. package/bundle/packages/rln/dist/contract/rln_base_contract.js +34 -8
  25. package/bundle/packages/rln/dist/contract/rln_contract.js +0 -1
  26. package/bundle/packages/rln/dist/credentials_manager.js +16 -15
  27. package/bundle/packages/rln/dist/identity.js +5 -8
  28. package/bundle/packages/rln/dist/keystore/keystore.js +15 -12
  29. package/bundle/packages/rln/dist/message.js +0 -2
  30. package/bundle/packages/rln/dist/rln.js +0 -2
  31. package/bundle/packages/rln/dist/utils/bytes.js +14 -16
  32. package/bundle/packages/rln/dist/utils/epoch.js +0 -1
  33. package/bundle/packages/utils/dist/common/sharding/index.js +0 -1
  34. package/dist/.tsbuildinfo +1 -1
  35. package/dist/contract/constants.d.ts +6 -0
  36. package/dist/contract/constants.js +6 -0
  37. package/dist/contract/constants.js.map +1 -1
  38. package/dist/contract/rln_base_contract.d.ts +6 -0
  39. package/dist/contract/rln_base_contract.js +34 -7
  40. package/dist/contract/rln_base_contract.js.map +1 -1
  41. package/dist/credentials_manager.js +16 -14
  42. package/dist/credentials_manager.js.map +1 -1
  43. package/dist/identity.d.ts +4 -2
  44. package/dist/identity.js +5 -6
  45. package/dist/identity.js.map +1 -1
  46. package/dist/keystore/keystore.js +15 -11
  47. package/dist/keystore/keystore.js.map +1 -1
  48. package/dist/utils/bytes.d.ts +2 -6
  49. package/dist/utils/bytes.js +13 -15
  50. package/dist/utils/bytes.js.map +1 -1
  51. package/dist/utils/index.d.ts +1 -1
  52. package/dist/utils/index.js +1 -1
  53. package/dist/utils/index.js.map +1 -1
  54. package/package.json +1 -1
  55. package/src/contract/constants.ts +9 -0
  56. package/src/contract/rln_base_contract.ts +54 -14
  57. package/src/credentials_manager.ts +27 -21
  58. package/src/identity.ts +5 -7
  59. package/src/keystore/keystore.ts +28 -24
  60. package/src/utils/bytes.ts +21 -25
  61. package/src/utils/index.ts +1 -1
  62. package/bundle/packages/core/dist/lib/light_push/light_push_v3.js +0 -30
  63. package/bundle/packages/core/dist/lib/light_push/utils.js +0 -18
  64. package/bundle/packages/interfaces/dist/light_push_v3.js +0 -29
  65. package/bundle/packages/proto/dist/generated/light_push_v3.js +0 -348
  66. package/dist/contract/test-utils.d.ts +0 -39
  67. package/dist/contract/test-utils.js +0 -118
  68. package/dist/contract/test-utils.js.map +0 -1
  69. package/src/contract/test-utils.ts +0 -179
@@ -3,9 +3,14 @@ import { ethers } from "ethers";
3
3
 
4
4
  import { IdentityCredential } from "../identity.js";
5
5
  import { DecryptedCredentials } from "../keystore/types.js";
6
+ import { buildBigIntFromUint8ArrayBE } from "../utils/bytes.js";
6
7
 
7
8
  import { RLN_ABI } from "./abi.js";
8
- import { DEFAULT_RATE_LIMIT, RATE_LIMIT_PARAMS } from "./constants.js";
9
+ import {
10
+ DEFAULT_Q,
11
+ DEFAULT_RATE_LIMIT,
12
+ RATE_LIMIT_PARAMS
13
+ } from "./constants.js";
9
14
  import {
10
15
  CustomQueryOptions,
11
16
  FetchMembersOptions,
@@ -25,6 +30,12 @@ export class RLNBaseContract {
25
30
  private minRateLimit?: number;
26
31
  private maxRateLimit?: number;
27
32
 
33
+ /**
34
+ * Default Q value for the RLN contract.
35
+ * @see https://github.com/waku-org/waku-rlnv2-contract/blob/b7e9a9b1bc69256a2a3076c1f099b50ce84e7eff/src/WakuRlnV2.sol#L25
36
+ */
37
+ public idCommitmentBigIntLimit = DEFAULT_Q;
38
+
28
39
  protected _members: Map<number, Member> = new Map();
29
40
  private _membersFilter: ethers.EventFilter;
30
41
  private _membershipErasedFilter: ethers.EventFilter;
@@ -77,12 +88,16 @@ export class RLNBaseContract {
77
88
  options: RLNContractInitOptions
78
89
  ): Promise<RLNBaseContract> {
79
90
  const instance = new RLNBaseContract(options);
80
- const [min, max] = await Promise.all([
91
+ const [min, max, idCommitmentBigIntLimit] = await Promise.all([
81
92
  instance.contract.minMembershipRateLimit(),
82
- instance.contract.maxMembershipRateLimit()
93
+ instance.contract.maxMembershipRateLimit(),
94
+ instance.contract.Q()
83
95
  ]);
84
96
  instance.minRateLimit = ethers.BigNumber.from(min).toNumber();
85
97
  instance.maxRateLimit = ethers.BigNumber.from(max).toNumber();
98
+ instance.idCommitmentBigIntLimit = BigInt(
99
+ idCommitmentBigIntLimit.toString()
100
+ );
86
101
 
87
102
  instance.validateRateLimit(instance.rateLimit);
88
103
  return instance;
@@ -491,6 +506,32 @@ export class RLNBaseContract {
491
506
  }
492
507
  }
493
508
 
509
+ private getIdCommitmentBigInt(bytes: Uint8Array): bigint {
510
+ let idCommitmentBigIntBE = buildBigIntFromUint8ArrayBE(bytes);
511
+ log.info("1");
512
+
513
+ if (!this.contract) {
514
+ throw Error("RLN contract is not initialized");
515
+ }
516
+
517
+ const idCommitmentBigIntLimit = this.contract.idCommitmentBigIntLimit;
518
+
519
+ log.info("idCommitmentBigIntBE: ", idCommitmentBigIntBE);
520
+ log.info("idCommitmentBigIntLimit: ", idCommitmentBigIntLimit);
521
+ log.info(
522
+ "idCommitmentBigIntBE >= idCommitmentBigIntLimit: ",
523
+ idCommitmentBigIntBE >= idCommitmentBigIntLimit
524
+ );
525
+
526
+ if (idCommitmentBigIntBE >= idCommitmentBigIntLimit) {
527
+ log.warn(
528
+ `ID commitment is greater than Q, reducing it by Q(idCommitmentBigIntLimit): ${idCommitmentBigIntBE} % ${idCommitmentBigIntLimit}`
529
+ );
530
+ idCommitmentBigIntBE = idCommitmentBigIntBE % idCommitmentBigIntLimit;
531
+ }
532
+ return idCommitmentBigIntBE;
533
+ }
534
+
494
535
  public async registerWithIdentity(
495
536
  identity: IdentityCredential
496
537
  ): Promise<DecryptedCredentials | undefined> {
@@ -499,10 +540,12 @@ export class RLNBaseContract {
499
540
  `Registering identity with rate limit: ${this.rateLimit} messages/epoch`
500
541
  );
501
542
 
502
- // Check if the ID commitment is already registered
503
- const existingIndex = await this.getMemberIndex(
504
- identity.IDCommitmentBigInt
543
+ const idCommitmentBigInt = this.getIdCommitmentBigInt(
544
+ identity.IDCommitment
505
545
  );
546
+
547
+ // Check if the ID commitment is already registered
548
+ const existingIndex = await this.getMemberIndex(idCommitmentBigInt);
506
549
  if (existingIndex) {
507
550
  throw new Error(
508
551
  `ID commitment is already registered with index ${existingIndex}`
@@ -518,19 +561,16 @@ export class RLNBaseContract {
518
561
  }
519
562
 
520
563
  const estimatedGas = await this.contract.estimateGas.register(
521
- identity.IDCommitmentBigInt,
564
+ idCommitmentBigInt,
522
565
  this.rateLimit,
523
566
  []
524
567
  );
525
568
  const gasLimit = estimatedGas.add(10000);
526
569
 
527
570
  const txRegisterResponse: ethers.ContractTransaction =
528
- await this.contract.register(
529
- identity.IDCommitmentBigInt,
530
- this.rateLimit,
531
- [],
532
- { gasLimit }
533
- );
571
+ await this.contract.register(idCommitmentBigInt, this.rateLimit, [], {
572
+ gasLimit
573
+ });
534
574
 
535
575
  const txRegisterReceipt = await txRegisterResponse.wait();
536
576
 
@@ -626,7 +666,7 @@ export class RLNBaseContract {
626
666
  permit.v,
627
667
  permit.r,
628
668
  permit.s,
629
- identity.IDCommitmentBigInt,
669
+ this.getIdCommitmentBigInt(identity.IDCommitment),
630
670
  this.rateLimit,
631
671
  idCommitmentsToErase.map((id) => ethers.BigNumber.from(id))
632
672
  );
@@ -1,5 +1,5 @@
1
1
  import { hmac } from "@noble/hashes/hmac";
2
- import { sha256 } from "@noble/hashes/sha256";
2
+ import { sha256 } from "@noble/hashes/sha2";
3
3
  import { Logger } from "@waku/utils";
4
4
  import { ethers } from "ethers";
5
5
 
@@ -13,10 +13,7 @@ import type {
13
13
  } from "./keystore/index.js";
14
14
  import { KeystoreEntity, Password } from "./keystore/types.js";
15
15
  import { RegisterMembershipOptions, StartRLNOptions } from "./types.js";
16
- import {
17
- buildBigIntFromUint8Array,
18
- extractMetaMaskSigner
19
- } from "./utils/index.js";
16
+ import { extractMetaMaskSigner, switchEndianness } from "./utils/index.js";
20
17
  import { Zerokit } from "./zerokit.js";
21
18
 
22
19
  const log = new Logger("waku:credentials");
@@ -116,7 +113,9 @@ export class RLNCredentialsManager {
116
113
  );
117
114
  } else {
118
115
  log.info("Using local implementation to generate identity");
119
- identity = this.generateSeededIdentityCredential(options.signature);
116
+ identity = await this.generateSeededIdentityCredential(
117
+ options.signature
118
+ );
120
119
  }
121
120
  }
122
121
 
@@ -249,7 +248,9 @@ export class RLNCredentialsManager {
249
248
  * @param seed A string seed to generate the identity from
250
249
  * @returns IdentityCredential
251
250
  */
252
- private generateSeededIdentityCredential(seed: string): IdentityCredential {
251
+ private async generateSeededIdentityCredential(
252
+ seed: string
253
+ ): Promise<IdentityCredential> {
253
254
  log.info("Generating seeded identity credential");
254
255
  // Convert the seed to bytes
255
256
  const encoder = new TextEncoder();
@@ -257,26 +258,31 @@ export class RLNCredentialsManager {
257
258
 
258
259
  // Generate deterministic values using HMAC-SHA256
259
260
  // We use different context strings for each component to ensure they're different
260
- const idTrapdoor = hmac(sha256, seedBytes, encoder.encode("IDTrapdoor"));
261
- const idNullifier = hmac(sha256, seedBytes, encoder.encode("IDNullifier"));
261
+ const idTrapdoorBE = hmac(sha256, seedBytes, encoder.encode("IDTrapdoor"));
262
+ const idNullifierBE = hmac(
263
+ sha256,
264
+ seedBytes,
265
+ encoder.encode("IDNullifier")
266
+ );
262
267
 
263
- // Generate IDSecretHash as a hash of IDTrapdoor and IDNullifier
264
- const combinedBytes = new Uint8Array([...idTrapdoor, ...idNullifier]);
265
- const idSecretHash = sha256(combinedBytes);
268
+ const combinedBytes = new Uint8Array([...idTrapdoorBE, ...idNullifierBE]);
269
+ const idSecretHashBE = sha256(combinedBytes);
266
270
 
267
- // Generate IDCommitment as a hash of IDSecretHash
268
- const idCommitment = sha256(idSecretHash);
271
+ const idCommitmentBE = sha256(idSecretHashBE);
269
272
 
270
- // Convert IDCommitment to BigInt
271
- const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment);
273
+ // All hashing functions return big-endian bytes
274
+ // We need to switch to little-endian for the identity credential
275
+ const idTrapdoorLE = switchEndianness(idTrapdoorBE);
276
+ const idNullifierLE = switchEndianness(idNullifierBE);
277
+ const idSecretHashLE = switchEndianness(idSecretHashBE);
278
+ const idCommitmentLE = switchEndianness(idCommitmentBE);
272
279
 
273
280
  log.info("Successfully generated identity credential");
274
281
  return new IdentityCredential(
275
- idTrapdoor,
276
- idNullifier,
277
- idSecretHash,
278
- idCommitment,
279
- idCommitmentBigInt
282
+ idTrapdoorLE,
283
+ idNullifierLE,
284
+ idSecretHashLE,
285
+ idCommitmentLE
280
286
  );
281
287
  }
282
288
  }
package/src/identity.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { buildBigIntFromUint8Array } from "./utils/index.js";
2
-
3
1
  export class IdentityCredential {
2
+ /**
3
+ * All variables are in little-endian format
4
+ */
4
5
  public constructor(
5
6
  public readonly IDTrapdoor: Uint8Array,
6
7
  public readonly IDNullifier: Uint8Array,
7
8
  public readonly IDSecretHash: Uint8Array,
8
- public readonly IDCommitment: Uint8Array,
9
- public readonly IDCommitmentBigInt: bigint
9
+ public readonly IDCommitment: Uint8Array
10
10
  ) {}
11
11
 
12
12
  public static fromBytes(memKeys: Uint8Array): IdentityCredential {
@@ -18,14 +18,12 @@ export class IdentityCredential {
18
18
  const idNullifier = memKeys.subarray(32, 64);
19
19
  const idSecretHash = memKeys.subarray(64, 96);
20
20
  const idCommitment = memKeys.subarray(96, 128);
21
- const idCommitmentBigInt = buildBigIntFromUint8Array(idCommitment, 32);
22
21
 
23
22
  return new IdentityCredential(
24
23
  idTrapdoor,
25
24
  idNullifier,
26
25
  idSecretHash,
27
- idCommitment,
28
- idCommitmentBigInt
26
+ idCommitment
29
27
  );
30
28
  }
31
29
  }
@@ -14,8 +14,6 @@ import {
14
14
  import _ from "lodash";
15
15
  import { v4 as uuidV4 } from "uuid";
16
16
 
17
- import { buildBigIntFromUint8Array } from "../utils/bytes.js";
18
-
19
17
  import { decryptEipKeystore, keccak256Checksum } from "./cipher.js";
20
18
  import { isCredentialValid, isKeystoreValid } from "./schema_validator.js";
21
19
  import type {
@@ -250,26 +248,25 @@ export class Keystore {
250
248
  const str = bytesToUtf8(bytes);
251
249
  const obj = JSON.parse(str);
252
250
 
253
- // TODO: add runtime validation of nwaku credentials
251
+ const idCommitmentLE = Keystore.fromArraylikeToBytes(
252
+ _.get(obj, "identityCredential.idCommitment", [])
253
+ );
254
+ const idTrapdoorLE = Keystore.fromArraylikeToBytes(
255
+ _.get(obj, "identityCredential.idTrapdoor", [])
256
+ );
257
+ const idNullifierLE = Keystore.fromArraylikeToBytes(
258
+ _.get(obj, "identityCredential.idNullifier", [])
259
+ );
260
+ const idSecretHashLE = Keystore.fromArraylikeToBytes(
261
+ _.get(obj, "identityCredential.idSecretHash", [])
262
+ );
263
+
254
264
  return {
255
265
  identity: {
256
- IDCommitment: Keystore.fromArraylikeToBytes(
257
- _.get(obj, "identityCredential.idCommitment", [])
258
- ),
259
- IDTrapdoor: Keystore.fromArraylikeToBytes(
260
- _.get(obj, "identityCredential.idTrapdoor", [])
261
- ),
262
- IDNullifier: Keystore.fromArraylikeToBytes(
263
- _.get(obj, "identityCredential.idNullifier", [])
264
- ),
265
- IDCommitmentBigInt: buildBigIntFromUint8Array(
266
- Keystore.fromArraylikeToBytes(
267
- _.get(obj, "identityCredential.idCommitment", [])
268
- )
269
- ),
270
- IDSecretHash: Keystore.fromArraylikeToBytes(
271
- _.get(obj, "identityCredential.idSecretHash", [])
272
- )
266
+ IDCommitment: idCommitmentLE,
267
+ IDTrapdoor: idTrapdoorLE,
268
+ IDNullifier: idNullifierLE,
269
+ IDSecretHash: idSecretHashLE
273
270
  },
274
271
  membership: {
275
272
  treeIndex: _.get(obj, "treeIndex"),
@@ -321,14 +318,21 @@ export class Keystore {
321
318
  // follows nwaku implementation
322
319
  // https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L98
323
320
  private static fromIdentityToBytes(options: KeystoreEntity): Uint8Array {
321
+ function toLittleEndian(bytes: Uint8Array): Uint8Array {
322
+ return new Uint8Array(bytes).reverse();
323
+ }
324
324
  return utf8ToBytes(
325
325
  JSON.stringify({
326
326
  treeIndex: options.membership.treeIndex,
327
327
  identityCredential: {
328
- idCommitment: Array.from(options.identity.IDCommitment),
329
- idNullifier: Array.from(options.identity.IDNullifier),
330
- idSecretHash: Array.from(options.identity.IDSecretHash),
331
- idTrapdoor: Array.from(options.identity.IDTrapdoor)
328
+ idCommitment: Array.from(
329
+ toLittleEndian(options.identity.IDCommitment)
330
+ ),
331
+ idNullifier: Array.from(toLittleEndian(options.identity.IDNullifier)),
332
+ idSecretHash: Array.from(
333
+ toLittleEndian(options.identity.IDSecretHash)
334
+ ),
335
+ idTrapdoor: Array.from(toLittleEndian(options.identity.IDTrapdoor))
332
336
  },
333
337
  membershipContract: {
334
338
  chainId: options.membership.chainId,
@@ -17,18 +17,13 @@ export function concatenate(...input: Uint8Array[]): Uint8Array {
17
17
  return result;
18
18
  }
19
19
 
20
- // Adapted from https://github.com/feross/buffer
21
- function checkInt(
22
- buf: Uint8Array,
23
- value: number,
24
- offset: number,
25
- ext: number,
26
- max: number,
27
- min: number
28
- ): void {
29
- if (value > max || value < min)
30
- throw new RangeError('"value" argument is out of bounds');
31
- if (offset + ext > buf.length) throw new RangeError("Index out of range");
20
+ export function switchEndianness(bytes: Uint8Array): Uint8Array {
21
+ return new Uint8Array(bytes.reverse());
22
+ }
23
+
24
+ export function buildBigIntFromUint8ArrayBE(bytes: Uint8Array): bigint {
25
+ // Interpret bytes as big-endian
26
+ return bytes.reduce((acc, byte) => (acc << 8n) + BigInt(byte), 0n);
32
27
  }
33
28
 
34
29
  export function writeUIntLE(
@@ -56,19 +51,6 @@ export function writeUIntLE(
56
51
  return buf;
57
52
  }
58
53
 
59
- /**
60
- * Transforms Uint8Array into BigInt
61
- * @param array: Uint8Array
62
- * @returns BigInt
63
- */
64
- export function buildBigIntFromUint8Array(
65
- array: Uint8Array,
66
- byteOffset: number = 0
67
- ): bigint {
68
- const dataView = new DataView(array.buffer);
69
- return dataView.getBigUint64(byteOffset, true);
70
- }
71
-
72
54
  /**
73
55
  * Fills with zeros to set length
74
56
  * @param array little endian Uint8Array
@@ -82,3 +64,17 @@ export function zeroPadLE(array: Uint8Array, length: number): Uint8Array {
82
64
  }
83
65
  return result;
84
66
  }
67
+
68
+ // Adapted from https://github.com/feross/buffer
69
+ function checkInt(
70
+ buf: Uint8Array,
71
+ value: number,
72
+ offset: number,
73
+ ext: number,
74
+ max: number,
75
+ min: number
76
+ ): void {
77
+ if (value > max || value < min)
78
+ throw new RangeError('"value" argument is out of bounds');
79
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
80
+ }
@@ -2,7 +2,7 @@ export { extractMetaMaskSigner } from "./metamask.js";
2
2
  export {
3
3
  concatenate,
4
4
  writeUIntLE,
5
- buildBigIntFromUint8Array,
5
+ switchEndianness,
6
6
  zeroPadLE
7
7
  } from "./bytes.js";
8
8
  export { sha256, poseidonHash } from "./hash.js";
@@ -1,30 +0,0 @@
1
- import '../../../../interfaces/dist/light_push_v3.js';
2
- import '../../../../interfaces/dist/protocols.js';
3
- import '../../../../interfaces/dist/connection_manager.js';
4
- import '../../../../interfaces/dist/health_indicator.js';
5
- import '../../../../proto/dist/generated/message.js';
6
- import '../../../../proto/dist/generated/filter.js';
7
- import '../../../../proto/dist/generated/topic_only_message.js';
8
- import '../../../../proto/dist/generated/filter_v2.js';
9
- import '../../../../proto/dist/generated/light_push.js';
10
- import '../../../../proto/dist/generated/light_push_v3.js';
11
- import '../../../../proto/dist/generated/store_v3.js';
12
- import '../../../../proto/dist/generated/peer_exchange.js';
13
- import '../../../../proto/dist/generated/metadata.js';
14
- import '../../../../proto/dist/generated/sds_message.js';
15
- import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
16
- import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
17
- import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
18
- import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
19
- import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
20
- import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
21
- import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
22
- import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
23
- import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
24
- import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
25
- import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
26
- import { Logger } from '../../../../utils/dist/logger/index.js';
27
- import '../../../../../node_modules/it-length-prefixed/dist/src/decode.js';
28
- import './utils.js';
29
-
30
- new Logger("light-push-v3");
@@ -1,18 +0,0 @@
1
- import '../../../../interfaces/dist/light_push_v3.js';
2
- import '../../../../interfaces/dist/protocols.js';
3
- import '../../../../interfaces/dist/connection_manager.js';
4
- import '../../../../interfaces/dist/health_indicator.js';
5
- import '../../../../../node_modules/multiformats/dist/src/bases/base10.js';
6
- import '../../../../../node_modules/multiformats/dist/src/bases/base16.js';
7
- import '../../../../../node_modules/multiformats/dist/src/bases/base2.js';
8
- import '../../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
9
- import '../../../../../node_modules/multiformats/dist/src/bases/base32.js';
10
- import '../../../../../node_modules/multiformats/dist/src/bases/base36.js';
11
- import '../../../../../node_modules/multiformats/dist/src/bases/base58.js';
12
- import '../../../../../node_modules/multiformats/dist/src/bases/base64.js';
13
- import '../../../../../node_modules/multiformats/dist/src/bases/base8.js';
14
- import '../../../../../node_modules/multiformats/dist/src/bases/identity.js';
15
- import '../../../../../node_modules/multiformats/dist/src/codecs/json.js';
16
- import { Logger } from '../../../../utils/dist/logger/index.js';
17
-
18
- new Logger("waku:light-push:utils");
@@ -1,29 +0,0 @@
1
- import './protocols.js';
2
-
3
- var LightPushStatusCodeV3;
4
- (function (LightPushStatusCodeV3) {
5
- LightPushStatusCodeV3[LightPushStatusCodeV3["SUCCESS"] = 200] = "SUCCESS";
6
- LightPushStatusCodeV3[LightPushStatusCodeV3["BAD_REQUEST"] = 400] = "BAD_REQUEST";
7
- LightPushStatusCodeV3[LightPushStatusCodeV3["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
8
- LightPushStatusCodeV3[LightPushStatusCodeV3["INVALID_MESSAGE_ERROR"] = 420] = "INVALID_MESSAGE_ERROR";
9
- LightPushStatusCodeV3[LightPushStatusCodeV3["UNSUPPORTED_PUBSUB_TOPIC"] = 421] = "UNSUPPORTED_PUBSUB_TOPIC";
10
- LightPushStatusCodeV3[LightPushStatusCodeV3["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
11
- LightPushStatusCodeV3[LightPushStatusCodeV3["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
12
- LightPushStatusCodeV3[LightPushStatusCodeV3["SERVICE_NOT_AVAILABLE"] = 503] = "SERVICE_NOT_AVAILABLE";
13
- LightPushStatusCodeV3[LightPushStatusCodeV3["OUT_OF_RLN_PROOF"] = 504] = "OUT_OF_RLN_PROOF";
14
- LightPushStatusCodeV3[LightPushStatusCodeV3["NO_PEERS_TO_RELAY"] = 505] = "NO_PEERS_TO_RELAY";
15
- })(LightPushStatusCodeV3 || (LightPushStatusCodeV3 = {}));
16
- ({
17
- [LightPushStatusCodeV3.SUCCESS]: "Message sent successfully",
18
- [LightPushStatusCodeV3.BAD_REQUEST]: "Bad request format",
19
- [LightPushStatusCodeV3.PAYLOAD_TOO_LARGE]: "Message payload exceeds maximum size",
20
- [LightPushStatusCodeV3.INVALID_MESSAGE_ERROR]: "Message validation failed",
21
- [LightPushStatusCodeV3.UNSUPPORTED_PUBSUB_TOPIC]: "Unsupported pubsub topic",
22
- [LightPushStatusCodeV3.TOO_MANY_REQUESTS]: "Rate limit exceeded",
23
- [LightPushStatusCodeV3.INTERNAL_SERVER_ERROR]: "Internal server error",
24
- [LightPushStatusCodeV3.SERVICE_NOT_AVAILABLE]: "Service temporarily unavailable",
25
- [LightPushStatusCodeV3.OUT_OF_RLN_PROOF]: "RLN proof generation failed",
26
- [LightPushStatusCodeV3.NO_PEERS_TO_RELAY]: "No relay peers available"
27
- });
28
-
29
- export { LightPushStatusCodeV3 };