@bsv/sdk 1.0.4 → 1.0.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.
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/primitives/BigNumber.js +1 -1
- package/dist/cjs/src/primitives/BigNumber.js.map +1 -1
- package/dist/cjs/src/primitives/Hash.js +98 -56
- package/dist/cjs/src/primitives/Hash.js.map +1 -1
- package/dist/cjs/src/primitives/PrivateKey.js +23 -0
- package/dist/cjs/src/primitives/PrivateKey.js.map +1 -1
- package/dist/cjs/src/primitives/PublicKey.js +19 -1
- package/dist/cjs/src/primitives/PublicKey.js.map +1 -1
- package/dist/cjs/src/primitives/SymmetricKey.js +14 -1
- package/dist/cjs/src/primitives/SymmetricKey.js.map +1 -1
- package/dist/cjs/src/primitives/index.js +3 -1
- package/dist/cjs/src/primitives/index.js.map +1 -1
- package/dist/cjs/src/primitives/utils.js +3 -3
- package/dist/cjs/src/primitives/utils.js.map +1 -1
- package/dist/cjs/src/script/templates/P2PKH.js +14 -3
- package/dist/cjs/src/script/templates/P2PKH.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/primitives/BigNumber.js +1 -1
- package/dist/esm/src/primitives/BigNumber.js.map +1 -1
- package/dist/esm/src/primitives/Hash.js +98 -56
- package/dist/esm/src/primitives/Hash.js.map +1 -1
- package/dist/esm/src/primitives/PrivateKey.js +23 -0
- package/dist/esm/src/primitives/PrivateKey.js.map +1 -1
- package/dist/esm/src/primitives/PublicKey.js +19 -1
- package/dist/esm/src/primitives/PublicKey.js.map +1 -1
- package/dist/esm/src/primitives/SymmetricKey.js +14 -1
- package/dist/esm/src/primitives/SymmetricKey.js.map +1 -1
- package/dist/esm/src/primitives/index.js +1 -0
- package/dist/esm/src/primitives/index.js.map +1 -1
- package/dist/esm/src/primitives/utils.js +3 -3
- package/dist/esm/src/primitives/utils.js.map +1 -1
- package/dist/esm/src/script/templates/P2PKH.js +14 -3
- package/dist/esm/src/script/templates/P2PKH.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/primitives/BigNumber.d.ts +1 -1
- package/dist/types/src/primitives/BigNumber.d.ts.map +1 -1
- package/dist/types/src/primitives/Hash.d.ts +73 -34
- package/dist/types/src/primitives/Hash.d.ts.map +1 -1
- package/dist/types/src/primitives/PrivateKey.d.ts +16 -1
- package/dist/types/src/primitives/PrivateKey.d.ts.map +1 -1
- package/dist/types/src/primitives/PublicKey.d.ts +14 -2
- package/dist/types/src/primitives/PublicKey.d.ts.map +1 -1
- package/dist/types/src/primitives/SymmetricKey.d.ts +11 -0
- package/dist/types/src/primitives/SymmetricKey.d.ts.map +1 -1
- package/dist/types/src/primitives/index.d.ts +1 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -1
- package/dist/types/src/primitives/utils.d.ts +2 -2
- package/dist/types/src/script/templates/P2PKH.d.ts +3 -3
- package/dist/types/src/script/templates/P2PKH.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/examples/EXAMPLE_BUILDING_CUSTOM_TX_BROADCASTER.md +89 -0
- package/docs/examples/EXAMPLE_COMPLEX_TX.md +164 -0
- package/docs/examples/EXAMPLE_ECIES.md +37 -0
- package/docs/examples/EXAMPLE_ENCRYPT_DECRYPT_MESSAGE.md +52 -0
- package/docs/examples/EXAMPLE_FEE_MODELING.md +199 -0
- package/docs/examples/EXAMPLE_HD_WALLETS.md +71 -0
- package/docs/examples/EXAMPLE_MESSAGE_SIGNING.md +63 -0
- package/docs/examples/EXAMPLE_PULSE_HEADERS.md +140 -0
- package/docs/examples/EXAMPLE_SCRIPT_TEMPLATES.md +170 -0
- package/docs/examples/EXAMPLE_SIMPLE_TX.md +64 -0
- package/docs/examples/EXAMPLE_TYPE_42.md +108 -0
- package/docs/examples/EXAMPLE_VERIFYING_BEEF.md +55 -0
- package/docs/examples/EXAMPLE_VERIFYING_SPENDS.md +69 -0
- package/docs/examples/GETTING_STARTED_NODE_CJS.md +73 -0
- package/docs/examples/GETTING_STARTED_REACT.md +121 -0
- package/docs/examples/README.md +19 -0
- package/docs/low-level/README.md +6 -0
- package/docs/low-level/TX_SIG.md +129 -0
- package/docs/low-level/TYPE_42.md +0 -0
- package/docs/primitives.md +679 -566
- package/docs/script.md +4 -4
- package/package.json +1 -1
- package/src/primitives/BigNumber.ts +2 -1
- package/src/primitives/Hash.ts +118 -64
- package/src/primitives/PrivateKey.ts +28 -1
- package/src/primitives/PublicKey.ts +24 -2
- package/src/primitives/SymmetricKey.ts +17 -3
- package/src/primitives/__tests/HMAC.test.ts +2 -2
- package/src/primitives/__tests/Hash.test.ts +2 -2
- package/src/primitives/index.ts +1 -0
- package/src/primitives/utils.ts +3 -3
- package/src/script/__tests/Script.test.ts +34 -0
- package/src/script/__tests/Spend.test.ts +7 -7
- package/src/script/templates/P2PKH.ts +13 -4
- package/src/transaction/__tests/Transaction.test.ts +1 -1
|
@@ -41,7 +41,8 @@ declare abstract class BaseHash {
|
|
|
41
41
|
hmacStrength: number;
|
|
42
42
|
constructor(blockSize: number, outSize: number, hmacStrength: number, padLength: number);
|
|
43
43
|
_update(msg: number[], start: number): void;
|
|
44
|
-
_digest(
|
|
44
|
+
_digest(): number[];
|
|
45
|
+
_digestHex(): string;
|
|
45
46
|
/**
|
|
46
47
|
* Converts the input message into an array, pads it, and joins into 32bit blocks.
|
|
47
48
|
* If there is enough data, it tries updating the hash computation.
|
|
@@ -55,19 +56,29 @@ declare abstract class BaseHash {
|
|
|
55
56
|
* @example
|
|
56
57
|
* sha256.update('Hello World', 'utf8');
|
|
57
58
|
*/
|
|
58
|
-
update(msg: number[] | string, enc?: 'hex'): this;
|
|
59
|
+
update(msg: number[] | string, enc?: 'hex' | 'utf8'): this;
|
|
59
60
|
/**
|
|
60
61
|
* Finalizes the hash computation and returns the hash value/result.
|
|
61
62
|
*
|
|
62
63
|
* @method digest
|
|
63
|
-
* @param enc - The encoding of the final hash. If 'hex' then a hex string will be provided, otherwise an array of numbers.
|
|
64
64
|
*
|
|
65
65
|
* @returns Returns the final hash value.
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
|
-
* const hash = sha256.digest(
|
|
68
|
+
* const hash = sha256.digest();
|
|
69
69
|
*/
|
|
70
|
-
digest(
|
|
70
|
+
digest(): number[];
|
|
71
|
+
/**
|
|
72
|
+
* Finalizes the hash computation and returns the hash value/result as a hex string.
|
|
73
|
+
*
|
|
74
|
+
* @method digest
|
|
75
|
+
*
|
|
76
|
+
* @returns Returns the final hash value as a hex string.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const hash = sha256.digestHex();
|
|
80
|
+
*/
|
|
81
|
+
digestHex(): string;
|
|
71
82
|
/**
|
|
72
83
|
* [Private Method] Used internally to prepare the padding for the final stage of the hash computation.
|
|
73
84
|
*
|
|
@@ -78,7 +89,13 @@ declare abstract class BaseHash {
|
|
|
78
89
|
*/
|
|
79
90
|
private _pad;
|
|
80
91
|
}
|
|
81
|
-
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* @param msg
|
|
95
|
+
* @param enc Optional. Encoding to use if msg is string. Default is 'utf8'.
|
|
96
|
+
* @returns array of byte values from msg. If msg is an array, a copy is returned.
|
|
97
|
+
*/
|
|
98
|
+
export declare function toArray(msg: number[] | string, enc?: 'hex' | 'utf8'): number[];
|
|
82
99
|
/**
|
|
83
100
|
* An implementation of RIPEMD160 cryptographic hash function. Extends the BaseHash class.
|
|
84
101
|
* It provides a way to compute a 'digest' for any kind of input data; transforming the data
|
|
@@ -100,7 +117,8 @@ export declare class RIPEMD160 extends BaseHash {
|
|
|
100
117
|
h: number[];
|
|
101
118
|
constructor();
|
|
102
119
|
_update(msg: number[], start: number): void;
|
|
103
|
-
_digest(
|
|
120
|
+
_digest(): number[];
|
|
121
|
+
_digestHex(): string;
|
|
104
122
|
}
|
|
105
123
|
/**
|
|
106
124
|
* An implementation of SHA256 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -127,7 +145,8 @@ export declare class SHA256 extends BaseHash {
|
|
|
127
145
|
k: number[];
|
|
128
146
|
constructor();
|
|
129
147
|
_update(msg: number[], start?: number): void;
|
|
130
|
-
_digest(
|
|
148
|
+
_digest(): number[];
|
|
149
|
+
_digestHex(): string;
|
|
131
150
|
}
|
|
132
151
|
/**
|
|
133
152
|
* An implementation of SHA1 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -154,7 +173,8 @@ export declare class SHA1 extends BaseHash {
|
|
|
154
173
|
k: number[];
|
|
155
174
|
constructor();
|
|
156
175
|
_update(msg: number[], start?: number): void;
|
|
157
|
-
_digest(
|
|
176
|
+
_digest(): number[];
|
|
177
|
+
_digestHex(): string;
|
|
158
178
|
}
|
|
159
179
|
/**
|
|
160
180
|
* An implementation of SHA512 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -182,7 +202,8 @@ export declare class SHA512 extends BaseHash {
|
|
|
182
202
|
constructor();
|
|
183
203
|
_prepareBlock(msg: any, start: any): void;
|
|
184
204
|
_update(msg: any, start: any): void;
|
|
185
|
-
_digest(
|
|
205
|
+
_digest(): number[];
|
|
206
|
+
_digestHex(): string;
|
|
186
207
|
}
|
|
187
208
|
/**
|
|
188
209
|
* The `SHA256HMAC` class is used to create Hash-based Message Authentication Code (HMAC) using the SHA-256 cryptographic hash function.
|
|
@@ -231,13 +252,22 @@ export declare class SHA256HMAC {
|
|
|
231
252
|
* Finalizes the HMAC computation and returns the resultant hash.
|
|
232
253
|
*
|
|
233
254
|
* @method digest
|
|
234
|
-
* @param enc - If 'hex', then the output is encoded as hexadecimal. If undefined or not 'hex', then no encoding is performed.
|
|
235
255
|
* @returns Returns the digest of the hashed data. Can be a number array or a string.
|
|
236
256
|
*
|
|
237
257
|
* @example
|
|
238
|
-
* let hashedMessage = myHMAC.digest(
|
|
258
|
+
* let hashedMessage = myHMAC.digest();
|
|
239
259
|
*/
|
|
240
|
-
digest(
|
|
260
|
+
digest(): number[];
|
|
261
|
+
/**
|
|
262
|
+
* Finalizes the HMAC computation and returns the resultant hash as a hex string.
|
|
263
|
+
*
|
|
264
|
+
* @method digest
|
|
265
|
+
* @returns Returns the digest of the hashed data as a hex string
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* let hashedMessage = myHMAC.digestHex();
|
|
269
|
+
*/
|
|
270
|
+
digestHex(): string;
|
|
241
271
|
}
|
|
242
272
|
/**
|
|
243
273
|
* The `SHA512HMAC` class is used to create Hash-based Message Authentication Code (HMAC) using the SHA-512 cryptographic hash function.
|
|
@@ -281,120 +311,129 @@ export declare class SHA512HMAC {
|
|
|
281
311
|
* @example
|
|
282
312
|
* myHMAC.update('deadbeef', 'hex');
|
|
283
313
|
*/
|
|
284
|
-
update(msg: number[] | string, enc?: 'hex'): SHA512HMAC;
|
|
314
|
+
update(msg: number[] | string, enc?: 'hex' | 'utf8'): SHA512HMAC;
|
|
285
315
|
/**
|
|
286
316
|
* Finalizes the HMAC computation and returns the resultant hash.
|
|
287
317
|
*
|
|
288
318
|
* @method digest
|
|
289
|
-
* @
|
|
290
|
-
*
|
|
319
|
+
* @returns Returns the digest of the hashed data as a number array.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* let hashedMessage = myHMAC.digest();
|
|
323
|
+
*/
|
|
324
|
+
digest(): number[];
|
|
325
|
+
/**
|
|
326
|
+
* Finalizes the HMAC computation and returns the resultant hash as a hex string.
|
|
327
|
+
*
|
|
328
|
+
* @method digest
|
|
329
|
+
* @returns Returns the digest of the hashed data as a hex string
|
|
291
330
|
*
|
|
292
331
|
* @example
|
|
293
|
-
* let hashedMessage = myHMAC.
|
|
332
|
+
* let hashedMessage = myHMAC.digestHex();
|
|
294
333
|
*/
|
|
295
|
-
|
|
334
|
+
digestHex(): string;
|
|
296
335
|
}
|
|
297
336
|
/**
|
|
298
337
|
* Computes RIPEMD160 hash of a given message.
|
|
299
338
|
* @function ripemd160
|
|
300
339
|
* @param msg - The message to compute the hash for.
|
|
301
|
-
* @param enc - The encoding of
|
|
340
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
302
341
|
*
|
|
303
342
|
* @returns the computed RIPEMD160 hash of the message.
|
|
304
343
|
*
|
|
305
344
|
* @example
|
|
306
345
|
* const digest = ripemd160('Hello, world!');
|
|
307
346
|
*/
|
|
308
|
-
export declare const ripemd160: (msg: number[] | string, enc?: 'hex') => number[]
|
|
347
|
+
export declare const ripemd160: (msg: number[] | string, enc?: 'hex' | 'utf8') => number[];
|
|
309
348
|
/**
|
|
310
349
|
* Computes SHA1 hash of a given message.
|
|
311
350
|
* @function sha1
|
|
312
351
|
* @param msg - The message to compute the hash for.
|
|
313
|
-
* @param enc - The encoding of
|
|
352
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
314
353
|
*
|
|
315
354
|
* @returns the computed SHA1 hash of the message.
|
|
316
355
|
*
|
|
317
356
|
* @example
|
|
318
357
|
* const digest = sha1('Hello, world!');
|
|
319
358
|
*/
|
|
320
|
-
export declare const sha1: (msg: number[] | string, enc?: 'hex') => number[]
|
|
359
|
+
export declare const sha1: (msg: number[] | string, enc?: 'hex' | 'utf8') => number[];
|
|
321
360
|
/**
|
|
322
361
|
* Computes SHA256 hash of a given message.
|
|
323
362
|
* @function sha256
|
|
324
363
|
* @param msg - The message to compute the hash for.
|
|
325
|
-
* @param enc - The encoding of
|
|
364
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
326
365
|
*
|
|
327
366
|
* @returns the computed SHA256 hash of the message.
|
|
328
367
|
*
|
|
329
368
|
* @example
|
|
330
369
|
* const digest = sha256('Hello, world!');
|
|
331
370
|
*/
|
|
332
|
-
export declare const sha256: (msg: number[] | string, enc?: 'hex') => number[]
|
|
371
|
+
export declare const sha256: (msg: number[] | string, enc?: 'hex' | 'utf8') => number[];
|
|
333
372
|
/**
|
|
334
373
|
* Computes SHA512 hash of a given message.
|
|
335
374
|
* @function sha512
|
|
336
375
|
* @param msg - The message to compute the hash for.
|
|
337
|
-
* @param enc - The encoding of
|
|
376
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
338
377
|
*
|
|
339
378
|
* @returns the computed SHA512 hash of the message.
|
|
340
379
|
*
|
|
341
380
|
* @example
|
|
342
381
|
* const digest = sha512('Hello, world!');
|
|
343
382
|
*/
|
|
344
|
-
export declare const sha512: (msg: number[] | string, enc?: 'hex') => number[]
|
|
383
|
+
export declare const sha512: (msg: number[] | string, enc?: 'hex' | 'utf8') => number[];
|
|
345
384
|
/**
|
|
346
385
|
* Performs a 'double hash' using SHA256. This means the data is hashed twice
|
|
347
386
|
* with SHA256. First, the SHA256 hash of the message is computed, then the
|
|
348
387
|
* SHA256 hash of the resulting hash is computed.
|
|
349
388
|
* @function hash256
|
|
350
389
|
* @param msg - The message to compute the hash for.
|
|
351
|
-
* @param enc -
|
|
390
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
352
391
|
*
|
|
353
392
|
* @returns the double hashed SHA256 output.
|
|
354
393
|
*
|
|
355
394
|
* @example
|
|
356
395
|
* const doubleHash = hash256('Hello, world!');
|
|
357
396
|
*/
|
|
358
|
-
export declare const hash256: (msg: number[] | string, enc?: 'hex') => number[]
|
|
397
|
+
export declare const hash256: (msg: number[] | string, enc?: 'hex' | 'utf8') => number[];
|
|
359
398
|
/**
|
|
360
399
|
* Computes SHA256 hash of a given message and then computes a RIPEMD160 hash of the result.
|
|
361
400
|
*
|
|
362
401
|
* @function hash160
|
|
363
402
|
* @param msg - The message to compute the hash for.
|
|
364
|
-
* @param enc - The encoding of
|
|
403
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
365
404
|
*
|
|
366
405
|
* @returns the RIPEMD160 hash of the SHA256 hash of the input message.
|
|
367
406
|
*
|
|
368
407
|
* @example
|
|
369
408
|
* const hash = hash160('Hello, world!');
|
|
370
409
|
*/
|
|
371
|
-
export declare const hash160: (msg: number[] | string, enc?: 'hex') => number[]
|
|
410
|
+
export declare const hash160: (msg: number[] | string, enc?: 'hex' | 'utf8') => number[];
|
|
372
411
|
/**
|
|
373
412
|
* Computes SHA256 HMAC of a given message with a given key.
|
|
374
413
|
* @function sha256hmac
|
|
375
414
|
* @param key - The key used to compute the HMAC
|
|
376
415
|
* @param msg - The message to compute the hash for.
|
|
377
|
-
* @param enc - The encoding of
|
|
416
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
378
417
|
*
|
|
379
418
|
* @returns the computed HMAC of the message.
|
|
380
419
|
*
|
|
381
420
|
* @example
|
|
382
421
|
* const digest = sha256hmac('deadbeef', 'ffff001d');
|
|
383
422
|
*/
|
|
384
|
-
export declare const sha256hmac: (key: number[] | string, msg: number[] | string, enc?: 'hex') => number[]
|
|
423
|
+
export declare const sha256hmac: (key: number[] | string, msg: number[] | string, enc?: 'hex') => number[];
|
|
385
424
|
/**
|
|
386
425
|
* Computes SHA512 HMAC of a given message with a given key.
|
|
387
426
|
* @function sha512hmac
|
|
388
427
|
* @param key - The key used to compute the HMAC
|
|
389
428
|
* @param msg - The message to compute the hash for.
|
|
390
|
-
* @param enc - The encoding of
|
|
429
|
+
* @param enc - The encoding of msg if string. Default is 'utf8'.
|
|
391
430
|
*
|
|
392
431
|
* @returns the computed HMAC of the message.
|
|
393
432
|
*
|
|
394
433
|
* @example
|
|
395
434
|
* const digest = sha512hmac('deadbeef', 'ffff001d');
|
|
396
435
|
*/
|
|
397
|
-
export declare const sha512hmac: (key: number[] | string, msg: number[] | string, enc?: 'hex') => number[]
|
|
436
|
+
export declare const sha512hmac: (key: number[] | string, msg: number[] | string, enc?: 'hex') => number[];
|
|
398
437
|
/**
|
|
399
438
|
* Limited SHA-512-only PBKDF2 function for use in deprecated BIP39 code.
|
|
400
439
|
* @function pbkdf2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../../src/primitives/Hash.ts"],"names":[],"mappings":"AAS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,SAAW,GAAG,MAAM,EAAE,CAiC1H"}
|
|
@@ -45,6 +45,21 @@ export default class PrivateKey extends BigNumber {
|
|
|
45
45
|
* @throws Will throw an error if the string is not a valid WIF.
|
|
46
46
|
**/
|
|
47
47
|
static fromWif(wif: string, prefixLength?: number): PrivateKey;
|
|
48
|
+
/**
|
|
49
|
+
* @constructor
|
|
50
|
+
*
|
|
51
|
+
* @param number - The number (various types accepted) to construct a BigNumber from. Default is 0.
|
|
52
|
+
*
|
|
53
|
+
* @param base - The base of number provided. By default is 10. Ignored if number is BigNumber.
|
|
54
|
+
*
|
|
55
|
+
* @param endian - The endianness provided. By default is 'big endian'. Ignored if number is BigNumber.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* import PrivateKey from './PrivateKey';
|
|
59
|
+
* import BigNumber from './BigNumber';
|
|
60
|
+
* const privKey = new PrivateKey(new BigNumber('123456', 10, 'be'));
|
|
61
|
+
*/
|
|
62
|
+
constructor(number?: BigNumber | number | string | number[], base?: number | 'be' | 'le' | 'hex', endian?: 'be' | 'le');
|
|
48
63
|
/**
|
|
49
64
|
* Signs a message using the private key.
|
|
50
65
|
*
|
|
@@ -59,7 +74,7 @@ export default class PrivateKey extends BigNumber {
|
|
|
59
74
|
* const privateKey = PrivateKey.fromRandom();
|
|
60
75
|
* const signature = privateKey.sign('Hello, World!');
|
|
61
76
|
*/
|
|
62
|
-
sign(msg: number[] | string, enc?: 'hex', forceLowS?: boolean, customK?: Function | BigNumber): Signature;
|
|
77
|
+
sign(msg: number[] | string, enc?: 'hex' | 'utf8', forceLowS?: boolean, customK?: Function | BigNumber): Signature;
|
|
63
78
|
/**
|
|
64
79
|
* Verifies a message's signature using the public key associated with this private key.
|
|
65
80
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../../../src/primitives/PrivateKey.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;A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AU,GAAG,UAAU;IAWlE;;;;;;;;;;;;;OAaG;gBAED,MAAM,GAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAM,EAClD,IAAI,GAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,KAAU,EACvC,MAAM,GAAE,IAAI,GAAG,IAAW;IAU5B;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,SAAS,GAAE,OAAc,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS;IAKzH;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO;IAKrE;;;;;;;;;;;OAWG;IACH,WAAW,IAAK,SAAS;IAMzB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAE,MAAM,GAAG,MAAM,EAAW,GAAG,MAAM;IAI1C;;;;;;;;;;;OAWG;IACH,SAAS,CAAE,MAAM,GAAG,MAAM,EAAW,GAAG,MAAM;IAI9C;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAE,GAAG,EAAE,SAAS,GAAG,KAAK;IAO1C;;;;;OAKG;IACH,WAAW,CAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,UAAU;CAOtE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Point from './Point.js';
|
|
2
2
|
import PrivateKey from './PrivateKey.js';
|
|
3
|
+
import BigNumber from './BigNumber.js';
|
|
3
4
|
import Signature from './Signature.js';
|
|
4
5
|
/**
|
|
5
6
|
* The PublicKey class extends the Point class. It is used in public-key cryptography to derive shared secret, verify message signatures, and encode the public key in the DER format.
|
|
@@ -36,6 +37,17 @@ export default class PublicKey extends Point {
|
|
|
36
37
|
* const myPubKey = PublicKey.fromString("03....")
|
|
37
38
|
*/
|
|
38
39
|
static fromString(str: string): PublicKey;
|
|
40
|
+
/**
|
|
41
|
+
* @constructor
|
|
42
|
+
* @param x - A point or the x-coordinate of the point. May be a number, a BigNumber, a string (which will be interpreted as hex), a number array, or null. If null, an "Infinity" point is constructed.
|
|
43
|
+
* @param y - If x is not a point, the y-coordinate of the point, similar to x.
|
|
44
|
+
* @param isRed - A boolean indicating if the point is a member of the field of integers modulo the k256 prime. Default is true.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* new PublicKey(point1);
|
|
48
|
+
* new PublicKey('abc123', 'def456');
|
|
49
|
+
*/
|
|
50
|
+
constructor(x: Point | BigNumber | number | number[] | string | null, y?: BigNumber | number | number[] | string | null, isRed?: boolean);
|
|
39
51
|
/**
|
|
40
52
|
* Derive a shared secret from a public key and a private key for use in symmetric encryption.
|
|
41
53
|
* This method multiplies the public key (an instance of Point) with a private key.
|
|
@@ -56,7 +68,7 @@ export default class PublicKey extends Point {
|
|
|
56
68
|
*
|
|
57
69
|
* @param msg - The message to verify. It can be a string or an array of numbers.
|
|
58
70
|
* @param sig - The Signature of the message that needs verification.
|
|
59
|
-
* @param enc - The encoding of the message. It defaults to '
|
|
71
|
+
* @param enc - The encoding of the message. It defaults to 'utf8'.
|
|
60
72
|
*
|
|
61
73
|
* @returns Returns true if the signature is verified successfully, otherwise false.
|
|
62
74
|
*
|
|
@@ -65,7 +77,7 @@ export default class PublicKey extends Point {
|
|
|
65
77
|
* const mySignature = new Signature(...)
|
|
66
78
|
* const isVerified = myPubKey.verify(myMessage, mySignature)
|
|
67
79
|
*/
|
|
68
|
-
verify(msg: number[] | string, sig: Signature, enc?: 'hex'): boolean;
|
|
80
|
+
verify(msg: number[] | string, sig: Signature, enc?: 'hex' | 'utf8'): boolean;
|
|
69
81
|
/**
|
|
70
82
|
* Encode the public key to DER (Distinguished Encoding Rules) format.
|
|
71
83
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicKey.d.ts","sourceRoot":"","sources":["../../../../src/primitives/PublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,UAAU,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"PublicKey.d.ts","sourceRoot":"","sources":["../../../../src/primitives/PublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,UAAU,MAAM,iBAAiB,CAAA;AAGxC,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAEtC,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAItC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK;IAC1C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,cAAc,CAAE,GAAG,EAAE,UAAU,GAAG,SAAS;IAMlD;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAE,GAAG,EAAE,MAAM,GAAG,SAAS;IAK1C;;;;;;;;;OASG;gBAED,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,EACxD,CAAC,GAAE,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,IAAW,EACvD,KAAK,GAAE,OAAc;IASvB;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAE,IAAI,EAAE,UAAU,GAAG,KAAK;IAO5C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO;IAK9E;;;;;;;OAOG;IACH,KAAK,IAAK,MAAM;IAIhB;;;;;;;OAOG;IACH,MAAM,CAAE,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,GAAG,MAAM;IAQvC;;;;;;;;;;;OAWG;IACH,SAAS,CAAE,MAAM,GAAG,MAAM,EAAW,GAAG,MAAM;IAI9C;;;;;OAKG;IACH,WAAW,CAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS;CASvE"}
|
|
@@ -8,6 +8,17 @@ import BigNumber from './BigNumber.js';
|
|
|
8
8
|
* @extends {BigNumber}
|
|
9
9
|
*/
|
|
10
10
|
export default class SymmetricKey extends BigNumber {
|
|
11
|
+
/**
|
|
12
|
+
* Generates a symmetric key randomly.
|
|
13
|
+
*
|
|
14
|
+
* @method fromRandom
|
|
15
|
+
* @static
|
|
16
|
+
* @returns The newly generated Symmetric Key.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const symmetricKey = SymmetricKey.fromRandom();
|
|
20
|
+
*/
|
|
21
|
+
static fromRandom(): SymmetricKey;
|
|
11
22
|
/**
|
|
12
23
|
* Encrypts a given message using AES-GCM encryption.
|
|
13
24
|
* The generated Initialization Vector (IV) is attached to the encrypted message for decryption purposes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SymmetricKey.d.ts","sourceRoot":"","sources":["../../../../src/primitives/SymmetricKey.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAKtC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS;IACjD;;;;;;;;;;;;;MAaE;IACF,OAAO,
|
|
1
|
+
{"version":3,"file":"SymmetricKey.d.ts","sourceRoot":"","sources":["../../../../src/primitives/SymmetricKey.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAKtC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS;IACjD;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,IAAI,YAAY;IAIjC;;;;;;;;;;;;;MAaE;IACF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,EAAE;IAY/D;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE;CAkBzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import BigNumber from './BigNumber.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Prepends a '0' to an odd character length word to ensure it has an even number of characters.
|
|
4
4
|
* @param {string} word - The input word.
|
|
5
|
-
* @returns {string} - The word with a leading '0' if it's
|
|
5
|
+
* @returns {string} - The word with a leading '0' if it's an odd character length; otherwise, the original word.
|
|
6
6
|
*/
|
|
7
7
|
export declare const zero2: (word: string) => string;
|
|
8
8
|
/**
|
|
@@ -10,12 +10,12 @@ import PrivateKey from '../../primitives/PrivateKey.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export default class P2PKH implements ScriptTemplate {
|
|
12
12
|
/**
|
|
13
|
-
* Creates a P2PKH locking script for a given public key hash
|
|
13
|
+
* Creates a P2PKH locking script for a given public key hash or address string
|
|
14
14
|
*
|
|
15
|
-
* @param {number[]} pubkeyhash - An array representing the public key hash.
|
|
15
|
+
* @param {number[] | string} pubkeyhash or address - An array or address representing the public key hash.
|
|
16
16
|
* @returns {LockingScript} - A P2PKH locking script.
|
|
17
17
|
*/
|
|
18
|
-
lock(pubkeyhash: number[]): LockingScript;
|
|
18
|
+
lock(pubkeyhash: string | number[]): LockingScript;
|
|
19
19
|
/**
|
|
20
20
|
* Creates a function that generates a P2PKH unlocking script along with its signature and length estimation.
|
|
21
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"P2PKH.d.ts","sourceRoot":"","sources":["../../../../../src/script/templates/P2PKH.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"P2PKH.d.ts","sourceRoot":"","sources":["../../../../../src/script/templates/P2PKH.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,sBAAsB,CAAA;AAEjD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,eAAe,MAAM,uBAAuB,CAAA;AACnD,OAAO,WAAW,MAAM,kCAAkC,CAAA;AAC1D,OAAO,UAAU,MAAM,gCAAgC,CAAA;AAIvD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,KAAM,YAAW,cAAc;IAClD;;;;;OAKG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,aAAa;IAkBlD;;;;;;;;;;;;OAYG;IACH,MAAM,CACJ,UAAU,EAAE,UAAU,EACtB,WAAW,GAAE,KAAK,GAAG,MAAM,GAAG,QAAgB,EAC9C,YAAY,GAAE,OAAe,GAC5B;QACD,IAAI,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;QACvE,cAAc,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;KACnC;CAyDF"}
|