@did-btcr2/keypair 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pair.js +70 -64
- package/dist/cjs/pair.js.map +1 -1
- package/dist/cjs/public.js +58 -48
- package/dist/cjs/public.js.map +1 -1
- package/dist/cjs/secret.js +34 -31
- package/dist/cjs/secret.js.map +1 -1
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pair.js +70 -64
- package/dist/esm/pair.js.map +1 -1
- package/dist/esm/public.js +58 -48
- package/dist/esm/public.js.map +1 -1
- package/dist/esm/secret.js +34 -31
- package/dist/esm/secret.js.map +1 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/pair.d.ts +42 -51
- package/dist/types/pair.d.ts.map +1 -1
- package/dist/types/public.d.ts +67 -44
- package/dist/types/public.d.ts.map +1 -1
- package/dist/types/secret.d.ts +31 -31
- package/dist/types/secret.d.ts.map +1 -1
- package/dist/types/types.d.ts +16 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +3 -4
- package/src/index.ts +2 -1
- package/src/pair.ts +83 -92
- package/src/public.ts +105 -72
- package/src/secret.ts +47 -44
- package/src/types.ts +19 -0
package/dist/cjs/secret.js
CHANGED
|
@@ -4,15 +4,16 @@ import { getRandomValues } from 'crypto';
|
|
|
4
4
|
import { base58btc } from 'multiformats/bases/base58';
|
|
5
5
|
import * as tinysecp from 'tiny-secp256k1';
|
|
6
6
|
import { SchnorrKeyPair } from './pair.js';
|
|
7
|
+
import { CompressedSecp256k1PublicKey } from './public.js';
|
|
7
8
|
/**
|
|
8
9
|
* Encapsulates a secp256k1 secret key
|
|
9
10
|
* Provides get methods for different formats (raw, secret, point).
|
|
10
11
|
* Provides helpers methods for comparison, serialization and publicKey generation.
|
|
11
|
-
* @class
|
|
12
|
-
* @type {
|
|
13
|
-
*
|
|
12
|
+
* @class Secp256k1SecretKey
|
|
13
|
+
* @type {Secp256k1SecretKey}
|
|
14
|
+
* @implements {SecretKey}
|
|
14
15
|
*/
|
|
15
|
-
export class
|
|
16
|
+
export class Secp256k1SecretKey {
|
|
16
17
|
/** @type {KeyBytes} The entropy for the secret key as a byte array */
|
|
17
18
|
_bytes;
|
|
18
19
|
/** @type {bigint} The entropy for the secret key as a bigint */
|
|
@@ -20,7 +21,7 @@ export class SecretKey {
|
|
|
20
21
|
/** @type {string} The secret key as a secretKeyMultibase */
|
|
21
22
|
_multibase;
|
|
22
23
|
/**
|
|
23
|
-
* Instantiates an instance of
|
|
24
|
+
* Instantiates an instance of Secp256k1SecretKey.
|
|
24
25
|
* @param {Entropy} entropy bytes (Uint8Array) or secret (bigint)
|
|
25
26
|
* @throws {SecretKeyError} If entropy is not provided, not a valid 32-byte secret key or not a valid bigint seed
|
|
26
27
|
*/
|
|
@@ -34,11 +35,11 @@ export class SecretKey {
|
|
|
34
35
|
// If bytes and bytes are not length 32
|
|
35
36
|
if (isBytes && entropy.length === 32) {
|
|
36
37
|
this._bytes = entropy;
|
|
37
|
-
this._seed =
|
|
38
|
+
this._seed = Secp256k1SecretKey.toSecret(entropy);
|
|
38
39
|
}
|
|
39
40
|
// If secret and secret is not a valid bigint, throw error
|
|
40
41
|
if (isSecret && !(entropy < 1n || entropy >= CURVE.n)) {
|
|
41
|
-
this._bytes =
|
|
42
|
+
this._bytes = Secp256k1SecretKey.toBytes(entropy);
|
|
42
43
|
this._seed = entropy;
|
|
43
44
|
}
|
|
44
45
|
if (!this._bytes || this._bytes.length !== 32) {
|
|
@@ -103,7 +104,7 @@ export class SecretKey {
|
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
106
|
* Checks if this secret key is equal to another.
|
|
106
|
-
* @param {
|
|
107
|
+
* @param {Secp256k1SecretKey} other The other secret key
|
|
107
108
|
* @returns {boolean} True if the private keys are equal, false otherwise
|
|
108
109
|
*/
|
|
109
110
|
equals(other) {
|
|
@@ -147,16 +148,18 @@ export class SecretKey {
|
|
|
147
148
|
}
|
|
148
149
|
/**
|
|
149
150
|
* Checks if the public key is a valid secp256k1 point.
|
|
150
|
-
* @param {
|
|
151
|
+
* @param {CompressedSecp256k1PublicKey} pk The public key to validate
|
|
151
152
|
* @returns {boolean} True if the public key is valid, false otherwise
|
|
152
153
|
*/
|
|
153
|
-
|
|
154
|
+
hasValidPublicKey(pk) {
|
|
154
155
|
// If the public key is not valid, return false
|
|
155
156
|
if (!tinysecp.isPoint(pk.compressed)) {
|
|
156
157
|
return false;
|
|
157
158
|
}
|
|
158
|
-
//
|
|
159
|
-
|
|
159
|
+
// Compute the public key from the secret key
|
|
160
|
+
const computed = new CompressedSecp256k1PublicKey(this.computePublicKey());
|
|
161
|
+
// Return true if the computed public key equals the provided public key
|
|
162
|
+
return computed.equals(pk);
|
|
160
163
|
}
|
|
161
164
|
/**
|
|
162
165
|
* Decodes the multibase string to the 34-byte secret key (2 byte prefix + 32 byte key).
|
|
@@ -182,22 +185,22 @@ export class SecretKey {
|
|
|
182
185
|
return decoded;
|
|
183
186
|
}
|
|
184
187
|
/**
|
|
185
|
-
* Creates a
|
|
188
|
+
* Creates a Secp256k1SecretKey object from a JSON object.
|
|
186
189
|
* @param {SecretKeyObject} json The JSON object containing the secret key bytes
|
|
187
|
-
* @returns {
|
|
190
|
+
* @returns {Secp256k1SecretKey} A new Secp256k1SecretKey object
|
|
188
191
|
*/
|
|
189
192
|
static fromJSON(json) {
|
|
190
|
-
return new
|
|
193
|
+
return new Secp256k1SecretKey(new Uint8Array(json.bytes));
|
|
191
194
|
}
|
|
192
195
|
/**
|
|
193
|
-
* Converts a
|
|
194
|
-
* @param {KeyBytes} bytes
|
|
196
|
+
* Converts a Secp256k1SecretKey or KeyBytes to a SchnorrKeyPair.
|
|
197
|
+
* @param {KeyBytes} bytes The secret key bytes
|
|
195
198
|
* @returns {SchnorrKeyPair} The SchnorrKeyPair object containing the public and private keys
|
|
196
199
|
* @throws {SecretKeyError} If the secret key is not valid
|
|
197
200
|
*/
|
|
198
201
|
static toKeyPair(bytes) {
|
|
199
|
-
// Create a new
|
|
200
|
-
const secretKey = new
|
|
202
|
+
// Create a new Secp256k1SecretKey from the bytes
|
|
203
|
+
const secretKey = new Secp256k1SecretKey(bytes);
|
|
201
204
|
// Compute the public key from the secret key
|
|
202
205
|
const publicKey = secretKey.computePublicKey();
|
|
203
206
|
// Create a new Pair from the public key and secret key
|
|
@@ -226,17 +229,17 @@ export class SecretKey {
|
|
|
226
229
|
return new Uint8Array(bytes);
|
|
227
230
|
}
|
|
228
231
|
/**
|
|
229
|
-
* Creates a new
|
|
230
|
-
* @param {bigint}
|
|
231
|
-
* @returns {
|
|
232
|
+
* Creates a new Secp256k1SecretKey object from a bigint secret.
|
|
233
|
+
* @param {bigint} entropy The secret bigint
|
|
234
|
+
* @returns {Secp256k1SecretKey} A new Secp256k1SecretKey object
|
|
232
235
|
*/
|
|
233
|
-
static
|
|
236
|
+
static fromEntropy(entropy) {
|
|
234
237
|
// Convert the secret bigint to a hex string
|
|
235
|
-
const hexsecret =
|
|
238
|
+
const hexsecret = entropy.toString(16).padStart(64, '0');
|
|
236
239
|
// Convert the hex string to a Uint8Array
|
|
237
240
|
const privateKeyBytes = new Uint8Array(hexsecret.match(/.{2}/g).map(byte => parseInt(byte, 16)));
|
|
238
|
-
// Return a new
|
|
239
|
-
return new
|
|
241
|
+
// Return a new Secp256k1SecretKey object
|
|
242
|
+
return new Secp256k1SecretKey(privateKeyBytes);
|
|
240
243
|
}
|
|
241
244
|
/**
|
|
242
245
|
* Generates random secret key bytes.
|
|
@@ -249,14 +252,14 @@ export class SecretKey {
|
|
|
249
252
|
return getRandomValues(byteArray);
|
|
250
253
|
}
|
|
251
254
|
/**
|
|
252
|
-
* Creates a new
|
|
253
|
-
* @returns {
|
|
255
|
+
* Creates a new Secp256k1SecretKey from random secret key bytes.
|
|
256
|
+
* @returns {Secp256k1SecretKey} A new Secp256k1SecretKey object
|
|
254
257
|
*/
|
|
255
258
|
static generate() {
|
|
256
259
|
// Generate empty 32-byte array
|
|
257
260
|
const randomBytes = this.random();
|
|
258
261
|
// Use the getRandomValues function to fill the byteArray with random values
|
|
259
|
-
return new
|
|
262
|
+
return new Secp256k1SecretKey(randomBytes);
|
|
260
263
|
}
|
|
261
264
|
/**
|
|
262
265
|
* Generates a public key from the given secret key bytes.
|
|
@@ -264,8 +267,8 @@ export class SecretKey {
|
|
|
264
267
|
* @returns {KeyBytes} The computed public key bytes
|
|
265
268
|
*/
|
|
266
269
|
static getPublicKey(bytes) {
|
|
267
|
-
// Create a new
|
|
268
|
-
return new
|
|
270
|
+
// Create a new Secp256k1SecretKey from the bytes and compute the public key
|
|
271
|
+
return new Secp256k1SecretKey(bytes).computePublicKey();
|
|
269
272
|
}
|
|
270
273
|
}
|
|
271
274
|
//# sourceMappingURL=secret.js.map
|
package/dist/cjs/secret.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../../src/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,uCAAuC,EAEvC,KAAK,EAIL,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../../src/secret.ts"],"names":[],"mappings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zD,yCAAyC;QACzC,MAAM,eAAe,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAClG,yCAAyC;QACzC,OAAO,IAAI,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM;QAClB,+BAA+B;QAC/B,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;QAErC,4EAA4E;QAC5E,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAGD;;;OAGG;IACI,MAAM,CAAC,QAAQ;QACpB,+BAA+B;QAC/B,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAElC,4EAA4E;QAC5E,OAAO,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,KAAe;QACxC,4EAA4E;QAC5E,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1D,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/esm/pair.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { KeyPairError } from '@did-btcr2/common';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CompressedSecp256k1PublicKey } from './public.js';
|
|
3
|
+
import { Secp256k1SecretKey } from './secret.js';
|
|
4
4
|
/**
|
|
5
|
-
* Encapsulates a
|
|
5
|
+
* Encapsulates a CompressedSecp256k1PublicKey and a Secp256k1SecretKey object as a single SchnorrKeyPair object.
|
|
6
6
|
* @class SchnorrKeyPair
|
|
7
7
|
* @type {SchnorrKeyPair}
|
|
8
8
|
*/
|
|
9
9
|
export class SchnorrKeyPair {
|
|
10
|
-
/** @type {
|
|
10
|
+
/** @type {Secp256k1SecretKey} The secret key object */
|
|
11
11
|
_secretKey;
|
|
12
|
-
/** @type {
|
|
12
|
+
/** @type {CompressedSecp256k1PublicKey} The public key object */ ;
|
|
13
13
|
_publicKey;
|
|
14
14
|
/** @type {string} The public key in multibase format */
|
|
15
15
|
_publicKeyMultibase;
|
|
@@ -17,37 +17,41 @@ export class SchnorrKeyPair {
|
|
|
17
17
|
_secretKeyMultibase;
|
|
18
18
|
/**
|
|
19
19
|
* Creates an instance of Keys. Must provide a at least a secret key.
|
|
20
|
-
* Can optionally provide both a
|
|
21
|
-
* @param {
|
|
20
|
+
* Can optionally provide both a secret and public key, but must be a valid pair.
|
|
21
|
+
* @param {SchnorrKeyPairParams} params The parameters to initialize the Keys object.
|
|
22
|
+
* @param {CompressedSecp256k1PublicKey | KeyBytes} params.publicKey The public key object or bytes
|
|
23
|
+
* @param {Secp256k1SecretKey | KeyBytes} [params.secret] The secret key object or bytes
|
|
24
|
+
* @throws {KeyPairError} If neither a public key or secret key is provided.
|
|
25
|
+
* @throws {KeyPairError} If the public key is not a valid pair with the secret key.
|
|
22
26
|
*/
|
|
23
|
-
constructor(
|
|
27
|
+
constructor(params = {}) {
|
|
24
28
|
// If no secret key or public key, throw an error
|
|
25
|
-
if (!publicKey && !secretKey) {
|
|
29
|
+
if (!params.publicKey && !params.secretKey) {
|
|
26
30
|
throw new KeyPairError('Argument missing: must at least provide a publicKey', 'CONSTRUCTOR_ERROR');
|
|
27
31
|
}
|
|
28
|
-
// Set the
|
|
29
|
-
if (secretKey instanceof Uint8Array) {
|
|
30
|
-
this._secretKey = new
|
|
32
|
+
// Set the secretKey
|
|
33
|
+
if (params.secretKey instanceof Uint8Array) {
|
|
34
|
+
this._secretKey = new Secp256k1SecretKey(params.secretKey);
|
|
31
35
|
}
|
|
32
|
-
else if (secretKey instanceof
|
|
33
|
-
this._secretKey = secretKey;
|
|
36
|
+
else if (params.secretKey instanceof Secp256k1SecretKey) {
|
|
37
|
+
this._secretKey = params.secretKey;
|
|
34
38
|
}
|
|
35
|
-
// Set the
|
|
36
|
-
if (publicKey instanceof
|
|
37
|
-
this._publicKey = publicKey;
|
|
39
|
+
// Set the publicKey
|
|
40
|
+
if (params.publicKey instanceof CompressedSecp256k1PublicKey) {
|
|
41
|
+
this._publicKey = params.publicKey;
|
|
38
42
|
}
|
|
39
|
-
else if (publicKey instanceof Uint8Array) {
|
|
40
|
-
this._publicKey = new
|
|
43
|
+
else if (params.publicKey instanceof Uint8Array) {
|
|
44
|
+
this._publicKey = new CompressedSecp256k1PublicKey(params.publicKey);
|
|
41
45
|
}
|
|
42
46
|
else {
|
|
43
|
-
this._publicKey = new
|
|
47
|
+
this._publicKey = new CompressedSecp256k1PublicKey(this._secretKey.computePublicKey());
|
|
44
48
|
}
|
|
45
|
-
this._publicKeyMultibase = this._publicKey.multibase.
|
|
49
|
+
this._publicKeyMultibase = this._publicKey.multibase.encoded;
|
|
46
50
|
this._secretKeyMultibase = this._secretKey ? this._secretKey.multibase : '';
|
|
47
51
|
}
|
|
48
52
|
/**
|
|
49
|
-
* Get the
|
|
50
|
-
* @returns {
|
|
53
|
+
* Get the Secp256k1SecretKey.
|
|
54
|
+
* @returns {Secp256k1SecretKey} The Secp256k1SecretKey object
|
|
51
55
|
* @throws {KeyPairError} If the secret key is not available
|
|
52
56
|
*/
|
|
53
57
|
get secretKey() {
|
|
@@ -60,34 +64,34 @@ export class SchnorrKeyPair {
|
|
|
60
64
|
throw new KeyPairError('Secret key is not valid', 'SECRET_KEY_ERROR');
|
|
61
65
|
}
|
|
62
66
|
// Return a copy of the secret key
|
|
63
|
-
const
|
|
64
|
-
return
|
|
67
|
+
const secret = this._secretKey;
|
|
68
|
+
return secret;
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
67
|
-
* Set the
|
|
68
|
-
* @param {
|
|
71
|
+
* Set the CompressedSecp256k1PublicKey.
|
|
72
|
+
* @param {CompressedSecp256k1PublicKey} publicKey The CompressedSecp256k1PublicKey object
|
|
69
73
|
* @throws {KeyPairError} If the public key is not a valid pair with the secret key.
|
|
70
74
|
*/
|
|
71
75
|
set publicKey(publicKey) {
|
|
72
76
|
// If the public key is not a valid pair with the secret key, throw an error
|
|
73
|
-
if (this.secretKey && !this.secretKey.
|
|
77
|
+
if (this.secretKey && !this.secretKey.hasValidPublicKey(publicKey)) {
|
|
74
78
|
throw new KeyPairError('Public key is not a valid pair with the secret key', 'PUBLIC_KEY_ERROR');
|
|
75
79
|
}
|
|
76
80
|
this._publicKey = publicKey;
|
|
77
|
-
this._publicKeyMultibase = publicKey.multibase.
|
|
81
|
+
this._publicKeyMultibase = publicKey.multibase.encoded;
|
|
78
82
|
this._secretKeyMultibase = this._secretKey ? this._secretKey.multibase : '';
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
81
|
-
* Get the
|
|
82
|
-
* @returns {
|
|
85
|
+
* Get the CompressedSecp256k1PublicKey.
|
|
86
|
+
* @returns {CompressedSecp256k1PublicKey} The CompressedSecp256k1PublicKey object
|
|
83
87
|
*/
|
|
84
88
|
get publicKey() {
|
|
85
89
|
const publicKey = this._publicKey;
|
|
86
90
|
return publicKey;
|
|
87
91
|
}
|
|
88
92
|
/**
|
|
89
|
-
* Get the
|
|
90
|
-
* @returns {
|
|
93
|
+
* Get the raw bytes of each key in the SchnorrKeyPair.
|
|
94
|
+
* @returns {RawSchnorrKeyPair} JSON object with the SchnorrKeyPair raw bytes.
|
|
91
95
|
*/
|
|
92
96
|
get raw() {
|
|
93
97
|
return {
|
|
@@ -97,7 +101,7 @@ export class SchnorrKeyPair {
|
|
|
97
101
|
}
|
|
98
102
|
/**
|
|
99
103
|
* Get the Keys in multibase format.
|
|
100
|
-
* @returns {MultibaseKeys} The
|
|
104
|
+
* @returns {MultibaseKeys} The Secp256k1SecretKey in multibase format
|
|
101
105
|
*/
|
|
102
106
|
get multibase() {
|
|
103
107
|
return {
|
|
@@ -121,42 +125,44 @@ export class SchnorrKeyPair {
|
|
|
121
125
|
* @returns {SchnorrKeyPair} The initialized Keys object.
|
|
122
126
|
*/
|
|
123
127
|
static fromJSON(keys) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
return new SchnorrKeyPair({
|
|
129
|
+
secretKey: Secp256k1SecretKey.fromJSON(keys.secretKey),
|
|
130
|
+
publicKey: CompressedSecp256k1PublicKey.fromJSON(keys.publicKey)
|
|
131
|
+
});
|
|
127
132
|
}
|
|
128
133
|
/**
|
|
129
|
-
* Static method creates a new SchnorrKeyPair from a
|
|
130
|
-
* @param {
|
|
134
|
+
* Static method creates a new SchnorrKeyPair from a Secp256k1SecretKey object or secret key bytes.
|
|
135
|
+
* @param {Secp256k1SecretKey | KeyBytes} data The secret key bytes
|
|
131
136
|
* @returns {SchnorrKeyPair} A new SchnorrKeyPair object
|
|
132
137
|
*/
|
|
133
138
|
static fromPrivateKey(data) {
|
|
134
|
-
// If the secret key is a
|
|
135
|
-
const bytes = data instanceof
|
|
139
|
+
// If the secret key is a Secp256k1SecretKey object, get the raw bytes else use the bytes
|
|
140
|
+
const bytes = data instanceof Secp256k1SecretKey ? data.bytes : data;
|
|
136
141
|
// Throw error if the secret key is not 32 bytes
|
|
137
142
|
if (bytes.length !== 32) {
|
|
138
143
|
throw new KeyPairError('Invalid arg: must be 32 byte secret key', 'FROM_PRIVATE_KEY_ERROR');
|
|
139
144
|
}
|
|
140
|
-
// If pk Uint8Array, construct
|
|
141
|
-
const
|
|
142
|
-
// Compute the public key from the secret key
|
|
143
|
-
const publicKey = secretKey.computePublicKey();
|
|
145
|
+
// If pk Uint8Array, construct Secp256k1SecretKey object else use the object
|
|
146
|
+
const secret = data instanceof Uint8Array ? new Secp256k1SecretKey(data) : data;
|
|
144
147
|
// Return a new Keys object
|
|
145
|
-
return new SchnorrKeyPair({
|
|
148
|
+
return new SchnorrKeyPair({
|
|
149
|
+
secretKey: data instanceof Uint8Array ? new Secp256k1SecretKey(data) : data,
|
|
150
|
+
publicKey: secret.computePublicKey()
|
|
151
|
+
});
|
|
146
152
|
}
|
|
147
153
|
/**
|
|
148
|
-
* Static method creates a new Keys (
|
|
149
|
-
* @param {bigint}
|
|
150
|
-
* @returns {
|
|
154
|
+
* Static method creates a new Keys (Secp256k1SecretKey/CompressedSecp256k1PublicKey) from bigint entropy.
|
|
155
|
+
* @param {bigint} entropy The entropy in bigint form
|
|
156
|
+
* @returns {SchnorrKeyPair} A new SchnorrKeyPair object
|
|
151
157
|
*/
|
|
152
|
-
static
|
|
153
|
-
const secretKey =
|
|
158
|
+
static fromEntropy(entropy) {
|
|
159
|
+
const secretKey = Secp256k1SecretKey.fromEntropy(entropy);
|
|
154
160
|
const publicKey = secretKey.computePublicKey();
|
|
155
161
|
return new SchnorrKeyPair({ secretKey, publicKey });
|
|
156
162
|
}
|
|
157
163
|
/**
|
|
158
164
|
* Converts key bytes to a hex string.
|
|
159
|
-
* @param {KeyBytes} keyBytes The key bytes (
|
|
165
|
+
* @param {KeyBytes} keyBytes The key bytes (secret or public).
|
|
160
166
|
* @returns {Hex} The key bytes as a hex string.
|
|
161
167
|
*/
|
|
162
168
|
static toHex(keyBytes) {
|
|
@@ -164,21 +170,21 @@ export class SchnorrKeyPair {
|
|
|
164
170
|
}
|
|
165
171
|
/**
|
|
166
172
|
* Compares two Keys objects for equality.
|
|
167
|
-
* @param {SchnorrKeyPair}
|
|
168
|
-
* @param {SchnorrKeyPair}
|
|
173
|
+
* @param {SchnorrKeyPair} kp The main keys.
|
|
174
|
+
* @param {SchnorrKeyPair} otherKp The other keys to compare.
|
|
169
175
|
* @returns {boolean} True if the public key and secret key are equal, false otherwise.
|
|
170
176
|
*/
|
|
171
|
-
static equals(
|
|
177
|
+
static equals(kp, otherKp) {
|
|
172
178
|
// Deconstruct the public keys from the key pairs
|
|
173
|
-
const pk =
|
|
174
|
-
const otherPk =
|
|
179
|
+
const pk = kp.publicKey;
|
|
180
|
+
const otherPk = otherKp.publicKey;
|
|
175
181
|
// If publicKeys present, use to compare as hex strings.
|
|
176
182
|
if (pk && otherPk) {
|
|
177
183
|
return pk.hex === otherPk.hex;
|
|
178
184
|
}
|
|
179
|
-
// Deconstruct the
|
|
180
|
-
const sk =
|
|
181
|
-
const otherSk =
|
|
185
|
+
// Deconstruct the secret keys from the key pairs
|
|
186
|
+
const sk = kp.secretKey;
|
|
187
|
+
const otherSk = otherKp.secretKey;
|
|
182
188
|
if (sk && otherSk) {
|
|
183
189
|
// Get the public key hex strings for both key pair publicKeys
|
|
184
190
|
return sk.hex === otherSk.hex;
|
|
@@ -187,13 +193,13 @@ export class SchnorrKeyPair {
|
|
|
187
193
|
}
|
|
188
194
|
/**
|
|
189
195
|
* Static method to generate a new random SchnorrKeyPair instance.
|
|
190
|
-
* @returns {SchnorrKeyPair} A new
|
|
196
|
+
* @returns {SchnorrKeyPair} A new Secp256k1SecretKey object.
|
|
191
197
|
*/
|
|
192
198
|
static generate() {
|
|
193
199
|
// Generate random secret key bytes
|
|
194
|
-
const
|
|
195
|
-
// Construct a new
|
|
196
|
-
const secretKey = new
|
|
200
|
+
const sk = Secp256k1SecretKey.random();
|
|
201
|
+
// Construct a new Secp256k1SecretKey object
|
|
202
|
+
const secretKey = new Secp256k1SecretKey(sk);
|
|
197
203
|
// Compute the public key from the secret key
|
|
198
204
|
const publicKey = secretKey.computePublicKey();
|
|
199
205
|
// Return a new Keys object
|
package/dist/esm/pair.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pair.js","sourceRoot":"","sources":["../../src/pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pair.js","sourceRoot":"","sources":["../../src/pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA2BjD;;;;GAIG;AACH,MAAM,OAAO,cAAc;IACzB,uDAAuD;IAC/C,UAAU,CAAsB;IAExC,iEAAiE,CAAA,CAAC;IAC1D,UAAU,CAA+B;IAEjD,wDAAwD;IAChD,mBAAmB,CAAS;IAEpC,wDAAwD;IAChD,mBAAmB,CAAS;IAEpC;;;;;;;;OAQG;IACH,YAAY,SAA+B,EAAE;QAC3C,iDAAiD;QACjD,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,YAAY,CAAC,qDAAqD,EAAE,mBAAmB,CAAC,CAAC;QACrG,CAAC;QAED,oBAAoB;QACpB,IAAG,MAAM,CAAC,SAAS,YAAY,UAAU,EAAE,CAAC;YAC1C,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7D,CAAC;aAAM,IAAI,MAAM,CAAC,SAAS,YAAY,kBAAkB,EAAE,CAAC;YAC1D,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC;QACrC,CAAC;QAED,oBAAoB;QACpB,IAAG,MAAM,CAA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