@bsv/sdk 1.6.14 → 1.6.16
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/auth/certificates/__tests/CompletedProtoWallet.js +1 -1
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/cjs/src/primitives/Point.js +123 -6
- package/dist/cjs/src/primitives/Point.js.map +1 -1
- package/dist/cjs/src/primitives/PrivateKey.js +19 -2
- package/dist/cjs/src/primitives/PrivateKey.js.map +1 -1
- package/dist/cjs/src/primitives/PublicKey.js +19 -2
- package/dist/cjs/src/primitives/PublicKey.js.map +1 -1
- package/dist/cjs/src/wallet/CachedKeyDeriver.js +12 -1
- package/dist/cjs/src/wallet/CachedKeyDeriver.js.map +1 -1
- package/dist/cjs/src/wallet/KeyDeriver.js +8 -5
- package/dist/cjs/src/wallet/KeyDeriver.js.map +1 -1
- package/dist/cjs/src/wallet/ProtoWallet.js +5 -2
- package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js +2 -2
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/esm/src/primitives/Point.js +123 -6
- package/dist/esm/src/primitives/Point.js.map +1 -1
- package/dist/esm/src/primitives/PrivateKey.js +19 -2
- package/dist/esm/src/primitives/PrivateKey.js.map +1 -1
- package/dist/esm/src/primitives/PublicKey.js +19 -2
- package/dist/esm/src/primitives/PublicKey.js.map +1 -1
- package/dist/esm/src/wallet/CachedKeyDeriver.js +20 -1
- package/dist/esm/src/wallet/CachedKeyDeriver.js.map +1 -1
- package/dist/esm/src/wallet/KeyDeriver.js +11 -5
- package/dist/esm/src/wallet/KeyDeriver.js.map +1 -1
- package/dist/esm/src/wallet/ProtoWallet.js +2 -2
- package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts.map +1 -1
- package/dist/types/src/primitives/Point.d.ts.map +1 -1
- package/dist/types/src/primitives/PrivateKey.d.ts +3 -1
- package/dist/types/src/primitives/PrivateKey.d.ts.map +1 -1
- package/dist/types/src/primitives/PublicKey.d.ts +3 -1
- package/dist/types/src/primitives/PublicKey.d.ts.map +1 -1
- package/dist/types/src/transaction/http/HttpClient.d.ts +2 -0
- package/dist/types/src/transaction/http/HttpClient.d.ts.map +1 -1
- package/dist/types/src/wallet/CachedKeyDeriver.d.ts +10 -2
- package/dist/types/src/wallet/CachedKeyDeriver.d.ts.map +1 -1
- package/dist/types/src/wallet/KeyDeriver.d.ts +5 -2
- package/dist/types/src/wallet/KeyDeriver.d.ts.map +1 -1
- package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/reference/auth.md +159 -212
- package/docs/reference/compat.md +96 -120
- package/docs/reference/identity.md +12 -21
- package/docs/reference/kvstore.md +19 -21
- package/docs/reference/messages.md +0 -3
- package/docs/reference/overlay-tools.md +18 -46
- package/docs/reference/primitives.md +404 -577
- package/docs/reference/registry.md +20 -43
- package/docs/reference/script.md +105 -140
- package/docs/reference/storage.md +12 -32
- package/docs/reference/totp.md +11 -16
- package/docs/reference/transaction.md +129 -201
- package/docs/reference/wallet.md +89 -247
- package/package.json +1 -1
- package/src/auth/certificates/__tests/CompletedProtoWallet.ts +3 -2
- package/src/primitives/Point.ts +152 -5
- package/src/primitives/PrivateKey.ts +22 -2
- package/src/primitives/PublicKey.ts +22 -2
- package/src/transaction/http/HttpClient.ts +2 -0
- package/src/wallet/CachedKeyDeriver.ts +32 -8
- package/src/wallet/KeyDeriver.ts +22 -6
- package/src/wallet/ProtoWallet.ts +3 -2
|
@@ -52,7 +52,6 @@ See also: [Curve](./primitives.md#class-curve)
|
|
|
52
52
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
53
53
|
|
|
54
54
|
---
|
|
55
|
-
|
|
56
55
|
### Class: BigNumber
|
|
57
56
|
|
|
58
57
|
JavaScript numbers are only precise up to 53 bits. Since Bitcoin relies on
|
|
@@ -229,12 +228,12 @@ constructor(number: number | string | number[] | bigint | undefined = 0, base: n
|
|
|
229
228
|
|
|
230
229
|
Argument Details
|
|
231
230
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
231
|
+
+ **number**
|
|
232
|
+
+ The number (various types accepted) to construct a BigNumber from. Default is 0.
|
|
233
|
+
+ **base**
|
|
234
|
+
+ The base of number provided. By default is 10.
|
|
235
|
+
+ **endian**
|
|
236
|
+
+ The endianness provided. By default is 'big endian'.
|
|
238
237
|
|
|
239
238
|
#### Property red
|
|
240
239
|
|
|
@@ -243,7 +242,6 @@ Reduction context of the big number.
|
|
|
243
242
|
```ts
|
|
244
243
|
public red: ReductionContext | null
|
|
245
244
|
```
|
|
246
|
-
|
|
247
245
|
See also: [ReductionContext](./primitives.md#class-reductioncontext)
|
|
248
246
|
|
|
249
247
|
#### Property wordSize
|
|
@@ -268,7 +266,6 @@ The multiplicative inverse is a number which when multiplied with the current Bi
|
|
|
268
266
|
```ts
|
|
269
267
|
_invmp(p: BigNumber): BigNumber
|
|
270
268
|
```
|
|
271
|
-
|
|
272
269
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
273
270
|
|
|
274
271
|
Returns
|
|
@@ -277,8 +274,8 @@ The multiplicative inverse `BigNumber` in the modulus field specified by `p`.
|
|
|
277
274
|
|
|
278
275
|
Argument Details
|
|
279
276
|
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
+ **p**
|
|
278
|
+
+ The `BigNumber` specifying the modulus field.
|
|
282
279
|
|
|
283
280
|
#### Method bitLength
|
|
284
281
|
|
|
@@ -313,7 +310,6 @@ Creates a BigNumber from a number representing the "bits" value in a block heade
|
|
|
313
310
|
```ts
|
|
314
311
|
static fromBits(bits: number, strict: boolean = false): BigNumber
|
|
315
312
|
```
|
|
316
|
-
|
|
317
313
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
318
314
|
|
|
319
315
|
Returns
|
|
@@ -322,10 +318,10 @@ Returns a BigNumber equivalent to the "bits" value in a block header.
|
|
|
322
318
|
|
|
323
319
|
Argument Details
|
|
324
320
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
321
|
+
+ **bits**
|
|
322
|
+
+ The number representing the bits value in a block header.
|
|
323
|
+
+ **strict**
|
|
324
|
+
+ If true, an error is thrown if the number has negative bit set.
|
|
329
325
|
|
|
330
326
|
Throws
|
|
331
327
|
|
|
@@ -338,7 +334,6 @@ Creates a BigNumber from a hexadecimal string.
|
|
|
338
334
|
```ts
|
|
339
335
|
static fromHex(hex: string, endian?: "le" | "be" | "little" | "big"): BigNumber
|
|
340
336
|
```
|
|
341
|
-
|
|
342
337
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
343
338
|
|
|
344
339
|
Returns
|
|
@@ -347,10 +342,10 @@ Returns a BigNumber created from the hexadecimal input string.
|
|
|
347
342
|
|
|
348
343
|
Argument Details
|
|
349
344
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
345
|
+
+ **hex**
|
|
346
|
+
+ The hexadecimal string to create a BigNumber from.
|
|
347
|
+
+ **endian**
|
|
348
|
+
+ Optional endianness for parsing the hex string.
|
|
354
349
|
|
|
355
350
|
Example
|
|
356
351
|
|
|
@@ -366,7 +361,6 @@ Creates a BigNumber from a JSON-serialized string.
|
|
|
366
361
|
```ts
|
|
367
362
|
static fromJSON(str: string): BigNumber
|
|
368
363
|
```
|
|
369
|
-
|
|
370
364
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
371
365
|
|
|
372
366
|
Returns
|
|
@@ -375,8 +369,8 @@ Returns a BigNumber created from the JSON input string.
|
|
|
375
369
|
|
|
376
370
|
Argument Details
|
|
377
371
|
|
|
378
|
-
|
|
379
|
-
|
|
372
|
+
+ **str**
|
|
373
|
+
+ The JSON-serialized string to create a BigNumber from.
|
|
380
374
|
|
|
381
375
|
#### Method fromNumber
|
|
382
376
|
|
|
@@ -385,7 +379,6 @@ Creates a BigNumber from a number.
|
|
|
385
379
|
```ts
|
|
386
380
|
static fromNumber(n: number): BigNumber
|
|
387
381
|
```
|
|
388
|
-
|
|
389
382
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
390
383
|
|
|
391
384
|
Returns
|
|
@@ -394,8 +387,8 @@ Returns a BigNumber equivalent to the input number.
|
|
|
394
387
|
|
|
395
388
|
Argument Details
|
|
396
389
|
|
|
397
|
-
|
|
398
|
-
|
|
390
|
+
+ **n**
|
|
391
|
+
+ The number to create a BigNumber from.
|
|
399
392
|
|
|
400
393
|
#### Method fromScriptNum
|
|
401
394
|
|
|
@@ -404,7 +397,6 @@ Creates a BigNumber from the format used in Bitcoin scripts.
|
|
|
404
397
|
```ts
|
|
405
398
|
static fromScriptNum(num: number[], requireMinimal: boolean = false, maxNumSize?: number): BigNumber
|
|
406
399
|
```
|
|
407
|
-
|
|
408
400
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
409
401
|
|
|
410
402
|
Returns
|
|
@@ -413,12 +405,12 @@ Returns a BigNumber equivalent to the number used in a Bitcoin script.
|
|
|
413
405
|
|
|
414
406
|
Argument Details
|
|
415
407
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
408
|
+
+ **num**
|
|
409
|
+
+ The number in the format used in Bitcoin scripts.
|
|
410
|
+
+ **requireMinimal**
|
|
411
|
+
+ If true, non-minimally encoded values will throw an error.
|
|
412
|
+
+ **maxNumSize**
|
|
413
|
+
+ The maximum allowed size for the number.
|
|
422
414
|
|
|
423
415
|
#### Method fromSm
|
|
424
416
|
|
|
@@ -427,7 +419,6 @@ Creates a BigNumber from a signed magnitude number.
|
|
|
427
419
|
```ts
|
|
428
420
|
static fromSm(bytes: number[], endian: "big" | "little" = "big"): BigNumber
|
|
429
421
|
```
|
|
430
|
-
|
|
431
422
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
432
423
|
|
|
433
424
|
Returns
|
|
@@ -436,10 +427,10 @@ Returns a BigNumber equivalent to the signed magnitude number interpreted with s
|
|
|
436
427
|
|
|
437
428
|
Argument Details
|
|
438
429
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
430
|
+
+ **bytes**
|
|
431
|
+
+ The signed magnitude number to convert to a BigNumber.
|
|
432
|
+
+ **endian**
|
|
433
|
+
+ Defines endianess. If not provided, big endian is assumed.
|
|
443
434
|
|
|
444
435
|
#### Method fromString
|
|
445
436
|
|
|
@@ -448,7 +439,6 @@ Creates a BigNumber from a string, considering an optional base.
|
|
|
448
439
|
```ts
|
|
449
440
|
static fromString(str: string, base?: number | "hex"): BigNumber
|
|
450
441
|
```
|
|
451
|
-
|
|
452
442
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
453
443
|
|
|
454
444
|
Returns
|
|
@@ -457,10 +447,10 @@ Returns a BigNumber equivalent to the string after conversion from the specified
|
|
|
457
447
|
|
|
458
448
|
Argument Details
|
|
459
449
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
450
|
+
+ **str**
|
|
451
|
+
+ The string to create a BigNumber from.
|
|
452
|
+
+ **base**
|
|
453
|
+
+ The base used for conversion. If not provided, base 10 is assumed.
|
|
464
454
|
|
|
465
455
|
#### Method isBN
|
|
466
456
|
|
|
@@ -476,8 +466,8 @@ Returns
|
|
|
476
466
|
|
|
477
467
|
Argument Details
|
|
478
468
|
|
|
479
|
-
|
|
480
|
-
|
|
469
|
+
+ **num**
|
|
470
|
+
+ The value to be checked.
|
|
481
471
|
|
|
482
472
|
#### Method max
|
|
483
473
|
|
|
@@ -486,7 +476,6 @@ Returns the bigger value between two BigNumbers
|
|
|
486
476
|
```ts
|
|
487
477
|
static max(left: BigNumber, right: BigNumber): BigNumber
|
|
488
478
|
```
|
|
489
|
-
|
|
490
479
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
491
480
|
|
|
492
481
|
Returns
|
|
@@ -495,10 +484,10 @@ Returns
|
|
|
495
484
|
|
|
496
485
|
Argument Details
|
|
497
486
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
487
|
+
+ **left**
|
|
488
|
+
+ The first BigNumber to be compared.
|
|
489
|
+
+ **right**
|
|
490
|
+
+ The second BigNumber to be compared.
|
|
502
491
|
|
|
503
492
|
#### Method min
|
|
504
493
|
|
|
@@ -507,7 +496,6 @@ Returns the smaller value between two BigNumbers
|
|
|
507
496
|
```ts
|
|
508
497
|
static min(left: BigNumber, right: BigNumber): BigNumber
|
|
509
498
|
```
|
|
510
|
-
|
|
511
499
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
512
500
|
|
|
513
501
|
Returns
|
|
@@ -516,10 +504,10 @@ Returns
|
|
|
516
504
|
|
|
517
505
|
Argument Details
|
|
518
506
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
507
|
+
+ **left**
|
|
508
|
+
+ The first BigNumber to be compared.
|
|
509
|
+
+ **right**
|
|
510
|
+
+ The second BigNumber to be compared.
|
|
523
511
|
|
|
524
512
|
#### Method mulTo
|
|
525
513
|
|
|
@@ -529,7 +517,6 @@ It chooses the multiplication method based on the lengths of the numbers to opti
|
|
|
529
517
|
```ts
|
|
530
518
|
mulTo(num: BigNumber, out: BigNumber): BigNumber
|
|
531
519
|
```
|
|
532
|
-
|
|
533
520
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
534
521
|
|
|
535
522
|
Returns
|
|
@@ -538,10 +525,10 @@ The BigNumber resulting from the multiplication operation.
|
|
|
538
525
|
|
|
539
526
|
Argument Details
|
|
540
527
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
528
|
+
+ **num**
|
|
529
|
+
+ The BigNumber multiply with.
|
|
530
|
+
+ **out**
|
|
531
|
+
+ The BigNumber where to store the result.
|
|
545
532
|
|
|
546
533
|
#### Method toArray
|
|
547
534
|
|
|
@@ -557,10 +544,10 @@ Array of bytes representing the BigNumber.
|
|
|
557
544
|
|
|
558
545
|
Argument Details
|
|
559
546
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
547
|
+
+ **endian**
|
|
548
|
+
+ Endianness of the output array, defaults to 'be'.
|
|
549
|
+
+ **length**
|
|
550
|
+
+ Optional length of the output array.
|
|
564
551
|
|
|
565
552
|
#### Method toBitArray
|
|
566
553
|
|
|
@@ -569,7 +556,6 @@ Converts a BigNumber to an array of bits.
|
|
|
569
556
|
```ts
|
|
570
557
|
static toBitArray(num: BigNumber): Array<0 | 1>
|
|
571
558
|
```
|
|
572
|
-
|
|
573
559
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
574
560
|
|
|
575
561
|
Returns
|
|
@@ -578,8 +564,8 @@ An array of bits.
|
|
|
578
564
|
|
|
579
565
|
Argument Details
|
|
580
566
|
|
|
581
|
-
|
|
582
|
-
|
|
567
|
+
+ **num**
|
|
568
|
+
+ The BigNumber to convert.
|
|
583
569
|
|
|
584
570
|
#### Method toBits
|
|
585
571
|
|
|
@@ -607,8 +593,8 @@ Returns a string representing the hexadecimal value of this BigNumber.
|
|
|
607
593
|
|
|
608
594
|
Argument Details
|
|
609
595
|
|
|
610
|
-
|
|
611
|
-
|
|
596
|
+
+ **length**
|
|
597
|
+
+ The minimum length of the hex string
|
|
612
598
|
|
|
613
599
|
Example
|
|
614
600
|
|
|
@@ -672,8 +658,8 @@ Returns an array equivalent to this BigNumber interpreted as a signed magnitude
|
|
|
672
658
|
|
|
673
659
|
Argument Details
|
|
674
660
|
|
|
675
|
-
|
|
676
|
-
|
|
661
|
+
+ **endian**
|
|
662
|
+
+ Defines endianess. If not provided, big endian is assumed.
|
|
677
663
|
|
|
678
664
|
#### Method toString
|
|
679
665
|
|
|
@@ -691,10 +677,10 @@ The string representation of the BigNumber instance
|
|
|
691
677
|
|
|
692
678
|
Argument Details
|
|
693
679
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
680
|
+
+ **base**
|
|
681
|
+
+ The base for representing number. Default is 10. Other accepted values are 16 and 'hex'.
|
|
682
|
+
+ **padding**
|
|
683
|
+
+ Represents the minimum number of digits to represent the BigNumber as a string. Default is 1.
|
|
698
684
|
|
|
699
685
|
#### Method zeroBits
|
|
700
686
|
|
|
@@ -719,7 +705,6 @@ const zeroBits = bn.zeroBits(); // 3
|
|
|
719
705
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
720
706
|
|
|
721
707
|
---
|
|
722
|
-
|
|
723
708
|
### Class: Curve
|
|
724
709
|
|
|
725
710
|
```ts
|
|
@@ -794,7 +779,6 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#
|
|
|
794
779
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
795
780
|
|
|
796
781
|
---
|
|
797
|
-
|
|
798
782
|
### Class: DRBG
|
|
799
783
|
|
|
800
784
|
This class behaves as a HMAC-based deterministic random bit generator (DRBG). It implements a deterministic random number generator using SHA256HMAC HASH function. It takes an initial entropy and nonce when instantiated for seeding purpose.
|
|
@@ -833,8 +817,8 @@ The required deterministic random hexadecimal string.
|
|
|
833
817
|
|
|
834
818
|
Argument Details
|
|
835
819
|
|
|
836
|
-
|
|
837
|
-
|
|
820
|
+
+ **len**
|
|
821
|
+
+ The length of required random number.
|
|
838
822
|
|
|
839
823
|
Example
|
|
840
824
|
|
|
@@ -849,7 +833,6 @@ Generates HMAC using the K value of the instance. This method is used internally
|
|
|
849
833
|
```ts
|
|
850
834
|
hmac(): SHA256HMAC
|
|
851
835
|
```
|
|
852
|
-
|
|
853
836
|
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
854
837
|
|
|
855
838
|
Returns
|
|
@@ -877,8 +860,8 @@ Nothing, but updates the internal state `K` and `V` value.
|
|
|
877
860
|
|
|
878
861
|
Argument Details
|
|
879
862
|
|
|
880
|
-
|
|
881
|
-
|
|
863
|
+
+ **seed**
|
|
864
|
+
+ an optional value that used to update `K` and `V`. Default is `undefined`.
|
|
882
865
|
|
|
883
866
|
Example
|
|
884
867
|
|
|
@@ -889,7 +872,6 @@ drbg.update('e13af...');
|
|
|
889
872
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
890
873
|
|
|
891
874
|
---
|
|
892
|
-
|
|
893
875
|
### Class: JacobianPoint
|
|
894
876
|
|
|
895
877
|
The `JacobianPoint` class extends the `BasePoint` class for handling Jacobian coordinates on an Elliptic Curve.
|
|
@@ -932,19 +914,18 @@ Constructs a new `JacobianPoint` instance.
|
|
|
932
914
|
```ts
|
|
933
915
|
constructor(x: string | BigNumber | null, y: string | BigNumber | null, z: string | BigNumber | null)
|
|
934
916
|
```
|
|
935
|
-
|
|
936
917
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
937
918
|
|
|
938
919
|
Argument Details
|
|
939
920
|
|
|
940
|
-
|
|
941
|
-
|
|
921
|
+
+ **x**
|
|
922
|
+
+ If `null`, the x-coordinate will default to the curve's defined 'one' constant.
|
|
942
923
|
If `x` is not a BigNumber, `x` will be converted to a `BigNumber` assuming it is a hex string.
|
|
943
|
-
|
|
944
|
-
|
|
924
|
+
+ **y**
|
|
925
|
+
+ If `null`, the y-coordinate will default to the curve's defined 'one' constant.
|
|
945
926
|
If `y` is not a BigNumber, `y` will be converted to a `BigNumber` assuming it is a hex string.
|
|
946
|
-
|
|
947
|
-
|
|
927
|
+
+ **z**
|
|
928
|
+
+ If `null`, the z-coordinate will default to 0.
|
|
948
929
|
If `z` is not a BigNumber, `z` will be converted to a `BigNumber` assuming it is a hex string.
|
|
949
930
|
|
|
950
931
|
Example
|
|
@@ -961,7 +942,6 @@ The `x` coordinate of the point in the Jacobian form.
|
|
|
961
942
|
```ts
|
|
962
943
|
x: BigNumber
|
|
963
944
|
```
|
|
964
|
-
|
|
965
945
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
966
946
|
|
|
967
947
|
#### Property y
|
|
@@ -971,7 +951,6 @@ The `y` coordinate of the point in the Jacobian form.
|
|
|
971
951
|
```ts
|
|
972
952
|
y: BigNumber
|
|
973
953
|
```
|
|
974
|
-
|
|
975
954
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
976
955
|
|
|
977
956
|
#### Property z
|
|
@@ -981,7 +960,6 @@ The `z` coordinate of the point in the Jacobian form.
|
|
|
981
960
|
```ts
|
|
982
961
|
z: BigNumber
|
|
983
962
|
```
|
|
984
|
-
|
|
985
963
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
986
964
|
|
|
987
965
|
#### Property zOne
|
|
@@ -1001,7 +979,6 @@ when either one of the points is the point at infinity, it will return the other
|
|
|
1001
979
|
```ts
|
|
1002
980
|
add(p: JacobianPoint): JacobianPoint
|
|
1003
981
|
```
|
|
1004
|
-
|
|
1005
982
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1006
983
|
|
|
1007
984
|
Returns
|
|
@@ -1010,8 +987,8 @@ Returns a new Jacobian point as the result of the addition.
|
|
|
1010
987
|
|
|
1011
988
|
Argument Details
|
|
1012
989
|
|
|
1013
|
-
|
|
1014
|
-
|
|
990
|
+
+ **p**
|
|
991
|
+
+ The Jacobian point to be added.
|
|
1015
992
|
|
|
1016
993
|
Example
|
|
1017
994
|
|
|
@@ -1028,7 +1005,6 @@ Point doubling operation in the Jacobian coordinates. A special case is when the
|
|
|
1028
1005
|
```ts
|
|
1029
1006
|
dbl(): JacobianPoint
|
|
1030
1007
|
```
|
|
1031
|
-
|
|
1032
1008
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1033
1009
|
|
|
1034
1010
|
Returns
|
|
@@ -1049,7 +1025,6 @@ Multiple doubling operation. It doubles the Jacobian point as many times as the
|
|
|
1049
1025
|
```ts
|
|
1050
1026
|
dblp(pow: number): JacobianPoint
|
|
1051
1027
|
```
|
|
1052
|
-
|
|
1053
1028
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1054
1029
|
|
|
1055
1030
|
Returns
|
|
@@ -1058,8 +1033,8 @@ Returns a new Jacobian point as the result of multiple doublings.
|
|
|
1058
1033
|
|
|
1059
1034
|
Argument Details
|
|
1060
1035
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1036
|
+
+ **pow**
|
|
1037
|
+
+ The number of times the point should be doubled.
|
|
1063
1038
|
|
|
1064
1039
|
Example
|
|
1065
1040
|
|
|
@@ -1075,7 +1050,6 @@ Equality check operation. It checks whether the affine or Jacobian point is equa
|
|
|
1075
1050
|
```ts
|
|
1076
1051
|
eq(p: Point | JacobianPoint): boolean
|
|
1077
1052
|
```
|
|
1078
|
-
|
|
1079
1053
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point)
|
|
1080
1054
|
|
|
1081
1055
|
Returns
|
|
@@ -1084,8 +1058,8 @@ Returns true if the points are equal, otherwise returns false.
|
|
|
1084
1058
|
|
|
1085
1059
|
Argument Details
|
|
1086
1060
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1061
|
+
+ **p**
|
|
1062
|
+
+ The affine or Jacobian point to compare with.
|
|
1089
1063
|
|
|
1090
1064
|
Example
|
|
1091
1065
|
|
|
@@ -1104,7 +1078,6 @@ of a point in projective coordinates.
|
|
|
1104
1078
|
```ts
|
|
1105
1079
|
eqXToP(x: BigNumber): boolean
|
|
1106
1080
|
```
|
|
1107
|
-
|
|
1108
1081
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1109
1082
|
|
|
1110
1083
|
Returns
|
|
@@ -1113,8 +1086,8 @@ Returns true if the x coordinates are equal, otherwise returns false.
|
|
|
1113
1086
|
|
|
1114
1087
|
Argument Details
|
|
1115
1088
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1089
|
+
+ **x**
|
|
1090
|
+
+ The x coordinate of a point in projective coordinates.
|
|
1118
1091
|
|
|
1119
1092
|
Example
|
|
1120
1093
|
|
|
@@ -1170,7 +1143,6 @@ the affine point to Jacobian, and then preforms the addition.
|
|
|
1170
1143
|
```ts
|
|
1171
1144
|
mixedAdd(p: Point): JacobianPoint
|
|
1172
1145
|
```
|
|
1173
|
-
|
|
1174
1146
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point)
|
|
1175
1147
|
|
|
1176
1148
|
Returns
|
|
@@ -1179,8 +1151,8 @@ Returns the result of the mixed addition as a new Jacobian point.
|
|
|
1179
1151
|
|
|
1180
1152
|
Argument Details
|
|
1181
1153
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1154
|
+
+ **p**
|
|
1155
|
+
+ The affine point to be added.
|
|
1184
1156
|
|
|
1185
1157
|
Example
|
|
1186
1158
|
|
|
@@ -1197,7 +1169,6 @@ Negation operation. It returns the additive inverse of the Jacobian point.
|
|
|
1197
1169
|
```ts
|
|
1198
1170
|
neg(): JacobianPoint
|
|
1199
1171
|
```
|
|
1200
|
-
|
|
1201
1172
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1202
1173
|
|
|
1203
1174
|
Returns
|
|
@@ -1218,7 +1189,6 @@ Converts the `JacobianPoint` object instance to standard affine `Point` format a
|
|
|
1218
1189
|
```ts
|
|
1219
1190
|
toP(): Point
|
|
1220
1191
|
```
|
|
1221
|
-
|
|
1222
1192
|
See also: [Point](./primitives.md#class-point)
|
|
1223
1193
|
|
|
1224
1194
|
Returns
|
|
@@ -1237,7 +1207,6 @@ const pointP = pointJ.toP(); // The point in affine coordinates.
|
|
|
1237
1207
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1238
1208
|
|
|
1239
1209
|
---
|
|
1240
|
-
|
|
1241
1210
|
### Class: K256
|
|
1242
1211
|
|
|
1243
1212
|
A class representing K-256, a prime number with optimizations, specifically used in the secp256k1 curve.
|
|
@@ -1283,7 +1252,6 @@ Multiplies a BigNumber ('num') with the constant 'K' in-place and returns the re
|
|
|
1283
1252
|
```ts
|
|
1284
1253
|
imulK(num: BigNumber): BigNumber
|
|
1285
1254
|
```
|
|
1286
|
-
|
|
1287
1255
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1288
1256
|
|
|
1289
1257
|
Returns
|
|
@@ -1292,8 +1260,8 @@ Returns the mutated BigNumber after multiplication.
|
|
|
1292
1260
|
|
|
1293
1261
|
Argument Details
|
|
1294
1262
|
|
|
1295
|
-
|
|
1296
|
-
|
|
1263
|
+
+ **num**
|
|
1264
|
+
+ The BigNumber to multiply with K.
|
|
1297
1265
|
|
|
1298
1266
|
Example
|
|
1299
1267
|
|
|
@@ -1310,15 +1278,14 @@ rules. This method modifies the input and output big numbers.
|
|
|
1310
1278
|
```ts
|
|
1311
1279
|
split(input: BigNumber, output: BigNumber): void
|
|
1312
1280
|
```
|
|
1313
|
-
|
|
1314
1281
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1315
1282
|
|
|
1316
1283
|
Argument Details
|
|
1317
1284
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1285
|
+
+ **input**
|
|
1286
|
+
+ The BigNumber to be split.
|
|
1287
|
+
+ **output**
|
|
1288
|
+
+ The BigNumber that results from the split.
|
|
1322
1289
|
|
|
1323
1290
|
Example
|
|
1324
1291
|
|
|
@@ -1331,7 +1298,6 @@ k256.split(input, output);
|
|
|
1331
1298
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1332
1299
|
|
|
1333
1300
|
---
|
|
1334
|
-
|
|
1335
1301
|
### Class: KeyShares
|
|
1336
1302
|
|
|
1337
1303
|
Example
|
|
@@ -1356,7 +1322,6 @@ See also: [PointInFiniteField](./primitives.md#class-pointinfinitefield)
|
|
|
1356
1322
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1357
1323
|
|
|
1358
1324
|
---
|
|
1359
|
-
|
|
1360
1325
|
### Class: Mersenne
|
|
1361
1326
|
|
|
1362
1327
|
A representation of a pseudo-Mersenne prime.
|
|
@@ -1385,10 +1350,10 @@ constructor(name: string, p: string)
|
|
|
1385
1350
|
|
|
1386
1351
|
Argument Details
|
|
1387
1352
|
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1353
|
+
+ **name**
|
|
1354
|
+
+ An identifier for the Mersenne instance.
|
|
1355
|
+
+ **p**
|
|
1356
|
+
+ A string representation of the pseudo-Mersenne prime, expressed in hexadecimal.
|
|
1392
1357
|
|
|
1393
1358
|
Example
|
|
1394
1359
|
|
|
@@ -1403,7 +1368,6 @@ The constant subtracted from 2^n to derive a pseudo-Mersenne prime.
|
|
|
1403
1368
|
```ts
|
|
1404
1369
|
k: BigNumber
|
|
1405
1370
|
```
|
|
1406
|
-
|
|
1407
1371
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1408
1372
|
|
|
1409
1373
|
#### Property n
|
|
@@ -1429,7 +1393,6 @@ BigNumber equivalent to 2^n - k.
|
|
|
1429
1393
|
```ts
|
|
1430
1394
|
p: BigNumber
|
|
1431
1395
|
```
|
|
1432
|
-
|
|
1433
1396
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1434
1397
|
|
|
1435
1398
|
#### Method imulK
|
|
@@ -1439,7 +1402,6 @@ Performs an in-place multiplication of the parameter by constant k.
|
|
|
1439
1402
|
```ts
|
|
1440
1403
|
imulK(num: BigNumber): BigNumber
|
|
1441
1404
|
```
|
|
1442
|
-
|
|
1443
1405
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1444
1406
|
|
|
1445
1407
|
Returns
|
|
@@ -1448,8 +1410,8 @@ The result of the multiplication, in BigNumber format.
|
|
|
1448
1410
|
|
|
1449
1411
|
Argument Details
|
|
1450
1412
|
|
|
1451
|
-
|
|
1452
|
-
|
|
1413
|
+
+ **num**
|
|
1414
|
+
+ The BigNumber to multiply with k.
|
|
1453
1415
|
|
|
1454
1416
|
Example
|
|
1455
1417
|
|
|
@@ -1465,7 +1427,6 @@ it is less than the square of the pseudo-Mersenne prime.
|
|
|
1465
1427
|
```ts
|
|
1466
1428
|
ireduce(num: BigNumber): BigNumber
|
|
1467
1429
|
```
|
|
1468
|
-
|
|
1469
1430
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1470
1431
|
|
|
1471
1432
|
Returns
|
|
@@ -1474,8 +1435,8 @@ The reduced BigNumber.
|
|
|
1474
1435
|
|
|
1475
1436
|
Argument Details
|
|
1476
1437
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1438
|
+
+ **num**
|
|
1439
|
+
+ The BigNumber to be reduced.
|
|
1479
1440
|
|
|
1480
1441
|
Example
|
|
1481
1442
|
|
|
@@ -1491,15 +1452,14 @@ to meet the magnitude of the pseudo-Mersenne prime.
|
|
|
1491
1452
|
```ts
|
|
1492
1453
|
split(input: BigNumber, out: BigNumber): void
|
|
1493
1454
|
```
|
|
1494
|
-
|
|
1495
1455
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1496
1456
|
|
|
1497
1457
|
Argument Details
|
|
1498
1458
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1459
|
+
+ **input**
|
|
1460
|
+
+ The BigNumber to be shifted (will contain HI part).
|
|
1461
|
+
+ **out**
|
|
1462
|
+
+ The BigNumber to hold the shifted result (LO part).
|
|
1503
1463
|
|
|
1504
1464
|
Example
|
|
1505
1465
|
|
|
@@ -1510,7 +1470,6 @@ mersenne.split(new BigNumber('2345', 16), new BigNumber());
|
|
|
1510
1470
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1511
1471
|
|
|
1512
1472
|
---
|
|
1513
|
-
|
|
1514
1473
|
### Class: MontgomoryMethod
|
|
1515
1474
|
|
|
1516
1475
|
Represents a Montgomery reduction context, which is a mathematical method
|
|
@@ -1545,13 +1504,12 @@ See also: [BigNumber](./primitives.md#class-bignumber), [ReductionContext](./pri
|
|
|
1545
1504
|
```ts
|
|
1546
1505
|
constructor(m: BigNumber | "k256")
|
|
1547
1506
|
```
|
|
1548
|
-
|
|
1549
1507
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1550
1508
|
|
|
1551
1509
|
Argument Details
|
|
1552
1510
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1511
|
+
+ **m**
|
|
1512
|
+
+ The modulus to be used for the Montgomery method reductions.
|
|
1555
1513
|
|
|
1556
1514
|
#### Property minv
|
|
1557
1515
|
|
|
@@ -1560,7 +1518,6 @@ The modular multiplicative inverse of `m` mod `r`.
|
|
|
1560
1518
|
```ts
|
|
1561
1519
|
minv: BigNumber
|
|
1562
1520
|
```
|
|
1563
|
-
|
|
1564
1521
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1565
1522
|
|
|
1566
1523
|
#### Property r
|
|
@@ -1570,7 +1527,6 @@ The 2^shift, shifted left by the bit length of modulus `m`.
|
|
|
1570
1527
|
```ts
|
|
1571
1528
|
r: BigNumber
|
|
1572
1529
|
```
|
|
1573
|
-
|
|
1574
1530
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1575
1531
|
|
|
1576
1532
|
#### Property r2
|
|
@@ -1580,7 +1536,6 @@ The square of `r` modulo `m`.
|
|
|
1580
1536
|
```ts
|
|
1581
1537
|
r2: BigNumber
|
|
1582
1538
|
```
|
|
1583
|
-
|
|
1584
1539
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1585
1540
|
|
|
1586
1541
|
#### Property rinv
|
|
@@ -1590,7 +1545,6 @@ The modular multiplicative inverse of `r` mod `m`.
|
|
|
1590
1545
|
```ts
|
|
1591
1546
|
rinv: BigNumber
|
|
1592
1547
|
```
|
|
1593
|
-
|
|
1594
1548
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1595
1549
|
|
|
1596
1550
|
#### Property shift
|
|
@@ -1608,7 +1562,6 @@ Converts a number from the Montgomery domain back to the original domain.
|
|
|
1608
1562
|
```ts
|
|
1609
1563
|
convertFrom(num: BigNumber): BigNumber
|
|
1610
1564
|
```
|
|
1611
|
-
|
|
1612
1565
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1613
1566
|
|
|
1614
1567
|
Returns
|
|
@@ -1617,8 +1570,8 @@ The result of the conversion from the Montgomery domain.
|
|
|
1617
1570
|
|
|
1618
1571
|
Argument Details
|
|
1619
1572
|
|
|
1620
|
-
|
|
1621
|
-
|
|
1573
|
+
+ **num**
|
|
1574
|
+
+ The number to be converted from the Montgomery domain.
|
|
1622
1575
|
|
|
1623
1576
|
Example
|
|
1624
1577
|
|
|
@@ -1634,7 +1587,6 @@ Converts a number into the Montgomery domain.
|
|
|
1634
1587
|
```ts
|
|
1635
1588
|
convertTo(num: BigNumber): BigNumber
|
|
1636
1589
|
```
|
|
1637
|
-
|
|
1638
1590
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1639
1591
|
|
|
1640
1592
|
Returns
|
|
@@ -1643,8 +1595,8 @@ The result of the conversion into the Montgomery domain.
|
|
|
1643
1595
|
|
|
1644
1596
|
Argument Details
|
|
1645
1597
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1598
|
+
+ **num**
|
|
1599
|
+
+ The number to be converted into the Montgomery domain.
|
|
1648
1600
|
|
|
1649
1601
|
Example
|
|
1650
1602
|
|
|
@@ -1660,7 +1612,6 @@ Performs an in-place multiplication of two numbers in the Montgomery domain.
|
|
|
1660
1612
|
```ts
|
|
1661
1613
|
imul(a: BigNumber, b: BigNumber): BigNumber
|
|
1662
1614
|
```
|
|
1663
|
-
|
|
1664
1615
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1665
1616
|
|
|
1666
1617
|
Returns
|
|
@@ -1669,10 +1620,10 @@ The result of the in-place multiplication.
|
|
|
1669
1620
|
|
|
1670
1621
|
Argument Details
|
|
1671
1622
|
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1623
|
+
+ **a**
|
|
1624
|
+
+ The first number to multiply.
|
|
1625
|
+
+ **b**
|
|
1626
|
+
+ The second number to multiply.
|
|
1676
1627
|
|
|
1677
1628
|
Example
|
|
1678
1629
|
|
|
@@ -1688,7 +1639,6 @@ Calculates the modular multiplicative inverse of a number in the Montgomery doma
|
|
|
1688
1639
|
```ts
|
|
1689
1640
|
invm(a: BigNumber): BigNumber
|
|
1690
1641
|
```
|
|
1691
|
-
|
|
1692
1642
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1693
1643
|
|
|
1694
1644
|
Returns
|
|
@@ -1697,8 +1647,8 @@ The modular multiplicative inverse of 'a'.
|
|
|
1697
1647
|
|
|
1698
1648
|
Argument Details
|
|
1699
1649
|
|
|
1700
|
-
|
|
1701
|
-
|
|
1650
|
+
+ **a**
|
|
1651
|
+
+ The number to compute the modular multiplicative inverse of.
|
|
1702
1652
|
|
|
1703
1653
|
Example
|
|
1704
1654
|
|
|
@@ -1714,7 +1664,6 @@ Performs the multiplication of two numbers in the Montgomery domain.
|
|
|
1714
1664
|
```ts
|
|
1715
1665
|
mul(a: BigNumber, b: BigNumber): BigNumber
|
|
1716
1666
|
```
|
|
1717
|
-
|
|
1718
1667
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1719
1668
|
|
|
1720
1669
|
Returns
|
|
@@ -1723,10 +1672,10 @@ The result of the multiplication.
|
|
|
1723
1672
|
|
|
1724
1673
|
Argument Details
|
|
1725
1674
|
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1675
|
+
+ **a**
|
|
1676
|
+
+ The first number to multiply.
|
|
1677
|
+
+ **b**
|
|
1678
|
+
+ The second number to multiply.
|
|
1730
1679
|
|
|
1731
1680
|
Example
|
|
1732
1681
|
|
|
@@ -1738,7 +1687,6 @@ const product = montMethod.mul(a, b);
|
|
|
1738
1687
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1739
1688
|
|
|
1740
1689
|
---
|
|
1741
|
-
|
|
1742
1690
|
### Class: Point
|
|
1743
1691
|
|
|
1744
1692
|
`Point` class is a representation of an elliptic curve point with affine coordinates.
|
|
@@ -1796,17 +1744,16 @@ See also: [BasePoint](./primitives.md#class-basepoint), [BigNumber](./primitives
|
|
|
1796
1744
|
```ts
|
|
1797
1745
|
constructor(x: BigNumber | number | number[] | string | null, y: BigNumber | number | number[] | string | null, isRed: boolean = true)
|
|
1798
1746
|
```
|
|
1799
|
-
|
|
1800
1747
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1801
1748
|
|
|
1802
1749
|
Argument Details
|
|
1803
1750
|
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1751
|
+
+ **x**
|
|
1752
|
+
+ 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.
|
|
1753
|
+
+ **y**
|
|
1754
|
+
+ The y-coordinate of the point, similar to x.
|
|
1755
|
+
+ **isRed**
|
|
1756
|
+
+ A boolean indicating if the point is a member of the field of integers modulo the k256 prime. Default is true.
|
|
1810
1757
|
|
|
1811
1758
|
Example
|
|
1812
1759
|
|
|
@@ -1830,7 +1777,6 @@ The x-coordinate of the point.
|
|
|
1830
1777
|
```ts
|
|
1831
1778
|
x: BigNumber | null
|
|
1832
1779
|
```
|
|
1833
|
-
|
|
1834
1780
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1835
1781
|
|
|
1836
1782
|
#### Property y
|
|
@@ -1840,7 +1786,6 @@ The y-coordinate of the point.
|
|
|
1840
1786
|
```ts
|
|
1841
1787
|
y: BigNumber | null
|
|
1842
1788
|
```
|
|
1843
|
-
|
|
1844
1789
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1845
1790
|
|
|
1846
1791
|
#### Method add
|
|
@@ -1850,7 +1795,6 @@ Adds another Point to this Point, returning a new Point.
|
|
|
1850
1795
|
```ts
|
|
1851
1796
|
add(p: Point): Point
|
|
1852
1797
|
```
|
|
1853
|
-
|
|
1854
1798
|
See also: [Point](./primitives.md#class-point)
|
|
1855
1799
|
|
|
1856
1800
|
Returns
|
|
@@ -1859,8 +1803,8 @@ A new Point that results from the addition.
|
|
|
1859
1803
|
|
|
1860
1804
|
Argument Details
|
|
1861
1805
|
|
|
1862
|
-
|
|
1863
|
-
|
|
1806
|
+
+ **p**
|
|
1807
|
+
+ The Point to add to this one.
|
|
1864
1808
|
|
|
1865
1809
|
Example
|
|
1866
1810
|
|
|
@@ -1877,7 +1821,6 @@ Doubles the current point.
|
|
|
1877
1821
|
```ts
|
|
1878
1822
|
dbl(): Point
|
|
1879
1823
|
```
|
|
1880
|
-
|
|
1881
1824
|
See also: [Point](./primitives.md#class-point)
|
|
1882
1825
|
|
|
1883
1826
|
Example
|
|
@@ -1897,7 +1840,6 @@ a point at infinity is still infinity.
|
|
|
1897
1840
|
```ts
|
|
1898
1841
|
dblp(k: number): Point
|
|
1899
1842
|
```
|
|
1900
|
-
|
|
1901
1843
|
See also: [Point](./primitives.md#class-point)
|
|
1902
1844
|
|
|
1903
1845
|
Returns
|
|
@@ -1906,8 +1848,8 @@ The Point after 'k' "doubling" operations have been performed.
|
|
|
1906
1848
|
|
|
1907
1849
|
Argument Details
|
|
1908
1850
|
|
|
1909
|
-
|
|
1910
|
-
|
|
1851
|
+
+ **k**
|
|
1852
|
+
+ The number of times the "doubling" operation is to be performed on the Point.
|
|
1911
1853
|
|
|
1912
1854
|
Example
|
|
1913
1855
|
|
|
@@ -1931,10 +1873,10 @@ If enc is undefined, a byte array representation of the point will be returned.
|
|
|
1931
1873
|
|
|
1932
1874
|
Argument Details
|
|
1933
1875
|
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1876
|
+
+ **compact**
|
|
1877
|
+
+ If true, an additional prefix byte 0x02 or 0x03 based on the 'y' coordinate being even or odd respectively is used. If false, byte 0x04 is used.
|
|
1878
|
+
+ **enc**
|
|
1879
|
+
+ Expects the string 'hex' if hexadecimal string encoding is required instead of an array of numbers.
|
|
1938
1880
|
|
|
1939
1881
|
Throws
|
|
1940
1882
|
|
|
@@ -1955,7 +1897,6 @@ Checks if the Point instance is equal to another given Point.
|
|
|
1955
1897
|
```ts
|
|
1956
1898
|
eq(p: Point): boolean
|
|
1957
1899
|
```
|
|
1958
|
-
|
|
1959
1900
|
See also: [Point](./primitives.md#class-point)
|
|
1960
1901
|
|
|
1961
1902
|
Returns
|
|
@@ -1964,8 +1905,8 @@ Whether the two Point instances are equal. Both the 'x' and 'y' coordinates have
|
|
|
1964
1905
|
|
|
1965
1906
|
Argument Details
|
|
1966
1907
|
|
|
1967
|
-
|
|
1968
|
-
|
|
1908
|
+
+ **p**
|
|
1909
|
+
+ The Point to be checked if equal to the current instance.
|
|
1969
1910
|
|
|
1970
1911
|
Example
|
|
1971
1912
|
|
|
@@ -1984,7 +1925,6 @@ The function verifies the integrity of the provided data and throws errors if in
|
|
|
1984
1925
|
```ts
|
|
1985
1926
|
static fromDER(bytes: number[]): Point
|
|
1986
1927
|
```
|
|
1987
|
-
|
|
1988
1928
|
See also: [Point](./primitives.md#class-point)
|
|
1989
1929
|
|
|
1990
1930
|
Returns
|
|
@@ -1993,8 +1933,8 @@ Returns a new point representing the given string.
|
|
|
1993
1933
|
|
|
1994
1934
|
Argument Details
|
|
1995
1935
|
|
|
1996
|
-
|
|
1997
|
-
|
|
1936
|
+
+ **bytes**
|
|
1937
|
+
+ The point representation number array.
|
|
1998
1938
|
|
|
1999
1939
|
Throws
|
|
2000
1940
|
|
|
@@ -2018,7 +1958,6 @@ JSON points into proper Point objects.
|
|
|
2018
1958
|
```ts
|
|
2019
1959
|
static fromJSON(obj: string | any[], isRed: boolean): Point
|
|
2020
1960
|
```
|
|
2021
|
-
|
|
2022
1961
|
See also: [Point](./primitives.md#class-point)
|
|
2023
1962
|
|
|
2024
1963
|
Returns
|
|
@@ -2027,10 +1966,10 @@ Returns a new point based on the deserialized JSON object.
|
|
|
2027
1966
|
|
|
2028
1967
|
Argument Details
|
|
2029
1968
|
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
1969
|
+
+ **obj**
|
|
1970
|
+
+ An object or array that holds the data for the point.
|
|
1971
|
+
+ **isRed**
|
|
1972
|
+
+ A boolean to direct how the Point is constructed from the JSON object.
|
|
2034
1973
|
|
|
2035
1974
|
Example
|
|
2036
1975
|
|
|
@@ -2048,7 +1987,6 @@ The function verifies the integrity of the provided data and throws errors if in
|
|
|
2048
1987
|
```ts
|
|
2049
1988
|
static fromString(str: string): Point
|
|
2050
1989
|
```
|
|
2051
|
-
|
|
2052
1990
|
See also: [Point](./primitives.md#class-point)
|
|
2053
1991
|
|
|
2054
1992
|
Returns
|
|
@@ -2057,8 +1995,8 @@ Returns a new point representing the given string.
|
|
|
2057
1995
|
|
|
2058
1996
|
Argument Details
|
|
2059
1997
|
|
|
2060
|
-
|
|
2061
|
-
|
|
1998
|
+
+ **str**
|
|
1999
|
+
+ The point representation string.
|
|
2062
2000
|
|
|
2063
2001
|
Throws
|
|
2064
2002
|
|
|
@@ -2081,7 +2019,6 @@ y coordinate is odd.
|
|
|
2081
2019
|
```ts
|
|
2082
2020
|
static fromX(x: BigNumber | number | number[] | string, odd: boolean): Point
|
|
2083
2021
|
```
|
|
2084
|
-
|
|
2085
2022
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2086
2023
|
|
|
2087
2024
|
Returns
|
|
@@ -2090,10 +2027,10 @@ Returns the new point.
|
|
|
2090
2027
|
|
|
2091
2028
|
Argument Details
|
|
2092
2029
|
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2030
|
+
+ **x**
|
|
2031
|
+
+ The x coordinate of the point.
|
|
2032
|
+
+ **odd**
|
|
2033
|
+
+ Boolean indicating whether the corresponding y coordinate is odd or not.
|
|
2097
2034
|
|
|
2098
2035
|
Throws
|
|
2099
2036
|
|
|
@@ -2113,7 +2050,6 @@ Returns X coordinate of point
|
|
|
2113
2050
|
```ts
|
|
2114
2051
|
getX(): BigNumber
|
|
2115
2052
|
```
|
|
2116
|
-
|
|
2117
2053
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2118
2054
|
|
|
2119
2055
|
Example
|
|
@@ -2130,7 +2066,6 @@ Returns X coordinate of point
|
|
|
2130
2066
|
```ts
|
|
2131
2067
|
getY(): BigNumber
|
|
2132
2068
|
```
|
|
2133
|
-
|
|
2134
2069
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2135
2070
|
|
|
2136
2071
|
Example
|
|
@@ -2186,7 +2121,6 @@ step. Instead of returning a regular Point, the result is a JacobianPoint.
|
|
|
2186
2121
|
```ts
|
|
2187
2122
|
jmulAdd(k1: BigNumber, p2: Point, k2: BigNumber): JPoint
|
|
2188
2123
|
```
|
|
2189
|
-
|
|
2190
2124
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2191
2125
|
|
|
2192
2126
|
Returns
|
|
@@ -2195,12 +2129,12 @@ A JacobianPoint that results from the combined multiplication and addition opera
|
|
|
2195
2129
|
|
|
2196
2130
|
Argument Details
|
|
2197
2131
|
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2132
|
+
+ **k1**
|
|
2133
|
+
+ The scalar value to multiply this Point by.
|
|
2134
|
+
+ **p2**
|
|
2135
|
+
+ The other Point to be involved in the operation
|
|
2136
|
+
+ **k2**
|
|
2137
|
+
+ The scalar value to multiply the Point p2 by.
|
|
2204
2138
|
|
|
2205
2139
|
Example
|
|
2206
2140
|
|
|
@@ -2217,7 +2151,6 @@ Multiplies this Point by a scalar value, returning a new Point.
|
|
|
2217
2151
|
```ts
|
|
2218
2152
|
mul(k: BigNumber | number | number[] | string): Point
|
|
2219
2153
|
```
|
|
2220
|
-
|
|
2221
2154
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2222
2155
|
|
|
2223
2156
|
Returns
|
|
@@ -2226,8 +2159,8 @@ A new Point that results from the multiplication.
|
|
|
2226
2159
|
|
|
2227
2160
|
Argument Details
|
|
2228
2161
|
|
|
2229
|
-
|
|
2230
|
-
|
|
2162
|
+
+ **k**
|
|
2163
|
+
+ The scalar value to multiply this Point by.
|
|
2231
2164
|
|
|
2232
2165
|
Example
|
|
2233
2166
|
|
|
@@ -2244,7 +2177,6 @@ Multiplies this Point by k1, adds the resulting Point to the result of p2 multip
|
|
|
2244
2177
|
```ts
|
|
2245
2178
|
mulAdd(k1: BigNumber, p2: Point, k2: BigNumber): Point
|
|
2246
2179
|
```
|
|
2247
|
-
|
|
2248
2180
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2249
2181
|
|
|
2250
2182
|
Returns
|
|
@@ -2253,12 +2185,12 @@ A Point that results from the combined multiplication and addition operations.
|
|
|
2253
2185
|
|
|
2254
2186
|
Argument Details
|
|
2255
2187
|
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2188
|
+
+ **k1**
|
|
2189
|
+
+ The scalar value to multiply this Point by.
|
|
2190
|
+
+ **p2**
|
|
2191
|
+
+ The other Point to be involved in the operation.
|
|
2192
|
+
+ **k2**
|
|
2193
|
+
+ The scalar value to multiply the Point p2 by.
|
|
2262
2194
|
|
|
2263
2195
|
Example
|
|
2264
2196
|
|
|
@@ -2275,7 +2207,6 @@ Negate a point. The negation of a point P is the mirror of P about x-axis.
|
|
|
2275
2207
|
```ts
|
|
2276
2208
|
neg(_precompute?: boolean): Point
|
|
2277
2209
|
```
|
|
2278
|
-
|
|
2279
2210
|
See also: [Point](./primitives.md#class-point)
|
|
2280
2211
|
|
|
2281
2212
|
Example
|
|
@@ -2325,7 +2256,6 @@ toJSON(): [
|
|
|
2325
2256
|
}?
|
|
2326
2257
|
]
|
|
2327
2258
|
```
|
|
2328
|
-
|
|
2329
2259
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2330
2260
|
|
|
2331
2261
|
Returns
|
|
@@ -2384,7 +2314,6 @@ const isValid = aPoint.validate();
|
|
|
2384
2314
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2385
2315
|
|
|
2386
2316
|
---
|
|
2387
|
-
|
|
2388
2317
|
### Class: PointInFiniteField
|
|
2389
2318
|
|
|
2390
2319
|
```ts
|
|
@@ -2410,7 +2339,6 @@ toString(): string
|
|
|
2410
2339
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2411
2340
|
|
|
2412
2341
|
---
|
|
2413
|
-
|
|
2414
2342
|
### Class: Polynomial
|
|
2415
2343
|
|
|
2416
2344
|
Polynomial class
|
|
@@ -2441,7 +2369,6 @@ See also: [BigNumber](./primitives.md#class-bignumber), [PointInFiniteField](./p
|
|
|
2441
2369
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2442
2370
|
|
|
2443
2371
|
---
|
|
2444
|
-
|
|
2445
2372
|
### Class: PrivateKey
|
|
2446
2373
|
|
|
2447
2374
|
Represents a Private Key, which is a secret that can be used to generate signatures in a cryptographic system.
|
|
@@ -2469,7 +2396,7 @@ export default class PrivateKey extends BigNumber {
|
|
|
2469
2396
|
toHex(): string
|
|
2470
2397
|
toString(base: number | "hex" = "hex", padding: number = 64): string
|
|
2471
2398
|
deriveSharedSecret(key: PublicKey): Point
|
|
2472
|
-
deriveChild(publicKey: PublicKey, invoiceNumber: string): PrivateKey
|
|
2399
|
+
deriveChild(publicKey: PublicKey, invoiceNumber: string, cacheSharedSecret?: ((priv: PrivateKey, pub: Point, point: Point) => void), retrieveCachedSharedSecret?: ((priv: PrivateKey, pub: Point) => (Point | undefined))): PrivateKey
|
|
2473
2400
|
toKeyShares(threshold: number, totalShares: number): KeyShares
|
|
2474
2401
|
toBackupShares(threshold: number, totalShares: number): string[]
|
|
2475
2402
|
static fromBackupShares(shares: string[]): PrivateKey
|
|
@@ -2484,19 +2411,18 @@ See also: [BigNumber](./primitives.md#class-bignumber), [KeyShares](./primitives
|
|
|
2484
2411
|
```ts
|
|
2485
2412
|
constructor(number: BigNumber | number | string | number[] = 0, base: number | "be" | "le" | "hex" = 10, endian: "be" | "le" = "be", modN: "apply" | "nocheck" | "error" = "apply")
|
|
2486
2413
|
```
|
|
2487
|
-
|
|
2488
2414
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2489
2415
|
|
|
2490
2416
|
Argument Details
|
|
2491
2417
|
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2418
|
+
+ **number**
|
|
2419
|
+
+ The number (various types accepted) to construct a BigNumber from. Default is 0.
|
|
2420
|
+
+ **base**
|
|
2421
|
+
+ The base of number provided. By default is 10. Ignored if number is BigNumber.
|
|
2422
|
+
+ **endian**
|
|
2423
|
+
+ The endianness provided. By default is 'big endian'. Ignored if number is BigNumber.
|
|
2424
|
+
+ **modN**
|
|
2425
|
+
+ Optional. Default 'apply. If 'apply', apply modN to input to guarantee a valid PrivateKey. If 'error', if input is out of field throw new Error('Input is out of field'). If 'nocheck', assumes input is in field.
|
|
2500
2426
|
|
|
2501
2427
|
Example
|
|
2502
2428
|
|
|
@@ -2516,7 +2442,6 @@ checkInField(): {
|
|
|
2516
2442
|
modN: BigNumber;
|
|
2517
2443
|
}
|
|
2518
2444
|
```
|
|
2519
|
-
|
|
2520
2445
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2521
2446
|
|
|
2522
2447
|
Returns
|
|
@@ -2528,10 +2453,9 @@ Returns
|
|
|
2528
2453
|
Derives a child key with BRC-42.
|
|
2529
2454
|
|
|
2530
2455
|
```ts
|
|
2531
|
-
deriveChild(publicKey: PublicKey, invoiceNumber: string): PrivateKey
|
|
2456
|
+
deriveChild(publicKey: PublicKey, invoiceNumber: string, cacheSharedSecret?: ((priv: PrivateKey, pub: Point, point: Point) => void), retrieveCachedSharedSecret?: ((priv: PrivateKey, pub: Point) => (Point | undefined))): PrivateKey
|
|
2532
2457
|
```
|
|
2533
|
-
|
|
2534
|
-
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
2458
|
+
See also: [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
2535
2459
|
|
|
2536
2460
|
Returns
|
|
2537
2461
|
|
|
@@ -2539,10 +2463,14 @@ The derived child key.
|
|
|
2539
2463
|
|
|
2540
2464
|
Argument Details
|
|
2541
2465
|
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2466
|
+
+ **publicKey**
|
|
2467
|
+
+ The public key of the other party
|
|
2468
|
+
+ **invoiceNumber**
|
|
2469
|
+
+ The invoice number used to derive the child key
|
|
2470
|
+
+ **cacheSharedSecret**
|
|
2471
|
+
+ Optional function to cache shared secrets
|
|
2472
|
+
+ **retrieveCachedSharedSecret**
|
|
2473
|
+
+ Optional function to retrieve shared secrets from the cache
|
|
2546
2474
|
|
|
2547
2475
|
#### Method deriveSharedSecret
|
|
2548
2476
|
|
|
@@ -2551,7 +2479,6 @@ Derives a shared secret from the public key.
|
|
|
2551
2479
|
```ts
|
|
2552
2480
|
deriveSharedSecret(key: PublicKey): Point
|
|
2553
2481
|
```
|
|
2554
|
-
|
|
2555
2482
|
See also: [Point](./primitives.md#class-point), [PublicKey](./primitives.md#class-publickey)
|
|
2556
2483
|
|
|
2557
2484
|
Returns
|
|
@@ -2560,8 +2487,8 @@ The derived shared secret (a point on the curve).
|
|
|
2560
2487
|
|
|
2561
2488
|
Argument Details
|
|
2562
2489
|
|
|
2563
|
-
|
|
2564
|
-
|
|
2490
|
+
+ **key**
|
|
2491
|
+
+ The public key to derive the shared secret from.
|
|
2565
2492
|
|
|
2566
2493
|
Throws
|
|
2567
2494
|
|
|
@@ -2580,7 +2507,6 @@ const sharedSecret = privateKey.deriveSharedSecret(publicKey);
|
|
|
2580
2507
|
```ts
|
|
2581
2508
|
static fromBackupShares(shares: string[]): PrivateKey
|
|
2582
2509
|
```
|
|
2583
|
-
|
|
2584
2510
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2585
2511
|
|
|
2586
2512
|
Returns
|
|
@@ -2603,7 +2529,6 @@ Generates a private key from a hexadecimal string.
|
|
|
2603
2529
|
```ts
|
|
2604
2530
|
static fromHex(str: string): PrivateKey
|
|
2605
2531
|
```
|
|
2606
|
-
|
|
2607
2532
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2608
2533
|
|
|
2609
2534
|
Returns
|
|
@@ -2612,8 +2537,8 @@ The generated Private Key instance.
|
|
|
2612
2537
|
|
|
2613
2538
|
Argument Details
|
|
2614
2539
|
|
|
2615
|
-
|
|
2616
|
-
|
|
2540
|
+
+ **str**
|
|
2541
|
+
+ The hexadecimal string representing the private key. The string must represent a valid private key in big-endian format.
|
|
2617
2542
|
|
|
2618
2543
|
Throws
|
|
2619
2544
|
|
|
@@ -2626,7 +2551,6 @@ Combines shares to reconstruct the private key.
|
|
|
2626
2551
|
```ts
|
|
2627
2552
|
static fromKeyShares(keyShares: KeyShares): PrivateKey
|
|
2628
2553
|
```
|
|
2629
|
-
|
|
2630
2554
|
See also: [KeyShares](./primitives.md#class-keyshares), [PrivateKey](./primitives.md#class-privatekey)
|
|
2631
2555
|
|
|
2632
2556
|
Returns
|
|
@@ -2635,10 +2559,10 @@ The reconstructed private key.
|
|
|
2635
2559
|
|
|
2636
2560
|
Argument Details
|
|
2637
2561
|
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2562
|
+
+ **shares**
|
|
2563
|
+
+ An array of points (shares) to be used to reconstruct the private key.
|
|
2564
|
+
+ **threshold**
|
|
2565
|
+
+ The minimum number of shares required to reconstruct the private key.
|
|
2642
2566
|
|
|
2643
2567
|
#### Method fromRandom
|
|
2644
2568
|
|
|
@@ -2647,7 +2571,6 @@ Generates a private key randomly.
|
|
|
2647
2571
|
```ts
|
|
2648
2572
|
static fromRandom(): PrivateKey
|
|
2649
2573
|
```
|
|
2650
|
-
|
|
2651
2574
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2652
2575
|
|
|
2653
2576
|
Returns
|
|
@@ -2667,7 +2590,6 @@ Generates a private key from a string.
|
|
|
2667
2590
|
```ts
|
|
2668
2591
|
static fromString(str: string, base: number | "hex" = "hex"): PrivateKey
|
|
2669
2592
|
```
|
|
2670
|
-
|
|
2671
2593
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2672
2594
|
|
|
2673
2595
|
Returns
|
|
@@ -2676,10 +2598,10 @@ The generated Private Key.
|
|
|
2676
2598
|
|
|
2677
2599
|
Argument Details
|
|
2678
2600
|
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2601
|
+
+ **str**
|
|
2602
|
+
+ The string to generate the private key from.
|
|
2603
|
+
+ **base**
|
|
2604
|
+
+ The base of the string.
|
|
2683
2605
|
|
|
2684
2606
|
Throws
|
|
2685
2607
|
|
|
@@ -2692,7 +2614,6 @@ Generates a private key from a WIF (Wallet Import Format) string.
|
|
|
2692
2614
|
```ts
|
|
2693
2615
|
static fromWif(wif: string, prefixLength: number = 1): PrivateKey
|
|
2694
2616
|
```
|
|
2695
|
-
|
|
2696
2617
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2697
2618
|
|
|
2698
2619
|
Returns
|
|
@@ -2701,10 +2622,10 @@ The generated Private Key.
|
|
|
2701
2622
|
|
|
2702
2623
|
Argument Details
|
|
2703
2624
|
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2625
|
+
+ **wif**
|
|
2626
|
+
+ The WIF string to generate the private key from.
|
|
2627
|
+
+ **base**
|
|
2628
|
+
+ The base of the string.
|
|
2708
2629
|
|
|
2709
2630
|
Throws
|
|
2710
2631
|
|
|
@@ -2727,7 +2648,6 @@ Signs a message using the private key.
|
|
|
2727
2648
|
```ts
|
|
2728
2649
|
sign(msg: number[] | string, enc?: "hex" | "utf8", forceLowS: boolean = true, customK?: ((iter: number) => BigNumber) | BigNumber): Signature
|
|
2729
2650
|
```
|
|
2730
|
-
|
|
2731
2651
|
See also: [BigNumber](./primitives.md#class-bignumber), [Signature](./primitives.md#class-signature)
|
|
2732
2652
|
|
|
2733
2653
|
Returns
|
|
@@ -2736,14 +2656,14 @@ A digital signature generated from the hash of the message and the private key.
|
|
|
2736
2656
|
|
|
2737
2657
|
Argument Details
|
|
2738
2658
|
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2659
|
+
+ **msg**
|
|
2660
|
+
+ The message (array of numbers or string) to be signed.
|
|
2661
|
+
+ **enc**
|
|
2662
|
+
+ If 'hex' the string will be treated as hex, utf8 otherwise.
|
|
2663
|
+
+ **forceLowS**
|
|
2664
|
+
+ If true (the default), the signature will be forced to have a low S value.
|
|
2665
|
+
+ **customK**
|
|
2666
|
+
+ — If provided, uses a custom K-value for the signature. Provie a function that returns a BigNumber, or the BigNumber itself.
|
|
2747
2667
|
|
|
2748
2668
|
Example
|
|
2749
2669
|
|
|
@@ -2767,8 +2687,8 @@ Returns the address encoding associated with the hash of the public key associat
|
|
|
2767
2687
|
|
|
2768
2688
|
Argument Details
|
|
2769
2689
|
|
|
2770
|
-
|
|
2771
|
-
|
|
2690
|
+
+ **prefix**
|
|
2691
|
+
+ defaults to [0x00] for mainnet, set to [0x6f] for testnet or use the strings 'testnet' or 'mainnet'
|
|
2772
2692
|
|
|
2773
2693
|
Example
|
|
2774
2694
|
|
|
@@ -2787,10 +2707,10 @@ toBackupShares(threshold: number, totalShares: number): string[]
|
|
|
2787
2707
|
|
|
2788
2708
|
Argument Details
|
|
2789
2709
|
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2710
|
+
+ **threshold**
|
|
2711
|
+
+ The number of shares which will be required to reconstruct the private key.
|
|
2712
|
+
+ **totalShares**
|
|
2713
|
+
+ The number of shares to generate for distribution.
|
|
2794
2714
|
|
|
2795
2715
|
#### Method toHex
|
|
2796
2716
|
|
|
@@ -2806,8 +2726,8 @@ Returns a string representing the hexadecimal value of this BigNumber.
|
|
|
2806
2726
|
|
|
2807
2727
|
Argument Details
|
|
2808
2728
|
|
|
2809
|
-
|
|
2810
|
-
|
|
2729
|
+
+ **length**
|
|
2730
|
+
+ The minimum length of the hex string
|
|
2811
2731
|
|
|
2812
2732
|
Example
|
|
2813
2733
|
|
|
@@ -2823,7 +2743,6 @@ Splits the private key into shares using Shamir's Secret Sharing Scheme.
|
|
|
2823
2743
|
```ts
|
|
2824
2744
|
toKeyShares(threshold: number, totalShares: number): KeyShares
|
|
2825
2745
|
```
|
|
2826
|
-
|
|
2827
2746
|
See also: [KeyShares](./primitives.md#class-keyshares)
|
|
2828
2747
|
|
|
2829
2748
|
Returns
|
|
@@ -2832,12 +2751,12 @@ An array of shares.
|
|
|
2832
2751
|
|
|
2833
2752
|
Argument Details
|
|
2834
2753
|
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2754
|
+
+ **threshold**
|
|
2755
|
+
+ The minimum number of shares required to reconstruct the private key.
|
|
2756
|
+
+ **totalShares**
|
|
2757
|
+
+ The total number of shares to generate.
|
|
2758
|
+
+ **prime**
|
|
2759
|
+
+ The prime number to be used in Shamir's Secret Sharing Scheme.
|
|
2841
2760
|
|
|
2842
2761
|
Example
|
|
2843
2762
|
|
|
@@ -2855,7 +2774,6 @@ The public key is generated by multiplying the base point G of the curve and the
|
|
|
2855
2774
|
```ts
|
|
2856
2775
|
toPublicKey(): PublicKey
|
|
2857
2776
|
```
|
|
2858
|
-
|
|
2859
2777
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
2860
2778
|
|
|
2861
2779
|
Returns
|
|
@@ -2885,10 +2803,10 @@ A string representation of the PrivateKey in the specified base, padded to the s
|
|
|
2885
2803
|
|
|
2886
2804
|
Argument Details
|
|
2887
2805
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2806
|
+
+ **base**
|
|
2807
|
+
+ The base for representing the number. Default is hexadecimal ('hex').
|
|
2808
|
+
+ **padding**
|
|
2809
|
+
+ The minimum number of digits for the output string. Default is 64, ensuring a 256-bit representation in hexadecimal.
|
|
2892
2810
|
|
|
2893
2811
|
#### Method toWif
|
|
2894
2812
|
|
|
@@ -2907,8 +2825,8 @@ The WIF string.
|
|
|
2907
2825
|
|
|
2908
2826
|
Argument Details
|
|
2909
2827
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2828
|
+
+ **prefix**
|
|
2829
|
+
+ defaults to [0x80] for mainnet, set it to [0xef] for testnet.
|
|
2912
2830
|
|
|
2913
2831
|
Throws
|
|
2914
2832
|
|
|
@@ -2929,7 +2847,6 @@ Verifies a message's signature using the public key associated with this private
|
|
|
2929
2847
|
```ts
|
|
2930
2848
|
verify(msg: number[] | string, sig: Signature, enc?: "hex"): boolean
|
|
2931
2849
|
```
|
|
2932
|
-
|
|
2933
2850
|
See also: [Signature](./primitives.md#class-signature)
|
|
2934
2851
|
|
|
2935
2852
|
Returns
|
|
@@ -2938,12 +2855,12 @@ Whether or not the signature is valid.
|
|
|
2938
2855
|
|
|
2939
2856
|
Argument Details
|
|
2940
2857
|
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2858
|
+
+ **msg**
|
|
2859
|
+
+ The original message which has been signed.
|
|
2860
|
+
+ **sig**
|
|
2861
|
+
+ The signature to be verified.
|
|
2862
|
+
+ **enc**
|
|
2863
|
+
+ The data encoding method.
|
|
2947
2864
|
|
|
2948
2865
|
Example
|
|
2949
2866
|
|
|
@@ -2956,7 +2873,6 @@ const isSignatureValid = privateKey.verify('Hello, World!', signature);
|
|
|
2956
2873
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2957
2874
|
|
|
2958
2875
|
---
|
|
2959
|
-
|
|
2960
2876
|
### Class: PublicKey
|
|
2961
2877
|
|
|
2962
2878
|
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.
|
|
@@ -2973,7 +2889,7 @@ export default class PublicKey extends Point {
|
|
|
2973
2889
|
toDER(enc?: "hex" | undefined): number[] | string
|
|
2974
2890
|
toHash(enc?: "hex"): number[] | string
|
|
2975
2891
|
toAddress(prefix: number[] | string = [0]): string
|
|
2976
|
-
deriveChild(privateKey: PrivateKey, invoiceNumber: string): PublicKey
|
|
2892
|
+
deriveChild(privateKey: PrivateKey, invoiceNumber: string, cacheSharedSecret?: ((priv: PrivateKey, pub: Point, point: Point) => void), retrieveCachedSharedSecret?: ((priv: PrivateKey, pub: Point) => (Point | undefined))): PublicKey
|
|
2977
2893
|
static fromMsgHashAndCompactSignature(msgHash: BigNumber, signature: number[] | string, enc?: "hex" | "base64"): PublicKey
|
|
2978
2894
|
}
|
|
2979
2895
|
```
|
|
@@ -2985,17 +2901,16 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#
|
|
|
2985
2901
|
```ts
|
|
2986
2902
|
constructor(x: Point | BigNumber | number | number[] | string | null, y: BigNumber | number | number[] | string | null = null, isRed: boolean = true)
|
|
2987
2903
|
```
|
|
2988
|
-
|
|
2989
2904
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2990
2905
|
|
|
2991
2906
|
Argument Details
|
|
2992
2907
|
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2908
|
+
+ **x**
|
|
2909
|
+
+ 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.
|
|
2910
|
+
+ **y**
|
|
2911
|
+
+ If x is not a point, the y-coordinate of the point, similar to x.
|
|
2912
|
+
+ **isRed**
|
|
2913
|
+
+ A boolean indicating if the point is a member of the field of integers modulo the k256 prime. Default is true.
|
|
2999
2914
|
|
|
3000
2915
|
Example
|
|
3001
2916
|
|
|
@@ -3009,10 +2924,9 @@ new PublicKey('abc123', 'def456');
|
|
|
3009
2924
|
Derives a child key with BRC-42.
|
|
3010
2925
|
|
|
3011
2926
|
```ts
|
|
3012
|
-
deriveChild(privateKey: PrivateKey, invoiceNumber: string): PublicKey
|
|
2927
|
+
deriveChild(privateKey: PrivateKey, invoiceNumber: string, cacheSharedSecret?: ((priv: PrivateKey, pub: Point, point: Point) => void), retrieveCachedSharedSecret?: ((priv: PrivateKey, pub: Point) => (Point | undefined))): PublicKey
|
|
3013
2928
|
```
|
|
3014
|
-
|
|
3015
|
-
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
2929
|
+
See also: [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
3016
2930
|
|
|
3017
2931
|
Returns
|
|
3018
2932
|
|
|
@@ -3020,10 +2934,14 @@ The derived child key.
|
|
|
3020
2934
|
|
|
3021
2935
|
Argument Details
|
|
3022
2936
|
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
2937
|
+
+ **privateKey**
|
|
2938
|
+
+ The private key of the other party
|
|
2939
|
+
+ **invoiceNumber**
|
|
2940
|
+
+ The invoice number used to derive the child key
|
|
2941
|
+
+ **cacheSharedSecret**
|
|
2942
|
+
+ Optional function to cache shared secrets
|
|
2943
|
+
+ **retrieveCachedSharedSecret**
|
|
2944
|
+
+ Optional function to retrieve shared secrets from the cache
|
|
3027
2945
|
|
|
3028
2946
|
#### Method deriveSharedSecret
|
|
3029
2947
|
|
|
@@ -3033,7 +2951,6 @@ This method multiplies the public key (an instance of Point) with a private key.
|
|
|
3033
2951
|
```ts
|
|
3034
2952
|
deriveSharedSecret(priv: PrivateKey): Point
|
|
3035
2953
|
```
|
|
3036
|
-
|
|
3037
2954
|
See also: [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey)
|
|
3038
2955
|
|
|
3039
2956
|
Returns
|
|
@@ -3042,8 +2959,8 @@ Returns the Point representing the shared secret.
|
|
|
3042
2959
|
|
|
3043
2960
|
Argument Details
|
|
3044
2961
|
|
|
3045
|
-
|
|
3046
|
-
|
|
2962
|
+
+ **priv**
|
|
2963
|
+
+ The private key to use in deriving the shared secret.
|
|
3047
2964
|
|
|
3048
2965
|
Throws
|
|
3049
2966
|
|
|
@@ -3063,7 +2980,6 @@ Static factory method to create a PublicKey instance from a number array.
|
|
|
3063
2980
|
```ts
|
|
3064
2981
|
static fromDER(bytes: number[]): PublicKey
|
|
3065
2982
|
```
|
|
3066
|
-
|
|
3067
2983
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
3068
2984
|
|
|
3069
2985
|
Returns
|
|
@@ -3072,8 +2988,8 @@ Returns the PublicKey created from the number array.
|
|
|
3072
2988
|
|
|
3073
2989
|
Argument Details
|
|
3074
2990
|
|
|
3075
|
-
|
|
3076
|
-
|
|
2991
|
+
+ **bytes**
|
|
2992
|
+
+ A number array representing a public key.
|
|
3077
2993
|
|
|
3078
2994
|
Example
|
|
3079
2995
|
|
|
@@ -3093,7 +3009,6 @@ The range represents the recovery param which can be 0,1,2,3.
|
|
|
3093
3009
|
```ts
|
|
3094
3010
|
static fromMsgHashAndCompactSignature(msgHash: BigNumber, signature: number[] | string, enc?: "hex" | "base64"): PublicKey
|
|
3095
3011
|
```
|
|
3096
|
-
|
|
3097
3012
|
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
3098
3013
|
|
|
3099
3014
|
Returns
|
|
@@ -3102,12 +3017,12 @@ A PublicKey instance derived from the message hash and compact signature.
|
|
|
3102
3017
|
|
|
3103
3018
|
Argument Details
|
|
3104
3019
|
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3020
|
+
+ **msgHash**
|
|
3021
|
+
+ The message hash which was signed.
|
|
3022
|
+
+ **signature**
|
|
3023
|
+
+ The signature in compact format.
|
|
3024
|
+
+ **enc**
|
|
3025
|
+
+ The encoding of the signature string.
|
|
3111
3026
|
|
|
3112
3027
|
Example
|
|
3113
3028
|
|
|
@@ -3123,7 +3038,6 @@ It multiplies the generator point 'g' on the elliptic curve by the private key.
|
|
|
3123
3038
|
```ts
|
|
3124
3039
|
static fromPrivateKey(key: PrivateKey): PublicKey
|
|
3125
3040
|
```
|
|
3126
|
-
|
|
3127
3041
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
3128
3042
|
|
|
3129
3043
|
Returns
|
|
@@ -3132,8 +3046,8 @@ Returns the PublicKey derived from the given PrivateKey.
|
|
|
3132
3046
|
|
|
3133
3047
|
Argument Details
|
|
3134
3048
|
|
|
3135
|
-
|
|
3136
|
-
|
|
3049
|
+
+ **key**
|
|
3050
|
+
+ The private key from which to derive the public key.
|
|
3137
3051
|
|
|
3138
3052
|
Example
|
|
3139
3053
|
|
|
@@ -3149,7 +3063,6 @@ Static factory method to create a PublicKey instance from a string.
|
|
|
3149
3063
|
```ts
|
|
3150
3064
|
static fromString(str: string): PublicKey
|
|
3151
3065
|
```
|
|
3152
|
-
|
|
3153
3066
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
3154
3067
|
|
|
3155
3068
|
Returns
|
|
@@ -3158,8 +3071,8 @@ Returns the PublicKey created from the string.
|
|
|
3158
3071
|
|
|
3159
3072
|
Argument Details
|
|
3160
3073
|
|
|
3161
|
-
|
|
3162
|
-
|
|
3074
|
+
+ **str**
|
|
3075
|
+
+ A string representing a public key.
|
|
3163
3076
|
|
|
3164
3077
|
Example
|
|
3165
3078
|
|
|
@@ -3182,8 +3095,8 @@ Returns the address encoding associated with the hash of the public key.
|
|
|
3182
3095
|
|
|
3183
3096
|
Argument Details
|
|
3184
3097
|
|
|
3185
|
-
|
|
3186
|
-
|
|
3098
|
+
+ **prefix**
|
|
3099
|
+
+ defaults to [0x00] for mainnet, set to [0x6f] for testnet or use the strings 'mainnet' or 'testnet'
|
|
3187
3100
|
|
|
3188
3101
|
Example
|
|
3189
3102
|
|
|
@@ -3208,8 +3121,8 @@ Returns the DER-encoded public key in number array or string.
|
|
|
3208
3121
|
|
|
3209
3122
|
Argument Details
|
|
3210
3123
|
|
|
3211
|
-
|
|
3212
|
-
|
|
3124
|
+
+ **enc**
|
|
3125
|
+
+ The encoding of the DER string. undefined = number array, 'hex' = hex string.
|
|
3213
3126
|
|
|
3214
3127
|
Example
|
|
3215
3128
|
|
|
@@ -3242,7 +3155,6 @@ Verify a signature of a message using this public key.
|
|
|
3242
3155
|
```ts
|
|
3243
3156
|
verify(msg: number[] | string, sig: Signature, enc?: "hex" | "utf8"): boolean
|
|
3244
3157
|
```
|
|
3245
|
-
|
|
3246
3158
|
See also: [Signature](./primitives.md#class-signature)
|
|
3247
3159
|
|
|
3248
3160
|
Returns
|
|
@@ -3251,12 +3163,12 @@ Returns true if the signature is verified successfully, otherwise false.
|
|
|
3251
3163
|
|
|
3252
3164
|
Argument Details
|
|
3253
3165
|
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3166
|
+
+ **msg**
|
|
3167
|
+
+ The message to verify. It can be a string or an array of numbers.
|
|
3168
|
+
+ **sig**
|
|
3169
|
+
+ The Signature of the message that needs verification.
|
|
3170
|
+
+ **enc**
|
|
3171
|
+
+ The encoding of the message. It defaults to 'utf8'.
|
|
3260
3172
|
|
|
3261
3173
|
Example
|
|
3262
3174
|
|
|
@@ -3269,7 +3181,6 @@ const isVerified = myPubKey.verify(myMessage, mySignature)
|
|
|
3269
3181
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3270
3182
|
|
|
3271
3183
|
---
|
|
3272
|
-
|
|
3273
3184
|
### Class: RIPEMD160
|
|
3274
3185
|
|
|
3275
3186
|
An implementation of RIPEMD160 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -3304,7 +3215,6 @@ h: number[]
|
|
|
3304
3215
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3305
3216
|
|
|
3306
3217
|
---
|
|
3307
|
-
|
|
3308
3218
|
### Class: Reader
|
|
3309
3219
|
|
|
3310
3220
|
```ts
|
|
@@ -3339,7 +3249,6 @@ See also: [BigNumber](./primitives.md#class-bignumber)
|
|
|
3339
3249
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3340
3250
|
|
|
3341
3251
|
---
|
|
3342
|
-
|
|
3343
3252
|
### Class: ReductionContext
|
|
3344
3253
|
|
|
3345
3254
|
A base reduction engine that provides several arithmetic operations over
|
|
@@ -3381,13 +3290,12 @@ Constructs a new ReductionContext.
|
|
|
3381
3290
|
```ts
|
|
3382
3291
|
constructor(m: BigNumber | "k256")
|
|
3383
3292
|
```
|
|
3384
|
-
|
|
3385
3293
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3386
3294
|
|
|
3387
3295
|
Argument Details
|
|
3388
3296
|
|
|
3389
|
-
|
|
3390
|
-
|
|
3297
|
+
+ **m**
|
|
3298
|
+
+ A BigNumber representing the modulus, or 'k256' to create a context for Koblitz curve.
|
|
3391
3299
|
|
|
3392
3300
|
Example
|
|
3393
3301
|
|
|
@@ -3403,7 +3311,6 @@ The modulus used for reduction operations.
|
|
|
3403
3311
|
```ts
|
|
3404
3312
|
m: BigNumber
|
|
3405
3313
|
```
|
|
3406
|
-
|
|
3407
3314
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3408
3315
|
|
|
3409
3316
|
#### Property prime
|
|
@@ -3413,7 +3320,6 @@ The prime number utilised in the reduction context, typically an instance of Mer
|
|
|
3413
3320
|
```ts
|
|
3414
3321
|
prime: Mersenne | null
|
|
3415
3322
|
```
|
|
3416
|
-
|
|
3417
3323
|
See also: [Mersenne](./primitives.md#class-mersenne)
|
|
3418
3324
|
|
|
3419
3325
|
#### Method add
|
|
@@ -3423,7 +3329,6 @@ Performs the addition operation on two BigNumbers in the reduction context.
|
|
|
3423
3329
|
```ts
|
|
3424
3330
|
add(a: BigNumber, b: BigNumber): BigNumber
|
|
3425
3331
|
```
|
|
3426
|
-
|
|
3427
3332
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3428
3333
|
|
|
3429
3334
|
Returns
|
|
@@ -3432,10 +3337,10 @@ Returns the result of 'a + b' in the reduction context.
|
|
|
3432
3337
|
|
|
3433
3338
|
Argument Details
|
|
3434
3339
|
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3340
|
+
+ **a**
|
|
3341
|
+
+ First BigNumber to add.
|
|
3342
|
+
+ **b**
|
|
3343
|
+
+ Second BigNumber to add.
|
|
3439
3344
|
|
|
3440
3345
|
Example
|
|
3441
3346
|
|
|
@@ -3451,7 +3356,6 @@ Converts a BigNumber from reduction context to its regular form.
|
|
|
3451
3356
|
```ts
|
|
3452
3357
|
convertFrom(num: BigNumber): BigNumber
|
|
3453
3358
|
```
|
|
3454
|
-
|
|
3455
3359
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3456
3360
|
|
|
3457
3361
|
Returns
|
|
@@ -3460,8 +3364,8 @@ Returns the converted BigNumber in its regular form.
|
|
|
3460
3364
|
|
|
3461
3365
|
Argument Details
|
|
3462
3366
|
|
|
3463
|
-
|
|
3464
|
-
|
|
3367
|
+
+ **num**
|
|
3368
|
+
+ The BigNumber to convert from the reduction context.
|
|
3465
3369
|
|
|
3466
3370
|
Example
|
|
3467
3371
|
|
|
@@ -3478,7 +3382,6 @@ Converts a BigNumber to its equivalent in the reduction context.
|
|
|
3478
3382
|
```ts
|
|
3479
3383
|
convertTo(num: BigNumber): BigNumber
|
|
3480
3384
|
```
|
|
3481
|
-
|
|
3482
3385
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3483
3386
|
|
|
3484
3387
|
Returns
|
|
@@ -3487,8 +3390,8 @@ Returns the converted BigNumber compatible with the reduction context.
|
|
|
3487
3390
|
|
|
3488
3391
|
Argument Details
|
|
3489
3392
|
|
|
3490
|
-
|
|
3491
|
-
|
|
3393
|
+
+ **num**
|
|
3394
|
+
+ The BigNumber to convert to the reduction context.
|
|
3492
3395
|
|
|
3493
3396
|
Example
|
|
3494
3397
|
|
|
@@ -3505,7 +3408,6 @@ in order to avoid creating a new BigNumber, it modifies the first one with the r
|
|
|
3505
3408
|
```ts
|
|
3506
3409
|
iadd(a: BigNumber, b: BigNumber): BigNumber
|
|
3507
3410
|
```
|
|
3508
|
-
|
|
3509
3411
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3510
3412
|
|
|
3511
3413
|
Returns
|
|
@@ -3514,10 +3416,10 @@ Returns the modified 'a' after addition with 'b' in the reduction context.
|
|
|
3514
3416
|
|
|
3515
3417
|
Argument Details
|
|
3516
3418
|
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3419
|
+
+ **a**
|
|
3420
|
+
+ First BigNumber to add.
|
|
3421
|
+
+ **b**
|
|
3422
|
+
+ Second BigNumber to add.
|
|
3521
3423
|
|
|
3522
3424
|
Example
|
|
3523
3425
|
|
|
@@ -3534,7 +3436,6 @@ Performs an in-place reduction of the given BigNumber by the modulus of the redu
|
|
|
3534
3436
|
```ts
|
|
3535
3437
|
imod(a: BigNumber): BigNumber
|
|
3536
3438
|
```
|
|
3537
|
-
|
|
3538
3439
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3539
3440
|
|
|
3540
3441
|
Returns
|
|
@@ -3543,8 +3444,8 @@ Returns the reduced result.
|
|
|
3543
3444
|
|
|
3544
3445
|
Argument Details
|
|
3545
3446
|
|
|
3546
|
-
|
|
3547
|
-
|
|
3447
|
+
+ **a**
|
|
3448
|
+
+ BigNumber to be reduced.
|
|
3548
3449
|
|
|
3549
3450
|
Example
|
|
3550
3451
|
|
|
@@ -3561,7 +3462,6 @@ modifying the first BigNumber with the result.
|
|
|
3561
3462
|
```ts
|
|
3562
3463
|
imul(a: BigNumber, b: BigNumber): BigNumber
|
|
3563
3464
|
```
|
|
3564
|
-
|
|
3565
3465
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3566
3466
|
|
|
3567
3467
|
Returns
|
|
@@ -3570,10 +3470,10 @@ Returns the modified 'a' after multiplication with 'b' in the reduction context.
|
|
|
3570
3470
|
|
|
3571
3471
|
Argument Details
|
|
3572
3472
|
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3473
|
+
+ **a**
|
|
3474
|
+
+ First BigNumber to multiply.
|
|
3475
|
+
+ **b**
|
|
3476
|
+
+ Second BigNumber to multiply.
|
|
3577
3477
|
|
|
3578
3478
|
Example
|
|
3579
3479
|
|
|
@@ -3590,7 +3490,6 @@ Calculates the multiplicative inverse of a BigNumber in the reduction context.
|
|
|
3590
3490
|
```ts
|
|
3591
3491
|
invm(a: BigNumber): BigNumber
|
|
3592
3492
|
```
|
|
3593
|
-
|
|
3594
3493
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3595
3494
|
|
|
3596
3495
|
Returns
|
|
@@ -3599,8 +3498,8 @@ Returns the multiplicative inverse of 'a' in the reduction context.
|
|
|
3599
3498
|
|
|
3600
3499
|
Argument Details
|
|
3601
3500
|
|
|
3602
|
-
|
|
3603
|
-
|
|
3501
|
+
+ **a**
|
|
3502
|
+
+ The BigNumber to find the multiplicative inverse of.
|
|
3604
3503
|
|
|
3605
3504
|
Example
|
|
3606
3505
|
|
|
@@ -3617,7 +3516,6 @@ modifying the original BigNumber with the result.
|
|
|
3617
3516
|
```ts
|
|
3618
3517
|
isqr(a: BigNumber): BigNumber
|
|
3619
3518
|
```
|
|
3620
|
-
|
|
3621
3519
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3622
3520
|
|
|
3623
3521
|
Returns
|
|
@@ -3626,8 +3524,8 @@ Returns the squared 'a' in the reduction context.
|
|
|
3626
3524
|
|
|
3627
3525
|
Argument Details
|
|
3628
3526
|
|
|
3629
|
-
|
|
3630
|
-
|
|
3527
|
+
+ **a**
|
|
3528
|
+
+ BigNumber to be squared.
|
|
3631
3529
|
|
|
3632
3530
|
Example
|
|
3633
3531
|
|
|
@@ -3645,7 +3543,6 @@ it modifies the first BigNumber with the result.
|
|
|
3645
3543
|
```ts
|
|
3646
3544
|
isub(a: BigNumber, b: BigNumber): BigNumber
|
|
3647
3545
|
```
|
|
3648
|
-
|
|
3649
3546
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3650
3547
|
|
|
3651
3548
|
Returns
|
|
@@ -3654,10 +3551,10 @@ Returns the modified 'a' after subtraction of 'b' in the reduction context.
|
|
|
3654
3551
|
|
|
3655
3552
|
Argument Details
|
|
3656
3553
|
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3554
|
+
+ **a**
|
|
3555
|
+
+ BigNumber to be subtracted from.
|
|
3556
|
+
+ **b**
|
|
3557
|
+
+ BigNumber to subtract.
|
|
3661
3558
|
|
|
3662
3559
|
Example
|
|
3663
3560
|
|
|
@@ -3674,7 +3571,6 @@ Multiplies two BigNumbers in the reduction context.
|
|
|
3674
3571
|
```ts
|
|
3675
3572
|
mul(a: BigNumber, b: BigNumber): BigNumber
|
|
3676
3573
|
```
|
|
3677
|
-
|
|
3678
3574
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3679
3575
|
|
|
3680
3576
|
Returns
|
|
@@ -3683,10 +3579,10 @@ Returns the result of 'a * b' in the reduction context.
|
|
|
3683
3579
|
|
|
3684
3580
|
Argument Details
|
|
3685
3581
|
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3582
|
+
+ **a**
|
|
3583
|
+
+ First BigNumber to multiply.
|
|
3584
|
+
+ **b**
|
|
3585
|
+
+ Second BigNumber to multiply.
|
|
3690
3586
|
|
|
3691
3587
|
Example
|
|
3692
3588
|
|
|
@@ -3702,7 +3598,6 @@ Negates a BigNumber in the context of the modulus.
|
|
|
3702
3598
|
```ts
|
|
3703
3599
|
neg(a: BigNumber): BigNumber
|
|
3704
3600
|
```
|
|
3705
|
-
|
|
3706
3601
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3707
3602
|
|
|
3708
3603
|
Returns
|
|
@@ -3711,8 +3606,8 @@ Returns the negation of 'a' in the reduction context.
|
|
|
3711
3606
|
|
|
3712
3607
|
Argument Details
|
|
3713
3608
|
|
|
3714
|
-
|
|
3715
|
-
|
|
3609
|
+
+ **a**
|
|
3610
|
+
+ BigNumber to negate.
|
|
3716
3611
|
|
|
3717
3612
|
Example
|
|
3718
3613
|
|
|
@@ -3728,7 +3623,6 @@ Raises a BigNumber to a power in the reduction context.
|
|
|
3728
3623
|
```ts
|
|
3729
3624
|
pow(a: BigNumber, num: BigNumber): BigNumber
|
|
3730
3625
|
```
|
|
3731
|
-
|
|
3732
3626
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3733
3627
|
|
|
3734
3628
|
Returns
|
|
@@ -3737,10 +3631,10 @@ Returns the result of 'a' raised to the power of 'num' in the reduction context.
|
|
|
3737
3631
|
|
|
3738
3632
|
Argument Details
|
|
3739
3633
|
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3634
|
+
+ **a**
|
|
3635
|
+
+ The BigNumber to be raised to a power.
|
|
3636
|
+
+ **num**
|
|
3637
|
+
+ The power to raise the BigNumber to.
|
|
3744
3638
|
|
|
3745
3639
|
Example
|
|
3746
3640
|
|
|
@@ -3756,7 +3650,6 @@ Performs bitwise shift left operation on a BigNumber in the reduction context.
|
|
|
3756
3650
|
```ts
|
|
3757
3651
|
shl(a: BigNumber, num: number): BigNumber
|
|
3758
3652
|
```
|
|
3759
|
-
|
|
3760
3653
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3761
3654
|
|
|
3762
3655
|
Returns
|
|
@@ -3765,10 +3658,10 @@ Returns the result of shifting 'a' left by 'num' positions in the reduction cont
|
|
|
3765
3658
|
|
|
3766
3659
|
Argument Details
|
|
3767
3660
|
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3661
|
+
+ **a**
|
|
3662
|
+
+ BigNumber to perform shift on.
|
|
3663
|
+
+ **num**
|
|
3664
|
+
+ The number of positions to shift.
|
|
3772
3665
|
|
|
3773
3666
|
Example
|
|
3774
3667
|
|
|
@@ -3784,7 +3677,6 @@ Calculates the square of a BigNumber in the reduction context.
|
|
|
3784
3677
|
```ts
|
|
3785
3678
|
sqr(a: BigNumber): BigNumber
|
|
3786
3679
|
```
|
|
3787
|
-
|
|
3788
3680
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3789
3681
|
|
|
3790
3682
|
Returns
|
|
@@ -3793,8 +3685,8 @@ Returns the result of 'a^2' in the reduction context.
|
|
|
3793
3685
|
|
|
3794
3686
|
Argument Details
|
|
3795
3687
|
|
|
3796
|
-
|
|
3797
|
-
|
|
3688
|
+
+ **a**
|
|
3689
|
+
+ BigNumber to be squared.
|
|
3798
3690
|
|
|
3799
3691
|
Example
|
|
3800
3692
|
|
|
@@ -3810,7 +3702,6 @@ Calculates the square root of a BigNumber in the reduction context.
|
|
|
3810
3702
|
```ts
|
|
3811
3703
|
sqrt(a: BigNumber): BigNumber
|
|
3812
3704
|
```
|
|
3813
|
-
|
|
3814
3705
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3815
3706
|
|
|
3816
3707
|
Returns
|
|
@@ -3819,8 +3710,8 @@ Returns the square root of 'a' in the reduction context.
|
|
|
3819
3710
|
|
|
3820
3711
|
Argument Details
|
|
3821
3712
|
|
|
3822
|
-
|
|
3823
|
-
|
|
3713
|
+
+ **a**
|
|
3714
|
+
+ The BigNumber to calculate the square root of.
|
|
3824
3715
|
|
|
3825
3716
|
Example
|
|
3826
3717
|
|
|
@@ -3836,7 +3727,6 @@ Subtracts one BigNumber from another BigNumber in the reduction context.
|
|
|
3836
3727
|
```ts
|
|
3837
3728
|
sub(a: BigNumber, b: BigNumber): BigNumber
|
|
3838
3729
|
```
|
|
3839
|
-
|
|
3840
3730
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3841
3731
|
|
|
3842
3732
|
Returns
|
|
@@ -3845,10 +3735,10 @@ Returns the result of 'a - b' in the reduction context.
|
|
|
3845
3735
|
|
|
3846
3736
|
Argument Details
|
|
3847
3737
|
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3738
|
+
+ **a**
|
|
3739
|
+
+ BigNumber to be subtracted from.
|
|
3740
|
+
+ **b**
|
|
3741
|
+
+ BigNumber to subtract.
|
|
3852
3742
|
|
|
3853
3743
|
Example
|
|
3854
3744
|
|
|
@@ -3865,13 +3755,12 @@ conditions are not met.
|
|
|
3865
3755
|
```ts
|
|
3866
3756
|
verify1(a: BigNumber): void
|
|
3867
3757
|
```
|
|
3868
|
-
|
|
3869
3758
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3870
3759
|
|
|
3871
3760
|
Argument Details
|
|
3872
3761
|
|
|
3873
|
-
|
|
3874
|
-
|
|
3762
|
+
+ **a**
|
|
3763
|
+
+ The BigNumber to be verified.
|
|
3875
3764
|
|
|
3876
3765
|
Example
|
|
3877
3766
|
|
|
@@ -3890,15 +3779,14 @@ conditions are not met.
|
|
|
3890
3779
|
```ts
|
|
3891
3780
|
verify2(a: BigNumber, b: BigNumber): void
|
|
3892
3781
|
```
|
|
3893
|
-
|
|
3894
3782
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3895
3783
|
|
|
3896
3784
|
Argument Details
|
|
3897
3785
|
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3786
|
+
+ **a**
|
|
3787
|
+
+ The first BigNumber to be verified.
|
|
3788
|
+
+ **b**
|
|
3789
|
+
+ The second BigNumber to be verified.
|
|
3902
3790
|
|
|
3903
3791
|
Example
|
|
3904
3792
|
|
|
@@ -3911,7 +3799,6 @@ this.verify2(new BigNumber(10).toRed(this), new BigNumber(20)); //throws an Erro
|
|
|
3911
3799
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3912
3800
|
|
|
3913
3801
|
---
|
|
3914
|
-
|
|
3915
3802
|
### Class: SHA1
|
|
3916
3803
|
|
|
3917
3804
|
An implementation of SHA1 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -3964,7 +3851,6 @@ k: number[]
|
|
|
3964
3851
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3965
3852
|
|
|
3966
3853
|
---
|
|
3967
|
-
|
|
3968
3854
|
### Class: SHA1HMAC
|
|
3969
3855
|
|
|
3970
3856
|
```ts
|
|
@@ -3984,7 +3870,6 @@ See also: [SHA1](./primitives.md#class-sha1)
|
|
|
3984
3870
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3985
3871
|
|
|
3986
3872
|
---
|
|
3987
|
-
|
|
3988
3873
|
### Class: SHA256
|
|
3989
3874
|
|
|
3990
3875
|
An implementation of SHA256 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -4037,7 +3922,6 @@ k: number[]
|
|
|
4037
3922
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4038
3923
|
|
|
4039
3924
|
---
|
|
4040
|
-
|
|
4041
3925
|
### Class: SHA256HMAC
|
|
4042
3926
|
|
|
4043
3927
|
The `SHA256HMAC` class is used to create Hash-based Message Authentication Code (HMAC) using the SHA-256 cryptographic hash function.
|
|
@@ -4075,8 +3959,8 @@ constructor(key: number[] | string)
|
|
|
4075
3959
|
|
|
4076
3960
|
Argument Details
|
|
4077
3961
|
|
|
4078
|
-
|
|
4079
|
-
|
|
3962
|
+
+ **key**
|
|
3963
|
+
+ The key to use to create the HMAC. Can be a number array or a string in hexadecimal format.
|
|
4080
3964
|
|
|
4081
3965
|
Example
|
|
4082
3966
|
|
|
@@ -4099,7 +3983,6 @@ Represents the inner hash of SHA-256.
|
|
|
4099
3983
|
```ts
|
|
4100
3984
|
inner: SHA256
|
|
4101
3985
|
```
|
|
4102
|
-
|
|
4103
3986
|
See also: [SHA256](./primitives.md#class-sha256)
|
|
4104
3987
|
|
|
4105
3988
|
#### Property outSize
|
|
@@ -4117,7 +4000,6 @@ Represents the outer hash of SHA-256.
|
|
|
4117
4000
|
```ts
|
|
4118
4001
|
outer: SHA256
|
|
4119
4002
|
```
|
|
4120
|
-
|
|
4121
4003
|
See also: [SHA256](./primitives.md#class-sha256)
|
|
4122
4004
|
|
|
4123
4005
|
#### Method digest
|
|
@@ -4163,7 +4045,6 @@ Updates the `SHA256HMAC` object with part of the message to be hashed.
|
|
|
4163
4045
|
```ts
|
|
4164
4046
|
update(msg: number[] | string, enc?: "hex"): SHA256HMAC
|
|
4165
4047
|
```
|
|
4166
|
-
|
|
4167
4048
|
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
4168
4049
|
|
|
4169
4050
|
Returns
|
|
@@ -4172,10 +4053,10 @@ Returns the instance of `SHA256HMAC` for chaining calls.
|
|
|
4172
4053
|
|
|
4173
4054
|
Argument Details
|
|
4174
4055
|
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4056
|
+
+ **msg**
|
|
4057
|
+
+ Part of the message to hash. Can be a number array or a string.
|
|
4058
|
+
+ **enc**
|
|
4059
|
+
+ If 'hex', then the input is encoded as hexadecimal. If undefined or not 'hex', then no encoding is performed.
|
|
4179
4060
|
|
|
4180
4061
|
Example
|
|
4181
4062
|
|
|
@@ -4186,7 +4067,6 @@ myHMAC.update('deadbeef', 'hex');
|
|
|
4186
4067
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4187
4068
|
|
|
4188
4069
|
---
|
|
4189
|
-
|
|
4190
4070
|
### Class: SHA512
|
|
4191
4071
|
|
|
4192
4072
|
An implementation of SHA512 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -4240,7 +4120,6 @@ k: number[]
|
|
|
4240
4120
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4241
4121
|
|
|
4242
4122
|
---
|
|
4243
|
-
|
|
4244
4123
|
### Class: SHA512HMAC
|
|
4245
4124
|
|
|
4246
4125
|
The `SHA512HMAC` class is used to create Hash-based Message Authentication Code (HMAC) using the SHA-512 cryptographic hash function.
|
|
@@ -4278,8 +4157,8 @@ constructor(key: number[] | string)
|
|
|
4278
4157
|
|
|
4279
4158
|
Argument Details
|
|
4280
4159
|
|
|
4281
|
-
|
|
4282
|
-
|
|
4160
|
+
+ **key**
|
|
4161
|
+
+ The key to use to create the HMAC. Can be a number array or a string in hexadecimal format.
|
|
4283
4162
|
|
|
4284
4163
|
Example
|
|
4285
4164
|
|
|
@@ -4302,7 +4181,6 @@ Represents the inner hash of SHA-512.
|
|
|
4302
4181
|
```ts
|
|
4303
4182
|
inner: SHA512
|
|
4304
4183
|
```
|
|
4305
|
-
|
|
4306
4184
|
See also: [SHA512](./primitives.md#class-sha512)
|
|
4307
4185
|
|
|
4308
4186
|
#### Property outSize
|
|
@@ -4320,7 +4198,6 @@ Represents the outer hash of SHA-512.
|
|
|
4320
4198
|
```ts
|
|
4321
4199
|
outer: SHA512
|
|
4322
4200
|
```
|
|
4323
|
-
|
|
4324
4201
|
See also: [SHA512](./primitives.md#class-sha512)
|
|
4325
4202
|
|
|
4326
4203
|
#### Method digest
|
|
@@ -4366,7 +4243,6 @@ Updates the `SHA512HMAC` object with part of the message to be hashed.
|
|
|
4366
4243
|
```ts
|
|
4367
4244
|
update(msg: number[] | string, enc?: "hex" | "utf8"): SHA512HMAC
|
|
4368
4245
|
```
|
|
4369
|
-
|
|
4370
4246
|
See also: [SHA512HMAC](./primitives.md#class-sha512hmac)
|
|
4371
4247
|
|
|
4372
4248
|
Returns
|
|
@@ -4375,10 +4251,10 @@ Returns the instance of `SHA512HMAC` for chaining calls.
|
|
|
4375
4251
|
|
|
4376
4252
|
Argument Details
|
|
4377
4253
|
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4254
|
+
+ **msg**
|
|
4255
|
+
+ Part of the message to hash. Can be a number array or a string.
|
|
4256
|
+
+ **enc**
|
|
4257
|
+
+ If 'hex', then the input is encoded as hexadecimal. If undefined or not 'hex', then no encoding is performed.
|
|
4382
4258
|
|
|
4383
4259
|
Example
|
|
4384
4260
|
|
|
@@ -4389,7 +4265,6 @@ myHMAC.update('deadbeef', 'hex');
|
|
|
4389
4265
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4390
4266
|
|
|
4391
4267
|
---
|
|
4392
|
-
|
|
4393
4268
|
### Class: Schnorr
|
|
4394
4269
|
|
|
4395
4270
|
Class representing the Schnorr Zero-Knowledge Proof (ZKP) protocol.
|
|
@@ -4399,7 +4274,6 @@ Specifically, it allows one party to prove to another that they know the private
|
|
|
4399
4274
|
and have correctly computed a shared secret, without disclosing the private key itself.
|
|
4400
4275
|
|
|
4401
4276
|
The protocol involves two main methods:
|
|
4402
|
-
|
|
4403
4277
|
- `generateProof`: Generates a proof linking a public key `A` and a shared secret `S`, proving knowledge of the corresponding private key `a`.
|
|
4404
4278
|
- `verifyProof`: Verifies the provided proof, ensuring its validity without revealing any secret information.
|
|
4405
4279
|
|
|
@@ -4422,7 +4296,6 @@ const proof = schnorr.generateProof(a, A, B, S);
|
|
|
4422
4296
|
const isValid = schnorr.verifyProof(A.point, B.point, S.point, proof);
|
|
4423
4297
|
console.log(`Proof is valid: ${isValid}`);
|
|
4424
4298
|
```
|
|
4425
|
-
|
|
4426
4299
|
```ts
|
|
4427
4300
|
export default class Schnorr {
|
|
4428
4301
|
constructor()
|
|
@@ -4452,7 +4325,6 @@ generateProof(aArg: PrivateKey, AArg: PublicKey, BArg: PublicKey, S: Point): {
|
|
|
4452
4325
|
z: BigNumber;
|
|
4453
4326
|
}
|
|
4454
4327
|
```
|
|
4455
|
-
|
|
4456
4328
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
4457
4329
|
|
|
4458
4330
|
Returns
|
|
@@ -4461,14 +4333,14 @@ Proof (R, S', z)
|
|
|
4461
4333
|
|
|
4462
4334
|
Argument Details
|
|
4463
4335
|
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4336
|
+
+ **a**
|
|
4337
|
+
+ Private key corresponding to public key A
|
|
4338
|
+
+ **A**
|
|
4339
|
+
+ Public key
|
|
4340
|
+
+ **B**
|
|
4341
|
+
+ Other party's public key
|
|
4342
|
+
+ **S**
|
|
4343
|
+
+ Shared secret
|
|
4472
4344
|
|
|
4473
4345
|
#### Method verifyProof
|
|
4474
4346
|
|
|
@@ -4481,7 +4353,6 @@ verifyProof(A: Point, B: Point, S: Point, proof: {
|
|
|
4481
4353
|
z: BigNumber;
|
|
4482
4354
|
}): boolean
|
|
4483
4355
|
```
|
|
4484
|
-
|
|
4485
4356
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
4486
4357
|
|
|
4487
4358
|
Returns
|
|
@@ -4490,19 +4361,18 @@ True if the proof is valid, false otherwise
|
|
|
4490
4361
|
|
|
4491
4362
|
Argument Details
|
|
4492
4363
|
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4364
|
+
+ **A**
|
|
4365
|
+
+ Public key
|
|
4366
|
+
+ **B**
|
|
4367
|
+
+ Other party's public key
|
|
4368
|
+
+ **S**
|
|
4369
|
+
+ Shared secret
|
|
4370
|
+
+ **proof**
|
|
4371
|
+
+ Proof (R, S', z)
|
|
4501
4372
|
|
|
4502
4373
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4503
4374
|
|
|
4504
4375
|
---
|
|
4505
|
-
|
|
4506
4376
|
### Class: Signature
|
|
4507
4377
|
|
|
4508
4378
|
Represents a digital signature.
|
|
@@ -4537,15 +4407,14 @@ Creates an instance of the Signature class.
|
|
|
4537
4407
|
```ts
|
|
4538
4408
|
constructor(r: BigNumber, s: BigNumber)
|
|
4539
4409
|
```
|
|
4540
|
-
|
|
4541
4410
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4542
4411
|
|
|
4543
4412
|
Argument Details
|
|
4544
4413
|
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4414
|
+
+ **r**
|
|
4415
|
+
+ The R component of the signature.
|
|
4416
|
+
+ **s**
|
|
4417
|
+
+ The S component of the signature.
|
|
4549
4418
|
|
|
4550
4419
|
Example
|
|
4551
4420
|
|
|
@@ -4565,7 +4434,6 @@ The recovery factor is a number between 0 and 3.
|
|
|
4565
4434
|
```ts
|
|
4566
4435
|
CalculateRecoveryFactor(pubkey: PublicKey, msgHash: BigNumber): number
|
|
4567
4436
|
```
|
|
4568
|
-
|
|
4569
4437
|
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
4570
4438
|
|
|
4571
4439
|
Returns
|
|
@@ -4575,8 +4443,8 @@ the recovery factor: number
|
|
|
4575
4443
|
|
|
4576
4444
|
Argument Details
|
|
4577
4445
|
|
|
4578
|
-
|
|
4579
|
-
|
|
4446
|
+
+ **msgHash**
|
|
4447
|
+
+ The message hash.
|
|
4580
4448
|
|
|
4581
4449
|
Example
|
|
4582
4450
|
|
|
@@ -4594,7 +4462,6 @@ The recovery factor is a number between 0 and 3.
|
|
|
4594
4462
|
```ts
|
|
4595
4463
|
RecoverPublicKey(recovery: number, e: BigNumber): PublicKey
|
|
4596
4464
|
```
|
|
4597
|
-
|
|
4598
4465
|
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
4599
4466
|
|
|
4600
4467
|
Returns
|
|
@@ -4603,10 +4470,10 @@ The public key associated with the signature.
|
|
|
4603
4470
|
|
|
4604
4471
|
Argument Details
|
|
4605
4472
|
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4473
|
+
+ **recovery**
|
|
4474
|
+
+ The recovery factor.
|
|
4475
|
+
+ **e**
|
|
4476
|
+
+ The message hash.
|
|
4610
4477
|
|
|
4611
4478
|
Example
|
|
4612
4479
|
|
|
@@ -4627,7 +4494,6 @@ We could support recovery functions in future if there's demand.
|
|
|
4627
4494
|
```ts
|
|
4628
4495
|
static fromCompact(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
4629
4496
|
```
|
|
4630
|
-
|
|
4631
4497
|
See also: [Signature](./primitives.md#class-signature)
|
|
4632
4498
|
|
|
4633
4499
|
Returns
|
|
@@ -4636,10 +4502,10 @@ The decoded data in the form of Signature instance.
|
|
|
4636
4502
|
|
|
4637
4503
|
Argument Details
|
|
4638
4504
|
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4505
|
+
+ **data**
|
|
4506
|
+
+ The sequence to decode from Compact encoding.
|
|
4507
|
+
+ **enc**
|
|
4508
|
+
+ The encoding of the data string.
|
|
4643
4509
|
|
|
4644
4510
|
Example
|
|
4645
4511
|
|
|
@@ -4656,7 +4522,6 @@ If a string is provided, it is assumed to represent a hexadecimal sequence.
|
|
|
4656
4522
|
```ts
|
|
4657
4523
|
static fromDER(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
4658
4524
|
```
|
|
4659
|
-
|
|
4660
4525
|
See also: [Signature](./primitives.md#class-signature)
|
|
4661
4526
|
|
|
4662
4527
|
Returns
|
|
@@ -4665,10 +4530,10 @@ The decoded data in the form of Signature instance.
|
|
|
4665
4530
|
|
|
4666
4531
|
Argument Details
|
|
4667
4532
|
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4533
|
+
+ **data**
|
|
4534
|
+
+ The sequence to decode from DER encoding.
|
|
4535
|
+
+ **enc**
|
|
4536
|
+
+ The encoding of the data string.
|
|
4672
4537
|
|
|
4673
4538
|
Example
|
|
4674
4539
|
|
|
@@ -4694,8 +4559,8 @@ The current instance in DER encoding.
|
|
|
4694
4559
|
|
|
4695
4560
|
Argument Details
|
|
4696
4561
|
|
|
4697
|
-
|
|
4698
|
-
|
|
4562
|
+
+ **enc**
|
|
4563
|
+
+ The encoding to use for the output.
|
|
4699
4564
|
|
|
4700
4565
|
Example
|
|
4701
4566
|
|
|
@@ -4721,8 +4586,8 @@ The current instance in DER encoding.
|
|
|
4721
4586
|
|
|
4722
4587
|
Argument Details
|
|
4723
4588
|
|
|
4724
|
-
|
|
4725
|
-
|
|
4589
|
+
+ **enc**
|
|
4590
|
+
+ The encoding to use for the output.
|
|
4726
4591
|
|
|
4727
4592
|
Example
|
|
4728
4593
|
|
|
@@ -4751,8 +4616,8 @@ The current instance in DER encoding.
|
|
|
4751
4616
|
|
|
4752
4617
|
Argument Details
|
|
4753
4618
|
|
|
4754
|
-
|
|
4755
|
-
|
|
4619
|
+
+ **enc**
|
|
4620
|
+
+ The encoding to use for the output.
|
|
4756
4621
|
|
|
4757
4622
|
Example
|
|
4758
4623
|
|
|
@@ -4770,7 +4635,6 @@ If the data or key do not match the signature, the function returns false.
|
|
|
4770
4635
|
```ts
|
|
4771
4636
|
verify(msg: number[] | string, key: PublicKey, enc?: "hex"): boolean
|
|
4772
4637
|
```
|
|
4773
|
-
|
|
4774
4638
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
4775
4639
|
|
|
4776
4640
|
Returns
|
|
@@ -4779,12 +4643,12 @@ A boolean representing whether the signature is valid.
|
|
|
4779
4643
|
|
|
4780
4644
|
Argument Details
|
|
4781
4645
|
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4646
|
+
+ **msg**
|
|
4647
|
+
+ The message to verify.
|
|
4648
|
+
+ **key**
|
|
4649
|
+
+ The public key used to sign the original message.
|
|
4650
|
+
+ **enc**
|
|
4651
|
+
+ The encoding of the msg string.
|
|
4788
4652
|
|
|
4789
4653
|
Example
|
|
4790
4654
|
|
|
@@ -4797,7 +4661,6 @@ const isVerified = signature.verify(msg, publicKey);
|
|
|
4797
4661
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4798
4662
|
|
|
4799
4663
|
---
|
|
4800
|
-
|
|
4801
4664
|
### Class: SymmetricKey
|
|
4802
4665
|
|
|
4803
4666
|
`SymmetricKey` is a class that extends the `BigNumber` class and implements symmetric encryption and decryption methods.
|
|
@@ -4830,10 +4693,10 @@ Returns the decrypted message as a string or an array of numbers, depending on `
|
|
|
4830
4693
|
|
|
4831
4694
|
Argument Details
|
|
4832
4695
|
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4696
|
+
+ **msg**
|
|
4697
|
+
+ The encrypted message to be decrypted. It can be a string or an array of numbers.
|
|
4698
|
+
+ **enc**
|
|
4699
|
+
+ optional. The encoding of the message (if no encoding is provided, uses utf8 for strings, unless specified as hex).
|
|
4837
4700
|
|
|
4838
4701
|
Throws
|
|
4839
4702
|
|
|
@@ -4862,10 +4725,10 @@ Returns the encrypted message as a string or an array of numbers, depending on `
|
|
|
4862
4725
|
|
|
4863
4726
|
Argument Details
|
|
4864
4727
|
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4728
|
+
+ **msg**
|
|
4729
|
+
+ The message to be encrypted. It can be a string or an array of numbers.
|
|
4730
|
+
+ **enc**
|
|
4731
|
+
+ optional. The encoding of the message. If hex, the string is assumed to be hex, UTF-8 otherwise.
|
|
4869
4732
|
|
|
4870
4733
|
Example
|
|
4871
4734
|
|
|
@@ -4881,7 +4744,6 @@ Generates a symmetric key randomly.
|
|
|
4881
4744
|
```ts
|
|
4882
4745
|
static fromRandom(): SymmetricKey
|
|
4883
4746
|
```
|
|
4884
|
-
|
|
4885
4747
|
See also: [SymmetricKey](./primitives.md#class-symmetrickey)
|
|
4886
4748
|
|
|
4887
4749
|
Returns
|
|
@@ -4897,7 +4759,6 @@ const symmetricKey = SymmetricKey.fromRandom();
|
|
|
4897
4759
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4898
4760
|
|
|
4899
4761
|
---
|
|
4900
|
-
|
|
4901
4762
|
### Class: TransactionSignature
|
|
4902
4763
|
|
|
4903
4764
|
```ts
|
|
@@ -4943,7 +4804,6 @@ public hasLowS(): boolean
|
|
|
4943
4804
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4944
4805
|
|
|
4945
4806
|
---
|
|
4946
|
-
|
|
4947
4807
|
### Class: Writer
|
|
4948
4808
|
|
|
4949
4809
|
```ts
|
|
@@ -4979,7 +4839,6 @@ See also: [BigNumber](./primitives.md#class-bignumber), [toArray](./primitives.m
|
|
|
4979
4839
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4980
4840
|
|
|
4981
4841
|
---
|
|
4982
|
-
|
|
4983
4842
|
## Functions
|
|
4984
4843
|
|
|
4985
4844
|
| |
|
|
@@ -5005,7 +4864,6 @@ export function AES(input: number[], key: number[]): number[]
|
|
|
5005
4864
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5006
4865
|
|
|
5007
4866
|
---
|
|
5008
|
-
|
|
5009
4867
|
### Function: AESGCM
|
|
5010
4868
|
|
|
5011
4869
|
```ts
|
|
@@ -5018,7 +4876,6 @@ export function AESGCM(plainText: number[], additionalAuthenticatedData: number[
|
|
|
5018
4876
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5019
4877
|
|
|
5020
4878
|
---
|
|
5021
|
-
|
|
5022
4879
|
### Function: AESGCMDecrypt
|
|
5023
4880
|
|
|
5024
4881
|
```ts
|
|
@@ -5028,7 +4885,6 @@ export function AESGCMDecrypt(cipherText: number[], additionalAuthenticatedData:
|
|
|
5028
4885
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5029
4886
|
|
|
5030
4887
|
---
|
|
5031
|
-
|
|
5032
4888
|
### Function: ghash
|
|
5033
4889
|
|
|
5034
4890
|
```ts
|
|
@@ -5038,7 +4894,6 @@ export function ghash(input: number[], hashSubKey: number[]): number[]
|
|
|
5038
4894
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5039
4895
|
|
|
5040
4896
|
---
|
|
5041
|
-
|
|
5042
4897
|
### Function: pbkdf2
|
|
5043
4898
|
|
|
5044
4899
|
Limited SHA-512-only PBKDF2 function for use in deprecated BIP39 code.
|
|
@@ -5053,21 +4908,20 @@ The computed key
|
|
|
5053
4908
|
|
|
5054
4909
|
Argument Details
|
|
5055
4910
|
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
4911
|
+
+ **password**
|
|
4912
|
+
+ The PBKDF2 password
|
|
4913
|
+
+ **salt**
|
|
4914
|
+
+ The PBKDF2 salt
|
|
4915
|
+
+ **iterations**
|
|
4916
|
+
+ The number of of iterations to run
|
|
4917
|
+
+ **keylen**
|
|
4918
|
+
+ The length of the key
|
|
4919
|
+
+ **digest**
|
|
4920
|
+
+ The digest (must be sha512 for this implementation)
|
|
5066
4921
|
|
|
5067
4922
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5068
4923
|
|
|
5069
4924
|
---
|
|
5070
|
-
|
|
5071
4925
|
### Function: toArray
|
|
5072
4926
|
|
|
5073
4927
|
```ts
|
|
@@ -5080,13 +4934,12 @@ array of byte values from msg. If msg is an array, a copy is returned.
|
|
|
5080
4934
|
|
|
5081
4935
|
Argument Details
|
|
5082
4936
|
|
|
5083
|
-
|
|
5084
|
-
|
|
4937
|
+
+ **enc**
|
|
4938
|
+
+ Optional. Encoding to use if msg is string. Default is 'utf8'.
|
|
5085
4939
|
|
|
5086
4940
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5087
4941
|
|
|
5088
4942
|
---
|
|
5089
|
-
|
|
5090
4943
|
### Function: toBase64
|
|
5091
4944
|
|
|
5092
4945
|
Converts an array of bytes (each between 0 and 255) into a base64 encoded string.
|
|
@@ -5108,13 +4961,12 @@ The base64 encoded string.
|
|
|
5108
4961
|
|
|
5109
4962
|
Argument Details
|
|
5110
4963
|
|
|
5111
|
-
|
|
5112
|
-
|
|
4964
|
+
+ **byteArray**
|
|
4965
|
+
+ An array of numbers where each number is a byte (0-255).
|
|
5113
4966
|
|
|
5114
4967
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5115
4968
|
|
|
5116
4969
|
---
|
|
5117
|
-
|
|
5118
4970
|
## Types
|
|
5119
4971
|
|
|
5120
4972
|
## Enums
|
|
@@ -5148,7 +5000,6 @@ checkBit = function (byteArray: number[], byteIndex: number, bitIndex: number):
|
|
|
5148
5000
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5149
5001
|
|
|
5150
5002
|
---
|
|
5151
|
-
|
|
5152
5003
|
### Variable: encode
|
|
5153
5004
|
|
|
5154
5005
|
```ts
|
|
@@ -5169,7 +5020,6 @@ See also: [toHex](./primitives.md#variable-tohex), [toUTF8](./primitives.md#vari
|
|
|
5169
5020
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5170
5021
|
|
|
5171
5022
|
---
|
|
5172
|
-
|
|
5173
5023
|
### Variable: exclusiveOR
|
|
5174
5024
|
|
|
5175
5025
|
```ts
|
|
@@ -5186,7 +5036,6 @@ exclusiveOR = function (block0: number[], block1: number[]): number[] {
|
|
|
5186
5036
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5187
5037
|
|
|
5188
5038
|
---
|
|
5189
|
-
|
|
5190
5039
|
### Variable: fromBase58
|
|
5191
5040
|
|
|
5192
5041
|
```ts
|
|
@@ -5223,7 +5072,6 @@ fromBase58 = (str: string): number[] => {
|
|
|
5223
5072
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5224
5073
|
|
|
5225
5074
|
---
|
|
5226
|
-
|
|
5227
5075
|
### Variable: fromBase58Check
|
|
5228
5076
|
|
|
5229
5077
|
```ts
|
|
@@ -5254,7 +5102,6 @@ See also: [fromBase58](./primitives.md#variable-frombase58), [hash256](./primiti
|
|
|
5254
5102
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5255
5103
|
|
|
5256
5104
|
---
|
|
5257
|
-
|
|
5258
5105
|
### Variable: getBytes
|
|
5259
5106
|
|
|
5260
5107
|
```ts
|
|
@@ -5271,7 +5118,6 @@ getBytes = function (numericValue: number): number[] {
|
|
|
5271
5118
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5272
5119
|
|
|
5273
5120
|
---
|
|
5274
|
-
|
|
5275
5121
|
### Variable: hash160
|
|
5276
5122
|
|
|
5277
5123
|
```ts
|
|
@@ -5286,7 +5132,6 @@ See also: [RIPEMD160](./primitives.md#class-ripemd160), [SHA256](./primitives.md
|
|
|
5286
5132
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5287
5133
|
|
|
5288
5134
|
---
|
|
5289
|
-
|
|
5290
5135
|
### Variable: hash256
|
|
5291
5136
|
|
|
5292
5137
|
```ts
|
|
@@ -5301,7 +5146,6 @@ See also: [SHA256](./primitives.md#class-sha256)
|
|
|
5301
5146
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5302
5147
|
|
|
5303
5148
|
---
|
|
5304
|
-
|
|
5305
5149
|
### Variable: incrementLeastSignificantThirtyTwoBits
|
|
5306
5150
|
|
|
5307
5151
|
```ts
|
|
@@ -5324,7 +5168,6 @@ incrementLeastSignificantThirtyTwoBits = function (block: number[]): number[] {
|
|
|
5324
5168
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5325
5169
|
|
|
5326
5170
|
---
|
|
5327
|
-
|
|
5328
5171
|
### Variable: minimallyEncode
|
|
5329
5172
|
|
|
5330
5173
|
```ts
|
|
@@ -5361,7 +5204,6 @@ minimallyEncode = (buf: number[]): number[] => {
|
|
|
5361
5204
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5362
5205
|
|
|
5363
5206
|
---
|
|
5364
|
-
|
|
5365
5207
|
### Variable: multiply
|
|
5366
5208
|
|
|
5367
5209
|
```ts
|
|
@@ -5391,7 +5233,6 @@ See also: [rightShift](./primitives.md#variable-rightshift)
|
|
|
5391
5233
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5392
5234
|
|
|
5393
5235
|
---
|
|
5394
|
-
|
|
5395
5236
|
### Variable: rightShift
|
|
5396
5237
|
|
|
5397
5238
|
```ts
|
|
@@ -5414,7 +5255,6 @@ rightShift = function (block: number[]): number[] {
|
|
|
5414
5255
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5415
5256
|
|
|
5416
5257
|
---
|
|
5417
|
-
|
|
5418
5258
|
### Variable: ripemd160
|
|
5419
5259
|
|
|
5420
5260
|
```ts
|
|
@@ -5428,7 +5268,6 @@ See also: [RIPEMD160](./primitives.md#class-ripemd160)
|
|
|
5428
5268
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5429
5269
|
|
|
5430
5270
|
---
|
|
5431
|
-
|
|
5432
5271
|
### Variable: sha1
|
|
5433
5272
|
|
|
5434
5273
|
```ts
|
|
@@ -5442,7 +5281,6 @@ See also: [SHA1](./primitives.md#class-sha1)
|
|
|
5442
5281
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5443
5282
|
|
|
5444
5283
|
---
|
|
5445
|
-
|
|
5446
5284
|
### Variable: sha256
|
|
5447
5285
|
|
|
5448
5286
|
```ts
|
|
@@ -5456,7 +5294,6 @@ See also: [SHA256](./primitives.md#class-sha256)
|
|
|
5456
5294
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5457
5295
|
|
|
5458
5296
|
---
|
|
5459
|
-
|
|
5460
5297
|
### Variable: sha256hmac
|
|
5461
5298
|
|
|
5462
5299
|
```ts
|
|
@@ -5470,7 +5307,6 @@ See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
|
5470
5307
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5471
5308
|
|
|
5472
5309
|
---
|
|
5473
|
-
|
|
5474
5310
|
### Variable: sha512
|
|
5475
5311
|
|
|
5476
5312
|
```ts
|
|
@@ -5484,7 +5320,6 @@ See also: [SHA512](./primitives.md#class-sha512)
|
|
|
5484
5320
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5485
5321
|
|
|
5486
5322
|
---
|
|
5487
|
-
|
|
5488
5323
|
### Variable: sha512hmac
|
|
5489
5324
|
|
|
5490
5325
|
```ts
|
|
@@ -5498,7 +5333,6 @@ See also: [SHA512HMAC](./primitives.md#class-sha512hmac)
|
|
|
5498
5333
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5499
5334
|
|
|
5500
5335
|
---
|
|
5501
|
-
|
|
5502
5336
|
### Variable: sign
|
|
5503
5337
|
|
|
5504
5338
|
```ts
|
|
@@ -5762,7 +5596,6 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Curve](./primitives.md#
|
|
|
5762
5596
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5763
5597
|
|
|
5764
5598
|
---
|
|
5765
|
-
|
|
5766
5599
|
### Variable: toArray
|
|
5767
5600
|
|
|
5768
5601
|
```ts
|
|
@@ -5788,7 +5621,6 @@ toArray = (msg: any, enc?: "hex" | "utf8" | "base64"): any[] => {
|
|
|
5788
5621
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5789
5622
|
|
|
5790
5623
|
---
|
|
5791
|
-
|
|
5792
5624
|
### Variable: toBase58
|
|
5793
5625
|
|
|
5794
5626
|
```ts
|
|
@@ -5824,7 +5656,6 @@ toBase58 = (bin: number[]): string => {
|
|
|
5824
5656
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5825
5657
|
|
|
5826
5658
|
---
|
|
5827
|
-
|
|
5828
5659
|
### Variable: toBase58Check
|
|
5829
5660
|
|
|
5830
5661
|
```ts
|
|
@@ -5840,7 +5671,6 @@ See also: [hash256](./primitives.md#variable-hash256), [toBase58](./primitives.m
|
|
|
5840
5671
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5841
5672
|
|
|
5842
5673
|
---
|
|
5843
|
-
|
|
5844
5674
|
### Variable: toHex
|
|
5845
5675
|
|
|
5846
5676
|
```ts
|
|
@@ -5858,7 +5688,6 @@ See also: [zero2](./primitives.md#variable-zero2)
|
|
|
5858
5688
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5859
5689
|
|
|
5860
5690
|
---
|
|
5861
|
-
|
|
5862
5691
|
### Variable: toUTF8
|
|
5863
5692
|
|
|
5864
5693
|
```ts
|
|
@@ -5908,7 +5737,6 @@ toUTF8 = (arr: number[]): string => {
|
|
|
5908
5737
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5909
5738
|
|
|
5910
5739
|
---
|
|
5911
|
-
|
|
5912
5740
|
### Variable: verify
|
|
5913
5741
|
|
|
5914
5742
|
```ts
|
|
@@ -6078,7 +5906,6 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Curve](./primitives.md#
|
|
|
6078
5906
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
6079
5907
|
|
|
6080
5908
|
---
|
|
6081
|
-
|
|
6082
5909
|
### Variable: zero2
|
|
6083
5910
|
|
|
6084
5911
|
```ts
|