@semaphore-protocol/identity 4.0.0-alpha.4 → 4.0.0-alpha.6

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/identity
3
- * @version 4.0.0-alpha.4
3
+ * @version 4.0.0-alpha.6
4
4
  * @file A library to create Semaphore identities.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
@@ -14,7 +14,7 @@
14
14
  * @license MIT
15
15
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/eddsa-poseidon}
16
16
  */
17
- function getDefaultExportFromCjs (x) {
17
+ function getDefaultExportFromCjs$1 (x) {
18
18
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
19
19
  }
20
20
  var poseidon5$1 = {};
@@ -65,7 +65,7 @@ function poseidon$1(_inputs, opt) {
65
65
  return state[0];
66
66
  }
67
67
  var poseidon_1$1 = poseidon$1;
68
- getDefaultExportFromCjs(poseidon_1$1);
68
+ getDefaultExportFromCjs$1(poseidon_1$1);
69
69
  var unstringify$1 = {};
70
70
  Object.defineProperty(unstringify$1, "__esModule", {
71
71
  value: true
@@ -428,7 +428,7 @@ Blake$2.padding = Buffer.from([
428
428
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
429
429
  ]);
430
430
  var blake = Blake$2;
431
- getDefaultExportFromCjs(blake);
431
+ getDefaultExportFromCjs$1(blake);
432
432
  const Blake$1 = blake;
433
433
  const zo$3 = Buffer.from([0x01]);
434
434
  const oo$3 = Buffer.from([0x81]);
@@ -526,7 +526,7 @@ var blake256 = class Blake256 extends Blake$1 {
526
526
  return buffer
527
527
  }
528
528
  };
529
- getDefaultExportFromCjs(blake256);
529
+ getDefaultExportFromCjs$1(blake256);
530
530
  const Blake256 = blake256;
531
531
  const zo$2 = Buffer.from([0x00]);
532
532
  const oo$2 = Buffer.from([0x80]);
@@ -547,7 +547,7 @@ var blake224 = class Blake224 extends Blake256 {
547
547
  return buffer
548
548
  }
549
549
  };
550
- getDefaultExportFromCjs(blake224);
550
+ getDefaultExportFromCjs$1(blake224);
551
551
  const Blake = blake;
552
552
  const zo$1 = Buffer.from([0x01]);
553
553
  const oo$1 = Buffer.from([0x81]);
@@ -678,7 +678,7 @@ var blake512 = class Blake512 extends Blake {
678
678
  return buffer
679
679
  }
680
680
  };
681
- getDefaultExportFromCjs(blake512);
681
+ getDefaultExportFromCjs$1(blake512);
682
682
  const Blake512 = blake512;
683
683
  const zo = Buffer.from([0x00]);
684
684
  const oo = Buffer.from([0x80]);
@@ -701,14 +701,14 @@ var blake384 = class Blake384 extends Blake512 {
701
701
  return buffer
702
702
  }
703
703
  };
704
- getDefaultExportFromCjs(blake384);
704
+ getDefaultExportFromCjs$1(blake384);
705
705
  var lib = {
706
706
  Blake224: blake224,
707
707
  Blake256: blake256,
708
708
  Blake384: blake384,
709
709
  Blake512: blake512
710
710
  };
711
- getDefaultExportFromCjs(lib);
711
+ getDefaultExportFromCjs$1(lib);
712
712
  function hash(message) {
713
713
  var engine = new lib.Blake512();
714
714
  engine.update(message);
@@ -799,6 +799,10 @@ function verifySignature(message, signature, publicKey) {
799
799
  return Fr.eq(BigInt(pLeft[0]), pRight[0]) && Fr.eq(pLeft[1], pRight[1]);
800
800
  }
801
801
 
802
+ function getDefaultExportFromCjs (x) {
803
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
804
+ }
805
+
802
806
  var poseidon2$1 = {};
803
807
 
804
808
  const F = BigInt('21888242871839275222246405745257275088548364400416034343698204186575808495617');
@@ -848,6 +852,7 @@ function poseidon(_inputs, opt) {
848
852
  return state[0];
849
853
  }
850
854
  var poseidon_1 = poseidon;
855
+ getDefaultExportFromCjs(poseidon_1);
851
856
 
852
857
  var unstringify = {};
853
858
 
@@ -895,86 +900,86 @@ function poseidon2(inputs) {
895
900
  return (0, _poseidon.default)(inputs, c);
896
901
  }
897
902
 
898
- function bytesToBigint(bytes) {
899
- var hex = "0x";
900
- for (var i = 0; i < bytes.length; i += 1) {
901
- hex += bytes[i].toString(16).padStart(2, "0");
902
- }
903
- return BigInt(hex);
903
+ function bytesToBigint(bytes) {
904
+ var hex = "0x";
905
+ for (var i = 0; i < bytes.length; i += 1) {
906
+ hex += bytes[i].toString(16).padStart(2, "0");
907
+ }
908
+ return BigInt(hex);
904
909
  }
905
910
 
906
- /* istanbul ignore file */
907
- function randomNumber() {
908
- var bytes = crypto.getRandomValues(new Uint8Array(32));
909
- return bytesToBigint(bytes);
911
+ /* istanbul ignore file */
912
+ function randomNumber() {
913
+ var bytes = crypto.getRandomValues(new Uint8Array(32));
914
+ return bytesToBigint(bytes);
910
915
  }
911
916
 
912
- var Identity = /** @class */ (function () {
913
- /**
914
- * Initializes the class attributes based on the parameters.
915
- * @param privateKey The secret value used to generate an EdDSA public key.
916
- */
917
- function Identity(privateKey) {
918
- if (privateKey === void 0) { privateKey = randomNumber().toString(); }
919
- this._privateKey = privateKey;
920
- this._secretScalar = deriveSecretScalar(privateKey);
921
- this._publicKey = derivePublicKey(privateKey);
922
- this._commitment = poseidon2_2(this._publicKey).toString();
923
- }
924
- Object.defineProperty(Identity.prototype, "privateKey", {
925
- /**
926
- * Returns the private key.
927
- * @returns The private key.
928
- */
929
- get: function () {
930
- return this._privateKey;
931
- },
932
- enumerable: false,
933
- configurable: true
934
- });
935
- Object.defineProperty(Identity.prototype, "secretScalar", {
936
- /**
937
- * Returns the secret scalar.
938
- * @returns The secret scalar.
939
- */
940
- get: function () {
941
- return this._secretScalar;
942
- },
943
- enumerable: false,
944
- configurable: true
945
- });
946
- Object.defineProperty(Identity.prototype, "publicKey", {
947
- /**
948
- * Returns the public key.
949
- * @returns The public key.
950
- */
951
- get: function () {
952
- return this._publicKey;
953
- },
954
- enumerable: false,
955
- configurable: true
956
- });
957
- Object.defineProperty(Identity.prototype, "commitment", {
958
- /**
959
- * Returns the identity commitment.
960
- * @returns The identity commitment.
961
- */
962
- get: function () {
963
- return this._commitment;
964
- },
965
- enumerable: false,
966
- configurable: true
967
- });
968
- Identity.prototype.signMessage = function (message) {
969
- return signMessage(this.privateKey, message);
970
- };
971
- Identity.prototype.verifySignature = function (message, signature) {
972
- return verifySignature(message, signature, this._publicKey);
973
- };
974
- Identity.verifySignature = function (message, signature, publicKey) {
975
- return verifySignature(message, signature, publicKey);
976
- };
977
- return Identity;
917
+ var Identity = /** @class */ (function () {
918
+ /**
919
+ * Initializes the class attributes based on the parameters.
920
+ * @param privateKey The secret value used to generate an EdDSA public key.
921
+ */
922
+ function Identity(privateKey) {
923
+ if (privateKey === void 0) { privateKey = randomNumber().toString(); }
924
+ this._privateKey = privateKey;
925
+ this._secretScalar = deriveSecretScalar(privateKey);
926
+ this._publicKey = derivePublicKey(privateKey);
927
+ this._commitment = poseidon2_2(this._publicKey).toString();
928
+ }
929
+ Object.defineProperty(Identity.prototype, "privateKey", {
930
+ /**
931
+ * Returns the private key.
932
+ * @returns The private key.
933
+ */
934
+ get: function () {
935
+ return this._privateKey;
936
+ },
937
+ enumerable: false,
938
+ configurable: true
939
+ });
940
+ Object.defineProperty(Identity.prototype, "secretScalar", {
941
+ /**
942
+ * Returns the secret scalar.
943
+ * @returns The secret scalar.
944
+ */
945
+ get: function () {
946
+ return this._secretScalar;
947
+ },
948
+ enumerable: false,
949
+ configurable: true
950
+ });
951
+ Object.defineProperty(Identity.prototype, "publicKey", {
952
+ /**
953
+ * Returns the public key.
954
+ * @returns The public key.
955
+ */
956
+ get: function () {
957
+ return this._publicKey;
958
+ },
959
+ enumerable: false,
960
+ configurable: true
961
+ });
962
+ Object.defineProperty(Identity.prototype, "commitment", {
963
+ /**
964
+ * Returns the identity commitment.
965
+ * @returns The identity commitment.
966
+ */
967
+ get: function () {
968
+ return this._commitment;
969
+ },
970
+ enumerable: false,
971
+ configurable: true
972
+ });
973
+ Identity.prototype.signMessage = function (message) {
974
+ return signMessage(this.privateKey, message);
975
+ };
976
+ Identity.prototype.verifySignature = function (message, signature) {
977
+ return verifySignature(message, signature, this._publicKey);
978
+ };
979
+ Identity.verifySignature = function (message, signature, publicKey) {
980
+ return verifySignature(message, signature, publicKey);
981
+ };
982
+ return Identity;
978
983
  }());
979
984
 
980
985
  export { Identity };
@@ -1,13 +1,19 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/identity
3
- * @version 4.0.0-alpha.4
3
+ * @version 4.0.0-alpha.6
4
4
  * @file A library to create Semaphore identities.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
7
7
  * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity}
8
8
  */
9
- import { signMessage, verifySignature, deriveSecretScalar, derivePublicKey } from '@zk-kit/eddsa-poseidon';
10
- import { randomBytes } from 'node:crypto';
9
+ 'use strict';
10
+
11
+ var eddsaPoseidon = require('@zk-kit/eddsa-poseidon');
12
+ var node_crypto = require('node:crypto');
13
+
14
+ function getDefaultExportFromCjs (x) {
15
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
16
+ }
11
17
 
12
18
  var poseidon2$1 = {};
13
19
 
@@ -58,6 +64,7 @@ function poseidon(_inputs, opt) {
58
64
  return state[0];
59
65
  }
60
66
  var poseidon_1 = poseidon;
67
+ getDefaultExportFromCjs(poseidon_1);
61
68
 
62
69
  var unstringify = {};
63
70
 
@@ -105,78 +112,78 @@ function poseidon2(inputs) {
105
112
  return (0, _poseidon.default)(inputs, c);
106
113
  }
107
114
 
108
- function randomNumber() {
109
- var bytes = randomBytes(32);
110
- var hex = "0x".concat(bytes.toString("hex"));
111
- return BigInt(hex);
115
+ function randomNumber() {
116
+ var bytes = node_crypto.randomBytes(32);
117
+ var hex = "0x".concat(bytes.toString("hex"));
118
+ return BigInt(hex);
112
119
  }
113
120
 
114
- var Identity = /** @class */ (function () {
115
- /**
116
- * Initializes the class attributes based on the parameters.
117
- * @param privateKey The secret value used to generate an EdDSA public key.
118
- */
119
- function Identity(privateKey) {
120
- if (privateKey === void 0) { privateKey = randomNumber().toString(); }
121
- this._privateKey = privateKey;
122
- this._secretScalar = deriveSecretScalar(privateKey);
123
- this._publicKey = derivePublicKey(privateKey);
124
- this._commitment = poseidon2_2(this._publicKey).toString();
125
- }
126
- Object.defineProperty(Identity.prototype, "privateKey", {
127
- /**
128
- * Returns the private key.
129
- * @returns The private key.
130
- */
131
- get: function () {
132
- return this._privateKey;
133
- },
134
- enumerable: false,
135
- configurable: true
136
- });
137
- Object.defineProperty(Identity.prototype, "secretScalar", {
138
- /**
139
- * Returns the secret scalar.
140
- * @returns The secret scalar.
141
- */
142
- get: function () {
143
- return this._secretScalar;
144
- },
145
- enumerable: false,
146
- configurable: true
147
- });
148
- Object.defineProperty(Identity.prototype, "publicKey", {
149
- /**
150
- * Returns the public key.
151
- * @returns The public key.
152
- */
153
- get: function () {
154
- return this._publicKey;
155
- },
156
- enumerable: false,
157
- configurable: true
158
- });
159
- Object.defineProperty(Identity.prototype, "commitment", {
160
- /**
161
- * Returns the identity commitment.
162
- * @returns The identity commitment.
163
- */
164
- get: function () {
165
- return this._commitment;
166
- },
167
- enumerable: false,
168
- configurable: true
169
- });
170
- Identity.prototype.signMessage = function (message) {
171
- return signMessage(this.privateKey, message);
172
- };
173
- Identity.prototype.verifySignature = function (message, signature) {
174
- return verifySignature(message, signature, this._publicKey);
175
- };
176
- Identity.verifySignature = function (message, signature, publicKey) {
177
- return verifySignature(message, signature, publicKey);
178
- };
179
- return Identity;
121
+ var Identity = /** @class */ (function () {
122
+ /**
123
+ * Initializes the class attributes based on the parameters.
124
+ * @param privateKey The secret value used to generate an EdDSA public key.
125
+ */
126
+ function Identity(privateKey) {
127
+ if (privateKey === void 0) { privateKey = randomNumber().toString(); }
128
+ this._privateKey = privateKey;
129
+ this._secretScalar = eddsaPoseidon.deriveSecretScalar(privateKey);
130
+ this._publicKey = eddsaPoseidon.derivePublicKey(privateKey);
131
+ this._commitment = poseidon2_2(this._publicKey).toString();
132
+ }
133
+ Object.defineProperty(Identity.prototype, "privateKey", {
134
+ /**
135
+ * Returns the private key.
136
+ * @returns The private key.
137
+ */
138
+ get: function () {
139
+ return this._privateKey;
140
+ },
141
+ enumerable: false,
142
+ configurable: true
143
+ });
144
+ Object.defineProperty(Identity.prototype, "secretScalar", {
145
+ /**
146
+ * Returns the secret scalar.
147
+ * @returns The secret scalar.
148
+ */
149
+ get: function () {
150
+ return this._secretScalar;
151
+ },
152
+ enumerable: false,
153
+ configurable: true
154
+ });
155
+ Object.defineProperty(Identity.prototype, "publicKey", {
156
+ /**
157
+ * Returns the public key.
158
+ * @returns The public key.
159
+ */
160
+ get: function () {
161
+ return this._publicKey;
162
+ },
163
+ enumerable: false,
164
+ configurable: true
165
+ });
166
+ Object.defineProperty(Identity.prototype, "commitment", {
167
+ /**
168
+ * Returns the identity commitment.
169
+ * @returns The identity commitment.
170
+ */
171
+ get: function () {
172
+ return this._commitment;
173
+ },
174
+ enumerable: false,
175
+ configurable: true
176
+ });
177
+ Identity.prototype.signMessage = function (message) {
178
+ return eddsaPoseidon.signMessage(this.privateKey, message);
179
+ };
180
+ Identity.prototype.verifySignature = function (message, signature) {
181
+ return eddsaPoseidon.verifySignature(message, signature, this._publicKey);
182
+ };
183
+ Identity.verifySignature = function (message, signature, publicKey) {
184
+ return eddsaPoseidon.verifySignature(message, signature, publicKey);
185
+ };
186
+ return Identity;
180
187
  }());
181
188
 
182
- export { Identity };
189
+ exports.Identity = Identity;
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/identity
3
- * @version 4.0.0-alpha.4
3
+ * @version 4.0.0-alpha.6
4
4
  * @file A library to create Semaphore identities.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
7
7
  * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/identity}
8
8
  */
9
- 'use strict';
9
+ import { signMessage, verifySignature, deriveSecretScalar, derivePublicKey } from '@zk-kit/eddsa-poseidon';
10
+ import { randomBytes } from 'node:crypto';
10
11
 
11
- Object.defineProperty(exports, '__esModule', { value: true });
12
-
13
- var eddsaPoseidon = require('@zk-kit/eddsa-poseidon');
14
- var node_crypto = require('node:crypto');
12
+ function getDefaultExportFromCjs (x) {
13
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
+ }
15
15
 
16
16
  var poseidon2$1 = {};
17
17
 
@@ -62,6 +62,7 @@ function poseidon(_inputs, opt) {
62
62
  return state[0];
63
63
  }
64
64
  var poseidon_1 = poseidon;
65
+ getDefaultExportFromCjs(poseidon_1);
65
66
 
66
67
  var unstringify = {};
67
68
 
@@ -109,78 +110,78 @@ function poseidon2(inputs) {
109
110
  return (0, _poseidon.default)(inputs, c);
110
111
  }
111
112
 
112
- function randomNumber() {
113
- var bytes = node_crypto.randomBytes(32);
114
- var hex = "0x".concat(bytes.toString("hex"));
115
- return BigInt(hex);
113
+ function randomNumber() {
114
+ var bytes = randomBytes(32);
115
+ var hex = "0x".concat(bytes.toString("hex"));
116
+ return BigInt(hex);
116
117
  }
117
118
 
118
- var Identity = /** @class */ (function () {
119
- /**
120
- * Initializes the class attributes based on the parameters.
121
- * @param privateKey The secret value used to generate an EdDSA public key.
122
- */
123
- function Identity(privateKey) {
124
- if (privateKey === void 0) { privateKey = randomNumber().toString(); }
125
- this._privateKey = privateKey;
126
- this._secretScalar = eddsaPoseidon.deriveSecretScalar(privateKey);
127
- this._publicKey = eddsaPoseidon.derivePublicKey(privateKey);
128
- this._commitment = poseidon2_2(this._publicKey).toString();
129
- }
130
- Object.defineProperty(Identity.prototype, "privateKey", {
131
- /**
132
- * Returns the private key.
133
- * @returns The private key.
134
- */
135
- get: function () {
136
- return this._privateKey;
137
- },
138
- enumerable: false,
139
- configurable: true
140
- });
141
- Object.defineProperty(Identity.prototype, "secretScalar", {
142
- /**
143
- * Returns the secret scalar.
144
- * @returns The secret scalar.
145
- */
146
- get: function () {
147
- return this._secretScalar;
148
- },
149
- enumerable: false,
150
- configurable: true
151
- });
152
- Object.defineProperty(Identity.prototype, "publicKey", {
153
- /**
154
- * Returns the public key.
155
- * @returns The public key.
156
- */
157
- get: function () {
158
- return this._publicKey;
159
- },
160
- enumerable: false,
161
- configurable: true
162
- });
163
- Object.defineProperty(Identity.prototype, "commitment", {
164
- /**
165
- * Returns the identity commitment.
166
- * @returns The identity commitment.
167
- */
168
- get: function () {
169
- return this._commitment;
170
- },
171
- enumerable: false,
172
- configurable: true
173
- });
174
- Identity.prototype.signMessage = function (message) {
175
- return eddsaPoseidon.signMessage(this.privateKey, message);
176
- };
177
- Identity.prototype.verifySignature = function (message, signature) {
178
- return eddsaPoseidon.verifySignature(message, signature, this._publicKey);
179
- };
180
- Identity.verifySignature = function (message, signature, publicKey) {
181
- return eddsaPoseidon.verifySignature(message, signature, publicKey);
182
- };
183
- return Identity;
119
+ var Identity = /** @class */ (function () {
120
+ /**
121
+ * Initializes the class attributes based on the parameters.
122
+ * @param privateKey The secret value used to generate an EdDSA public key.
123
+ */
124
+ function Identity(privateKey) {
125
+ if (privateKey === void 0) { privateKey = randomNumber().toString(); }
126
+ this._privateKey = privateKey;
127
+ this._secretScalar = deriveSecretScalar(privateKey);
128
+ this._publicKey = derivePublicKey(privateKey);
129
+ this._commitment = poseidon2_2(this._publicKey).toString();
130
+ }
131
+ Object.defineProperty(Identity.prototype, "privateKey", {
132
+ /**
133
+ * Returns the private key.
134
+ * @returns The private key.
135
+ */
136
+ get: function () {
137
+ return this._privateKey;
138
+ },
139
+ enumerable: false,
140
+ configurable: true
141
+ });
142
+ Object.defineProperty(Identity.prototype, "secretScalar", {
143
+ /**
144
+ * Returns the secret scalar.
145
+ * @returns The secret scalar.
146
+ */
147
+ get: function () {
148
+ return this._secretScalar;
149
+ },
150
+ enumerable: false,
151
+ configurable: true
152
+ });
153
+ Object.defineProperty(Identity.prototype, "publicKey", {
154
+ /**
155
+ * Returns the public key.
156
+ * @returns The public key.
157
+ */
158
+ get: function () {
159
+ return this._publicKey;
160
+ },
161
+ enumerable: false,
162
+ configurable: true
163
+ });
164
+ Object.defineProperty(Identity.prototype, "commitment", {
165
+ /**
166
+ * Returns the identity commitment.
167
+ * @returns The identity commitment.
168
+ */
169
+ get: function () {
170
+ return this._commitment;
171
+ },
172
+ enumerable: false,
173
+ configurable: true
174
+ });
175
+ Identity.prototype.signMessage = function (message) {
176
+ return signMessage(this.privateKey, message);
177
+ };
178
+ Identity.prototype.verifySignature = function (message, signature) {
179
+ return verifySignature(message, signature, this._publicKey);
180
+ };
181
+ Identity.verifySignature = function (message, signature, publicKey) {
182
+ return verifySignature(message, signature, publicKey);
183
+ };
184
+ return Identity;
184
185
  }());
185
186
 
186
- exports.Identity = Identity;
187
+ export { Identity };
@@ -1 +1 @@
1
- export declare function bytesToBigint(bytes: Uint8Array): bigint;
1
+ export declare function bytesToBigint(bytes: Uint8Array): bigint;
@@ -1,35 +1,35 @@
1
- import { BigNumberish, Point, Signature } from "@zk-kit/eddsa-poseidon";
2
- export default class Identity {
3
- private _privateKey;
4
- private _secretScalar;
5
- private _publicKey;
6
- private _commitment;
7
- /**
8
- * Initializes the class attributes based on the parameters.
9
- * @param privateKey The secret value used to generate an EdDSA public key.
10
- */
11
- constructor(privateKey?: BigNumberish);
12
- /**
13
- * Returns the private key.
14
- * @returns The private key.
15
- */
16
- get privateKey(): BigNumberish;
17
- /**
18
- * Returns the secret scalar.
19
- * @returns The secret scalar.
20
- */
21
- get secretScalar(): string;
22
- /**
23
- * Returns the public key.
24
- * @returns The public key.
25
- */
26
- get publicKey(): Point<string>;
27
- /**
28
- * Returns the identity commitment.
29
- * @returns The identity commitment.
30
- */
31
- get commitment(): string;
32
- signMessage(message: BigNumberish): Signature<string>;
33
- verifySignature(message: BigNumberish, signature: Signature): boolean;
34
- static verifySignature(message: BigNumberish, signature: Signature, publicKey: Point): boolean;
35
- }
1
+ import { BigNumberish, Point, Signature } from "@zk-kit/eddsa-poseidon";
2
+ export default class Identity {
3
+ private _privateKey;
4
+ private _secretScalar;
5
+ private _publicKey;
6
+ private _commitment;
7
+ /**
8
+ * Initializes the class attributes based on the parameters.
9
+ * @param privateKey The secret value used to generate an EdDSA public key.
10
+ */
11
+ constructor(privateKey?: BigNumberish);
12
+ /**
13
+ * Returns the private key.
14
+ * @returns The private key.
15
+ */
16
+ get privateKey(): BigNumberish;
17
+ /**
18
+ * Returns the secret scalar.
19
+ * @returns The secret scalar.
20
+ */
21
+ get secretScalar(): string;
22
+ /**
23
+ * Returns the public key.
24
+ * @returns The public key.
25
+ */
26
+ get publicKey(): Point<string>;
27
+ /**
28
+ * Returns the identity commitment.
29
+ * @returns The identity commitment.
30
+ */
31
+ get commitment(): string;
32
+ signMessage(message: BigNumberish): Signature<string>;
33
+ verifySignature(message: BigNumberish, signature: Signature): boolean;
34
+ static verifySignature(message: BigNumberish, signature: Signature, publicKey: Point): boolean;
35
+ }
@@ -1,2 +1,2 @@
1
- import Identity from "./identity";
2
- export { Identity };
1
+ import Identity from "./identity";
2
+ export { Identity };
@@ -1 +1 @@
1
- export declare function randomNumber(): bigint;
1
+ export declare function randomNumber(): bigint;
@@ -1 +1 @@
1
- export declare function randomNumber(): bigint;
1
+ export declare function randomNumber(): bigint;
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@semaphore-protocol/identity",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.6",
4
4
  "description": "A library to create Semaphore identities.",
5
+ "type": "module",
5
6
  "license": "MIT",
6
- "main": "dist/index.node.js",
7
- "browser": "dist/index.browser.mjs",
7
+ "main": "dist/index.browser.js",
8
+ "types": "dist/types/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
11
+ "types": "./dist/types/index.d.ts",
10
12
  "node": {
11
- "import": "./dist/index.node.mjs",
12
- "require": "./dist/index.node.js"
13
+ "require": "./dist/index.node.cjs",
14
+ "default": "./dist/index.node.js"
13
15
  },
14
- "browser": "./dist/index.browser.mjs",
15
- "default": "./dist/index.browser.mjs",
16
- "types": "./dist/types/index.d.ts"
16
+ "browser": "./dist/index.browser.js",
17
+ "default": "./dist/index.browser.js"
17
18
  }
18
19
  },
19
- "types": "dist/types/index.d.ts",
20
20
  "files": [
21
21
  "dist/",
22
22
  "src/",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@rollup/plugin-alias": "^5.1.0",
42
- "@rollup/plugin-commonjs": "^24.0.1",
43
- "@rollup/plugin-node-resolve": "^15.0.1",
42
+ "@rollup/plugin-commonjs": "^25.0.7",
43
+ "@rollup/plugin-node-resolve": "^15.2.3",
44
44
  "rollup-plugin-cleanup": "^3.2.1",
45
- "rollup-plugin-typescript2": "^0.31.2"
45
+ "rollup-plugin-typescript2": "^0.36.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@zk-kit/eddsa-poseidon": "0.4.1",