@waku/rln 0.1.1 → 0.1.2-6454446

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 (106) hide show
  1. package/README.md +26 -2
  2. package/bundle/assets/rln_wasm_bg-a503e304.wasm +0 -0
  3. package/bundle/index.js +58406 -10987
  4. package/dist/codec.d.ts +7 -4
  5. package/dist/codec.js +15 -5
  6. package/dist/codec.js.map +1 -1
  7. package/dist/{constants.d.ts → contract/constants.d.ts} +2 -2
  8. package/dist/contract/constants.js +67 -0
  9. package/dist/contract/constants.js.map +1 -0
  10. package/dist/contract/index.d.ts +2 -0
  11. package/dist/contract/index.js +3 -0
  12. package/dist/contract/index.js.map +1 -0
  13. package/dist/contract/rln_contract.d.ts +46 -0
  14. package/dist/contract/rln_contract.js +213 -0
  15. package/dist/contract/rln_contract.js.map +1 -0
  16. package/dist/create.d.ts +2 -0
  17. package/dist/create.js +8 -0
  18. package/dist/create.js.map +1 -0
  19. package/dist/identity.d.ts +9 -0
  20. package/dist/identity.js +24 -0
  21. package/dist/identity.js.map +1 -0
  22. package/dist/index.d.ts +9 -5
  23. package/dist/index.js +9 -12
  24. package/dist/index.js.map +1 -1
  25. package/dist/keystore/cipher.d.ts +4 -0
  26. package/dist/keystore/cipher.js +28 -0
  27. package/dist/keystore/cipher.js.map +1 -0
  28. package/dist/keystore/credential_validation_generated.d.ts +8 -0
  29. package/dist/keystore/credential_validation_generated.js +121 -0
  30. package/dist/keystore/credential_validation_generated.js.map +1 -0
  31. package/dist/keystore/index.d.ts +4 -0
  32. package/dist/keystore/index.js +3 -0
  33. package/dist/keystore/index.js.map +1 -0
  34. package/dist/keystore/keystore.d.ts +50 -0
  35. package/dist/keystore/keystore.js +205 -0
  36. package/dist/keystore/keystore.js.map +1 -0
  37. package/dist/keystore/keystore_validation_generated.d.ts +8 -0
  38. package/dist/keystore/keystore_validation_generated.js +75 -0
  39. package/dist/keystore/keystore_validation_generated.js.map +1 -0
  40. package/dist/keystore/schema_validator.d.ts +2 -0
  41. package/dist/keystore/schema_validator.js +18 -0
  42. package/dist/keystore/schema_validator.js.map +1 -0
  43. package/dist/keystore/types.d.ts +29 -0
  44. package/dist/keystore/types.js +2 -0
  45. package/dist/keystore/types.js.map +1 -0
  46. package/dist/message.d.ts +2 -1
  47. package/dist/message.js +10 -4
  48. package/dist/message.js.map +1 -1
  49. package/dist/proof.d.ts +21 -0
  50. package/dist/proof.js +49 -0
  51. package/dist/proof.js.map +1 -0
  52. package/dist/resources/verification_key.d.ts +9 -9
  53. package/dist/resources/witness_calculator.js.map +1 -0
  54. package/dist/rln.d.ts +55 -46
  55. package/dist/rln.js +136 -183
  56. package/dist/rln.js.map +1 -1
  57. package/dist/root_tracker.js +5 -2
  58. package/dist/root_tracker.js.map +1 -1
  59. package/dist/utils/bytes.d.ts +20 -0
  60. package/dist/utils/bytes.js +64 -0
  61. package/dist/utils/bytes.js.map +1 -0
  62. package/dist/utils/epoch.js.map +1 -0
  63. package/dist/utils/hash.d.ts +2 -0
  64. package/dist/utils/hash.js +13 -0
  65. package/dist/utils/hash.js.map +1 -0
  66. package/dist/utils/index.d.ts +4 -0
  67. package/dist/utils/index.js +5 -0
  68. package/dist/utils/index.js.map +1 -0
  69. package/dist/utils/metamask.d.ts +2 -0
  70. package/dist/utils/metamask.js +12 -0
  71. package/dist/utils/metamask.js.map +1 -0
  72. package/dist/zerokit.d.ts +19 -0
  73. package/dist/zerokit.js +105 -0
  74. package/dist/zerokit.js.map +1 -0
  75. package/package.json +38 -28
  76. package/src/codec.ts +18 -9
  77. package/src/create.ts +9 -0
  78. package/src/identity.ts +27 -0
  79. package/src/index.ts +16 -18
  80. package/src/message.ts +9 -5
  81. package/src/proof.ts +67 -0
  82. package/src/rln.ts +220 -270
  83. package/src/root_tracker.ts +4 -1
  84. package/src/zerokit.ts +181 -0
  85. package/bundle/assets/rln_wasm_bg-6f96f821.wasm +0 -0
  86. package/dist/.tsbuildinfo +0 -1
  87. package/dist/byte_utils.d.ts +0 -1
  88. package/dist/byte_utils.js +0 -24
  89. package/dist/byte_utils.js.map +0 -1
  90. package/dist/constants.js +0 -14
  91. package/dist/constants.js.map +0 -1
  92. package/dist/epoch.js.map +0 -1
  93. package/dist/rln_contract.d.ts +0 -34
  94. package/dist/rln_contract.js +0 -159
  95. package/dist/rln_contract.js.map +0 -1
  96. package/dist/witness_calculator.js.map +0 -1
  97. package/src/byte_utils.ts +0 -39
  98. package/src/constants.ts +0 -14
  99. package/src/epoch.ts +0 -30
  100. package/src/rln_contract.ts +0 -268
  101. package/src/witness_calculator.d.ts +0 -8
  102. package/src/witness_calculator.js +0 -335
  103. /package/dist/{witness_calculator.d.ts → resources/witness_calculator.d.ts} +0 -0
  104. /package/dist/{witness_calculator.js → resources/witness_calculator.js} +0 -0
  105. /package/dist/{epoch.d.ts → utils/epoch.d.ts} +0 -0
  106. /package/dist/{epoch.js → utils/epoch.js} +0 -0
@@ -0,0 +1,121 @@
1
+ /* eslint eslint-comments/no-unlimited-disable: "off" */
2
+ // This file was generated by /scripts/schema-validation-codegen.ts
3
+ // Do not modify this file by hand.
4
+ /* eslint-disable */
5
+ // @ts-ignore
6
+ "use strict";
7
+ export const Credential = validate11;
8
+ const schema12 = { "type": "object", "properties": { "crypto": { "type": "object", "properties": { "cipher": { "type": "string" }, "cipherparams": { "type": "object" }, "ciphertext": { "type": "string" }, "kdf": { "type": "string" }, "kdfparams": { "type": "object" }, "mac": { "type": "string" } }, "required": ["cipher", "cipherparams", "ciphertext", "kdf", "kdfparams", "mac"] } }, "required": ["crypto"] };
9
+ function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) {
10
+ if (data && typeof data == "object" && !Array.isArray(data)) {
11
+ let missing0;
12
+ if ((data.crypto === undefined) && (missing0 = "crypto")) {
13
+ validate11.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
14
+ return false;
15
+ }
16
+ else {
17
+ if (data.crypto !== undefined) {
18
+ let data0 = data.crypto;
19
+ const _errs1 = errors;
20
+ if (errors === _errs1) {
21
+ if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
22
+ let missing1;
23
+ if (((((((data0.cipher === undefined) && (missing1 = "cipher")) || ((data0.cipherparams === undefined) && (missing1 = "cipherparams"))) || ((data0.ciphertext === undefined) && (missing1 = "ciphertext"))) || ((data0.kdf === undefined) && (missing1 = "kdf"))) || ((data0.kdfparams === undefined) && (missing1 = "kdfparams"))) || ((data0.mac === undefined) && (missing1 = "mac"))) {
24
+ validate11.errors = [{ instancePath: instancePath + "/crypto", schemaPath: "#/properties/crypto/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
25
+ return false;
26
+ }
27
+ else {
28
+ if (data0.cipher !== undefined) {
29
+ const _errs3 = errors;
30
+ if (typeof data0.cipher !== "string") {
31
+ validate11.errors = [{ instancePath: instancePath + "/crypto/cipher", schemaPath: "#/properties/crypto/properties/cipher/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32
+ return false;
33
+ }
34
+ var valid1 = _errs3 === errors;
35
+ }
36
+ else {
37
+ var valid1 = true;
38
+ }
39
+ if (valid1) {
40
+ if (data0.cipherparams !== undefined) {
41
+ let data2 = data0.cipherparams;
42
+ const _errs5 = errors;
43
+ if (!(data2 && typeof data2 == "object" && !Array.isArray(data2))) {
44
+ validate11.errors = [{ instancePath: instancePath + "/crypto/cipherparams", schemaPath: "#/properties/crypto/properties/cipherparams/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
45
+ return false;
46
+ }
47
+ var valid1 = _errs5 === errors;
48
+ }
49
+ else {
50
+ var valid1 = true;
51
+ }
52
+ if (valid1) {
53
+ if (data0.ciphertext !== undefined) {
54
+ const _errs7 = errors;
55
+ if (typeof data0.ciphertext !== "string") {
56
+ validate11.errors = [{ instancePath: instancePath + "/crypto/ciphertext", schemaPath: "#/properties/crypto/properties/ciphertext/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
57
+ return false;
58
+ }
59
+ var valid1 = _errs7 === errors;
60
+ }
61
+ else {
62
+ var valid1 = true;
63
+ }
64
+ if (valid1) {
65
+ if (data0.kdf !== undefined) {
66
+ const _errs9 = errors;
67
+ if (typeof data0.kdf !== "string") {
68
+ validate11.errors = [{ instancePath: instancePath + "/crypto/kdf", schemaPath: "#/properties/crypto/properties/kdf/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
69
+ return false;
70
+ }
71
+ var valid1 = _errs9 === errors;
72
+ }
73
+ else {
74
+ var valid1 = true;
75
+ }
76
+ if (valid1) {
77
+ if (data0.kdfparams !== undefined) {
78
+ let data5 = data0.kdfparams;
79
+ const _errs11 = errors;
80
+ if (!(data5 && typeof data5 == "object" && !Array.isArray(data5))) {
81
+ validate11.errors = [{ instancePath: instancePath + "/crypto/kdfparams", schemaPath: "#/properties/crypto/properties/kdfparams/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
82
+ return false;
83
+ }
84
+ var valid1 = _errs11 === errors;
85
+ }
86
+ else {
87
+ var valid1 = true;
88
+ }
89
+ if (valid1) {
90
+ if (data0.mac !== undefined) {
91
+ const _errs13 = errors;
92
+ if (typeof data0.mac !== "string") {
93
+ validate11.errors = [{ instancePath: instancePath + "/crypto/mac", schemaPath: "#/properties/crypto/properties/mac/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
94
+ return false;
95
+ }
96
+ var valid1 = _errs13 === errors;
97
+ }
98
+ else {
99
+ var valid1 = true;
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ else {
109
+ validate11.errors = [{ instancePath: instancePath + "/crypto", schemaPath: "#/properties/crypto/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
110
+ return false;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ else {
117
+ validate11.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
118
+ return false;
119
+ }
120
+ } validate11.errors = vErrors; return errors === 0; }
121
+ //# sourceMappingURL=credential_validation_generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential_validation_generated.js","sourceRoot":"","sources":["../../src/keystore/credential_validation_generated.ts"],"names":[],"mappings":"AACA,wDAAwD;AACxD,mEAAmE;AACnE,mCAAmC;AAEnC,oBAAoB;AACpB,aAAa;AACb,YAAY,CAAC;AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAAA,MAAM,QAAQ,GAAG,EAAC,MAAM,EAAC,QAAQ,EAAC,YAAY,EAAC,EAAC,QAAQ,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,YAAY,EAAC,EAAC,QAAQ,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,cAAc,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,YAAY,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,KAAK,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,WAAW,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,KAAK,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,EAAC,UAAU,EAAC,CAAC,QAAQ,EAAC,cAAc,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,EAAC,KAAK,CAAC,EAAC,EAAC,EAAC,UAAU,EAAC,CAAC,QAAQ,CAAC,EAAC,CAAC;AAAA,SAAS,UAAU,CAAC,IAAI,EAAE,EAAC,YAAY,GAAC,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,GAAC,IAAI,EAAC,GAAC,EAAE,IAAE,IAAI,OAAO,GAAG,IAAI,CAAC,CAAA,IAAI,MAAM,GAAG,CAAC,CAAC,CAAA,IAAG,MAAM,KAAK,CAAC,EAAC,CAAC;IAAA,IAAG,IAAI,IAAI,OAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,KAAK,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} from "./types.js";
3
+ export { Keystore };
4
+ export type { EncryptedCredentials, DecryptedCredentials };
@@ -0,0 +1,3 @@
1
+ import { Keystore } from "./keystore.js";
2
+ export { Keystore };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keystore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { ICipherModule, IPbkdf2KdfModule } from "@chainsafe/bls-keystore";
2
+ import type { KeystoreEntity, MembershipHash, Password, Sha256Hash } from "./types.js";
3
+ type NwakuCredential = {
4
+ crypto: {
5
+ cipher: ICipherModule["function"];
6
+ cipherparams: ICipherModule["params"];
7
+ ciphertext: ICipherModule["message"];
8
+ kdf: IPbkdf2KdfModule["function"];
9
+ kdfparams: IPbkdf2KdfModule["params"];
10
+ mac: Sha256Hash;
11
+ };
12
+ };
13
+ interface NwakuKeystore {
14
+ application: string;
15
+ version: string;
16
+ appIdentifier: string;
17
+ credentials: {
18
+ [key: MembershipHash]: NwakuCredential;
19
+ };
20
+ }
21
+ type KeystoreCreateOptions = {
22
+ application?: string;
23
+ version?: string;
24
+ appIdentifier?: string;
25
+ };
26
+ export declare class Keystore {
27
+ private data;
28
+ private constructor();
29
+ static create(options?: KeystoreCreateOptions): Keystore;
30
+ static fromString(str: string): undefined | Keystore;
31
+ static fromObject(obj: NwakuKeystore): Keystore;
32
+ addCredential(options: KeystoreEntity, password: Password): Promise<MembershipHash>;
33
+ readCredential(membershipHash: MembershipHash, password: Password): Promise<undefined | KeystoreEntity>;
34
+ removeCredential(hash: MembershipHash): void;
35
+ toString(): string;
36
+ toObject(): NwakuKeystore;
37
+ /**
38
+ * Read array of hashes of current credentials
39
+ * @returns array of keys of credentials in current Keystore
40
+ */
41
+ keys(): string[];
42
+ private static isValidNwakuStore;
43
+ private static fromCredentialToEip;
44
+ private static fromEipToCredential;
45
+ private static fromBytesToIdentity;
46
+ private static fromArraylikeToBytes;
47
+ private static computeMembershipHash;
48
+ private static fromIdentityToBytes;
49
+ }
50
+ export {};
@@ -0,0 +1,205 @@
1
+ import { create as createEipKeystore } from "@chainsafe/bls-keystore";
2
+ import debug from "debug";
3
+ import { sha256 } from "ethereum-cryptography/sha256";
4
+ import { bytesToHex, bytesToUtf8, utf8ToBytes } from "ethereum-cryptography/utils";
5
+ import _ from "lodash";
6
+ import { v4 as uuidV4 } from "uuid";
7
+ import { buildBigIntFromUint8Array } from "../utils/bytes.js";
8
+ import { decryptEipKeystore, keccak256Checksum } from "./cipher.js";
9
+ import { isCredentialValid, isKeystoreValid } from "./schema_validator.js";
10
+ const log = debug("waku:rln:keystore");
11
+ export class Keystore {
12
+ data;
13
+ constructor(options) {
14
+ this.data = Object.assign({
15
+ application: "waku-rln-relay",
16
+ appIdentifier: "01234567890abcdef",
17
+ version: "0.2",
18
+ credentials: {}
19
+ }, options);
20
+ }
21
+ static create(options = {}) {
22
+ return new Keystore(options);
23
+ }
24
+ // should be valid JSON string that contains Keystore file
25
+ // https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/keyfile.nim#L376
26
+ static fromString(str) {
27
+ try {
28
+ const obj = JSON.parse(str);
29
+ if (!Keystore.isValidNwakuStore(obj)) {
30
+ throw Error("Invalid string, does not match Nwaku Keystore format.");
31
+ }
32
+ return new Keystore(obj);
33
+ }
34
+ catch (err) {
35
+ log("Cannot create Keystore from string:", err);
36
+ return;
37
+ }
38
+ }
39
+ static fromObject(obj) {
40
+ if (!Keystore.isValidNwakuStore(obj)) {
41
+ throw Error("Invalid object, does not match Nwaku Keystore format.");
42
+ }
43
+ return new Keystore(obj);
44
+ }
45
+ async addCredential(options, password) {
46
+ const membershipHash = Keystore.computeMembershipHash(options.membership);
47
+ if (this.data.credentials[membershipHash]) {
48
+ throw Error("Credential already exists in the store.");
49
+ }
50
+ // these are not important
51
+ const stubPath = "/stub/path";
52
+ const stubPubkey = new Uint8Array([0]);
53
+ const secret = Keystore.fromIdentityToBytes(options);
54
+ const eipKeystore = await createEipKeystore(password, secret, stubPubkey, stubPath);
55
+ // need to re-compute checksum since nwaku uses keccak256 instead of sha256
56
+ const checksum = await keccak256Checksum(password, eipKeystore);
57
+ const nwakuCredential = Keystore.fromEipToCredential(eipKeystore, checksum);
58
+ this.data.credentials[membershipHash] = nwakuCredential;
59
+ return membershipHash;
60
+ }
61
+ async readCredential(membershipHash, password) {
62
+ const nwakuCredential = this.data.credentials[membershipHash];
63
+ if (!nwakuCredential) {
64
+ return;
65
+ }
66
+ const eipKeystore = Keystore.fromCredentialToEip(nwakuCredential);
67
+ const bytes = await decryptEipKeystore(password, eipKeystore);
68
+ return Keystore.fromBytesToIdentity(bytes);
69
+ }
70
+ removeCredential(hash) {
71
+ if (!this.data.credentials[hash]) {
72
+ return;
73
+ }
74
+ delete this.data.credentials[hash];
75
+ }
76
+ toString() {
77
+ return JSON.stringify(this.data);
78
+ }
79
+ toObject() {
80
+ return this.data;
81
+ }
82
+ /**
83
+ * Read array of hashes of current credentials
84
+ * @returns array of keys of credentials in current Keystore
85
+ */
86
+ keys() {
87
+ return Object.keys(this.toObject().credentials || {});
88
+ }
89
+ static isValidNwakuStore(obj) {
90
+ if (!isKeystoreValid(obj)) {
91
+ return false;
92
+ }
93
+ const areCredentialsValid = Object.values(_.get(obj, "credentials", {}))
94
+ .map((c) => isCredentialValid(c))
95
+ .every((v) => v);
96
+ return areCredentialsValid;
97
+ }
98
+ static fromCredentialToEip(credential) {
99
+ const nwakuCrypto = credential.crypto;
100
+ const eipCrypto = {
101
+ kdf: {
102
+ function: nwakuCrypto.kdf,
103
+ params: nwakuCrypto.kdfparams,
104
+ message: ""
105
+ },
106
+ cipher: {
107
+ function: nwakuCrypto.cipher,
108
+ params: nwakuCrypto.cipherparams,
109
+ message: nwakuCrypto.ciphertext
110
+ },
111
+ checksum: {
112
+ // @chainsafe/bls-keystore supports only sha256
113
+ // but nwaku uses keccak256
114
+ // https://github.com/waku-org/nwaku/blob/25d6e52e3804d15f9b61bc4cc6dd448540c072a1/waku/waku_keystore/keyfile.nim#L367
115
+ function: "sha256",
116
+ params: {},
117
+ message: nwakuCrypto.mac
118
+ }
119
+ };
120
+ return {
121
+ version: 4,
122
+ uuid: uuidV4(),
123
+ description: undefined,
124
+ path: "safe to ignore, not important for decrypt",
125
+ pubkey: "safe to ignore, not important for decrypt",
126
+ crypto: eipCrypto
127
+ };
128
+ }
129
+ static fromEipToCredential(eipKeystore, checksum) {
130
+ const eipCrypto = eipKeystore.crypto;
131
+ const eipKdf = eipCrypto.kdf;
132
+ return {
133
+ crypto: {
134
+ cipher: eipCrypto.cipher.function,
135
+ cipherparams: eipCrypto.cipher.params,
136
+ ciphertext: eipCrypto.cipher.message,
137
+ kdf: eipKdf.function,
138
+ kdfparams: eipKdf.params,
139
+ // @chainsafe/bls-keystore generates only sha256
140
+ // but nwaku uses keccak256
141
+ // https://github.com/waku-org/nwaku/blob/25d6e52e3804d15f9b61bc4cc6dd448540c072a1/waku/waku_keystore/keyfile.nim#L367
142
+ mac: checksum
143
+ }
144
+ };
145
+ }
146
+ static fromBytesToIdentity(bytes) {
147
+ try {
148
+ const str = bytesToUtf8(bytes);
149
+ const obj = JSON.parse(str);
150
+ // TODO: add runtime validation of nwaku credentials
151
+ return {
152
+ identity: {
153
+ IDCommitment: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idCommitment", [])),
154
+ IDTrapdoor: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idTrapdoor", [])),
155
+ IDNullifier: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idNullifier", [])),
156
+ IDCommitmentBigInt: buildBigIntFromUint8Array(Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idCommitment", []))),
157
+ IDSecretHash: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idSecretHash", []))
158
+ },
159
+ membership: {
160
+ treeIndex: _.get(obj, "treeIndex"),
161
+ chainId: _.get(obj, "membershipContract.chainId"),
162
+ address: _.get(obj, "membershipContract.address")
163
+ }
164
+ };
165
+ }
166
+ catch (err) {
167
+ log("Cannot parse bytes to Nwaku Credentials:", err);
168
+ return;
169
+ }
170
+ }
171
+ static fromArraylikeToBytes(obj) {
172
+ const bytes = [];
173
+ let index = 0;
174
+ let lastElement = obj[index];
175
+ while (lastElement !== undefined) {
176
+ bytes.push(lastElement);
177
+ index += 1;
178
+ lastElement = obj[index];
179
+ }
180
+ return new Uint8Array(bytes);
181
+ }
182
+ // follows nwaku implementation
183
+ // https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L111
184
+ static computeMembershipHash(info) {
185
+ return bytesToHex(sha256(utf8ToBytes(`${info.chainId}${info.address}${info.treeIndex}`))).toUpperCase();
186
+ }
187
+ // follows nwaku implementation
188
+ // https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L98
189
+ static fromIdentityToBytes(options) {
190
+ return utf8ToBytes(JSON.stringify({
191
+ treeIndex: options.membership.treeIndex,
192
+ identityCredential: {
193
+ idCommitment: options.identity.IDCommitment,
194
+ idNullifier: options.identity.IDNullifier,
195
+ idSecretHash: options.identity.IDSecretHash,
196
+ idTrapdoor: options.identity.IDTrapdoor
197
+ },
198
+ membershipContract: {
199
+ chainId: options.membership.chainId,
200
+ address: options.membership.address
201
+ }
202
+ }));
203
+ }
204
+ }
205
+ //# sourceMappingURL=keystore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keystore.js","sourceRoot":"","sources":["../../src/keystore/keystore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,MAAM,O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11(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
3
+ instancePath?: string | undefined;
4
+ parentData: any;
5
+ parentDataProperty: any;
6
+ rootData?: any;
7
+ }): boolean;
8
+ export {};
@@ -0,0 +1,75 @@
1
+ /* eslint eslint-comments/no-unlimited-disable: "off" */
2
+ // This file was generated by /scripts/schema-validation-codegen.ts
3
+ // Do not modify this file by hand.
4
+ /* eslint-disable */
5
+ // @ts-ignore
6
+ "use strict";
7
+ export const Keystore = validate11;
8
+ const schema12 = { "type": "object", "properties": { "credentials": { "type": "object" }, "appIdentifier": { "type": "string" }, "version": { "type": "string" }, "application": { "type": "string" } }, "required": ["application", "appIdentifier", "credentials", "version"] };
9
+ function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) {
10
+ if (data && typeof data == "object" && !Array.isArray(data)) {
11
+ let missing0;
12
+ if (((((data.application === undefined) && (missing0 = "application")) || ((data.appIdentifier === undefined) && (missing0 = "appIdentifier"))) || ((data.credentials === undefined) && (missing0 = "credentials"))) || ((data.version === undefined) && (missing0 = "version"))) {
13
+ validate11.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
14
+ return false;
15
+ }
16
+ else {
17
+ if (data.credentials !== undefined) {
18
+ let data0 = data.credentials;
19
+ const _errs1 = errors;
20
+ if (!(data0 && typeof data0 == "object" && !Array.isArray(data0))) {
21
+ validate11.errors = [{ instancePath: instancePath + "/credentials", schemaPath: "#/properties/credentials/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
22
+ return false;
23
+ }
24
+ var valid0 = _errs1 === errors;
25
+ }
26
+ else {
27
+ var valid0 = true;
28
+ }
29
+ if (valid0) {
30
+ if (data.appIdentifier !== undefined) {
31
+ const _errs3 = errors;
32
+ if (typeof data.appIdentifier !== "string") {
33
+ validate11.errors = [{ instancePath: instancePath + "/appIdentifier", schemaPath: "#/properties/appIdentifier/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
34
+ return false;
35
+ }
36
+ var valid0 = _errs3 === errors;
37
+ }
38
+ else {
39
+ var valid0 = true;
40
+ }
41
+ if (valid0) {
42
+ if (data.version !== undefined) {
43
+ const _errs5 = errors;
44
+ if (typeof data.version !== "string") {
45
+ validate11.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
46
+ return false;
47
+ }
48
+ var valid0 = _errs5 === errors;
49
+ }
50
+ else {
51
+ var valid0 = true;
52
+ }
53
+ if (valid0) {
54
+ if (data.application !== undefined) {
55
+ const _errs7 = errors;
56
+ if (typeof data.application !== "string") {
57
+ validate11.errors = [{ instancePath: instancePath + "/application", schemaPath: "#/properties/application/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
58
+ return false;
59
+ }
60
+ var valid0 = _errs7 === errors;
61
+ }
62
+ else {
63
+ var valid0 = true;
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ else {
71
+ validate11.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
72
+ return false;
73
+ }
74
+ } validate11.errors = vErrors; return errors === 0; }
75
+ //# sourceMappingURL=keystore_validation_generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keystore_validation_generated.js","sourceRoot":"","sources":["../../src/keystore/keystore_validation_generated.ts"],"names":[],"mappings":"AACA,wDAAwD;AACxD,mEAAmE;AACnE,mCAAmC;AAEnC,oBAAoB;AACpB,aAAa;AACb,YAAY,CAAC;AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAAA,MAAM,QAAQ,GAAG,EAAC,MAAM,EAAC,QAAQ,EAAC,YAAY,EAAC,EAAC,aAAa,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,eAAe,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,SAAS,EAAC,EAAC,MAAM,EAAC,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EAAC,YAAY,EAAC,UAAU,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,OAAO,EAAC,gBAAgB,EAAC,CAAC,CAAC;QAAA,OAAO,KAAK,CAAC;IAAA,CAAC;AAAA,CAAC,CAAA,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,CAAA,OAAO,MAAM,KAAK,CAAC,CAAC,CAAA,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function isKeystoreValid(keystore: unknown): boolean;
2
+ export declare function isCredentialValid(credential: unknown): boolean;
@@ -0,0 +1,18 @@
1
+ import { Credential as _validateCredentialGenerated } from "./credential_validation_generated.js";
2
+ import { Keystore as _validateKeystoreGenerated } from "./keystore_validation_generated.js";
3
+ const _validateKeystore = _validateKeystoreGenerated;
4
+ const _validateCredential = _validateCredentialGenerated;
5
+ function schemaValidationErrors(validator, data) {
6
+ const validated = validator(data);
7
+ if (validated) {
8
+ return null;
9
+ }
10
+ return validator.errors;
11
+ }
12
+ export function isKeystoreValid(keystore) {
13
+ return !schemaValidationErrors(_validateKeystore, keystore);
14
+ }
15
+ export function isCredentialValid(credential) {
16
+ return !schemaValidationErrors(_validateCredential, credential);
17
+ }
18
+ //# sourceMappingURL=schema_validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema_validator.js","sourceRoot":"","sources":["../../src/keystore/schema_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,QAAQ,IAAI,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAY5F,MAAM,iBAAiB,GAAG,0BAAyC,CAAC;AACpE,MAAM,mBAAmB,GAAG,4BAA2C,CAAC;AAExE,SAAS,sBAAsB,CAC7B,SAAsB,EACtB,IAAa;IAEb,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAiB;IAC/C,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,OAAO,CAAC,sBAAsB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { IdentityCredential } from "../identity.js";
2
+ export type MembershipHash = string;
3
+ export type Sha256Hash = string;
4
+ export type Keccak256Hash = string;
5
+ export type Password = string | Uint8Array;
6
+ export type MembershipInfo = {
7
+ chainId: number;
8
+ address: string;
9
+ treeIndex: number;
10
+ };
11
+ export type KeystoreEntity = {
12
+ identity: IdentityCredential;
13
+ membership: MembershipInfo;
14
+ };
15
+ export type DecryptedCredentials = KeystoreEntity;
16
+ export type EncryptedCredentials = {
17
+ /**
18
+ * Valid JSON string that contains Keystore
19
+ */
20
+ keystore: string;
21
+ /**
22
+ * ID of credentials from provided Keystore to use
23
+ */
24
+ id: string;
25
+ /**
26
+ * Password to decrypt credentials provided
27
+ */
28
+ password: Password;
29
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/keystore/types.ts"],"names":[],"mappings":""}
package/dist/message.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare class RlnMessage<T extends IDecodedMessage> implements IDecodedMe
5
5
  rlnInstance: RLNInstance;
6
6
  msg: T;
7
7
  rateLimitProof: IRateLimitProof | undefined;
8
- pubSubTopic: string;
8
+ pubsubTopic: string;
9
9
  constructor(rlnInstance: RLNInstance, msg: T, rateLimitProof: IRateLimitProof | undefined);
10
10
  verify(roots: Uint8Array[]): boolean | undefined;
11
11
  verifyNoRoot(): boolean | undefined;
@@ -13,5 +13,6 @@ export declare class RlnMessage<T extends IDecodedMessage> implements IDecodedMe
13
13
  get contentTopic(): string;
14
14
  get timestamp(): Date | undefined;
15
15
  get ephemeral(): boolean | undefined;
16
+ get meta(): Uint8Array | undefined;
16
17
  get epoch(): number | undefined;
17
18
  }
package/dist/message.js CHANGED
@@ -1,24 +1,27 @@
1
1
  import * as utils from "@waku/utils/bytes";
2
- import { epochBytesToInt } from "./epoch.js";
2
+ import { epochBytesToInt } from "./utils/index.js";
3
3
  export function toRLNSignal(contentTopic, msg) {
4
4
  const contentTopicBytes = utils.utf8ToBytes(contentTopic ?? "");
5
5
  return new Uint8Array([...(msg.payload ?? []), ...contentTopicBytes]);
6
6
  }
7
7
  export class RlnMessage {
8
+ rlnInstance;
9
+ msg;
10
+ rateLimitProof;
11
+ pubsubTopic = "";
8
12
  constructor(rlnInstance, msg, rateLimitProof) {
9
13
  this.rlnInstance = rlnInstance;
10
14
  this.msg = msg;
11
15
  this.rateLimitProof = rateLimitProof;
12
- this.pubSubTopic = "";
13
16
  }
14
17
  verify(roots) {
15
18
  return this.rateLimitProof
16
- ? this.rlnInstance.verifyWithRoots(this.rateLimitProof, toRLNSignal(this.msg.contentTopic, this.msg), ...roots) // this.rlnInstance.verifyRLNProof once issue status-im/nwaku#1248 is fixed
19
+ ? this.rlnInstance.zerokit.verifyWithRoots(this.rateLimitProof, toRLNSignal(this.msg.contentTopic, this.msg), ...roots) // this.rlnInstance.verifyRLNProof once issue status-im/nwaku#1248 is fixed
17
20
  : undefined;
18
21
  }
19
22
  verifyNoRoot() {
20
23
  return this.rateLimitProof
21
- ? this.rlnInstance.verifyWithNoRoot(this.rateLimitProof, toRLNSignal(this.msg.contentTopic, this.msg)) // this.rlnInstance.verifyRLNProof once issue status-im/nwaku#1248 is fixed
24
+ ? this.rlnInstance.zerokit.verifyWithNoRoot(this.rateLimitProof, toRLNSignal(this.msg.contentTopic, this.msg)) // this.rlnInstance.verifyRLNProof once issue status-im/nwaku#1248 is fixed
22
25
  : undefined;
23
26
  }
24
27
  get payload() {
@@ -33,6 +36,9 @@ export class RlnMessage {
33
36
  get ephemeral() {
34
37
  return this.msg.ephemeral;
35
38
  }
39
+ get meta() {
40
+ return this.msg.meta;
41
+ }
36
42
  get epoch() {
37
43
  const bytes = this.msg.rateLimitProof?.epoch;
38
44
  if (!bytes)