@maci-protocol/domainobjs 0.0.0-ci.185b643

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 (57) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/LICENSE +22 -0
  3. package/README.md +78 -0
  4. package/build/ts/ballot.d.ts +68 -0
  5. package/build/ts/ballot.d.ts.map +1 -0
  6. package/build/ts/ballot.js +120 -0
  7. package/build/ts/ballot.js.map +1 -0
  8. package/build/ts/commands/PCommand.d.ts +89 -0
  9. package/build/ts/commands/PCommand.d.ts.map +1 -0
  10. package/build/ts/commands/PCommand.js +171 -0
  11. package/build/ts/commands/PCommand.js.map +1 -0
  12. package/build/ts/commands/index.d.ts +3 -0
  13. package/build/ts/commands/index.d.ts.map +1 -0
  14. package/build/ts/commands/index.js +6 -0
  15. package/build/ts/commands/index.js.map +1 -0
  16. package/build/ts/commands/types.d.ts +21 -0
  17. package/build/ts/commands/types.d.ts.map +1 -0
  18. package/build/ts/commands/types.js +3 -0
  19. package/build/ts/commands/types.js.map +1 -0
  20. package/build/ts/constants.d.ts +6 -0
  21. package/build/ts/constants.d.ts.map +1 -0
  22. package/build/ts/constants.js +9 -0
  23. package/build/ts/constants.js.map +1 -0
  24. package/build/ts/index.d.ts +11 -0
  25. package/build/ts/index.d.ts.map +1 -0
  26. package/build/ts/index.js +26 -0
  27. package/build/ts/index.js.map +1 -0
  28. package/build/ts/keyPair.d.ts +49 -0
  29. package/build/ts/keyPair.d.ts.map +1 -0
  30. package/build/ts/keyPair.js +82 -0
  31. package/build/ts/keyPair.js.map +1 -0
  32. package/build/ts/message.d.ts +58 -0
  33. package/build/ts/message.d.ts.map +1 -0
  34. package/build/ts/message.js +78 -0
  35. package/build/ts/message.js.map +1 -0
  36. package/build/ts/privateKey.d.ts +56 -0
  37. package/build/ts/privateKey.d.ts.map +1 -0
  38. package/build/ts/privateKey.js +79 -0
  39. package/build/ts/privateKey.js.map +1 -0
  40. package/build/ts/publicKey.d.ts +89 -0
  41. package/build/ts/publicKey.d.ts.map +1 -0
  42. package/build/ts/publicKey.js +141 -0
  43. package/build/ts/publicKey.js.map +1 -0
  44. package/build/ts/stateLeaf.d.ts +81 -0
  45. package/build/ts/stateLeaf.d.ts.map +1 -0
  46. package/build/ts/stateLeaf.js +126 -0
  47. package/build/ts/stateLeaf.js.map +1 -0
  48. package/build/ts/types.d.ts +73 -0
  49. package/build/ts/types.d.ts.map +1 -0
  50. package/build/ts/types.js +3 -0
  51. package/build/ts/types.js.map +1 -0
  52. package/build/ts/verifyingKey.d.ts +57 -0
  53. package/build/ts/verifyingKey.d.ts.map +1 -0
  54. package/build/ts/verifyingKey.js +96 -0
  55. package/build/ts/verifyingKey.js.map +1 -0
  56. package/build/tsconfig.build.tsbuildinfo +1 -0
  57. package/package.json +55 -0
@@ -0,0 +1,56 @@
1
+ import { type PrivKey as RawPrivKey } from "@maci-protocol/crypto";
2
+ import type { IJsonPrivateKey } from "./types";
3
+ export declare const SERIALIZED_PRIV_KEY_PREFIX = "macisk.";
4
+ /**
5
+ * @notice PrivKey is a TS Class representing a MACI PrivateKey
6
+ * which is a seed to be used to generate a public key (point on the curve)
7
+ * This is a MACI private key, which is not to be
8
+ * confused with an Ethereum private key.
9
+ * A serialized MACI private key is prefixed by 'macisk.'
10
+ */
11
+ export declare class PrivKey {
12
+ rawPrivKey: RawPrivKey;
13
+ /**
14
+ * Generate a new Private key object
15
+ * @param rawPrivKey the raw private key (a bigint)
16
+ */
17
+ constructor(rawPrivKey: RawPrivKey);
18
+ /**
19
+ * Create a copy of this Private key
20
+ * @returns a copy of the Private key
21
+ */
22
+ copy: () => PrivKey;
23
+ /**
24
+ * Return this Private key as a circuit input
25
+ * @returns the Private key as a circuit input
26
+ */
27
+ asCircuitInputs: () => string;
28
+ /**
29
+ * Serialize the private key
30
+ * @returns the serialized private key
31
+ */
32
+ serialize: () => string;
33
+ /**
34
+ * Deserialize the private key
35
+ * @param s the serialized private key
36
+ * @returns the deserialized private key
37
+ */
38
+ static deserialize: (s: string) => PrivKey;
39
+ /**
40
+ * Check if the serialized private key is valid
41
+ * @param s the serialized private key
42
+ * @returns whether it is a valid serialized private key
43
+ */
44
+ static isValidSerializedPrivKey: (s: string) => boolean;
45
+ /**
46
+ * Serialize this object
47
+ */
48
+ toJSON(): IJsonPrivateKey;
49
+ /**
50
+ * Deserialize this object from a JSON object
51
+ * @param json - the json object
52
+ * @returns the deserialized object as a PrivKey instance
53
+ */
54
+ static fromJSON(json: IJsonPrivateKey): PrivKey;
55
+ }
56
+ //# sourceMappingURL=privateKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privateKey.d.ts","sourceRoot":"","sources":["../../ts/privateKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,0BAA0B,YAAY,CAAC;AAEpD;;;;;;GAMG;AACH,qBAAa,OAAO;IAClB,UAAU,EAAE,UAAU,CAAC;IAEvB;;;OAGG;gBACS,UAAU,EAAE,UAAU;IAIlC;;;OAGG;IACH,IAAI,QAAO,OAAO,CAAoD;IAEtE;;;OAGG;IACH,eAAe,QAAO,MAAM,CAAwD;IAEpF;;;OAGG;IACH,SAAS,QAAO,MAAM,CAOpB;IAEF;;;;OAIG;IACH,MAAM,CAAC,WAAW,GAAI,GAAG,MAAM,KAAG,OAAO,CAGvC;IAEF;;;;OAIG;IACH,MAAM,CAAC,wBAAwB,GAAI,GAAG,MAAM,KAAG,OAAO,CAKpD;IAEF;;OAEG;IACH,MAAM,IAAI,eAAe;IAMzB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO;CAGhD"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrivKey = exports.SERIALIZED_PRIV_KEY_PREFIX = void 0;
4
+ const crypto_1 = require("@maci-protocol/crypto");
5
+ exports.SERIALIZED_PRIV_KEY_PREFIX = "macisk.";
6
+ /**
7
+ * @notice PrivKey is a TS Class representing a MACI PrivateKey
8
+ * which is a seed to be used to generate a public key (point on the curve)
9
+ * This is a MACI private key, which is not to be
10
+ * confused with an Ethereum private key.
11
+ * A serialized MACI private key is prefixed by 'macisk.'
12
+ */
13
+ class PrivKey {
14
+ /**
15
+ * Generate a new Private key object
16
+ * @param rawPrivKey the raw private key (a bigint)
17
+ */
18
+ constructor(rawPrivKey) {
19
+ /**
20
+ * Create a copy of this Private key
21
+ * @returns a copy of the Private key
22
+ */
23
+ this.copy = () => new PrivKey(BigInt(this.rawPrivKey.toString()));
24
+ /**
25
+ * Return this Private key as a circuit input
26
+ * @returns the Private key as a circuit input
27
+ */
28
+ this.asCircuitInputs = () => (0, crypto_1.formatPrivKeyForBabyJub)(this.rawPrivKey).toString();
29
+ /**
30
+ * Serialize the private key
31
+ * @returns the serialized private key
32
+ */
33
+ this.serialize = () => {
34
+ let x = this.rawPrivKey.toString(16);
35
+ if (x.length % 2 !== 0) {
36
+ x = `0${x}`;
37
+ }
38
+ return `${exports.SERIALIZED_PRIV_KEY_PREFIX}${x.padStart(64, "0")}`;
39
+ };
40
+ this.rawPrivKey = rawPrivKey;
41
+ }
42
+ /**
43
+ * Serialize this object
44
+ */
45
+ toJSON() {
46
+ return {
47
+ privKey: this.serialize(),
48
+ };
49
+ }
50
+ /**
51
+ * Deserialize this object from a JSON object
52
+ * @param json - the json object
53
+ * @returns the deserialized object as a PrivKey instance
54
+ */
55
+ static fromJSON(json) {
56
+ return PrivKey.deserialize(json.privKey);
57
+ }
58
+ }
59
+ exports.PrivKey = PrivKey;
60
+ /**
61
+ * Deserialize the private key
62
+ * @param s the serialized private key
63
+ * @returns the deserialized private key
64
+ */
65
+ PrivKey.deserialize = (s) => {
66
+ const x = s.slice(exports.SERIALIZED_PRIV_KEY_PREFIX.length);
67
+ return new PrivKey(BigInt(`0x${x}`));
68
+ };
69
+ /**
70
+ * Check if the serialized private key is valid
71
+ * @param s the serialized private key
72
+ * @returns whether it is a valid serialized private key
73
+ */
74
+ PrivKey.isValidSerializedPrivKey = (s) => {
75
+ const correctPrefix = s.startsWith(exports.SERIALIZED_PRIV_KEY_PREFIX);
76
+ const x = s.slice(exports.SERIALIZED_PRIV_KEY_PREFIX.length);
77
+ return correctPrefix && x.length === 64;
78
+ };
79
+ //# sourceMappingURL=privateKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privateKey.js","sourceRoot":"","sources":["../../ts/privateKey.ts"],"names":[],"mappings":";;;AAAA,kDAA4F;AAI/E,QAAA,0BAA0B,GAAG,SAAS,CAAC;AAEpD;;;;;;GAMG;AACH,MAAa,OAAO;IAGlB;;;OAGG;IACH,YAAY,UAAsB;QAIlC;;;WAGG;QACH,SAAI,GAAG,GAAY,EAAE,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAEtE;;;WAGG;QACH,oBAAe,GAAG,GAAW,EAAE,CAAC,IAAA,gCAAuB,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;QAEpF;;;WAGG;QACH,cAAS,GAAG,GAAW,EAAE;YACvB,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACrC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACvB,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;YACd,CAAC;YAED,OAAO,GAAG,kCAA0B,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;QAC/D,CAAC,CAAC;QA1BA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAiDD;;OAEG;IACH,MAAM;QACJ,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE;SAC1B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAqB;QACnC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;;AA1EH,0BA2EC;AAvCC;;;;GAIG;AACI,mBAAW,GAAG,CAAC,CAAS,EAAW,EAAE;IAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,kCAA0B,CAAC,MAAM,CAAC,CAAC;IACrD,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC,AAHiB,CAGhB;AAEF;;;;GAIG;AACI,gCAAwB,GAAG,CAAC,CAAS,EAAW,EAAE;IACvD,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,CAAC,kCAA0B,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,kCAA0B,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,aAAa,IAAI,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC;AAC1C,CAAC,AAL8B,CAK7B"}
@@ -0,0 +1,89 @@
1
+ import { type PubKey as RawPubKey } from "@maci-protocol/crypto";
2
+ import type { IJsonPublicKey, IG1ContractParams } from "./types";
3
+ export declare const SERIALIZED_PUB_KEY_PREFIX = "macipk.";
4
+ /**
5
+ * @notice A class representing a public key
6
+ * This is a MACI public key, which is not to be
7
+ * confused with an Ethereum public key.
8
+ * A serialized MACI public key is prefixed by 'macipk.'
9
+ * A raw MACI public key can be thought as a pair of
10
+ * BigIntegers (x, y) representing a point on the baby jubjub curve
11
+ */
12
+ export declare class PubKey {
13
+ rawPubKey: RawPubKey;
14
+ /**
15
+ * Create a new instance of a public key
16
+ * @dev You might want to allow an invalid raw key,
17
+ * as when decrypting invalid messages, the public key data
18
+ * will be random, and likely not be a point on the curve.
19
+ * However we need to match keys to the circuit which does
20
+ * not perform such checks
21
+ * @param rawPubKey the raw public key
22
+ * @param allowInvalid whether to allow invalid public keys
23
+ */
24
+ constructor(rawPubKey: RawPubKey, allowInvalid?: boolean);
25
+ /**
26
+ * Create a copy of the public key
27
+ * @returns a copy of the public key
28
+ */
29
+ copy: () => PubKey;
30
+ /**
31
+ * Return this public key as smart contract parameters
32
+ * @returns the public key as smart contract parameters
33
+ */
34
+ asContractParam: () => IG1ContractParams;
35
+ /**
36
+ * Return this public key as circuit inputs
37
+ * @returns an array of strings
38
+ */
39
+ asCircuitInputs: () => string[];
40
+ /**
41
+ * Return this public key as an array of bigints
42
+ * @returns the public key as an array of bigints
43
+ */
44
+ asArray: () => bigint[];
45
+ /**
46
+ * Generate a serialized public key from this public key object
47
+ * @returns the string representation of a serialized public key
48
+ */
49
+ serialize: () => string;
50
+ /**
51
+ * Hash the two baby jubjub coordinates
52
+ * @returns the hash of this public key
53
+ */
54
+ hash: () => bigint;
55
+ /**
56
+ * Check whether this public key equals to another public key
57
+ * @param p the public key to compare with
58
+ * @returns whether they match
59
+ */
60
+ equals: (p: PubKey) => boolean;
61
+ /**
62
+ * Deserialize a serialized public key
63
+ * @param s the serialized public key
64
+ * @returns the deserialized public key
65
+ */
66
+ static deserialize: (s: string) => PubKey;
67
+ /**
68
+ * Check whether a serialized public key is serialized correctly
69
+ * @param s the serialized public key
70
+ * @returns whether the serialized public key is valid
71
+ */
72
+ static isValidSerializedPubKey: (s: string) => boolean;
73
+ /**
74
+ * Serialize this object
75
+ */
76
+ toJSON(): IJsonPublicKey;
77
+ /**
78
+ * Deserialize a JSON object into a PubKey instance
79
+ * @param json - the json object
80
+ * @returns PubKey
81
+ */
82
+ static fromJSON(json: IJsonPublicKey): PubKey;
83
+ /**
84
+ * Generate a default pad key
85
+ * @returns a default pad key
86
+ */
87
+ static genPadKey(): PubKey;
88
+ }
89
+ //# sourceMappingURL=publicKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicKey.d.ts","sourceRoot":"","sources":["../../ts/publicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAInH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjE,eAAO,MAAM,yBAAyB,YAAY,CAAC;AAEnD;;;;;;;GAOG;AACH,qBAAa,MAAM;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;;;;;;;;OASG;gBACS,SAAS,EAAE,SAAS,EAAE,YAAY,UAAQ;IAOtD;;;OAGG;IACH,IAAI,QAAO,MAAM,CAA6F;IAE9G;;;OAGG;IACH,eAAe,QAAO,iBAAiB,CAOrC;IAEF;;;OAGG;IACH,eAAe,QAAO,MAAM,EAAE,CAA4C;IAE1E;;;OAGG;IACH,OAAO,QAAO,MAAM,EAAE,CAA2C;IAEjE;;;OAGG;IACH,SAAS,QAAO,MAAM,CAQpB;IAEF;;;OAGG;IACH,IAAI,QAAO,MAAM,CAAwD;IAEzE;;;;OAIG;IACH,MAAM,GAAI,GAAG,MAAM,KAAG,OAAO,CAAiF;IAE9G;;;;OAIG;IACH,MAAM,CAAC,WAAW,GAAI,GAAG,MAAM,KAAG,MAAM,CAGtC;IAEF;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,GAAI,GAAG,MAAM,KAAG,OAAO,CASnD;IAEF;;OAEG;IACH,MAAM,IAAI,cAAc;IAMxB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IAI7C;;;OAGG;IACH,MAAM,CAAC,SAAS,IAAI,MAAM;CAY3B"}
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PubKey = exports.SERIALIZED_PUB_KEY_PREFIX = void 0;
7
+ const crypto_1 = require("@maci-protocol/crypto");
8
+ const assert_1 = __importDefault(require("assert"));
9
+ exports.SERIALIZED_PUB_KEY_PREFIX = "macipk.";
10
+ /**
11
+ * @notice A class representing a public key
12
+ * This is a MACI public key, which is not to be
13
+ * confused with an Ethereum public key.
14
+ * A serialized MACI public key is prefixed by 'macipk.'
15
+ * A raw MACI public key can be thought as a pair of
16
+ * BigIntegers (x, y) representing a point on the baby jubjub curve
17
+ */
18
+ class PubKey {
19
+ /**
20
+ * Create a new instance of a public key
21
+ * @dev You might want to allow an invalid raw key,
22
+ * as when decrypting invalid messages, the public key data
23
+ * will be random, and likely not be a point on the curve.
24
+ * However we need to match keys to the circuit which does
25
+ * not perform such checks
26
+ * @param rawPubKey the raw public key
27
+ * @param allowInvalid whether to allow invalid public keys
28
+ */
29
+ constructor(rawPubKey, allowInvalid = false) {
30
+ /**
31
+ * Create a copy of the public key
32
+ * @returns a copy of the public key
33
+ */
34
+ this.copy = () => new PubKey([BigInt(this.rawPubKey[0].toString()), BigInt(this.rawPubKey[1].toString())]);
35
+ /**
36
+ * Return this public key as smart contract parameters
37
+ * @returns the public key as smart contract parameters
38
+ */
39
+ this.asContractParam = () => {
40
+ const [x, y] = this.rawPubKey;
41
+ return {
42
+ x: x.toString(),
43
+ y: y.toString(),
44
+ };
45
+ };
46
+ /**
47
+ * Return this public key as circuit inputs
48
+ * @returns an array of strings
49
+ */
50
+ this.asCircuitInputs = () => this.rawPubKey.map((x) => x.toString());
51
+ /**
52
+ * Return this public key as an array of bigints
53
+ * @returns the public key as an array of bigints
54
+ */
55
+ this.asArray = () => [this.rawPubKey[0], this.rawPubKey[1]];
56
+ /**
57
+ * Generate a serialized public key from this public key object
58
+ * @returns the string representation of a serialized public key
59
+ */
60
+ this.serialize = () => {
61
+ const packed = (0, crypto_1.packPubKey)(this.rawPubKey).toString(16);
62
+ if (packed.length % 2 !== 0) {
63
+ return `${exports.SERIALIZED_PUB_KEY_PREFIX}0${packed}`;
64
+ }
65
+ return `${exports.SERIALIZED_PUB_KEY_PREFIX}${packed}`;
66
+ };
67
+ /**
68
+ * Hash the two baby jubjub coordinates
69
+ * @returns the hash of this public key
70
+ */
71
+ this.hash = () => (0, crypto_1.hashLeftRight)(this.rawPubKey[0], this.rawPubKey[1]);
72
+ /**
73
+ * Check whether this public key equals to another public key
74
+ * @param p the public key to compare with
75
+ * @returns whether they match
76
+ */
77
+ this.equals = (p) => this.rawPubKey[0] === p.rawPubKey[0] && this.rawPubKey[1] === p.rawPubKey[1];
78
+ if (!allowInvalid) {
79
+ (0, assert_1.default)((0, crypto_1.inCurve)(rawPubKey), "PubKey not on curve");
80
+ }
81
+ this.rawPubKey = rawPubKey;
82
+ }
83
+ /**
84
+ * Serialize this object
85
+ */
86
+ toJSON() {
87
+ return {
88
+ pubKey: this.serialize(),
89
+ };
90
+ }
91
+ /**
92
+ * Deserialize a JSON object into a PubKey instance
93
+ * @param json - the json object
94
+ * @returns PubKey
95
+ */
96
+ static fromJSON(json) {
97
+ return PubKey.deserialize(json.pubKey);
98
+ }
99
+ /**
100
+ * Generate a default pad key
101
+ * @returns a default pad key
102
+ */
103
+ static genPadKey() {
104
+ // This public key is the first Pedersen base
105
+ // point from iden3's circomlib implementation of the Pedersen hash.
106
+ // Since it is generated using a hash-to-curve function, we are
107
+ // confident that no-one knows the private key associated with this
108
+ // public key. See:
109
+ // https://github.com/iden3/circomlib/blob/d5ed1c3ce4ca137a6b3ca48bec4ac12c1b38957a/src/pedersen_printbases.js
110
+ return new PubKey([
111
+ BigInt("10457101036533406547632367118273992217979173478358440826365724437999023779287"),
112
+ BigInt("19824078218392094440610104313265183977899662750282163392862422243483260492317"),
113
+ ]);
114
+ }
115
+ }
116
+ exports.PubKey = PubKey;
117
+ /**
118
+ * Deserialize a serialized public key
119
+ * @param s the serialized public key
120
+ * @returns the deserialized public key
121
+ */
122
+ PubKey.deserialize = (s) => {
123
+ const len = exports.SERIALIZED_PUB_KEY_PREFIX.length;
124
+ return new PubKey((0, crypto_1.unpackPubKey)(BigInt(`0x${s.slice(len).toString()}`)));
125
+ };
126
+ /**
127
+ * Check whether a serialized public key is serialized correctly
128
+ * @param s the serialized public key
129
+ * @returns whether the serialized public key is valid
130
+ */
131
+ PubKey.isValidSerializedPubKey = (s) => {
132
+ const correctPrefix = s.startsWith(exports.SERIALIZED_PUB_KEY_PREFIX);
133
+ try {
134
+ PubKey.deserialize(s);
135
+ return correctPrefix;
136
+ }
137
+ catch {
138
+ return false;
139
+ }
140
+ };
141
+ //# sourceMappingURL=publicKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicKey.js","sourceRoot":"","sources":["../../ts/publicKey.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,81 @@
1
+ import type { IJsonStateLeaf, IStateLeaf, IStateLeafContractParams } from "./types";
2
+ import { PubKey } from "./publicKey";
3
+ /**
4
+ * @notice A leaf in the state tree, which maps
5
+ * public keys to voice credit balances
6
+ */
7
+ export declare class StateLeaf implements IStateLeaf {
8
+ pubKey: PubKey;
9
+ voiceCreditBalance: bigint;
10
+ /**
11
+ * Create a new instance of a state leaf
12
+ * @param pubKey the public key of the user signin up
13
+ * @param voiceCreditBalance the voice credit balance of the user
14
+ */
15
+ constructor(pubKey: PubKey, voiceCreditBalance: bigint);
16
+ /**
17
+ * Crate a deep copy of the object
18
+ * @returns a copy of the state leaf
19
+ */
20
+ copy(): StateLeaf;
21
+ /**
22
+ * Generate a blank state leaf
23
+ * @returns a blank state leaf
24
+ */
25
+ static genBlankLeaf(): StateLeaf;
26
+ /**
27
+ * Generate a random leaf (random salt and random key pair)
28
+ * @returns a random state leaf
29
+ */
30
+ static genRandomLeaf(): StateLeaf;
31
+ /**
32
+ * Return this state leaf as an array of bigints
33
+ * @returns the state leaf as an array of bigints
34
+ */
35
+ private asArray;
36
+ /**
37
+ * Return this state leaf as an array of bigints
38
+ * @returns the state leaf as an array of bigints
39
+ */
40
+ asCircuitInputs: () => bigint[];
41
+ /**
42
+ * Hash this state leaf (first convert as array)
43
+ * @returns the has of the state leaf elements
44
+ */
45
+ hash: () => bigint;
46
+ /**
47
+ * Return this state leaf as a contract param
48
+ * @returns the state leaf as a contract param (object)
49
+ */
50
+ asContractParam(): IStateLeafContractParams;
51
+ /**
52
+ * Check if two state leaves are equal
53
+ * @param leaf the state leaf to compare with
54
+ * @returns whether they are equal or not
55
+ */
56
+ equals(leaf: StateLeaf): boolean;
57
+ /**
58
+ * Serialize the state leaf
59
+ * @notice serialize the public key
60
+ * @notice convert the voice credit balance to a hex string
61
+ * @returns
62
+ */
63
+ serialize: () => string;
64
+ /**
65
+ * Deserialize the state leaf
66
+ * @param serialized the serialized state leaf
67
+ * @returns a deserialized state leaf
68
+ */
69
+ static deserialize: (serialized: string) => StateLeaf;
70
+ /**
71
+ * Serialize to a JSON object
72
+ */
73
+ toJSON(): IJsonStateLeaf;
74
+ /**
75
+ * Deserialize into a StateLeaf instance
76
+ * @param json - the json representation
77
+ * @returns the deserialized object as a StateLeaf instance
78
+ */
79
+ static fromJSON(json: IJsonStateLeaf): StateLeaf;
80
+ }
81
+ //# sourceMappingURL=stateLeaf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateLeaf.d.ts","sourceRoot":"","sources":["../../ts/stateLeaf.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGpF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH,qBAAa,SAAU,YAAW,UAAU;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;gBACS,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM;IAKtD;;;OAGG;IACH,IAAI,IAAI,SAAS;IAIjB;;;OAGG;IACH,MAAM,CAAC,YAAY,IAAI,SAAS;IAkBhC;;;OAGG;IACH,MAAM,CAAC,aAAa,IAAI,SAAS;IAKjC;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAuE;IAEtF;;;OAGG;IACH,eAAe,QAAO,MAAM,EAAE,CAAmB;IAEjD;;;OAGG;IACH,IAAI,QAAO,MAAM,CAA0B;IAE3C;;;OAGG;IACH,eAAe,IAAI,wBAAwB;IAO3C;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAIhC;;;;;OAKG;IACH,SAAS,QAAO,MAAM,CAIpB;IAEF;;;;OAIG;IACH,MAAM,CAAC,WAAW,GAAI,YAAY,MAAM,KAAG,SAAS,CAKlD;IAEF;;OAEG;IACH,MAAM,IAAI,cAAc;IAOxB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS;CAGjD"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StateLeaf = void 0;
4
+ const crypto_1 = require("@maci-protocol/crypto");
5
+ const keyPair_1 = require("./keyPair");
6
+ const publicKey_1 = require("./publicKey");
7
+ /**
8
+ * @notice A leaf in the state tree, which maps
9
+ * public keys to voice credit balances
10
+ */
11
+ class StateLeaf {
12
+ /**
13
+ * Create a new instance of a state leaf
14
+ * @param pubKey the public key of the user signin up
15
+ * @param voiceCreditBalance the voice credit balance of the user
16
+ */
17
+ constructor(pubKey, voiceCreditBalance) {
18
+ /**
19
+ * Return this state leaf as an array of bigints
20
+ * @returns the state leaf as an array of bigints
21
+ */
22
+ this.asArray = () => [...this.pubKey.asArray(), this.voiceCreditBalance];
23
+ /**
24
+ * Return this state leaf as an array of bigints
25
+ * @returns the state leaf as an array of bigints
26
+ */
27
+ this.asCircuitInputs = () => this.asArray();
28
+ /**
29
+ * Hash this state leaf (first convert as array)
30
+ * @returns the has of the state leaf elements
31
+ */
32
+ this.hash = () => (0, crypto_1.hash3)(this.asArray());
33
+ /**
34
+ * Serialize the state leaf
35
+ * @notice serialize the public key
36
+ * @notice convert the voice credit balance to a hex string
37
+ * @returns
38
+ */
39
+ this.serialize = () => {
40
+ const data = [this.pubKey.serialize(), this.voiceCreditBalance.toString(16)];
41
+ return Buffer.from(JSON.stringify(data, null, 0), "utf8").toString("base64url");
42
+ };
43
+ this.pubKey = pubKey;
44
+ this.voiceCreditBalance = voiceCreditBalance;
45
+ }
46
+ /**
47
+ * Crate a deep copy of the object
48
+ * @returns a copy of the state leaf
49
+ */
50
+ copy() {
51
+ return new StateLeaf(this.pubKey.copy(), BigInt(this.voiceCreditBalance.toString()));
52
+ }
53
+ /**
54
+ * Generate a blank state leaf
55
+ * @returns a blank state leaf
56
+ */
57
+ static genBlankLeaf() {
58
+ // The public key for a blank state leaf is the first Pedersen base
59
+ // point from iden3's circomlib implementation of the Pedersen hash.
60
+ // Since it is generated using a hash-to-curve function, we are
61
+ // confident that no-one knows the private key associated with this
62
+ // public key. See:
63
+ // https://github.com/iden3/circomlib/blob/d5ed1c3ce4ca137a6b3ca48bec4ac12c1b38957a/src/pedersen_printbases.js
64
+ // Its hash should equal
65
+ // 11672248758340751985123309654953904206381780234474872690580702076708041504880.
66
+ return new StateLeaf(new publicKey_1.PubKey([
67
+ BigInt("10457101036533406547632367118273992217979173478358440826365724437999023779287"),
68
+ BigInt("19824078218392094440610104313265183977899662750282163392862422243483260492317"),
69
+ ]), BigInt(0));
70
+ }
71
+ /**
72
+ * Generate a random leaf (random salt and random key pair)
73
+ * @returns a random state leaf
74
+ */
75
+ static genRandomLeaf() {
76
+ const keypair = new keyPair_1.Keypair();
77
+ return new StateLeaf(keypair.pubKey, (0, crypto_1.genRandomSalt)());
78
+ }
79
+ /**
80
+ * Return this state leaf as a contract param
81
+ * @returns the state leaf as a contract param (object)
82
+ */
83
+ asContractParam() {
84
+ return {
85
+ pubKey: this.pubKey.asContractParam(),
86
+ voiceCreditBalance: this.voiceCreditBalance.toString(),
87
+ };
88
+ }
89
+ /**
90
+ * Check if two state leaves are equal
91
+ * @param leaf the state leaf to compare with
92
+ * @returns whether they are equal or not
93
+ */
94
+ equals(leaf) {
95
+ return this.pubKey.equals(leaf.pubKey) && this.voiceCreditBalance === leaf.voiceCreditBalance;
96
+ }
97
+ /**
98
+ * Serialize to a JSON object
99
+ */
100
+ toJSON() {
101
+ return {
102
+ pubKey: this.pubKey.serialize(),
103
+ voiceCreditBalance: this.voiceCreditBalance.toString(),
104
+ };
105
+ }
106
+ /**
107
+ * Deserialize into a StateLeaf instance
108
+ * @param json - the json representation
109
+ * @returns the deserialized object as a StateLeaf instance
110
+ */
111
+ static fromJSON(json) {
112
+ return new StateLeaf(publicKey_1.PubKey.deserialize(json.pubKey), BigInt(json.voiceCreditBalance));
113
+ }
114
+ }
115
+ exports.StateLeaf = StateLeaf;
116
+ /**
117
+ * Deserialize the state leaf
118
+ * @param serialized the serialized state leaf
119
+ * @returns a deserialized state leaf
120
+ */
121
+ StateLeaf.deserialize = (serialized) => {
122
+ const base64 = serialized.replace(/-/g, "+").replace(/_/g, "/");
123
+ const json = JSON.parse(Buffer.from(base64, "base64").toString("utf8"));
124
+ return new StateLeaf(publicKey_1.PubKey.deserialize(json[0]), BigInt(`0x${json[1]}`));
125
+ };
126
+ //# sourceMappingURL=stateLeaf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateLeaf.js","sourceRoot":"","sources":["../../ts/stateLeaf.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,73 @@
1
+ import type { PubKey } from "./publicKey";
2
+ import type { G1Point, G2Point } from "@maci-protocol/crypto";
3
+ /**
4
+ * @notice An interface representing a zk-SNARK proof
5
+ */
6
+ export interface Proof {
7
+ a: G1Point;
8
+ b: G2Point;
9
+ c: G1Point;
10
+ }
11
+ /**
12
+ * @notice An interface representing a MACI state leaf
13
+ */
14
+ export interface IStateLeaf {
15
+ pubKey: PubKey;
16
+ voiceCreditBalance: bigint;
17
+ }
18
+ /**
19
+ * @notice An interface representing a MACI vote option leaf
20
+ */
21
+ export interface VoteOptionTreeLeaf {
22
+ votes: bigint;
23
+ }
24
+ export interface IJsonKeyPair {
25
+ privKey: string;
26
+ pubKey: string;
27
+ }
28
+ export type IJsonPrivateKey = Pick<IJsonKeyPair, "privKey">;
29
+ export type IJsonPublicKey = Pick<IJsonKeyPair, "pubKey">;
30
+ export interface IJsonStateLeaf {
31
+ pubKey: string;
32
+ voiceCreditBalance: string;
33
+ }
34
+ export type BigNumberish = number | string | bigint;
35
+ export interface IG1ContractParams {
36
+ x: BigNumberish;
37
+ y: BigNumberish;
38
+ }
39
+ export interface IG2ContractParams {
40
+ x: BigNumberish[];
41
+ y: BigNumberish[];
42
+ }
43
+ export interface IVkContractParams {
44
+ alpha1: IG1ContractParams;
45
+ beta2: IG2ContractParams;
46
+ gamma2: IG2ContractParams;
47
+ delta2: IG2ContractParams;
48
+ ic: IG1ContractParams[];
49
+ }
50
+ export interface IVkObjectParams {
51
+ protocol: BigNumberish;
52
+ curve: BigNumberish;
53
+ nPublic: BigNumberish;
54
+ vk_alpha_1: BigNumberish[];
55
+ vk_beta_2: BigNumberish[][];
56
+ vk_gamma_2: BigNumberish[][];
57
+ vk_delta_2: BigNumberish[][];
58
+ vk_alphabeta_12: BigNumberish[][][];
59
+ IC: BigNumberish[][];
60
+ }
61
+ export interface IStateLeafContractParams {
62
+ pubKey: IG1ContractParams;
63
+ voiceCreditBalance: BigNumberish;
64
+ }
65
+ export interface IMessageContractParams {
66
+ data: BigNumberish[];
67
+ }
68
+ export interface IJsonBallot {
69
+ votes: BigNumberish[];
70
+ nonce: BigNumberish;
71
+ voteOptionTreeDepth: BigNumberish;
72
+ }
73
+ //# sourceMappingURL=types.d.ts.map