@did-btcr2/keypair 0.10.0 → 0.11.1
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/dist/cjs/pair.js +43 -49
- package/dist/cjs/pair.js.map +1 -1
- package/dist/cjs/public.js +21 -139
- package/dist/cjs/public.js.map +1 -1
- package/dist/cjs/secret.js +65 -82
- package/dist/cjs/secret.js.map +1 -1
- package/dist/esm/pair.js +43 -49
- package/dist/esm/pair.js.map +1 -1
- package/dist/esm/public.js +21 -139
- package/dist/esm/public.js.map +1 -1
- package/dist/esm/secret.js +65 -82
- package/dist/esm/secret.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/pair.d.ts +19 -4
- package/dist/types/pair.d.ts.map +1 -1
- package/dist/types/public.d.ts +7 -42
- package/dist/types/public.d.ts.map +1 -1
- package/dist/types/secret.d.ts +21 -20
- package/dist/types/secret.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -2
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/pair.ts +51 -56
- package/src/public.ts +25 -176
- package/src/secret.ts +72 -111
- package/src/types.ts +2 -2
package/dist/cjs/secret.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SecretKeyError } from '@did-btcr2/common';
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha2';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import { bytesToHex } from '@noble/hashes/utils';
|
|
4
|
+
import { secp256k1, schnorr } from '@noble/curves/secp256k1.js';
|
|
5
|
+
import { randomBytes } from '@noble/hashes/utils';
|
|
6
|
+
import { base58 } from '@scure/base';
|
|
7
7
|
import { CompressedSecp256k1PublicKey } from './public.js';
|
|
8
|
+
import { equalBytes } from '@noble/curves/utils.js';
|
|
9
|
+
/** Fixed secret key header bytes per the Data Integrity BIP340 Cryptosuite spec: [0x81, 0x26] */
|
|
10
|
+
const BIP340_SECRET_KEY_MULTIBASE_PREFIX = new Uint8Array([0x81, 0x26]);
|
|
11
|
+
/** Hash of the BIP-340 Multikey secret key prefix */
|
|
12
|
+
const BIP340_SECRET_KEY_MULTIBASE_PREFIX_HASH = bytesToHex(sha256(BIP340_SECRET_KEY_MULTIBASE_PREFIX));
|
|
8
13
|
/**
|
|
9
14
|
* Encapsulates a secp256k1 secret key
|
|
10
15
|
* Provides get methods for different formats (raw, secret, point).
|
|
@@ -32,25 +37,35 @@ export class Secp256k1SecretKey {
|
|
|
32
37
|
if (!isBytes && !isSecret) {
|
|
33
38
|
throw new SecretKeyError('Invalid entropy: must be a valid byte array (32) or bigint', 'CONSTRUCTOR_ERROR');
|
|
34
39
|
}
|
|
35
|
-
// If bytes and
|
|
40
|
+
// If bytes and length is 32, defensive-copy and derive seed
|
|
36
41
|
if (isBytes && entropy.length === 32) {
|
|
37
|
-
this.#bytes = entropy;
|
|
38
|
-
this.#seed = Secp256k1SecretKey.toSecret(
|
|
42
|
+
this.#bytes = new Uint8Array(entropy);
|
|
43
|
+
this.#seed = Secp256k1SecretKey.toSecret(this.#bytes);
|
|
39
44
|
}
|
|
40
|
-
// If
|
|
41
|
-
if (isSecret &&
|
|
45
|
+
// If bigint in valid range [1, n), convert to bytes
|
|
46
|
+
if (isSecret && entropy >= 1n && entropy < secp256k1.Point.Fn.ORDER) {
|
|
42
47
|
this.#bytes = Secp256k1SecretKey.toBytes(entropy);
|
|
43
48
|
this.#seed = entropy;
|
|
44
49
|
}
|
|
45
50
|
if (!this.#bytes || this.#bytes.length !== 32) {
|
|
46
51
|
throw new SecretKeyError('Invalid bytes: must be a valid 32-byte secret key', 'CONSTRUCTOR_ERROR');
|
|
47
52
|
}
|
|
48
|
-
if (!this.#seed ||
|
|
49
|
-
throw new SecretKeyError('Invalid seed: must
|
|
53
|
+
if (!this.#seed || this.#seed < 1n || this.#seed >= secp256k1.Point.Fn.ORDER) {
|
|
54
|
+
throw new SecretKeyError('Invalid seed: must be valid bigint', 'CONSTRUCTOR_ERROR');
|
|
50
55
|
}
|
|
51
56
|
// Set the secret key multibase
|
|
52
57
|
this.#multibase = this.encode();
|
|
53
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Zeros out secret key material from memory.
|
|
61
|
+
* The instance should not be used after calling this method.
|
|
62
|
+
*/
|
|
63
|
+
destroy() {
|
|
64
|
+
if (this.#bytes)
|
|
65
|
+
this.#bytes.fill(0);
|
|
66
|
+
this.#seed = undefined;
|
|
67
|
+
this.#multibase = '';
|
|
68
|
+
}
|
|
54
69
|
/**
|
|
55
70
|
* Get the secret key entropy as a byte array.
|
|
56
71
|
* @returns {KeyBytes} The secret key bytes as a Uint8Array
|
|
@@ -90,75 +105,71 @@ export class Secp256k1SecretKey {
|
|
|
90
105
|
* @returns {string} The secret key in BIP340 multibase format.
|
|
91
106
|
*/
|
|
92
107
|
encode() {
|
|
93
|
-
// Convert Uint8Array bytes to an Array
|
|
94
108
|
const secretKeyBytes = Array.from(this.bytes);
|
|
95
|
-
if (secretKeyBytes.length !== 32) {
|
|
96
|
-
throw new SecretKeyError('Invalid secret key: must be a valid 32-byte secret key', 'ENCODE_MULTIBASE_ERROR');
|
|
97
|
-
}
|
|
98
|
-
// Convert prefix to an array
|
|
99
109
|
const mbaseBytes = Array.from(BIP340_SECRET_KEY_MULTIBASE_PREFIX);
|
|
100
|
-
// Push the secret key bytes at the end of the prefix
|
|
101
110
|
mbaseBytes.push(...secretKeyBytes);
|
|
102
|
-
|
|
103
|
-
return base58btc.encode(Uint8Array.from(mbaseBytes));
|
|
111
|
+
return 'z' + base58.encode(Uint8Array.from(mbaseBytes));
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
106
114
|
* Checks if this secret key is equal to another.
|
|
107
|
-
* @param {
|
|
115
|
+
* @param {SecretKey} other The other secret key
|
|
108
116
|
* @returns {boolean} True if the private keys are equal, false otherwise
|
|
109
117
|
*/
|
|
110
118
|
equals(other) {
|
|
111
|
-
|
|
112
|
-
return this.hex === other.hex;
|
|
119
|
+
return equalBytes(this.bytes, other.bytes);
|
|
113
120
|
}
|
|
114
121
|
/**
|
|
115
122
|
* Computes the public key from the secret key bytes.
|
|
116
123
|
* @returns {CompressedSecp256k1PublicKey} The computed public key
|
|
117
124
|
*/
|
|
118
125
|
computePublicKey() {
|
|
119
|
-
|
|
120
|
-
const publicKeyBytes = tinysecp.pointFromScalar(this.bytes, true);
|
|
121
|
-
// If no public key, throw error
|
|
122
|
-
if (!publicKeyBytes) {
|
|
123
|
-
throw new SecretKeyError('Invalid compute: failed to derive public key', 'COMPUTE_PUBLIC_KEY_ERROR');
|
|
124
|
-
}
|
|
125
|
-
// If public key is not compressed, throw error
|
|
126
|
-
if (publicKeyBytes.length !== 33) {
|
|
127
|
-
throw new SecretKeyError('Invalid compute: public key not compressed format', 'COMPUTE_PUBLIC_KEY_ERROR');
|
|
128
|
-
}
|
|
129
|
-
return new CompressedSecp256k1PublicKey(publicKeyBytes);
|
|
126
|
+
return new CompressedSecp256k1PublicKey(secp256k1.getPublicKey(this.bytes));
|
|
130
127
|
}
|
|
131
128
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
129
|
+
* Safe JSON representation. Does not expose secret material.
|
|
130
|
+
* Called implicitly by JSON.stringify(). Use exportJSON() for full serialization.
|
|
134
131
|
*/
|
|
135
132
|
toJSON() {
|
|
133
|
+
return { type: 'Secp256k1SecretKey' };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Exports the secret key as a JSON object. Contains sensitive material.
|
|
137
|
+
* @returns {SecretKeyObject} The secret key as a JSON object
|
|
138
|
+
*/
|
|
139
|
+
exportJSON() {
|
|
136
140
|
return {
|
|
137
141
|
bytes: Array.from(this.bytes),
|
|
138
142
|
seed: this.seed.toString(),
|
|
139
143
|
hex: this.hex,
|
|
140
144
|
};
|
|
141
145
|
}
|
|
146
|
+
/** @override Prevents secret material from appearing in console.log */
|
|
147
|
+
toString() {
|
|
148
|
+
return '[Secp256k1SecretKey]';
|
|
149
|
+
}
|
|
150
|
+
/** @override Prevents secret material from appearing in Node.js inspect */
|
|
151
|
+
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
152
|
+
return '[Secp256k1SecretKey]';
|
|
153
|
+
}
|
|
142
154
|
/**
|
|
143
155
|
* Checks if the secret key is valid.
|
|
144
156
|
* @returns {boolean} True if the secret key is valid, false otherwise
|
|
145
157
|
*/
|
|
146
158
|
isValid() {
|
|
147
|
-
return
|
|
159
|
+
return secp256k1.utils.isValidSecretKey(this.bytes);
|
|
148
160
|
}
|
|
149
161
|
/**
|
|
150
162
|
* Checks if the public key is a valid secp256k1 point.
|
|
151
163
|
* @returns {boolean} True if the public key is valid, false otherwise
|
|
152
164
|
*/
|
|
153
165
|
hasValidPublicKey() {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
166
|
+
try {
|
|
167
|
+
this.computePublicKey();
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
158
171
|
return false;
|
|
159
172
|
}
|
|
160
|
-
// Return true if the computed public key equals the provided public key
|
|
161
|
-
return true;
|
|
162
173
|
}
|
|
163
174
|
/**
|
|
164
175
|
* Produce a signature over arbitrary data using schnorr or ecdsa.
|
|
@@ -171,13 +182,11 @@ export class Secp256k1SecretKey {
|
|
|
171
182
|
sign(data, opts) {
|
|
172
183
|
// Set default options if not provided
|
|
173
184
|
opts ??= { scheme: 'schnorr' };
|
|
174
|
-
// Sign ecdsa and return
|
|
175
185
|
if (opts.scheme === 'ecdsa') {
|
|
176
|
-
return
|
|
186
|
+
return secp256k1.sign(data, this.bytes);
|
|
177
187
|
}
|
|
178
|
-
// Sign schnorr and return
|
|
179
188
|
if (opts.scheme === 'schnorr') {
|
|
180
|
-
return
|
|
189
|
+
return schnorr.sign(data, this.bytes);
|
|
181
190
|
}
|
|
182
191
|
throw new SecretKeyError(`Invalid scheme: ${opts.scheme}.`, 'SIGN_ERROR', opts);
|
|
183
192
|
}
|
|
@@ -188,7 +197,7 @@ export class Secp256k1SecretKey {
|
|
|
188
197
|
*/
|
|
189
198
|
static decode(multibase) {
|
|
190
199
|
// Decode the public key multibase string
|
|
191
|
-
const decoded =
|
|
200
|
+
const decoded = base58.decode(multibase.slice(1));
|
|
192
201
|
// If the public key bytes are not 35 bytes, throw an error
|
|
193
202
|
if (decoded.length !== 34) {
|
|
194
203
|
throw new SecretKeyError('Invalid argument: must be 34 byte secretKeyMultibase', 'DECODE_MULTIBASE_ERROR');
|
|
@@ -212,20 +221,6 @@ export class Secp256k1SecretKey {
|
|
|
212
221
|
static fromJSON(json) {
|
|
213
222
|
return new Secp256k1SecretKey(new Uint8Array(json.bytes));
|
|
214
223
|
}
|
|
215
|
-
/**
|
|
216
|
-
* Converts a Secp256k1SecretKey or KeyBytes to a SchnorrKeyPair.
|
|
217
|
-
* @param {KeyBytes} bytes The secret key bytes
|
|
218
|
-
* @returns {SchnorrKeyPair} The SchnorrKeyPair object containing the public and private keys
|
|
219
|
-
* @throws {SecretKeyError} If the secret key is not valid
|
|
220
|
-
*/
|
|
221
|
-
static toKeyPair(bytes) {
|
|
222
|
-
// Create a new Secp256k1SecretKey from the bytes
|
|
223
|
-
const secretKey = new Secp256k1SecretKey(bytes);
|
|
224
|
-
// Compute the public key from the secret key
|
|
225
|
-
const publicKey = secretKey.computePublicKey();
|
|
226
|
-
// Create a new Pair from the public key and secret key
|
|
227
|
-
return new SchnorrKeyPair({ publicKey, secretKey });
|
|
228
|
-
}
|
|
229
224
|
/**
|
|
230
225
|
* Convert a bigint secret to secret key bytes.
|
|
231
226
|
* @param {KeyBytes} bytes The secret key bytes
|
|
@@ -243,42 +238,30 @@ export class Secp256k1SecretKey {
|
|
|
243
238
|
// Ensure it’s a valid 32-byte value in [1, n-1] and convert bigint to Uint8Array
|
|
244
239
|
const bytes = Uint8Array.from({ length: 32 }, (_, i) => Number(secret >> BigInt(8 * (31 - i)) & BigInt(0xff)));
|
|
245
240
|
// If bytes are not a valid secp256k1 secret key, throw error
|
|
246
|
-
if (!
|
|
241
|
+
if (!secp256k1.utils.isValidSecretKey(bytes)) {
|
|
247
242
|
throw new SecretKeyError('Invalid secret key: secret out of valid range', 'SET_PRIVATE_KEY_ERROR');
|
|
248
243
|
}
|
|
249
244
|
return new Uint8Array(bytes);
|
|
250
245
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Creates a new Secp256k1SecretKey object from random bytes.
|
|
253
|
-
* @param {KeyBytes} bytes The secret key bytes
|
|
254
|
-
* @returns {Secp256k1SecretKey} A new Secp256k1SecretKey object
|
|
255
|
-
*/
|
|
256
|
-
static fromBytes(bytes) {
|
|
257
|
-
// Return a new Secp256k1SecretKey object
|
|
258
|
-
return new Secp256k1SecretKey(bytes);
|
|
259
|
-
}
|
|
260
246
|
/**
|
|
261
247
|
* Creates a new Secp256k1SecretKey object from a bigint secret.
|
|
262
248
|
* @param {bigint} bint The secret bigint
|
|
263
249
|
* @returns {Secp256k1SecretKey} A new Secp256k1SecretKey object
|
|
264
250
|
*/
|
|
265
251
|
static fromBigInt(bint) {
|
|
266
|
-
|
|
267
|
-
const hexsecret = bint.toString(16).padStart(64, '0');
|
|
268
|
-
// Convert the hex string to a Uint8Array
|
|
269
|
-
const bytes = new Uint8Array(hexsecret.match(/.{2}/g).map(byte => parseInt(byte, 16)));
|
|
270
|
-
// Return a new Secp256k1SecretKey object
|
|
271
|
-
return new Secp256k1SecretKey(bytes);
|
|
252
|
+
return new Secp256k1SecretKey(Secp256k1SecretKey.toBytes(bint));
|
|
272
253
|
}
|
|
273
254
|
/**
|
|
274
255
|
* Generates random secret key bytes.
|
|
275
256
|
* @returns {KeyBytes} Uint8Array of 32 random bytes.
|
|
276
257
|
*/
|
|
277
258
|
static random() {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
259
|
+
let byteArray;
|
|
260
|
+
// Retry until bytes fall in valid scalar range [1, n)
|
|
261
|
+
do {
|
|
262
|
+
byteArray = randomBytes(32);
|
|
263
|
+
} while (!secp256k1.utils.isValidSecretKey(byteArray));
|
|
264
|
+
return byteArray;
|
|
282
265
|
}
|
|
283
266
|
/**
|
|
284
267
|
* Creates a new Secp256k1SecretKey from random secret key bytes.
|
package/dist/cjs/secret.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../../src/secret.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../../src/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,cAAc,EAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,iGAAiG;AACjG,MAAM,kCAAkC,GAAU,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/E,qDAAqD;AACrD,MAAM,uCAAuC,GAAW,UAAU,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC,CAAC;AA+C/G;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IAC7B,sEAAsE;IACtE,MAAM,CAAY;IAElB,gEAAgE;IAChE,KAAK,CAAU;IAEf,4DAA4D;IAC5D,UAAU,CAAS;IAEnB;;;;OAIG;IACH,YAAY,OAAuB;QACjC,4DAA4D;QAC5D,MAAM,OAAO,GAAG,OAAO,YAAY,UAAU,CAAC;QAC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C,KAAe;QACxC,4EAA4E;QAC5E,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1D,CAAC;CACF"}
|
package/dist/esm/pair.js
CHANGED
|
@@ -7,22 +7,8 @@ import { Secp256k1SecretKey } from './secret.js';
|
|
|
7
7
|
* @type {SchnorrKeyPair}
|
|
8
8
|
*/
|
|
9
9
|
export class SchnorrKeyPair {
|
|
10
|
-
/**
|
|
11
|
-
* The secret key objec
|
|
12
|
-
*/
|
|
13
10
|
#secretKey;
|
|
14
|
-
/**
|
|
15
|
-
* The public key object
|
|
16
|
-
*/ ;
|
|
17
11
|
#publicKey;
|
|
18
|
-
/**
|
|
19
|
-
* The public key in multibase forma
|
|
20
|
-
*/
|
|
21
|
-
#publicKeyMultibase;
|
|
22
|
-
/**
|
|
23
|
-
* The secret key in multibase forma
|
|
24
|
-
*/
|
|
25
|
-
#secretKeyMultibase;
|
|
26
12
|
/**
|
|
27
13
|
* Creates an instance of Keys. Must provide a at least a secret key.
|
|
28
14
|
* Can optionally provide both a secret and public key, but must be a valid pair.
|
|
@@ -54,8 +40,13 @@ export class SchnorrKeyPair {
|
|
|
54
40
|
else {
|
|
55
41
|
this.#publicKey = this.#secretKey.computePublicKey();
|
|
56
42
|
}
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
// Validate that an explicitly provided public key matches the secret key
|
|
44
|
+
if (this.#secretKey && params.publicKey) {
|
|
45
|
+
const derived = this.#secretKey.computePublicKey();
|
|
46
|
+
if (!this.#publicKey.equals(derived)) {
|
|
47
|
+
throw new KeyPairError('Public key does not match secret key', 'CONSTRUCTOR_ERROR');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
59
50
|
}
|
|
60
51
|
/**
|
|
61
52
|
* Get the Secp256k1SecretKey.
|
|
@@ -81,26 +72,27 @@ export class SchnorrKeyPair {
|
|
|
81
72
|
* @throws {KeyPairError} If the public key is not a valid pair with the secret key.
|
|
82
73
|
*/
|
|
83
74
|
set publicKey(publicKey) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!
|
|
87
|
-
throw new KeyPairError('
|
|
75
|
+
if (this.#secretKey) {
|
|
76
|
+
const derived = this.#secretKey.computePublicKey();
|
|
77
|
+
if (!publicKey.equals(derived)) {
|
|
78
|
+
throw new KeyPairError('Public key does not match secret key', 'PUBLIC_KEY_ERROR');
|
|
88
79
|
}
|
|
89
|
-
const cPk = this.secretKey.computePublicKey();
|
|
90
|
-
if (!publicKey.equals(cPk))
|
|
91
|
-
throw new KeyPairError('Public key is not a valid pair with the secret key', 'PUBLIC_KEY_ERROR');
|
|
92
80
|
}
|
|
93
81
|
this.#publicKey = publicKey;
|
|
94
|
-
this.#publicKeyMultibase = publicKey.multibase.encoded;
|
|
95
|
-
this.#secretKeyMultibase = this.#secretKey ? this.#secretKey.multibase : '';
|
|
96
82
|
}
|
|
97
83
|
/**
|
|
98
84
|
* Get the CompressedSecp256k1PublicKey.
|
|
99
85
|
* @returns {CompressedSecp256k1PublicKey} The CompressedSecp256k1PublicKey object
|
|
100
86
|
*/
|
|
101
87
|
get publicKey() {
|
|
102
|
-
|
|
103
|
-
|
|
88
|
+
return this.#publicKey;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether this key pair contains a secret key.
|
|
92
|
+
* @returns {boolean} True if the secret key is present.
|
|
93
|
+
*/
|
|
94
|
+
get hasSecretKey() {
|
|
95
|
+
return !!this.#secretKey;
|
|
104
96
|
}
|
|
105
97
|
/**
|
|
106
98
|
* Get the `raw` bytes of each key in the SchnorrKeyPair.
|
|
@@ -109,7 +101,7 @@ export class SchnorrKeyPair {
|
|
|
109
101
|
get raw() {
|
|
110
102
|
return {
|
|
111
103
|
public: this.publicKey.x,
|
|
112
|
-
secret: this
|
|
104
|
+
secret: this.#secretKey ? this.#secretKey.bytes : undefined
|
|
113
105
|
};
|
|
114
106
|
}
|
|
115
107
|
/**
|
|
@@ -119,7 +111,7 @@ export class SchnorrKeyPair {
|
|
|
119
111
|
get hex() {
|
|
120
112
|
return {
|
|
121
113
|
public: this.publicKey.hex,
|
|
122
|
-
secret: this.#secretKey ? this
|
|
114
|
+
secret: this.#secretKey ? this.#secretKey.hex : undefined
|
|
123
115
|
};
|
|
124
116
|
}
|
|
125
117
|
/**
|
|
@@ -128,20 +120,36 @@ export class SchnorrKeyPair {
|
|
|
128
120
|
*/
|
|
129
121
|
get multibase() {
|
|
130
122
|
return {
|
|
131
|
-
publicKeyMultibase: this.#
|
|
132
|
-
secretKeyMultibase: this.#
|
|
123
|
+
publicKeyMultibase: this.#publicKey.multibase.encoded,
|
|
124
|
+
secretKeyMultibase: this.#secretKey ? this.#secretKey.multibase : '',
|
|
133
125
|
};
|
|
134
126
|
}
|
|
135
127
|
/**
|
|
136
|
-
* JSON representation
|
|
137
|
-
*
|
|
128
|
+
* Safe JSON representation. Only includes the public key.
|
|
129
|
+
* Called implicitly by JSON.stringify(). Use exportJSON() for full serialization.
|
|
130
|
+
* @returns {{ publicKey: PublicKeyObject }} The JSON representation of the public key
|
|
138
131
|
*/
|
|
139
132
|
toJSON() {
|
|
133
|
+
return { publicKey: this.publicKey.toJSON() };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Exports the full key pair as a JSON object. Contains sensitive material.
|
|
137
|
+
* @returns {SchnorrKeyPairObject} The key pair as a JSON object
|
|
138
|
+
* @throws {KeyPairError} If the secret key is not available
|
|
139
|
+
*/
|
|
140
|
+
exportJSON() {
|
|
141
|
+
if (!this.#secretKey) {
|
|
142
|
+
throw new KeyPairError('Cannot export: secret key required. Use publicKey.toJSON() for public-key-only pairs.', 'SERIALIZE_ERROR');
|
|
143
|
+
}
|
|
140
144
|
return {
|
|
141
|
-
secretKey: this
|
|
145
|
+
secretKey: this.#secretKey.exportJSON(),
|
|
142
146
|
publicKey: this.publicKey.toJSON()
|
|
143
147
|
};
|
|
144
148
|
}
|
|
149
|
+
/** @override Prevents secret material from appearing in Node.js inspect */
|
|
150
|
+
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
151
|
+
return `[SchnorrKeyPair ${this.publicKey.hex}]`;
|
|
152
|
+
}
|
|
145
153
|
/**
|
|
146
154
|
* Static method creates a new Keys from a JSON object.
|
|
147
155
|
* @param {SchnorrKeyPairObject} keys The JSON object to initialize the Keys.
|
|
@@ -200,21 +208,7 @@ export class SchnorrKeyPair {
|
|
|
200
208
|
* @returns {boolean} True if the public key and secret key are equal, false otherwise.
|
|
201
209
|
*/
|
|
202
210
|
static equals(kp, otherKp) {
|
|
203
|
-
|
|
204
|
-
const pk = kp.publicKey;
|
|
205
|
-
const otherPk = otherKp.publicKey;
|
|
206
|
-
// If publicKeys present, use to compare as hex strings.
|
|
207
|
-
if (pk && otherPk) {
|
|
208
|
-
return pk.hex === otherPk.hex;
|
|
209
|
-
}
|
|
210
|
-
// Deconstruct the secret keys from the key pairs
|
|
211
|
-
const sk = kp.secretKey;
|
|
212
|
-
const otherSk = otherKp.secretKey;
|
|
213
|
-
if (sk && otherSk) {
|
|
214
|
-
// Get the public key hex strings for both key pair publicKeys
|
|
215
|
-
return sk.hex === otherSk.hex;
|
|
216
|
-
}
|
|
217
|
-
throw new KeyPairError('Cannot compare invalid key pair(s)', 'KEYPAIR_EQUALS_ERROR');
|
|
211
|
+
return kp.publicKey.equals(otherKp.publicKey);
|
|
218
212
|
}
|
|
219
213
|
/**
|
|
220
214
|
* Static method to generate a new random SchnorrKeyPair instance.
|
package/dist/esm/pair.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pair.js","sourceRoot":"","sources":["../../src/pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"pair.js","sourceRoot":"","sources":["../../src/pair.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAa,MAAM,aAAa,CAAC;AACtE,OAA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