@maci-protocol/domainobjs 0.0.0-ci.4c6d4e8 → 0.0.0-ci.4d0e3a3

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 (58) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE +1 -2
  3. package/build/ts/ballot.d.ts +8 -7
  4. package/build/ts/ballot.d.ts.map +1 -1
  5. package/build/ts/ballot.js +19 -19
  6. package/build/ts/ballot.js.map +1 -1
  7. package/build/ts/commands/{PCommand.d.ts → VoteCommand.d.ts} +18 -18
  8. package/build/ts/commands/VoteCommand.d.ts.map +1 -0
  9. package/build/ts/commands/{PCommand.js → VoteCommand.js} +30 -30
  10. package/build/ts/commands/VoteCommand.js.map +1 -0
  11. package/build/ts/commands/index.d.ts +1 -1
  12. package/build/ts/commands/index.d.ts.map +1 -1
  13. package/build/ts/commands/index.js +3 -3
  14. package/build/ts/commands/index.js.map +1 -1
  15. package/build/ts/commands/types.d.ts +1 -1
  16. package/build/ts/commands/types.d.ts.map +1 -1
  17. package/build/ts/constants.d.ts +2 -2
  18. package/build/ts/constants.d.ts.map +1 -1
  19. package/build/ts/constants.js +2 -2
  20. package/build/ts/constants.js.map +1 -1
  21. package/build/ts/index.d.ts +5 -4
  22. package/build/ts/index.d.ts.map +1 -1
  23. package/build/ts/index.js +7 -5
  24. package/build/ts/index.js.map +1 -1
  25. package/build/ts/keyPair.d.ts +11 -11
  26. package/build/ts/keyPair.d.ts.map +1 -1
  27. package/build/ts/keyPair.js +21 -22
  28. package/build/ts/keyPair.js.map +1 -1
  29. package/build/ts/message.d.ts +3 -3
  30. package/build/ts/message.d.ts.map +1 -1
  31. package/build/ts/message.js +2 -2
  32. package/build/ts/message.js.map +1 -1
  33. package/build/ts/privateKey.d.ts +12 -12
  34. package/build/ts/privateKey.d.ts.map +1 -1
  35. package/build/ts/privateKey.js +20 -20
  36. package/build/ts/privateKey.js.map +1 -1
  37. package/build/ts/publicKey.d.ts +16 -16
  38. package/build/ts/publicKey.d.ts.map +1 -1
  39. package/build/ts/publicKey.js +27 -27
  40. package/build/ts/publicKey.js.map +1 -1
  41. package/build/ts/stateLeaf.d.ts +6 -6
  42. package/build/ts/stateLeaf.d.ts.map +1 -1
  43. package/build/ts/stateLeaf.js +15 -15
  44. package/build/ts/stateLeaf.js.map +1 -1
  45. package/build/ts/types.d.ts +27 -10
  46. package/build/ts/types.d.ts.map +1 -1
  47. package/build/ts/verifyingKey.d.ts +7 -7
  48. package/build/ts/verifyingKey.d.ts.map +1 -1
  49. package/build/ts/verifyingKey.js +9 -9
  50. package/build/ts/verifyingKey.js.map +1 -1
  51. package/build/ts/voteCounts.d.ts +63 -0
  52. package/build/ts/voteCounts.d.ts.map +1 -0
  53. package/build/ts/voteCounts.js +110 -0
  54. package/build/ts/voteCounts.js.map +1 -0
  55. package/build/tsconfig.build.tsbuildinfo +1 -1
  56. package/package.json +5 -5
  57. package/build/ts/commands/PCommand.d.ts.map +0 -1
  58. package/build/ts/commands/PCommand.js.map +0 -1
package/build/ts/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VerifyingKey = exports.PCommand = exports.padKey = exports.blankStateLeafHash = exports.blankStateLeaf = exports.StateLeaf = exports.Keypair = exports.SERIALIZED_PUB_KEY_PREFIX = exports.PubKey = exports.SERIALIZED_PRIV_KEY_PREFIX = exports.PrivKey = exports.Message = exports.Ballot = void 0;
3
+ exports.VoteCommand = exports.VoteCounts = exports.VerifyingKey = exports.padKey = exports.blankStateLeafHash = exports.blankStateLeaf = exports.StateLeaf = exports.Keypair = exports.SERIALIZED_PUB_KEY_PREFIX = exports.PublicKey = exports.SERIALIZED_PRIV_KEY_PREFIX = exports.PrivateKey = exports.Message = exports.Ballot = void 0;
4
4
  var ballot_1 = require("./ballot");
5
5
  Object.defineProperty(exports, "Ballot", { enumerable: true, get: function () { return ballot_1.Ballot; } });
6
6
  var message_1 = require("./message");
7
7
  Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_1.Message; } });
8
8
  var privateKey_1 = require("./privateKey");
9
- Object.defineProperty(exports, "PrivKey", { enumerable: true, get: function () { return privateKey_1.PrivKey; } });
9
+ Object.defineProperty(exports, "PrivateKey", { enumerable: true, get: function () { return privateKey_1.PrivateKey; } });
10
10
  Object.defineProperty(exports, "SERIALIZED_PRIV_KEY_PREFIX", { enumerable: true, get: function () { return privateKey_1.SERIALIZED_PRIV_KEY_PREFIX; } });
11
11
  var publicKey_1 = require("./publicKey");
12
- Object.defineProperty(exports, "PubKey", { enumerable: true, get: function () { return publicKey_1.PubKey; } });
12
+ Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return publicKey_1.PublicKey; } });
13
13
  Object.defineProperty(exports, "SERIALIZED_PUB_KEY_PREFIX", { enumerable: true, get: function () { return publicKey_1.SERIALIZED_PUB_KEY_PREFIX; } });
14
14
  var keyPair_1 = require("./keyPair");
15
15
  Object.defineProperty(exports, "Keypair", { enumerable: true, get: function () { return keyPair_1.Keypair; } });
@@ -19,8 +19,10 @@ var constants_1 = require("./constants");
19
19
  Object.defineProperty(exports, "blankStateLeaf", { enumerable: true, get: function () { return constants_1.blankStateLeaf; } });
20
20
  Object.defineProperty(exports, "blankStateLeafHash", { enumerable: true, get: function () { return constants_1.blankStateLeafHash; } });
21
21
  Object.defineProperty(exports, "padKey", { enumerable: true, get: function () { return constants_1.padKey; } });
22
- var commands_1 = require("./commands");
23
- Object.defineProperty(exports, "PCommand", { enumerable: true, get: function () { return commands_1.PCommand; } });
24
22
  var verifyingKey_1 = require("./verifyingKey");
25
23
  Object.defineProperty(exports, "VerifyingKey", { enumerable: true, get: function () { return verifyingKey_1.VerifyingKey; } });
24
+ var voteCounts_1 = require("./voteCounts");
25
+ Object.defineProperty(exports, "VoteCounts", { enumerable: true, get: function () { return voteCounts_1.VoteCounts; } });
26
+ var commands_1 = require("./commands");
27
+ Object.defineProperty(exports, "VoteCommand", { enumerable: true, get: function () { return commands_1.VoteCommand; } });
26
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AAEf,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,2CAAmE;AAA1D,qGAAA,OAAO,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAE5C,yCAAgE;AAAvD,mGAAA,MAAM,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAE1C,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,yCAAyE;AAAhE,2GAAA,cAAc,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AAAE,mGAAA,MAAM,OAAA;AAmBnD,uCAA8E;AAA7B,oGAAA,QAAQ,OAAA;AAEzD,+CAA8C;AAArC,4GAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAAsE;AAA7D,wGAAA,UAAU,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAC/C,yCAAmE;AAA1D,sGAAA,SAAS,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAC7C,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,yCAAyE;AAAhE,2GAAA,cAAc,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AAAE,mGAAA,MAAM,OAAA;AACnD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAoBnB,uCAAiF;AAAhC,uGAAA,WAAW,OAAA"}
@@ -1,7 +1,7 @@
1
- import { EcdhSharedKey } from "@maci-protocol/crypto";
1
+ import { type EcdhSharedKey } from "@maci-protocol/crypto";
2
2
  import type { IJsonKeyPair } from "./types";
3
- import { PrivKey } from "./privateKey";
4
- import { PubKey } from "./publicKey";
3
+ import { PrivateKey } from "./privateKey";
4
+ import { PublicKey } from "./publicKey";
5
5
  /**
6
6
  * @notice A KeyPair is a pair of public and private keys
7
7
  * This is a MACI keypair, which is not to be
@@ -9,14 +9,14 @@ import { PubKey } from "./publicKey";
9
9
  * A MACI keypair is comprised of a MACI public key and a MACI private key
10
10
  */
11
11
  export declare class Keypair {
12
- privKey: PrivKey;
13
- pubKey: PubKey;
12
+ privateKey: PrivateKey;
13
+ publicKey: PublicKey;
14
14
  /**
15
15
  * Create a new instance of a Keypair
16
- * @param privKey the private key (optional)
17
- * @notice if no privKey is passed, it will automatically generate a new private key
16
+ * @param privateKey the private key (optional)
17
+ * @notice if no privateKey is passed, it will automatically generate a new private key
18
18
  */
19
- constructor(privKey?: PrivKey);
19
+ constructor(privateKey?: PrivateKey);
20
20
  /**
21
21
  * Create a deep clone of this Keypair
22
22
  * @returns a copy of the Keypair
@@ -24,11 +24,11 @@ export declare class Keypair {
24
24
  copy: () => Keypair;
25
25
  /**
26
26
  * Generate a shared key
27
- * @param privKey
28
- * @param pubKey
27
+ * @param privateKey
28
+ * @param publicKey
29
29
  * @returns
30
30
  */
31
- static genEcdhSharedKey(privKey: PrivKey, pubKey: PubKey): EcdhSharedKey;
31
+ static generateEcdhSharedKey(privateKey: PrivateKey, publicKey: PublicKey): EcdhSharedKey;
32
32
  /**
33
33
  * Check whether two Keypairs are equal
34
34
  * @param keypair the keypair to compare with
@@ -1 +1 @@
1
- {"version":3,"file":"keyPair.d.ts","sourceRoot":"","sources":["../../ts/keyPair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2C,MAAM,uBAAuB,CAAC;AAI/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS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AEG;IACH,MAAM,IAAI,YAAY;IAOtB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAG7C"}
@@ -17,33 +17,33 @@ const publicKey_1 = require("./publicKey");
17
17
  class Keypair {
18
18
  /**
19
19
  * Create a new instance of a Keypair
20
- * @param privKey the private key (optional)
21
- * @notice if no privKey is passed, it will automatically generate a new private key
20
+ * @param privateKey the private key (optional)
21
+ * @notice if no privateKey is passed, it will automatically generate a new private key
22
22
  */
23
- constructor(privKey) {
23
+ constructor(privateKey) {
24
24
  /**
25
25
  * Create a deep clone of this Keypair
26
26
  * @returns a copy of the Keypair
27
27
  */
28
- this.copy = () => new Keypair(this.privKey.copy());
29
- if (privKey) {
30
- this.privKey = privKey;
31
- this.pubKey = new publicKey_1.PubKey((0, crypto_1.genPubKey)(privKey.rawPrivKey));
28
+ this.copy = () => new Keypair(this.privateKey.copy());
29
+ if (privateKey) {
30
+ this.privateKey = privateKey;
31
+ this.publicKey = new publicKey_1.PublicKey((0, crypto_1.generatePublicKey)(privateKey.raw));
32
32
  }
33
33
  else {
34
- const rawKeyPair = (0, crypto_1.genKeypair)();
35
- this.privKey = new privateKey_1.PrivKey(rawKeyPair.privKey);
36
- this.pubKey = new publicKey_1.PubKey(rawKeyPair.pubKey);
34
+ const rawKeypair = (0, crypto_1.generateKeypair)();
35
+ this.privateKey = new privateKey_1.PrivateKey(rawKeypair.privateKey);
36
+ this.publicKey = new publicKey_1.PublicKey(rawKeypair.publicKey);
37
37
  }
38
38
  }
39
39
  /**
40
40
  * Generate a shared key
41
- * @param privKey
42
- * @param pubKey
41
+ * @param privateKey
42
+ * @param publicKey
43
43
  * @returns
44
44
  */
45
- static genEcdhSharedKey(privKey, pubKey) {
46
- return (0, crypto_1.genEcdhSharedKey)(privKey.rawPrivKey, pubKey.rawPubKey);
45
+ static generateEcdhSharedKey(privateKey, publicKey) {
46
+ return (0, crypto_1.generateEcdhSharedKey)(privateKey.raw, publicKey.raw);
47
47
  }
48
48
  /**
49
49
  * Check whether two Keypairs are equal
@@ -51,22 +51,21 @@ class Keypair {
51
51
  * @returns whether they are equal or not
52
52
  */
53
53
  equals(keypair) {
54
- const equalPrivKey = this.privKey.rawPrivKey === keypair.privKey.rawPrivKey;
55
- const equalPubKey = this.pubKey.rawPubKey[0] === keypair.pubKey.rawPubKey[0] &&
56
- this.pubKey.rawPubKey[1] === keypair.pubKey.rawPubKey[1];
54
+ const equalPrivateKey = this.privateKey.raw === keypair.privateKey.raw;
55
+ const equalPublic = this.publicKey.raw[0] === keypair.publicKey.raw[0] && this.publicKey.raw[1] === keypair.publicKey.raw[1];
57
56
  // If this assertion fails, something is very wrong and this function
58
57
  // should not return anything
59
58
  // eslint-disable-next-line no-bitwise
60
- (0, assert_1.default)(!(+equalPrivKey ^ +equalPubKey));
61
- return equalPrivKey;
59
+ (0, assert_1.default)(!(+equalPrivateKey ^ +equalPublic));
60
+ return equalPrivateKey;
62
61
  }
63
62
  /**
64
63
  * Serialize into a JSON object
65
64
  */
66
65
  toJSON() {
67
66
  return {
68
- privKey: this.privKey.serialize(),
69
- pubKey: this.pubKey.serialize(),
67
+ privateKey: this.privateKey.serialize(),
68
+ publicKey: this.publicKey.serialize(),
70
69
  };
71
70
  }
72
71
  /**
@@ -75,7 +74,7 @@ class Keypair {
75
74
  * @returns a keypair instance
76
75
  */
77
76
  static fromJSON(json) {
78
- return new Keypair(privateKey_1.PrivKey.deserialize(json.privKey));
77
+ return new Keypair(privateKey_1.PrivateKey.deserialize(json.privateKey));
79
78
  }
80
79
  }
81
80
  exports.Keypair = Keypair;
@@ -1 +1 @@
1
- {"version":3,"file":"keyPair.js","sourceRoot":"","sources":["../../ts/keyPair.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA+F;AAE/F,oDAA4B;AAI5B,6CAAuC;AACvC,2CAAqC;AAErC;;;;;GAKG;AACH,MAAa,OAAO;IAKlB;;;;OAIG;IACH,YAAY,OAAiB;QAW7B;;;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,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAgB;QACrB,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QACvE,MAAM,WAAW,GACf,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAE3G,qEAAqE;QACrE,6BAA6B;QAC7B,sCAAsC;QACtC,IAAA,gBAAM,EAAC,CAAC,CAAC,CAAC,eAAe,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;QAE3C,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;YACvC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;SACtC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAkB;QAChC,OAAO,IAAI,OAAO,CAAC,uBAAU,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAzED,0BAyEC"}
@@ -1,4 +1,4 @@
1
- import type { PubKey } from "./publicKey";
1
+ import type { PublicKey } from "./publicKey";
2
2
  import type { IMessageContractParams } from "./types";
3
3
  /**
4
4
  * @notice An encrypted command and signature.
@@ -29,10 +29,10 @@ export declare class Message {
29
29
  asCircuitInputs: () => bigint[];
30
30
  /**
31
31
  * Hash the message data and a public key
32
- * @param encPubKey the public key that is used to encrypt this message
32
+ * @param encryptionPublicKey the public key that is used to encrypt this message
33
33
  * @returns the hash of the message data and the public key
34
34
  */
35
- hash: (encPubKey: PubKey) => bigint;
35
+ hash: (encryptionPublicKey: PublicKey) => bigint;
36
36
  /**
37
37
  * Create a copy of the message
38
38
  * @returns a copy of the message
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../ts/message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,qBAAa,OAAO;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf,MAAM,CAAC,WAAW,SAAM;IAExB;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE;IAK1B;;;OAGG;IACH,OAAO,CAAC,OAAO,CAA6B;IAE5C;;;OAGG;IACH,eAAe,QAAO,sBAAsB,CAEzC;IAEH;;;OAGG;IACH,eAAe,QAAO,MAAM,EAAE,CAAmB;IAEjD;;;;OAIG;IACH,IAAI,GAAI,WAAW,MAAM,KAAG,MAAM,CAAmD;IAErF;;;OAGG;IACH,IAAI,QAAO,OAAO,CAAoE;IAEtF;;;;OAIG;IACH,MAAM,GAAI,GAAG,OAAO,KAAG,OAAO,CAM5B;IAEF;;OAEG;IACH,MAAM,IAAI,sBAAsB;IAIhC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO;CAGvD"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../ts/message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,qBAAa,OAAO;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf,MAAM,CAAC,WAAW,SAAM;IAExB;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE;IAK1B;;;OAGG;IACH,OAAO,CAAC,OAAO,CAA6B;IAE5C;;;OAGG;IACH,eAAe,QAAO,sBAAsB,CAEzC;IAEH;;;OAGG;IACH,eAAe,QAAO,MAAM,EAAE,CAAmB;IAEjD;;;;OAIG;IACH,IAAI,GAAI,qBAAqB,SAAS,KAAG,MAAM,CAAuD;IAEtG;;;OAGG;IACH,IAAI,QAAO,OAAO,CAAoE;IAEtF;;;;OAIG;IACH,MAAM,GAAI,GAAG,OAAO,KAAG,OAAO,CAM5B;IAEF;;OAEG;IACH,MAAM,IAAI,sBAAsB;IAIhC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO;CAGvD"}
@@ -35,10 +35,10 @@ class Message {
35
35
  this.asCircuitInputs = () => this.asArray();
36
36
  /**
37
37
  * Hash the message data and a public key
38
- * @param encPubKey the public key that is used to encrypt this message
38
+ * @param encryptionPublicKey the public key that is used to encrypt this message
39
39
  * @returns the hash of the message data and the public key
40
40
  */
41
- this.hash = (encPubKey) => (0, crypto_1.hash12)([...this.data, ...encPubKey.rawPubKey]);
41
+ this.hash = (encryptionPublicKey) => (0, crypto_1.hash12)([...this.data, ...encryptionPublicKey.raw]);
42
42
  /**
43
43
  * Create a copy of the message
44
44
  * @returns a copy of the message
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../ts/message.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA+C;AAE/C,oDAA4B;AAK5B;;GAEG;AACH,MAAa,OAAO;IAKlB;;;;OAIG;IACH,YAAY,IAAc;QAK1B;;;WAGG;QACK,YAAO,GAAG,GAAa,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;QAE5C;;;WAGG;QACH,oBAAe,GAAG,GAA2B,EAAE,CAAC,CAAC;YAC/C,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,C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KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC;QAhDA,IAAA,gBAAM,EAAC,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAgDD;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAA4B;QAC1C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;;AA3EH,0BA4EC;AAzEQ,mBAAW,GAAG,EAAE,AAAL,CAAM"}
@@ -1,25 +1,25 @@
1
- import { type PrivKey as RawPrivKey } from "@maci-protocol/crypto";
1
+ import { type PrivateKey as RawPrivateKey } from "@maci-protocol/crypto";
2
2
  import type { IJsonPrivateKey } from "./types";
3
3
  export declare const SERIALIZED_PRIV_KEY_PREFIX = "macisk.";
4
4
  /**
5
- * @notice PrivKey is a TS Class representing a MACI PrivateKey
5
+ * @notice PrivateKey is a TS Class representing a MACI PrivateKey
6
6
  * which is a seed to be used to generate a public key (point on the curve)
7
7
  * This is a MACI private key, which is not to be
8
8
  * confused with an Ethereum private key.
9
9
  * A serialized MACI private key is prefixed by 'macisk.'
10
10
  */
11
- export declare class PrivKey {
12
- rawPrivKey: RawPrivKey;
11
+ export declare class PrivateKey {
12
+ raw: RawPrivateKey;
13
13
  /**
14
14
  * Generate a new Private key object
15
- * @param rawPrivKey the raw private key (a bigint)
15
+ * @param raw the raw private key (a bigint)
16
16
  */
17
- constructor(rawPrivKey: RawPrivKey);
17
+ constructor(raw: RawPrivateKey);
18
18
  /**
19
19
  * Create a copy of this Private key
20
20
  * @returns a copy of the Private key
21
21
  */
22
- copy: () => PrivKey;
22
+ copy: () => PrivateKey;
23
23
  /**
24
24
  * Return this Private key as a circuit input
25
25
  * @returns the Private key as a circuit input
@@ -35,13 +35,13 @@ export declare class PrivKey {
35
35
  * @param s the serialized private key
36
36
  * @returns the deserialized private key
37
37
  */
38
- static deserialize: (s: string) => PrivKey;
38
+ static deserialize: (s: string) => PrivateKey;
39
39
  /**
40
40
  * Check if the serialized private key is valid
41
- * @param s the serialized private key
41
+ * @param serialized the serialized private key
42
42
  * @returns whether it is a valid serialized private key
43
43
  */
44
- static isValidSerializedPrivKey: (s: string) => boolean;
44
+ static isValidSerialized: (serialized: string) => boolean;
45
45
  /**
46
46
  * Serialize this object
47
47
  */
@@ -49,8 +49,8 @@ export declare class PrivKey {
49
49
  /**
50
50
  * Deserialize this object from a JSON object
51
51
  * @param json - the json object
52
- * @returns the deserialized object as a PrivKey instance
52
+ * @returns the deserialized object as a PrivateKey instance
53
53
  */
54
- static fromJSON(json: IJsonPrivateKey): PrivKey;
54
+ static fromJSON(json: IJsonPrivateKey): PrivateKey;
55
55
  }
56
56
  //# sourceMappingURL=privateKey.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"privateKey.d.ts","sourceRoot":"","sources":["../../ts/privateKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,UAAU,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAErG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,0BAA0B,YAAY,CAAC;AAEpD;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB,GAAG,EAAE,aAAa,CAAC;IAEnB;;;OAGG;gBACS,GAAG,EAAE,aAAa;IAI9B;;;OAGG;IACH,IAAI,QAAO,UAAU,CAAgD;IAErE;;;OAGG;IACH,eAAe,QAAO,MAAM,CAAoD;IAEhF;;;OAGG;IACH,SAAS,QAAO,MAAM,CAOpB;IAEF;;;;OAIG;IACH,MAAM,CAAC,WAAW,GAAI,GAAG,MAAM,KAAG,UAAU,CAG1C;IAEF;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,GAAI,YAAY,MAAM,KAAG,OAAO,CAKtD;IAEF;;OAEG;IACH,MAAM,IAAI,eAAe;IAMzB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU;CAGnD"}
@@ -1,79 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrivKey = exports.SERIALIZED_PRIV_KEY_PREFIX = void 0;
3
+ exports.PrivateKey = exports.SERIALIZED_PRIV_KEY_PREFIX = void 0;
4
4
  const crypto_1 = require("@maci-protocol/crypto");
5
5
  exports.SERIALIZED_PRIV_KEY_PREFIX = "macisk.";
6
6
  /**
7
- * @notice PrivKey is a TS Class representing a MACI PrivateKey
7
+ * @notice PrivateKey is a TS Class representing a MACI PrivateKey
8
8
  * which is a seed to be used to generate a public key (point on the curve)
9
9
  * This is a MACI private key, which is not to be
10
10
  * confused with an Ethereum private key.
11
11
  * A serialized MACI private key is prefixed by 'macisk.'
12
12
  */
13
- class PrivKey {
13
+ class PrivateKey {
14
14
  /**
15
15
  * Generate a new Private key object
16
- * @param rawPrivKey the raw private key (a bigint)
16
+ * @param raw the raw private key (a bigint)
17
17
  */
18
- constructor(rawPrivKey) {
18
+ constructor(raw) {
19
19
  /**
20
20
  * Create a copy of this Private key
21
21
  * @returns a copy of the Private key
22
22
  */
23
- this.copy = () => new PrivKey(BigInt(this.rawPrivKey.toString()));
23
+ this.copy = () => new PrivateKey(BigInt(this.raw.toString()));
24
24
  /**
25
25
  * Return this Private key as a circuit input
26
26
  * @returns the Private key as a circuit input
27
27
  */
28
- this.asCircuitInputs = () => (0, crypto_1.formatPrivKeyForBabyJub)(this.rawPrivKey).toString();
28
+ this.asCircuitInputs = () => (0, crypto_1.formatPrivateKeyForBabyJub)(this.raw).toString();
29
29
  /**
30
30
  * Serialize the private key
31
31
  * @returns the serialized private key
32
32
  */
33
33
  this.serialize = () => {
34
- let x = this.rawPrivKey.toString(16);
34
+ let x = this.raw.toString(16);
35
35
  if (x.length % 2 !== 0) {
36
36
  x = `0${x}`;
37
37
  }
38
38
  return `${exports.SERIALIZED_PRIV_KEY_PREFIX}${x.padStart(64, "0")}`;
39
39
  };
40
- this.rawPrivKey = rawPrivKey;
40
+ this.raw = raw;
41
41
  }
42
42
  /**
43
43
  * Serialize this object
44
44
  */
45
45
  toJSON() {
46
46
  return {
47
- privKey: this.serialize(),
47
+ privateKey: this.serialize(),
48
48
  };
49
49
  }
50
50
  /**
51
51
  * Deserialize this object from a JSON object
52
52
  * @param json - the json object
53
- * @returns the deserialized object as a PrivKey instance
53
+ * @returns the deserialized object as a PrivateKey instance
54
54
  */
55
55
  static fromJSON(json) {
56
- return PrivKey.deserialize(json.privKey);
56
+ return PrivateKey.deserialize(json.privateKey);
57
57
  }
58
58
  }
59
- exports.PrivKey = PrivKey;
59
+ exports.PrivateKey = PrivateKey;
60
60
  /**
61
61
  * Deserialize the private key
62
62
  * @param s the serialized private key
63
63
  * @returns the deserialized private key
64
64
  */
65
- PrivKey.deserialize = (s) => {
65
+ PrivateKey.deserialize = (s) => {
66
66
  const x = s.slice(exports.SERIALIZED_PRIV_KEY_PREFIX.length);
67
- return new PrivKey(BigInt(`0x${x}`));
67
+ return new PrivateKey(BigInt(`0x${x}`));
68
68
  };
69
69
  /**
70
70
  * Check if the serialized private key is valid
71
- * @param s the serialized private key
71
+ * @param serialized the serialized private key
72
72
  * @returns whether it is a valid serialized private key
73
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;
74
+ PrivateKey.isValidSerialized = (serialized) => {
75
+ const correctPrefix = serialized.startsWith(exports.SERIALIZED_PRIV_KEY_PREFIX);
76
+ const body = serialized.slice(exports.SERIALIZED_PRIV_KEY_PREFIX.length);
77
+ return correctPrefix && body.length === 64;
78
78
  };
79
79
  //# sourceMappingURL=privateKey.js.map
@@ -1 +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;;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AW,GAAG,CAAC,CAAS,EAAc,EAAE;IAC7C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,kCAA0B,CAAC,MAAM,CAAC,CAAC;IACrD,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC,AAHiB,CAGhB;AAEF;;;;GAIG;AACI,4BAAiB,GAAG,CAAC,UAAkB,EAAW,EAAE;IACzD,MAAM,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,kCAA0B,CAAC,CAAC;IACxE,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,kCAA0B,CAAC,MAAM,CAAC,CAAC;IAEjE,OAAO,aAAa,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC;AAC7C,CAAC,AALuB,CAKtB"}
@@ -1,4 +1,4 @@
1
- import { type PubKey as RawPubKey } from "@maci-protocol/crypto";
1
+ import { type PublicKey as RawPublicKey } from "@maci-protocol/crypto";
2
2
  import type { IJsonPublicKey, IG1ContractParams } from "./types";
3
3
  export declare const SERIALIZED_PUB_KEY_PREFIX = "macipk.";
4
4
  /**
@@ -9,8 +9,8 @@ export declare const SERIALIZED_PUB_KEY_PREFIX = "macipk.";
9
9
  * A raw MACI public key can be thought as a pair of
10
10
  * BigIntegers (x, y) representing a point on the baby jubjub curve
11
11
  */
12
- export declare class PubKey {
13
- rawPubKey: RawPubKey;
12
+ export declare class PublicKey {
13
+ raw: RawPublicKey;
14
14
  /**
15
15
  * Create a new instance of a public key
16
16
  * @dev You might want to allow an invalid raw key,
@@ -18,15 +18,15 @@ export declare class PubKey {
18
18
  * will be random, and likely not be a point on the curve.
19
19
  * However we need to match keys to the circuit which does
20
20
  * not perform such checks
21
- * @param rawPubKey the raw public key
21
+ * @param raw the raw public key
22
22
  * @param allowInvalid whether to allow invalid public keys
23
23
  */
24
- constructor(rawPubKey: RawPubKey, allowInvalid?: boolean);
24
+ constructor(raw: RawPublicKey, allowInvalid?: boolean);
25
25
  /**
26
26
  * Create a copy of the public key
27
27
  * @returns a copy of the public key
28
28
  */
29
- copy: () => PubKey;
29
+ copy: () => PublicKey;
30
30
  /**
31
31
  * Return this public key as smart contract parameters
32
32
  * @returns the public key as smart contract parameters
@@ -54,36 +54,36 @@ export declare class PubKey {
54
54
  hash: () => bigint;
55
55
  /**
56
56
  * Check whether this public key equals to another public key
57
- * @param p the public key to compare with
57
+ * @param key the public key to compare with
58
58
  * @returns whether they match
59
59
  */
60
- equals: (p: PubKey) => boolean;
60
+ equals: (key: PublicKey) => boolean;
61
61
  /**
62
62
  * Deserialize a serialized public key
63
63
  * @param s the serialized public key
64
64
  * @returns the deserialized public key
65
65
  */
66
- static deserialize: (s: string) => PubKey;
66
+ static deserialize: (s: string) => PublicKey;
67
67
  /**
68
68
  * Check whether a serialized public key is serialized correctly
69
69
  * @param s the serialized public key
70
70
  * @returns whether the serialized public key is valid
71
71
  */
72
- static isValidSerializedPubKey: (s: string) => boolean;
72
+ static isValidSerialized: (s: string) => boolean;
73
73
  /**
74
74
  * Serialize this object
75
75
  */
76
76
  toJSON(): IJsonPublicKey;
77
77
  /**
78
- * Deserialize a JSON object into a PubKey instance
78
+ * Deserialize a JSON object into a PublicKey instance
79
79
  * @param json - the json object
80
- * @returns PubKey
80
+ * @returns PublicKey
81
81
  */
82
- static fromJSON(json: IJsonPublicKey): PubKey;
82
+ static fromJSON(json: IJsonPublicKey): PublicKey;
83
83
  /**
84
- * Generate a default pad key
85
- * @returns a default pad key
84
+ * Generate a default padding key
85
+ * @returns a default padding key
86
86
  */
87
- static genPadKey(): PubKey;
87
+ static generatePaddingKey(): PublicKey;
88
88
  }
89
89
  //# sourceMappingURL=publicKey.d.ts.map
@@ -1 +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;A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