@bsv/sdk 1.6.11 → 1.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/cjs/src/wallet/WalletClient.js +1 -0
- package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/esm/src/wallet/WalletClient.js +1 -0
- package/dist/esm/src/wallet/WalletClient.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/MARKDOWN_VALIDATION_GUIDE.md +175 -0
- package/docs/concepts/beef.md +8 -0
- package/docs/concepts/chain-tracking.md +12 -0
- package/docs/concepts/decentralized-identity.md +37 -0
- package/docs/concepts/fees.md +32 -0
- package/docs/concepts/identity-certificates.md +53 -1
- package/docs/concepts/index.md +15 -0
- package/docs/concepts/key-management.md +9 -0
- package/docs/concepts/script-templates.md +13 -0
- package/docs/concepts/sdk-philosophy.md +8 -0
- package/docs/concepts/signatures.md +15 -0
- package/docs/concepts/spv-verification.md +12 -0
- package/docs/concepts/transaction-encoding.md +19 -0
- package/docs/concepts/transaction-structure.md +4 -0
- package/docs/concepts/trust-model.md +16 -0
- package/docs/concepts/verification.md +31 -0
- package/docs/concepts/wallet-integration.md +6 -0
- package/docs/guides/development-wallet-setup.md +374 -0
- package/docs/guides/direct-transaction-creation.md +12 -2
- package/docs/guides/http-client-configuration.md +122 -48
- package/docs/guides/index.md +117 -9
- package/docs/guides/large-transactions.md +448 -0
- package/docs/guides/multisig-transactions.md +792 -0
- package/docs/guides/security-best-practices.md +494 -0
- package/docs/guides/transaction-batching.md +132 -0
- package/docs/guides/transaction-signing-methods.md +230 -79
- package/docs/index.md +0 -2
- package/docs/reference/auth.md +212 -159
- package/docs/reference/compat.md +120 -96
- package/docs/reference/configuration.md +6 -0
- package/docs/reference/debugging.md +5 -0
- package/docs/reference/errors.md +50 -0
- package/docs/reference/identity.md +21 -12
- package/docs/reference/index.md +14 -1
- package/docs/reference/kvstore.md +21 -19
- package/docs/reference/messages.md +3 -0
- package/docs/reference/op-codes.md +20 -1
- package/docs/reference/overlay-tools.md +46 -18
- package/docs/reference/primitives.md +571 -390
- package/docs/reference/registry.md +43 -20
- package/docs/reference/script.md +140 -105
- package/docs/reference/storage.md +32 -12
- package/docs/reference/totp.md +16 -11
- package/docs/reference/transaction-signatures.md +2 -1
- package/docs/reference/transaction.md +201 -120
- package/docs/reference/wallet.md +241 -64
- package/docs/tutorials/advanced-transaction.md +1 -4
- package/docs/tutorials/aes-encryption.md +3 -1
- package/docs/tutorials/authfetch-tutorial.md +29 -0
- package/docs/tutorials/ecdh-key-exchange.md +2 -0
- package/docs/tutorials/elliptic-curve-fundamentals.md +3 -0
- package/docs/tutorials/error-handling.md +1 -0
- package/docs/tutorials/first-transaction-low-level.md +1 -0
- package/docs/tutorials/first-transaction.md +5 -8
- package/docs/tutorials/hashes-and-hmacs.md +5 -31
- package/docs/tutorials/identity-management.md +27 -0
- package/docs/tutorials/index.md +114 -77
- package/docs/tutorials/key-management.md +5 -3
- package/docs/tutorials/protowallet-development.md +27 -0
- package/docs/tutorials/spv-merkle-proofs.md +9 -6
- package/docs/tutorials/testnet-transactions-low-level.md +25 -18
- package/docs/tutorials/transaction-broadcasting.md +10 -7
- package/docs/tutorials/transaction-types.md +5 -4
- package/docs/tutorials/type-42.md +0 -14
- package/docs/tutorials/uhrp-storage.md +23 -3
- package/package.json +1 -1
- package/src/identity/README.md +0 -1
- package/src/primitives/__tests/SymmetricKey.test.ts +45 -0
- package/src/primitives/__tests/SymmetricKeyCompatibility.test.ts +150 -0
- package/src/transaction/__tests/Transaction.test.ts +1 -1
- package/src/transaction/broadcasters/DefaultBroadcaster.ts +1 -1
- package/src/transaction/broadcasters/__tests/ARC.test.ts +1 -1
- package/src/wallet/WalletClient.ts +1 -0
|
@@ -52,6 +52,7 @@ 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
|
+
|
|
55
56
|
### Class: BigNumber
|
|
56
57
|
|
|
57
58
|
JavaScript numbers are only precise up to 53 bits. Since Bitcoin relies on
|
|
@@ -228,12 +229,12 @@ constructor(number: number | string | number[] | bigint | undefined = 0, base: n
|
|
|
228
229
|
|
|
229
230
|
Argument Details
|
|
230
231
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
- **number**
|
|
233
|
+
- The number (various types accepted) to construct a BigNumber from. Default is 0.
|
|
234
|
+
- **base**
|
|
235
|
+
- The base of number provided. By default is 10.
|
|
236
|
+
- **endian**
|
|
237
|
+
- The endianness provided. By default is 'big endian'.
|
|
237
238
|
|
|
238
239
|
#### Property red
|
|
239
240
|
|
|
@@ -242,6 +243,7 @@ Reduction context of the big number.
|
|
|
242
243
|
```ts
|
|
243
244
|
public red: ReductionContext | null
|
|
244
245
|
```
|
|
246
|
+
|
|
245
247
|
See also: [ReductionContext](./primitives.md#class-reductioncontext)
|
|
246
248
|
|
|
247
249
|
#### Property wordSize
|
|
@@ -266,6 +268,7 @@ The multiplicative inverse is a number which when multiplied with the current Bi
|
|
|
266
268
|
```ts
|
|
267
269
|
_invmp(p: BigNumber): BigNumber
|
|
268
270
|
```
|
|
271
|
+
|
|
269
272
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
270
273
|
|
|
271
274
|
Returns
|
|
@@ -274,8 +277,8 @@ The multiplicative inverse `BigNumber` in the modulus field specified by `p`.
|
|
|
274
277
|
|
|
275
278
|
Argument Details
|
|
276
279
|
|
|
277
|
-
|
|
278
|
-
|
|
280
|
+
- **p**
|
|
281
|
+
- The `BigNumber` specifying the modulus field.
|
|
279
282
|
|
|
280
283
|
#### Method bitLength
|
|
281
284
|
|
|
@@ -310,6 +313,7 @@ Creates a BigNumber from a number representing the "bits" value in a block heade
|
|
|
310
313
|
```ts
|
|
311
314
|
static fromBits(bits: number, strict: boolean = false): BigNumber
|
|
312
315
|
```
|
|
316
|
+
|
|
313
317
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
314
318
|
|
|
315
319
|
Returns
|
|
@@ -318,10 +322,10 @@ Returns a BigNumber equivalent to the "bits" value in a block header.
|
|
|
318
322
|
|
|
319
323
|
Argument Details
|
|
320
324
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
+
- **bits**
|
|
326
|
+
- The number representing the bits value in a block header.
|
|
327
|
+
- **strict**
|
|
328
|
+
- If true, an error is thrown if the number has negative bit set.
|
|
325
329
|
|
|
326
330
|
Throws
|
|
327
331
|
|
|
@@ -334,6 +338,7 @@ Creates a BigNumber from a hexadecimal string.
|
|
|
334
338
|
```ts
|
|
335
339
|
static fromHex(hex: string, endian?: "le" | "be" | "little" | "big"): BigNumber
|
|
336
340
|
```
|
|
341
|
+
|
|
337
342
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
338
343
|
|
|
339
344
|
Returns
|
|
@@ -342,10 +347,10 @@ Returns a BigNumber created from the hexadecimal input string.
|
|
|
342
347
|
|
|
343
348
|
Argument Details
|
|
344
349
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
350
|
+
- **hex**
|
|
351
|
+
- The hexadecimal string to create a BigNumber from.
|
|
352
|
+
- **endian**
|
|
353
|
+
- Optional endianness for parsing the hex string.
|
|
349
354
|
|
|
350
355
|
Example
|
|
351
356
|
|
|
@@ -361,6 +366,7 @@ Creates a BigNumber from a JSON-serialized string.
|
|
|
361
366
|
```ts
|
|
362
367
|
static fromJSON(str: string): BigNumber
|
|
363
368
|
```
|
|
369
|
+
|
|
364
370
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
365
371
|
|
|
366
372
|
Returns
|
|
@@ -369,8 +375,8 @@ Returns a BigNumber created from the JSON input string.
|
|
|
369
375
|
|
|
370
376
|
Argument Details
|
|
371
377
|
|
|
372
|
-
|
|
373
|
-
|
|
378
|
+
- **str**
|
|
379
|
+
- The JSON-serialized string to create a BigNumber from.
|
|
374
380
|
|
|
375
381
|
#### Method fromNumber
|
|
376
382
|
|
|
@@ -379,6 +385,7 @@ Creates a BigNumber from a number.
|
|
|
379
385
|
```ts
|
|
380
386
|
static fromNumber(n: number): BigNumber
|
|
381
387
|
```
|
|
388
|
+
|
|
382
389
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
383
390
|
|
|
384
391
|
Returns
|
|
@@ -387,8 +394,8 @@ Returns a BigNumber equivalent to the input number.
|
|
|
387
394
|
|
|
388
395
|
Argument Details
|
|
389
396
|
|
|
390
|
-
|
|
391
|
-
|
|
397
|
+
- **n**
|
|
398
|
+
- The number to create a BigNumber from.
|
|
392
399
|
|
|
393
400
|
#### Method fromScriptNum
|
|
394
401
|
|
|
@@ -397,6 +404,7 @@ Creates a BigNumber from the format used in Bitcoin scripts.
|
|
|
397
404
|
```ts
|
|
398
405
|
static fromScriptNum(num: number[], requireMinimal: boolean = false, maxNumSize?: number): BigNumber
|
|
399
406
|
```
|
|
407
|
+
|
|
400
408
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
401
409
|
|
|
402
410
|
Returns
|
|
@@ -405,12 +413,12 @@ Returns a BigNumber equivalent to the number used in a Bitcoin script.
|
|
|
405
413
|
|
|
406
414
|
Argument Details
|
|
407
415
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
416
|
+
- **num**
|
|
417
|
+
- The number in the format used in Bitcoin scripts.
|
|
418
|
+
- **requireMinimal**
|
|
419
|
+
- If true, non-minimally encoded values will throw an error.
|
|
420
|
+
- **maxNumSize**
|
|
421
|
+
- The maximum allowed size for the number.
|
|
414
422
|
|
|
415
423
|
#### Method fromSm
|
|
416
424
|
|
|
@@ -419,6 +427,7 @@ Creates a BigNumber from a signed magnitude number.
|
|
|
419
427
|
```ts
|
|
420
428
|
static fromSm(bytes: number[], endian: "big" | "little" = "big"): BigNumber
|
|
421
429
|
```
|
|
430
|
+
|
|
422
431
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
423
432
|
|
|
424
433
|
Returns
|
|
@@ -427,10 +436,10 @@ Returns a BigNumber equivalent to the signed magnitude number interpreted with s
|
|
|
427
436
|
|
|
428
437
|
Argument Details
|
|
429
438
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
439
|
+
- **bytes**
|
|
440
|
+
- The signed magnitude number to convert to a BigNumber.
|
|
441
|
+
- **endian**
|
|
442
|
+
- Defines endianess. If not provided, big endian is assumed.
|
|
434
443
|
|
|
435
444
|
#### Method fromString
|
|
436
445
|
|
|
@@ -439,6 +448,7 @@ Creates a BigNumber from a string, considering an optional base.
|
|
|
439
448
|
```ts
|
|
440
449
|
static fromString(str: string, base?: number | "hex"): BigNumber
|
|
441
450
|
```
|
|
451
|
+
|
|
442
452
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
443
453
|
|
|
444
454
|
Returns
|
|
@@ -447,10 +457,10 @@ Returns a BigNumber equivalent to the string after conversion from the specified
|
|
|
447
457
|
|
|
448
458
|
Argument Details
|
|
449
459
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
460
|
+
- **str**
|
|
461
|
+
- The string to create a BigNumber from.
|
|
462
|
+
- **base**
|
|
463
|
+
- The base used for conversion. If not provided, base 10 is assumed.
|
|
454
464
|
|
|
455
465
|
#### Method isBN
|
|
456
466
|
|
|
@@ -466,8 +476,8 @@ Returns
|
|
|
466
476
|
|
|
467
477
|
Argument Details
|
|
468
478
|
|
|
469
|
-
|
|
470
|
-
|
|
479
|
+
- **num**
|
|
480
|
+
- The value to be checked.
|
|
471
481
|
|
|
472
482
|
#### Method max
|
|
473
483
|
|
|
@@ -476,6 +486,7 @@ Returns the bigger value between two BigNumbers
|
|
|
476
486
|
```ts
|
|
477
487
|
static max(left: BigNumber, right: BigNumber): BigNumber
|
|
478
488
|
```
|
|
489
|
+
|
|
479
490
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
480
491
|
|
|
481
492
|
Returns
|
|
@@ -484,10 +495,10 @@ Returns
|
|
|
484
495
|
|
|
485
496
|
Argument Details
|
|
486
497
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
498
|
+
- **left**
|
|
499
|
+
- The first BigNumber to be compared.
|
|
500
|
+
- **right**
|
|
501
|
+
- The second BigNumber to be compared.
|
|
491
502
|
|
|
492
503
|
#### Method min
|
|
493
504
|
|
|
@@ -496,6 +507,7 @@ Returns the smaller value between two BigNumbers
|
|
|
496
507
|
```ts
|
|
497
508
|
static min(left: BigNumber, right: BigNumber): BigNumber
|
|
498
509
|
```
|
|
510
|
+
|
|
499
511
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
500
512
|
|
|
501
513
|
Returns
|
|
@@ -504,10 +516,10 @@ Returns
|
|
|
504
516
|
|
|
505
517
|
Argument Details
|
|
506
518
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
519
|
+
- **left**
|
|
520
|
+
- The first BigNumber to be compared.
|
|
521
|
+
- **right**
|
|
522
|
+
- The second BigNumber to be compared.
|
|
511
523
|
|
|
512
524
|
#### Method mulTo
|
|
513
525
|
|
|
@@ -517,6 +529,7 @@ It chooses the multiplication method based on the lengths of the numbers to opti
|
|
|
517
529
|
```ts
|
|
518
530
|
mulTo(num: BigNumber, out: BigNumber): BigNumber
|
|
519
531
|
```
|
|
532
|
+
|
|
520
533
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
521
534
|
|
|
522
535
|
Returns
|
|
@@ -525,10 +538,10 @@ The BigNumber resulting from the multiplication operation.
|
|
|
525
538
|
|
|
526
539
|
Argument Details
|
|
527
540
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
541
|
+
- **num**
|
|
542
|
+
- The BigNumber multiply with.
|
|
543
|
+
- **out**
|
|
544
|
+
- The BigNumber where to store the result.
|
|
532
545
|
|
|
533
546
|
#### Method toArray
|
|
534
547
|
|
|
@@ -544,10 +557,10 @@ Array of bytes representing the BigNumber.
|
|
|
544
557
|
|
|
545
558
|
Argument Details
|
|
546
559
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
560
|
+
- **endian**
|
|
561
|
+
- Endianness of the output array, defaults to 'be'.
|
|
562
|
+
- **length**
|
|
563
|
+
- Optional length of the output array.
|
|
551
564
|
|
|
552
565
|
#### Method toBitArray
|
|
553
566
|
|
|
@@ -556,6 +569,7 @@ Converts a BigNumber to an array of bits.
|
|
|
556
569
|
```ts
|
|
557
570
|
static toBitArray(num: BigNumber): Array<0 | 1>
|
|
558
571
|
```
|
|
572
|
+
|
|
559
573
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
560
574
|
|
|
561
575
|
Returns
|
|
@@ -564,8 +578,8 @@ An array of bits.
|
|
|
564
578
|
|
|
565
579
|
Argument Details
|
|
566
580
|
|
|
567
|
-
|
|
568
|
-
|
|
581
|
+
- **num**
|
|
582
|
+
- The BigNumber to convert.
|
|
569
583
|
|
|
570
584
|
#### Method toBits
|
|
571
585
|
|
|
@@ -593,8 +607,8 @@ Returns a string representing the hexadecimal value of this BigNumber.
|
|
|
593
607
|
|
|
594
608
|
Argument Details
|
|
595
609
|
|
|
596
|
-
|
|
597
|
-
|
|
610
|
+
- **length**
|
|
611
|
+
- The minimum length of the hex string
|
|
598
612
|
|
|
599
613
|
Example
|
|
600
614
|
|
|
@@ -658,8 +672,8 @@ Returns an array equivalent to this BigNumber interpreted as a signed magnitude
|
|
|
658
672
|
|
|
659
673
|
Argument Details
|
|
660
674
|
|
|
661
|
-
|
|
662
|
-
|
|
675
|
+
- **endian**
|
|
676
|
+
- Defines endianess. If not provided, big endian is assumed.
|
|
663
677
|
|
|
664
678
|
#### Method toString
|
|
665
679
|
|
|
@@ -677,10 +691,10 @@ The string representation of the BigNumber instance
|
|
|
677
691
|
|
|
678
692
|
Argument Details
|
|
679
693
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
694
|
+
- **base**
|
|
695
|
+
- The base for representing number. Default is 10. Other accepted values are 16 and 'hex'.
|
|
696
|
+
- **padding**
|
|
697
|
+
- Represents the minimum number of digits to represent the BigNumber as a string. Default is 1.
|
|
684
698
|
|
|
685
699
|
#### Method zeroBits
|
|
686
700
|
|
|
@@ -705,6 +719,7 @@ const zeroBits = bn.zeroBits(); // 3
|
|
|
705
719
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
706
720
|
|
|
707
721
|
---
|
|
722
|
+
|
|
708
723
|
### Class: Curve
|
|
709
724
|
|
|
710
725
|
```ts
|
|
@@ -779,6 +794,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#
|
|
|
779
794
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
780
795
|
|
|
781
796
|
---
|
|
797
|
+
|
|
782
798
|
### Class: DRBG
|
|
783
799
|
|
|
784
800
|
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.
|
|
@@ -817,8 +833,8 @@ The required deterministic random hexadecimal string.
|
|
|
817
833
|
|
|
818
834
|
Argument Details
|
|
819
835
|
|
|
820
|
-
|
|
821
|
-
|
|
836
|
+
- **len**
|
|
837
|
+
- The length of required random number.
|
|
822
838
|
|
|
823
839
|
Example
|
|
824
840
|
|
|
@@ -833,6 +849,7 @@ Generates HMAC using the K value of the instance. This method is used internally
|
|
|
833
849
|
```ts
|
|
834
850
|
hmac(): SHA256HMAC
|
|
835
851
|
```
|
|
852
|
+
|
|
836
853
|
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
837
854
|
|
|
838
855
|
Returns
|
|
@@ -860,8 +877,8 @@ Nothing, but updates the internal state `K` and `V` value.
|
|
|
860
877
|
|
|
861
878
|
Argument Details
|
|
862
879
|
|
|
863
|
-
|
|
864
|
-
|
|
880
|
+
- **seed**
|
|
881
|
+
- an optional value that used to update `K` and `V`. Default is `undefined`.
|
|
865
882
|
|
|
866
883
|
Example
|
|
867
884
|
|
|
@@ -872,6 +889,7 @@ drbg.update('e13af...');
|
|
|
872
889
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
873
890
|
|
|
874
891
|
---
|
|
892
|
+
|
|
875
893
|
### Class: JacobianPoint
|
|
876
894
|
|
|
877
895
|
The `JacobianPoint` class extends the `BasePoint` class for handling Jacobian coordinates on an Elliptic Curve.
|
|
@@ -914,18 +932,19 @@ Constructs a new `JacobianPoint` instance.
|
|
|
914
932
|
```ts
|
|
915
933
|
constructor(x: string | BigNumber | null, y: string | BigNumber | null, z: string | BigNumber | null)
|
|
916
934
|
```
|
|
935
|
+
|
|
917
936
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
918
937
|
|
|
919
938
|
Argument Details
|
|
920
939
|
|
|
921
|
-
|
|
922
|
-
|
|
940
|
+
- **x**
|
|
941
|
+
- If `null`, the x-coordinate will default to the curve's defined 'one' constant.
|
|
923
942
|
If `x` is not a BigNumber, `x` will be converted to a `BigNumber` assuming it is a hex string.
|
|
924
|
-
|
|
925
|
-
|
|
943
|
+
- **y**
|
|
944
|
+
- If `null`, the y-coordinate will default to the curve's defined 'one' constant.
|
|
926
945
|
If `y` is not a BigNumber, `y` will be converted to a `BigNumber` assuming it is a hex string.
|
|
927
|
-
|
|
928
|
-
|
|
946
|
+
- **z**
|
|
947
|
+
- If `null`, the z-coordinate will default to 0.
|
|
929
948
|
If `z` is not a BigNumber, `z` will be converted to a `BigNumber` assuming it is a hex string.
|
|
930
949
|
|
|
931
950
|
Example
|
|
@@ -942,6 +961,7 @@ The `x` coordinate of the point in the Jacobian form.
|
|
|
942
961
|
```ts
|
|
943
962
|
x: BigNumber
|
|
944
963
|
```
|
|
964
|
+
|
|
945
965
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
946
966
|
|
|
947
967
|
#### Property y
|
|
@@ -951,6 +971,7 @@ The `y` coordinate of the point in the Jacobian form.
|
|
|
951
971
|
```ts
|
|
952
972
|
y: BigNumber
|
|
953
973
|
```
|
|
974
|
+
|
|
954
975
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
955
976
|
|
|
956
977
|
#### Property z
|
|
@@ -960,6 +981,7 @@ The `z` coordinate of the point in the Jacobian form.
|
|
|
960
981
|
```ts
|
|
961
982
|
z: BigNumber
|
|
962
983
|
```
|
|
984
|
+
|
|
963
985
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
964
986
|
|
|
965
987
|
#### Property zOne
|
|
@@ -979,6 +1001,7 @@ when either one of the points is the point at infinity, it will return the other
|
|
|
979
1001
|
```ts
|
|
980
1002
|
add(p: JacobianPoint): JacobianPoint
|
|
981
1003
|
```
|
|
1004
|
+
|
|
982
1005
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
983
1006
|
|
|
984
1007
|
Returns
|
|
@@ -987,8 +1010,8 @@ Returns a new Jacobian point as the result of the addition.
|
|
|
987
1010
|
|
|
988
1011
|
Argument Details
|
|
989
1012
|
|
|
990
|
-
|
|
991
|
-
|
|
1013
|
+
- **p**
|
|
1014
|
+
- The Jacobian point to be added.
|
|
992
1015
|
|
|
993
1016
|
Example
|
|
994
1017
|
|
|
@@ -1005,6 +1028,7 @@ Point doubling operation in the Jacobian coordinates. A special case is when the
|
|
|
1005
1028
|
```ts
|
|
1006
1029
|
dbl(): JacobianPoint
|
|
1007
1030
|
```
|
|
1031
|
+
|
|
1008
1032
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1009
1033
|
|
|
1010
1034
|
Returns
|
|
@@ -1025,6 +1049,7 @@ Multiple doubling operation. It doubles the Jacobian point as many times as the
|
|
|
1025
1049
|
```ts
|
|
1026
1050
|
dblp(pow: number): JacobianPoint
|
|
1027
1051
|
```
|
|
1052
|
+
|
|
1028
1053
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1029
1054
|
|
|
1030
1055
|
Returns
|
|
@@ -1033,8 +1058,8 @@ Returns a new Jacobian point as the result of multiple doublings.
|
|
|
1033
1058
|
|
|
1034
1059
|
Argument Details
|
|
1035
1060
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1061
|
+
- **pow**
|
|
1062
|
+
- The number of times the point should be doubled.
|
|
1038
1063
|
|
|
1039
1064
|
Example
|
|
1040
1065
|
|
|
@@ -1050,6 +1075,7 @@ Equality check operation. It checks whether the affine or Jacobian point is equa
|
|
|
1050
1075
|
```ts
|
|
1051
1076
|
eq(p: Point | JacobianPoint): boolean
|
|
1052
1077
|
```
|
|
1078
|
+
|
|
1053
1079
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point)
|
|
1054
1080
|
|
|
1055
1081
|
Returns
|
|
@@ -1058,8 +1084,8 @@ Returns true if the points are equal, otherwise returns false.
|
|
|
1058
1084
|
|
|
1059
1085
|
Argument Details
|
|
1060
1086
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1087
|
+
- **p**
|
|
1088
|
+
- The affine or Jacobian point to compare with.
|
|
1063
1089
|
|
|
1064
1090
|
Example
|
|
1065
1091
|
|
|
@@ -1078,6 +1104,7 @@ of a point in projective coordinates.
|
|
|
1078
1104
|
```ts
|
|
1079
1105
|
eqXToP(x: BigNumber): boolean
|
|
1080
1106
|
```
|
|
1107
|
+
|
|
1081
1108
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1082
1109
|
|
|
1083
1110
|
Returns
|
|
@@ -1086,8 +1113,8 @@ Returns true if the x coordinates are equal, otherwise returns false.
|
|
|
1086
1113
|
|
|
1087
1114
|
Argument Details
|
|
1088
1115
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1116
|
+
- **x**
|
|
1117
|
+
- The x coordinate of a point in projective coordinates.
|
|
1091
1118
|
|
|
1092
1119
|
Example
|
|
1093
1120
|
|
|
@@ -1143,6 +1170,7 @@ the affine point to Jacobian, and then preforms the addition.
|
|
|
1143
1170
|
```ts
|
|
1144
1171
|
mixedAdd(p: Point): JacobianPoint
|
|
1145
1172
|
```
|
|
1173
|
+
|
|
1146
1174
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point)
|
|
1147
1175
|
|
|
1148
1176
|
Returns
|
|
@@ -1151,8 +1179,8 @@ Returns the result of the mixed addition as a new Jacobian point.
|
|
|
1151
1179
|
|
|
1152
1180
|
Argument Details
|
|
1153
1181
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1182
|
+
- **p**
|
|
1183
|
+
- The affine point to be added.
|
|
1156
1184
|
|
|
1157
1185
|
Example
|
|
1158
1186
|
|
|
@@ -1169,6 +1197,7 @@ Negation operation. It returns the additive inverse of the Jacobian point.
|
|
|
1169
1197
|
```ts
|
|
1170
1198
|
neg(): JacobianPoint
|
|
1171
1199
|
```
|
|
1200
|
+
|
|
1172
1201
|
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
1173
1202
|
|
|
1174
1203
|
Returns
|
|
@@ -1189,6 +1218,7 @@ Converts the `JacobianPoint` object instance to standard affine `Point` format a
|
|
|
1189
1218
|
```ts
|
|
1190
1219
|
toP(): Point
|
|
1191
1220
|
```
|
|
1221
|
+
|
|
1192
1222
|
See also: [Point](./primitives.md#class-point)
|
|
1193
1223
|
|
|
1194
1224
|
Returns
|
|
@@ -1207,6 +1237,7 @@ const pointP = pointJ.toP(); // The point in affine coordinates.
|
|
|
1207
1237
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1208
1238
|
|
|
1209
1239
|
---
|
|
1240
|
+
|
|
1210
1241
|
### Class: K256
|
|
1211
1242
|
|
|
1212
1243
|
A class representing K-256, a prime number with optimizations, specifically used in the secp256k1 curve.
|
|
@@ -1252,6 +1283,7 @@ Multiplies a BigNumber ('num') with the constant 'K' in-place and returns the re
|
|
|
1252
1283
|
```ts
|
|
1253
1284
|
imulK(num: BigNumber): BigNumber
|
|
1254
1285
|
```
|
|
1286
|
+
|
|
1255
1287
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1256
1288
|
|
|
1257
1289
|
Returns
|
|
@@ -1260,8 +1292,8 @@ Returns the mutated BigNumber after multiplication.
|
|
|
1260
1292
|
|
|
1261
1293
|
Argument Details
|
|
1262
1294
|
|
|
1263
|
-
|
|
1264
|
-
|
|
1295
|
+
- **num**
|
|
1296
|
+
- The BigNumber to multiply with K.
|
|
1265
1297
|
|
|
1266
1298
|
Example
|
|
1267
1299
|
|
|
@@ -1278,14 +1310,15 @@ rules. This method modifies the input and output big numbers.
|
|
|
1278
1310
|
```ts
|
|
1279
1311
|
split(input: BigNumber, output: BigNumber): void
|
|
1280
1312
|
```
|
|
1313
|
+
|
|
1281
1314
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1282
1315
|
|
|
1283
1316
|
Argument Details
|
|
1284
1317
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1318
|
+
- **input**
|
|
1319
|
+
- The BigNumber to be split.
|
|
1320
|
+
- **output**
|
|
1321
|
+
- The BigNumber that results from the split.
|
|
1289
1322
|
|
|
1290
1323
|
Example
|
|
1291
1324
|
|
|
@@ -1298,6 +1331,7 @@ k256.split(input, output);
|
|
|
1298
1331
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1299
1332
|
|
|
1300
1333
|
---
|
|
1334
|
+
|
|
1301
1335
|
### Class: KeyShares
|
|
1302
1336
|
|
|
1303
1337
|
Example
|
|
@@ -1322,6 +1356,7 @@ See also: [PointInFiniteField](./primitives.md#class-pointinfinitefield)
|
|
|
1322
1356
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1323
1357
|
|
|
1324
1358
|
---
|
|
1359
|
+
|
|
1325
1360
|
### Class: Mersenne
|
|
1326
1361
|
|
|
1327
1362
|
A representation of a pseudo-Mersenne prime.
|
|
@@ -1350,10 +1385,10 @@ constructor(name: string, p: string)
|
|
|
1350
1385
|
|
|
1351
1386
|
Argument Details
|
|
1352
1387
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1388
|
+
- **name**
|
|
1389
|
+
- An identifier for the Mersenne instance.
|
|
1390
|
+
- **p**
|
|
1391
|
+
- A string representation of the pseudo-Mersenne prime, expressed in hexadecimal.
|
|
1357
1392
|
|
|
1358
1393
|
Example
|
|
1359
1394
|
|
|
@@ -1368,6 +1403,7 @@ The constant subtracted from 2^n to derive a pseudo-Mersenne prime.
|
|
|
1368
1403
|
```ts
|
|
1369
1404
|
k: BigNumber
|
|
1370
1405
|
```
|
|
1406
|
+
|
|
1371
1407
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1372
1408
|
|
|
1373
1409
|
#### Property n
|
|
@@ -1393,6 +1429,7 @@ BigNumber equivalent to 2^n - k.
|
|
|
1393
1429
|
```ts
|
|
1394
1430
|
p: BigNumber
|
|
1395
1431
|
```
|
|
1432
|
+
|
|
1396
1433
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1397
1434
|
|
|
1398
1435
|
#### Method imulK
|
|
@@ -1402,6 +1439,7 @@ Performs an in-place multiplication of the parameter by constant k.
|
|
|
1402
1439
|
```ts
|
|
1403
1440
|
imulK(num: BigNumber): BigNumber
|
|
1404
1441
|
```
|
|
1442
|
+
|
|
1405
1443
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1406
1444
|
|
|
1407
1445
|
Returns
|
|
@@ -1410,8 +1448,8 @@ The result of the multiplication, in BigNumber format.
|
|
|
1410
1448
|
|
|
1411
1449
|
Argument Details
|
|
1412
1450
|
|
|
1413
|
-
|
|
1414
|
-
|
|
1451
|
+
- **num**
|
|
1452
|
+
- The BigNumber to multiply with k.
|
|
1415
1453
|
|
|
1416
1454
|
Example
|
|
1417
1455
|
|
|
@@ -1427,6 +1465,7 @@ it is less than the square of the pseudo-Mersenne prime.
|
|
|
1427
1465
|
```ts
|
|
1428
1466
|
ireduce(num: BigNumber): BigNumber
|
|
1429
1467
|
```
|
|
1468
|
+
|
|
1430
1469
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1431
1470
|
|
|
1432
1471
|
Returns
|
|
@@ -1435,8 +1474,8 @@ The reduced BigNumber.
|
|
|
1435
1474
|
|
|
1436
1475
|
Argument Details
|
|
1437
1476
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1477
|
+
- **num**
|
|
1478
|
+
- The BigNumber to be reduced.
|
|
1440
1479
|
|
|
1441
1480
|
Example
|
|
1442
1481
|
|
|
@@ -1452,14 +1491,15 @@ to meet the magnitude of the pseudo-Mersenne prime.
|
|
|
1452
1491
|
```ts
|
|
1453
1492
|
split(input: BigNumber, out: BigNumber): void
|
|
1454
1493
|
```
|
|
1494
|
+
|
|
1455
1495
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1456
1496
|
|
|
1457
1497
|
Argument Details
|
|
1458
1498
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1499
|
+
- **input**
|
|
1500
|
+
- The BigNumber to be shifted (will contain HI part).
|
|
1501
|
+
- **out**
|
|
1502
|
+
- The BigNumber to hold the shifted result (LO part).
|
|
1463
1503
|
|
|
1464
1504
|
Example
|
|
1465
1505
|
|
|
@@ -1470,6 +1510,7 @@ mersenne.split(new BigNumber('2345', 16), new BigNumber());
|
|
|
1470
1510
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1471
1511
|
|
|
1472
1512
|
---
|
|
1513
|
+
|
|
1473
1514
|
### Class: MontgomoryMethod
|
|
1474
1515
|
|
|
1475
1516
|
Represents a Montgomery reduction context, which is a mathematical method
|
|
@@ -1504,12 +1545,13 @@ See also: [BigNumber](./primitives.md#class-bignumber), [ReductionContext](./pri
|
|
|
1504
1545
|
```ts
|
|
1505
1546
|
constructor(m: BigNumber | "k256")
|
|
1506
1547
|
```
|
|
1548
|
+
|
|
1507
1549
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1508
1550
|
|
|
1509
1551
|
Argument Details
|
|
1510
1552
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1553
|
+
- **m**
|
|
1554
|
+
- The modulus to be used for the Montgomery method reductions.
|
|
1513
1555
|
|
|
1514
1556
|
#### Property minv
|
|
1515
1557
|
|
|
@@ -1518,6 +1560,7 @@ The modular multiplicative inverse of `m` mod `r`.
|
|
|
1518
1560
|
```ts
|
|
1519
1561
|
minv: BigNumber
|
|
1520
1562
|
```
|
|
1563
|
+
|
|
1521
1564
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1522
1565
|
|
|
1523
1566
|
#### Property r
|
|
@@ -1527,6 +1570,7 @@ The 2^shift, shifted left by the bit length of modulus `m`.
|
|
|
1527
1570
|
```ts
|
|
1528
1571
|
r: BigNumber
|
|
1529
1572
|
```
|
|
1573
|
+
|
|
1530
1574
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1531
1575
|
|
|
1532
1576
|
#### Property r2
|
|
@@ -1536,6 +1580,7 @@ The square of `r` modulo `m`.
|
|
|
1536
1580
|
```ts
|
|
1537
1581
|
r2: BigNumber
|
|
1538
1582
|
```
|
|
1583
|
+
|
|
1539
1584
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1540
1585
|
|
|
1541
1586
|
#### Property rinv
|
|
@@ -1545,6 +1590,7 @@ The modular multiplicative inverse of `r` mod `m`.
|
|
|
1545
1590
|
```ts
|
|
1546
1591
|
rinv: BigNumber
|
|
1547
1592
|
```
|
|
1593
|
+
|
|
1548
1594
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1549
1595
|
|
|
1550
1596
|
#### Property shift
|
|
@@ -1562,6 +1608,7 @@ Converts a number from the Montgomery domain back to the original domain.
|
|
|
1562
1608
|
```ts
|
|
1563
1609
|
convertFrom(num: BigNumber): BigNumber
|
|
1564
1610
|
```
|
|
1611
|
+
|
|
1565
1612
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1566
1613
|
|
|
1567
1614
|
Returns
|
|
@@ -1570,8 +1617,8 @@ The result of the conversion from the Montgomery domain.
|
|
|
1570
1617
|
|
|
1571
1618
|
Argument Details
|
|
1572
1619
|
|
|
1573
|
-
|
|
1574
|
-
|
|
1620
|
+
- **num**
|
|
1621
|
+
- The number to be converted from the Montgomery domain.
|
|
1575
1622
|
|
|
1576
1623
|
Example
|
|
1577
1624
|
|
|
@@ -1587,6 +1634,7 @@ Converts a number into the Montgomery domain.
|
|
|
1587
1634
|
```ts
|
|
1588
1635
|
convertTo(num: BigNumber): BigNumber
|
|
1589
1636
|
```
|
|
1637
|
+
|
|
1590
1638
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1591
1639
|
|
|
1592
1640
|
Returns
|
|
@@ -1595,8 +1643,8 @@ The result of the conversion into the Montgomery domain.
|
|
|
1595
1643
|
|
|
1596
1644
|
Argument Details
|
|
1597
1645
|
|
|
1598
|
-
|
|
1599
|
-
|
|
1646
|
+
- **num**
|
|
1647
|
+
- The number to be converted into the Montgomery domain.
|
|
1600
1648
|
|
|
1601
1649
|
Example
|
|
1602
1650
|
|
|
@@ -1612,6 +1660,7 @@ Performs an in-place multiplication of two numbers in the Montgomery domain.
|
|
|
1612
1660
|
```ts
|
|
1613
1661
|
imul(a: BigNumber, b: BigNumber): BigNumber
|
|
1614
1662
|
```
|
|
1663
|
+
|
|
1615
1664
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1616
1665
|
|
|
1617
1666
|
Returns
|
|
@@ -1620,10 +1669,10 @@ The result of the in-place multiplication.
|
|
|
1620
1669
|
|
|
1621
1670
|
Argument Details
|
|
1622
1671
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1672
|
+
- **a**
|
|
1673
|
+
- The first number to multiply.
|
|
1674
|
+
- **b**
|
|
1675
|
+
- The second number to multiply.
|
|
1627
1676
|
|
|
1628
1677
|
Example
|
|
1629
1678
|
|
|
@@ -1639,6 +1688,7 @@ Calculates the modular multiplicative inverse of a number in the Montgomery doma
|
|
|
1639
1688
|
```ts
|
|
1640
1689
|
invm(a: BigNumber): BigNumber
|
|
1641
1690
|
```
|
|
1691
|
+
|
|
1642
1692
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1643
1693
|
|
|
1644
1694
|
Returns
|
|
@@ -1647,8 +1697,8 @@ The modular multiplicative inverse of 'a'.
|
|
|
1647
1697
|
|
|
1648
1698
|
Argument Details
|
|
1649
1699
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1700
|
+
- **a**
|
|
1701
|
+
- The number to compute the modular multiplicative inverse of.
|
|
1652
1702
|
|
|
1653
1703
|
Example
|
|
1654
1704
|
|
|
@@ -1664,6 +1714,7 @@ Performs the multiplication of two numbers in the Montgomery domain.
|
|
|
1664
1714
|
```ts
|
|
1665
1715
|
mul(a: BigNumber, b: BigNumber): BigNumber
|
|
1666
1716
|
```
|
|
1717
|
+
|
|
1667
1718
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1668
1719
|
|
|
1669
1720
|
Returns
|
|
@@ -1672,10 +1723,10 @@ The result of the multiplication.
|
|
|
1672
1723
|
|
|
1673
1724
|
Argument Details
|
|
1674
1725
|
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1726
|
+
- **a**
|
|
1727
|
+
- The first number to multiply.
|
|
1728
|
+
- **b**
|
|
1729
|
+
- The second number to multiply.
|
|
1679
1730
|
|
|
1680
1731
|
Example
|
|
1681
1732
|
|
|
@@ -1687,6 +1738,7 @@ const product = montMethod.mul(a, b);
|
|
|
1687
1738
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
1688
1739
|
|
|
1689
1740
|
---
|
|
1741
|
+
|
|
1690
1742
|
### Class: Point
|
|
1691
1743
|
|
|
1692
1744
|
`Point` class is a representation of an elliptic curve point with affine coordinates.
|
|
@@ -1744,16 +1796,17 @@ See also: [BasePoint](./primitives.md#class-basepoint), [BigNumber](./primitives
|
|
|
1744
1796
|
```ts
|
|
1745
1797
|
constructor(x: BigNumber | number | number[] | string | null, y: BigNumber | number | number[] | string | null, isRed: boolean = true)
|
|
1746
1798
|
```
|
|
1799
|
+
|
|
1747
1800
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1748
1801
|
|
|
1749
1802
|
Argument Details
|
|
1750
1803
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1804
|
+
- **x**
|
|
1805
|
+
- 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.
|
|
1806
|
+
- **y**
|
|
1807
|
+
- The y-coordinate of the point, similar to x.
|
|
1808
|
+
- **isRed**
|
|
1809
|
+
- A boolean indicating if the point is a member of the field of integers modulo the k256 prime. Default is true.
|
|
1757
1810
|
|
|
1758
1811
|
Example
|
|
1759
1812
|
|
|
@@ -1777,6 +1830,7 @@ The x-coordinate of the point.
|
|
|
1777
1830
|
```ts
|
|
1778
1831
|
x: BigNumber | null
|
|
1779
1832
|
```
|
|
1833
|
+
|
|
1780
1834
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1781
1835
|
|
|
1782
1836
|
#### Property y
|
|
@@ -1786,6 +1840,7 @@ The y-coordinate of the point.
|
|
|
1786
1840
|
```ts
|
|
1787
1841
|
y: BigNumber | null
|
|
1788
1842
|
```
|
|
1843
|
+
|
|
1789
1844
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1790
1845
|
|
|
1791
1846
|
#### Method add
|
|
@@ -1795,6 +1850,7 @@ Adds another Point to this Point, returning a new Point.
|
|
|
1795
1850
|
```ts
|
|
1796
1851
|
add(p: Point): Point
|
|
1797
1852
|
```
|
|
1853
|
+
|
|
1798
1854
|
See also: [Point](./primitives.md#class-point)
|
|
1799
1855
|
|
|
1800
1856
|
Returns
|
|
@@ -1803,8 +1859,8 @@ A new Point that results from the addition.
|
|
|
1803
1859
|
|
|
1804
1860
|
Argument Details
|
|
1805
1861
|
|
|
1806
|
-
|
|
1807
|
-
|
|
1862
|
+
- **p**
|
|
1863
|
+
- The Point to add to this one.
|
|
1808
1864
|
|
|
1809
1865
|
Example
|
|
1810
1866
|
|
|
@@ -1821,6 +1877,7 @@ Doubles the current point.
|
|
|
1821
1877
|
```ts
|
|
1822
1878
|
dbl(): Point
|
|
1823
1879
|
```
|
|
1880
|
+
|
|
1824
1881
|
See also: [Point](./primitives.md#class-point)
|
|
1825
1882
|
|
|
1826
1883
|
Example
|
|
@@ -1840,6 +1897,7 @@ a point at infinity is still infinity.
|
|
|
1840
1897
|
```ts
|
|
1841
1898
|
dblp(k: number): Point
|
|
1842
1899
|
```
|
|
1900
|
+
|
|
1843
1901
|
See also: [Point](./primitives.md#class-point)
|
|
1844
1902
|
|
|
1845
1903
|
Returns
|
|
@@ -1848,8 +1906,8 @@ The Point after 'k' "doubling" operations have been performed.
|
|
|
1848
1906
|
|
|
1849
1907
|
Argument Details
|
|
1850
1908
|
|
|
1851
|
-
|
|
1852
|
-
|
|
1909
|
+
- **k**
|
|
1910
|
+
- The number of times the "doubling" operation is to be performed on the Point.
|
|
1853
1911
|
|
|
1854
1912
|
Example
|
|
1855
1913
|
|
|
@@ -1873,10 +1931,10 @@ If enc is undefined, a byte array representation of the point will be returned.
|
|
|
1873
1931
|
|
|
1874
1932
|
Argument Details
|
|
1875
1933
|
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1934
|
+
- **compact**
|
|
1935
|
+
- 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.
|
|
1936
|
+
- **enc**
|
|
1937
|
+
- Expects the string 'hex' if hexadecimal string encoding is required instead of an array of numbers.
|
|
1880
1938
|
|
|
1881
1939
|
Throws
|
|
1882
1940
|
|
|
@@ -1897,6 +1955,7 @@ Checks if the Point instance is equal to another given Point.
|
|
|
1897
1955
|
```ts
|
|
1898
1956
|
eq(p: Point): boolean
|
|
1899
1957
|
```
|
|
1958
|
+
|
|
1900
1959
|
See also: [Point](./primitives.md#class-point)
|
|
1901
1960
|
|
|
1902
1961
|
Returns
|
|
@@ -1905,8 +1964,8 @@ Whether the two Point instances are equal. Both the 'x' and 'y' coordinates have
|
|
|
1905
1964
|
|
|
1906
1965
|
Argument Details
|
|
1907
1966
|
|
|
1908
|
-
|
|
1909
|
-
|
|
1967
|
+
- **p**
|
|
1968
|
+
- The Point to be checked if equal to the current instance.
|
|
1910
1969
|
|
|
1911
1970
|
Example
|
|
1912
1971
|
|
|
@@ -1925,6 +1984,7 @@ The function verifies the integrity of the provided data and throws errors if in
|
|
|
1925
1984
|
```ts
|
|
1926
1985
|
static fromDER(bytes: number[]): Point
|
|
1927
1986
|
```
|
|
1987
|
+
|
|
1928
1988
|
See also: [Point](./primitives.md#class-point)
|
|
1929
1989
|
|
|
1930
1990
|
Returns
|
|
@@ -1933,8 +1993,8 @@ Returns a new point representing the given string.
|
|
|
1933
1993
|
|
|
1934
1994
|
Argument Details
|
|
1935
1995
|
|
|
1936
|
-
|
|
1937
|
-
|
|
1996
|
+
- **bytes**
|
|
1997
|
+
- The point representation number array.
|
|
1938
1998
|
|
|
1939
1999
|
Throws
|
|
1940
2000
|
|
|
@@ -1958,6 +2018,7 @@ JSON points into proper Point objects.
|
|
|
1958
2018
|
```ts
|
|
1959
2019
|
static fromJSON(obj: string | any[], isRed: boolean): Point
|
|
1960
2020
|
```
|
|
2021
|
+
|
|
1961
2022
|
See also: [Point](./primitives.md#class-point)
|
|
1962
2023
|
|
|
1963
2024
|
Returns
|
|
@@ -1966,10 +2027,10 @@ Returns a new point based on the deserialized JSON object.
|
|
|
1966
2027
|
|
|
1967
2028
|
Argument Details
|
|
1968
2029
|
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
2030
|
+
- **obj**
|
|
2031
|
+
- An object or array that holds the data for the point.
|
|
2032
|
+
- **isRed**
|
|
2033
|
+
- A boolean to direct how the Point is constructed from the JSON object.
|
|
1973
2034
|
|
|
1974
2035
|
Example
|
|
1975
2036
|
|
|
@@ -1987,6 +2048,7 @@ The function verifies the integrity of the provided data and throws errors if in
|
|
|
1987
2048
|
```ts
|
|
1988
2049
|
static fromString(str: string): Point
|
|
1989
2050
|
```
|
|
2051
|
+
|
|
1990
2052
|
See also: [Point](./primitives.md#class-point)
|
|
1991
2053
|
|
|
1992
2054
|
Returns
|
|
@@ -1995,8 +2057,8 @@ Returns a new point representing the given string.
|
|
|
1995
2057
|
|
|
1996
2058
|
Argument Details
|
|
1997
2059
|
|
|
1998
|
-
|
|
1999
|
-
|
|
2060
|
+
- **str**
|
|
2061
|
+
- The point representation string.
|
|
2000
2062
|
|
|
2001
2063
|
Throws
|
|
2002
2064
|
|
|
@@ -2019,6 +2081,7 @@ y coordinate is odd.
|
|
|
2019
2081
|
```ts
|
|
2020
2082
|
static fromX(x: BigNumber | number | number[] | string, odd: boolean): Point
|
|
2021
2083
|
```
|
|
2084
|
+
|
|
2022
2085
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2023
2086
|
|
|
2024
2087
|
Returns
|
|
@@ -2027,10 +2090,10 @@ Returns the new point.
|
|
|
2027
2090
|
|
|
2028
2091
|
Argument Details
|
|
2029
2092
|
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2093
|
+
- **x**
|
|
2094
|
+
- The x coordinate of the point.
|
|
2095
|
+
- **odd**
|
|
2096
|
+
- Boolean indicating whether the corresponding y coordinate is odd or not.
|
|
2034
2097
|
|
|
2035
2098
|
Throws
|
|
2036
2099
|
|
|
@@ -2050,6 +2113,7 @@ Returns X coordinate of point
|
|
|
2050
2113
|
```ts
|
|
2051
2114
|
getX(): BigNumber
|
|
2052
2115
|
```
|
|
2116
|
+
|
|
2053
2117
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2054
2118
|
|
|
2055
2119
|
Example
|
|
@@ -2066,6 +2130,7 @@ Returns X coordinate of point
|
|
|
2066
2130
|
```ts
|
|
2067
2131
|
getY(): BigNumber
|
|
2068
2132
|
```
|
|
2133
|
+
|
|
2069
2134
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2070
2135
|
|
|
2071
2136
|
Example
|
|
@@ -2121,6 +2186,7 @@ step. Instead of returning a regular Point, the result is a JacobianPoint.
|
|
|
2121
2186
|
```ts
|
|
2122
2187
|
jmulAdd(k1: BigNumber, p2: Point, k2: BigNumber): JPoint
|
|
2123
2188
|
```
|
|
2189
|
+
|
|
2124
2190
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2125
2191
|
|
|
2126
2192
|
Returns
|
|
@@ -2129,12 +2195,12 @@ A JacobianPoint that results from the combined multiplication and addition opera
|
|
|
2129
2195
|
|
|
2130
2196
|
Argument Details
|
|
2131
2197
|
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2198
|
+
- **k1**
|
|
2199
|
+
- The scalar value to multiply this Point by.
|
|
2200
|
+
- **p2**
|
|
2201
|
+
- The other Point to be involved in the operation
|
|
2202
|
+
- **k2**
|
|
2203
|
+
- The scalar value to multiply the Point p2 by.
|
|
2138
2204
|
|
|
2139
2205
|
Example
|
|
2140
2206
|
|
|
@@ -2151,6 +2217,7 @@ Multiplies this Point by a scalar value, returning a new Point.
|
|
|
2151
2217
|
```ts
|
|
2152
2218
|
mul(k: BigNumber | number | number[] | string): Point
|
|
2153
2219
|
```
|
|
2220
|
+
|
|
2154
2221
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2155
2222
|
|
|
2156
2223
|
Returns
|
|
@@ -2159,8 +2226,8 @@ A new Point that results from the multiplication.
|
|
|
2159
2226
|
|
|
2160
2227
|
Argument Details
|
|
2161
2228
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2229
|
+
- **k**
|
|
2230
|
+
- The scalar value to multiply this Point by.
|
|
2164
2231
|
|
|
2165
2232
|
Example
|
|
2166
2233
|
|
|
@@ -2177,6 +2244,7 @@ Multiplies this Point by k1, adds the resulting Point to the result of p2 multip
|
|
|
2177
2244
|
```ts
|
|
2178
2245
|
mulAdd(k1: BigNumber, p2: Point, k2: BigNumber): Point
|
|
2179
2246
|
```
|
|
2247
|
+
|
|
2180
2248
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2181
2249
|
|
|
2182
2250
|
Returns
|
|
@@ -2185,12 +2253,12 @@ A Point that results from the combined multiplication and addition operations.
|
|
|
2185
2253
|
|
|
2186
2254
|
Argument Details
|
|
2187
2255
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2256
|
+
- **k1**
|
|
2257
|
+
- The scalar value to multiply this Point by.
|
|
2258
|
+
- **p2**
|
|
2259
|
+
- The other Point to be involved in the operation.
|
|
2260
|
+
- **k2**
|
|
2261
|
+
- The scalar value to multiply the Point p2 by.
|
|
2194
2262
|
|
|
2195
2263
|
Example
|
|
2196
2264
|
|
|
@@ -2207,6 +2275,7 @@ Negate a point. The negation of a point P is the mirror of P about x-axis.
|
|
|
2207
2275
|
```ts
|
|
2208
2276
|
neg(_precompute?: boolean): Point
|
|
2209
2277
|
```
|
|
2278
|
+
|
|
2210
2279
|
See also: [Point](./primitives.md#class-point)
|
|
2211
2280
|
|
|
2212
2281
|
Example
|
|
@@ -2256,6 +2325,7 @@ toJSON(): [
|
|
|
2256
2325
|
}?
|
|
2257
2326
|
]
|
|
2258
2327
|
```
|
|
2328
|
+
|
|
2259
2329
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2260
2330
|
|
|
2261
2331
|
Returns
|
|
@@ -2314,6 +2384,7 @@ const isValid = aPoint.validate();
|
|
|
2314
2384
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2315
2385
|
|
|
2316
2386
|
---
|
|
2387
|
+
|
|
2317
2388
|
### Class: PointInFiniteField
|
|
2318
2389
|
|
|
2319
2390
|
```ts
|
|
@@ -2339,6 +2410,7 @@ toString(): string
|
|
|
2339
2410
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2340
2411
|
|
|
2341
2412
|
---
|
|
2413
|
+
|
|
2342
2414
|
### Class: Polynomial
|
|
2343
2415
|
|
|
2344
2416
|
Polynomial class
|
|
@@ -2369,6 +2441,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [PointInFiniteField](./p
|
|
|
2369
2441
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2370
2442
|
|
|
2371
2443
|
---
|
|
2444
|
+
|
|
2372
2445
|
### Class: PrivateKey
|
|
2373
2446
|
|
|
2374
2447
|
Represents a Private Key, which is a secret that can be used to generate signatures in a cryptographic system.
|
|
@@ -2411,18 +2484,19 @@ See also: [BigNumber](./primitives.md#class-bignumber), [KeyShares](./primitives
|
|
|
2411
2484
|
```ts
|
|
2412
2485
|
constructor(number: BigNumber | number | string | number[] = 0, base: number | "be" | "le" | "hex" = 10, endian: "be" | "le" = "be", modN: "apply" | "nocheck" | "error" = "apply")
|
|
2413
2486
|
```
|
|
2487
|
+
|
|
2414
2488
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2415
2489
|
|
|
2416
2490
|
Argument Details
|
|
2417
2491
|
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2492
|
+
- **number**
|
|
2493
|
+
- The number (various types accepted) to construct a BigNumber from. Default is 0.
|
|
2494
|
+
- **base**
|
|
2495
|
+
- The base of number provided. By default is 10. Ignored if number is BigNumber.
|
|
2496
|
+
- **endian**
|
|
2497
|
+
- The endianness provided. By default is 'big endian'. Ignored if number is BigNumber.
|
|
2498
|
+
- **modN**
|
|
2499
|
+
- 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.
|
|
2426
2500
|
|
|
2427
2501
|
Example
|
|
2428
2502
|
|
|
@@ -2442,6 +2516,7 @@ checkInField(): {
|
|
|
2442
2516
|
modN: BigNumber;
|
|
2443
2517
|
}
|
|
2444
2518
|
```
|
|
2519
|
+
|
|
2445
2520
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2446
2521
|
|
|
2447
2522
|
Returns
|
|
@@ -2455,6 +2530,7 @@ Derives a child key with BRC-42.
|
|
|
2455
2530
|
```ts
|
|
2456
2531
|
deriveChild(publicKey: PublicKey, invoiceNumber: string): PrivateKey
|
|
2457
2532
|
```
|
|
2533
|
+
|
|
2458
2534
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
2459
2535
|
|
|
2460
2536
|
Returns
|
|
@@ -2463,10 +2539,10 @@ The derived child key.
|
|
|
2463
2539
|
|
|
2464
2540
|
Argument Details
|
|
2465
2541
|
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2542
|
+
- **publicKey**
|
|
2543
|
+
- The public key of the other party
|
|
2544
|
+
- **invoiceNumber**
|
|
2545
|
+
- The invoice number used to derive the child key
|
|
2470
2546
|
|
|
2471
2547
|
#### Method deriveSharedSecret
|
|
2472
2548
|
|
|
@@ -2475,6 +2551,7 @@ Derives a shared secret from the public key.
|
|
|
2475
2551
|
```ts
|
|
2476
2552
|
deriveSharedSecret(key: PublicKey): Point
|
|
2477
2553
|
```
|
|
2554
|
+
|
|
2478
2555
|
See also: [Point](./primitives.md#class-point), [PublicKey](./primitives.md#class-publickey)
|
|
2479
2556
|
|
|
2480
2557
|
Returns
|
|
@@ -2483,8 +2560,8 @@ The derived shared secret (a point on the curve).
|
|
|
2483
2560
|
|
|
2484
2561
|
Argument Details
|
|
2485
2562
|
|
|
2486
|
-
|
|
2487
|
-
|
|
2563
|
+
- **key**
|
|
2564
|
+
- The public key to derive the shared secret from.
|
|
2488
2565
|
|
|
2489
2566
|
Throws
|
|
2490
2567
|
|
|
@@ -2503,6 +2580,7 @@ const sharedSecret = privateKey.deriveSharedSecret(publicKey);
|
|
|
2503
2580
|
```ts
|
|
2504
2581
|
static fromBackupShares(shares: string[]): PrivateKey
|
|
2505
2582
|
```
|
|
2583
|
+
|
|
2506
2584
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2507
2585
|
|
|
2508
2586
|
Returns
|
|
@@ -2525,6 +2603,7 @@ Generates a private key from a hexadecimal string.
|
|
|
2525
2603
|
```ts
|
|
2526
2604
|
static fromHex(str: string): PrivateKey
|
|
2527
2605
|
```
|
|
2606
|
+
|
|
2528
2607
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2529
2608
|
|
|
2530
2609
|
Returns
|
|
@@ -2533,8 +2612,8 @@ The generated Private Key instance.
|
|
|
2533
2612
|
|
|
2534
2613
|
Argument Details
|
|
2535
2614
|
|
|
2536
|
-
|
|
2537
|
-
|
|
2615
|
+
- **str**
|
|
2616
|
+
- The hexadecimal string representing the private key. The string must represent a valid private key in big-endian format.
|
|
2538
2617
|
|
|
2539
2618
|
Throws
|
|
2540
2619
|
|
|
@@ -2547,6 +2626,7 @@ Combines shares to reconstruct the private key.
|
|
|
2547
2626
|
```ts
|
|
2548
2627
|
static fromKeyShares(keyShares: KeyShares): PrivateKey
|
|
2549
2628
|
```
|
|
2629
|
+
|
|
2550
2630
|
See also: [KeyShares](./primitives.md#class-keyshares), [PrivateKey](./primitives.md#class-privatekey)
|
|
2551
2631
|
|
|
2552
2632
|
Returns
|
|
@@ -2555,10 +2635,10 @@ The reconstructed private key.
|
|
|
2555
2635
|
|
|
2556
2636
|
Argument Details
|
|
2557
2637
|
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2638
|
+
- **shares**
|
|
2639
|
+
- An array of points (shares) to be used to reconstruct the private key.
|
|
2640
|
+
- **threshold**
|
|
2641
|
+
- The minimum number of shares required to reconstruct the private key.
|
|
2562
2642
|
|
|
2563
2643
|
#### Method fromRandom
|
|
2564
2644
|
|
|
@@ -2567,6 +2647,7 @@ Generates a private key randomly.
|
|
|
2567
2647
|
```ts
|
|
2568
2648
|
static fromRandom(): PrivateKey
|
|
2569
2649
|
```
|
|
2650
|
+
|
|
2570
2651
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2571
2652
|
|
|
2572
2653
|
Returns
|
|
@@ -2586,6 +2667,7 @@ Generates a private key from a string.
|
|
|
2586
2667
|
```ts
|
|
2587
2668
|
static fromString(str: string, base: number | "hex" = "hex"): PrivateKey
|
|
2588
2669
|
```
|
|
2670
|
+
|
|
2589
2671
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2590
2672
|
|
|
2591
2673
|
Returns
|
|
@@ -2594,10 +2676,10 @@ The generated Private Key.
|
|
|
2594
2676
|
|
|
2595
2677
|
Argument Details
|
|
2596
2678
|
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2679
|
+
- **str**
|
|
2680
|
+
- The string to generate the private key from.
|
|
2681
|
+
- **base**
|
|
2682
|
+
- The base of the string.
|
|
2601
2683
|
|
|
2602
2684
|
Throws
|
|
2603
2685
|
|
|
@@ -2610,6 +2692,7 @@ Generates a private key from a WIF (Wallet Import Format) string.
|
|
|
2610
2692
|
```ts
|
|
2611
2693
|
static fromWif(wif: string, prefixLength: number = 1): PrivateKey
|
|
2612
2694
|
```
|
|
2695
|
+
|
|
2613
2696
|
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
2614
2697
|
|
|
2615
2698
|
Returns
|
|
@@ -2618,10 +2701,10 @@ The generated Private Key.
|
|
|
2618
2701
|
|
|
2619
2702
|
Argument Details
|
|
2620
2703
|
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2704
|
+
- **wif**
|
|
2705
|
+
- The WIF string to generate the private key from.
|
|
2706
|
+
- **base**
|
|
2707
|
+
- The base of the string.
|
|
2625
2708
|
|
|
2626
2709
|
Throws
|
|
2627
2710
|
|
|
@@ -2644,6 +2727,7 @@ Signs a message using the private key.
|
|
|
2644
2727
|
```ts
|
|
2645
2728
|
sign(msg: number[] | string, enc?: "hex" | "utf8", forceLowS: boolean = true, customK?: ((iter: number) => BigNumber) | BigNumber): Signature
|
|
2646
2729
|
```
|
|
2730
|
+
|
|
2647
2731
|
See also: [BigNumber](./primitives.md#class-bignumber), [Signature](./primitives.md#class-signature)
|
|
2648
2732
|
|
|
2649
2733
|
Returns
|
|
@@ -2652,14 +2736,14 @@ A digital signature generated from the hash of the message and the private key.
|
|
|
2652
2736
|
|
|
2653
2737
|
Argument Details
|
|
2654
2738
|
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2739
|
+
- **msg**
|
|
2740
|
+
- The message (array of numbers or string) to be signed.
|
|
2741
|
+
- **enc**
|
|
2742
|
+
- If 'hex' the string will be treated as hex, utf8 otherwise.
|
|
2743
|
+
- **forceLowS**
|
|
2744
|
+
- If true (the default), the signature will be forced to have a low S value.
|
|
2745
|
+
- **customK**
|
|
2746
|
+
- — If provided, uses a custom K-value for the signature. Provie a function that returns a BigNumber, or the BigNumber itself.
|
|
2663
2747
|
|
|
2664
2748
|
Example
|
|
2665
2749
|
|
|
@@ -2683,8 +2767,8 @@ Returns the address encoding associated with the hash of the public key associat
|
|
|
2683
2767
|
|
|
2684
2768
|
Argument Details
|
|
2685
2769
|
|
|
2686
|
-
|
|
2687
|
-
|
|
2770
|
+
- **prefix**
|
|
2771
|
+
- defaults to [0x00] for mainnet, set to [0x6f] for testnet or use the strings 'testnet' or 'mainnet'
|
|
2688
2772
|
|
|
2689
2773
|
Example
|
|
2690
2774
|
|
|
@@ -2703,10 +2787,10 @@ toBackupShares(threshold: number, totalShares: number): string[]
|
|
|
2703
2787
|
|
|
2704
2788
|
Argument Details
|
|
2705
2789
|
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2790
|
+
- **threshold**
|
|
2791
|
+
- The number of shares which will be required to reconstruct the private key.
|
|
2792
|
+
- **totalShares**
|
|
2793
|
+
- The number of shares to generate for distribution.
|
|
2710
2794
|
|
|
2711
2795
|
#### Method toHex
|
|
2712
2796
|
|
|
@@ -2722,8 +2806,8 @@ Returns a string representing the hexadecimal value of this BigNumber.
|
|
|
2722
2806
|
|
|
2723
2807
|
Argument Details
|
|
2724
2808
|
|
|
2725
|
-
|
|
2726
|
-
|
|
2809
|
+
- **length**
|
|
2810
|
+
- The minimum length of the hex string
|
|
2727
2811
|
|
|
2728
2812
|
Example
|
|
2729
2813
|
|
|
@@ -2739,6 +2823,7 @@ Splits the private key into shares using Shamir's Secret Sharing Scheme.
|
|
|
2739
2823
|
```ts
|
|
2740
2824
|
toKeyShares(threshold: number, totalShares: number): KeyShares
|
|
2741
2825
|
```
|
|
2826
|
+
|
|
2742
2827
|
See also: [KeyShares](./primitives.md#class-keyshares)
|
|
2743
2828
|
|
|
2744
2829
|
Returns
|
|
@@ -2747,12 +2832,12 @@ An array of shares.
|
|
|
2747
2832
|
|
|
2748
2833
|
Argument Details
|
|
2749
2834
|
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2835
|
+
- **threshold**
|
|
2836
|
+
- The minimum number of shares required to reconstruct the private key.
|
|
2837
|
+
- **totalShares**
|
|
2838
|
+
- The total number of shares to generate.
|
|
2839
|
+
- **prime**
|
|
2840
|
+
- The prime number to be used in Shamir's Secret Sharing Scheme.
|
|
2756
2841
|
|
|
2757
2842
|
Example
|
|
2758
2843
|
|
|
@@ -2770,6 +2855,7 @@ The public key is generated by multiplying the base point G of the curve and the
|
|
|
2770
2855
|
```ts
|
|
2771
2856
|
toPublicKey(): PublicKey
|
|
2772
2857
|
```
|
|
2858
|
+
|
|
2773
2859
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
2774
2860
|
|
|
2775
2861
|
Returns
|
|
@@ -2799,10 +2885,10 @@ A string representation of the PrivateKey in the specified base, padded to the s
|
|
|
2799
2885
|
|
|
2800
2886
|
Argument Details
|
|
2801
2887
|
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2888
|
+
- **base**
|
|
2889
|
+
- The base for representing the number. Default is hexadecimal ('hex').
|
|
2890
|
+
- **padding**
|
|
2891
|
+
- The minimum number of digits for the output string. Default is 64, ensuring a 256-bit representation in hexadecimal.
|
|
2806
2892
|
|
|
2807
2893
|
#### Method toWif
|
|
2808
2894
|
|
|
@@ -2821,8 +2907,8 @@ The WIF string.
|
|
|
2821
2907
|
|
|
2822
2908
|
Argument Details
|
|
2823
2909
|
|
|
2824
|
-
|
|
2825
|
-
|
|
2910
|
+
- **prefix**
|
|
2911
|
+
- defaults to [0x80] for mainnet, set it to [0xef] for testnet.
|
|
2826
2912
|
|
|
2827
2913
|
Throws
|
|
2828
2914
|
|
|
@@ -2843,6 +2929,7 @@ Verifies a message's signature using the public key associated with this private
|
|
|
2843
2929
|
```ts
|
|
2844
2930
|
verify(msg: number[] | string, sig: Signature, enc?: "hex"): boolean
|
|
2845
2931
|
```
|
|
2932
|
+
|
|
2846
2933
|
See also: [Signature](./primitives.md#class-signature)
|
|
2847
2934
|
|
|
2848
2935
|
Returns
|
|
@@ -2851,12 +2938,12 @@ Whether or not the signature is valid.
|
|
|
2851
2938
|
|
|
2852
2939
|
Argument Details
|
|
2853
2940
|
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2941
|
+
- **msg**
|
|
2942
|
+
- The original message which has been signed.
|
|
2943
|
+
- **sig**
|
|
2944
|
+
- The signature to be verified.
|
|
2945
|
+
- **enc**
|
|
2946
|
+
- The data encoding method.
|
|
2860
2947
|
|
|
2861
2948
|
Example
|
|
2862
2949
|
|
|
@@ -2869,6 +2956,7 @@ const isSignatureValid = privateKey.verify('Hello, World!', signature);
|
|
|
2869
2956
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
2870
2957
|
|
|
2871
2958
|
---
|
|
2959
|
+
|
|
2872
2960
|
### Class: PublicKey
|
|
2873
2961
|
|
|
2874
2962
|
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.
|
|
@@ -2897,16 +2985,17 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#
|
|
|
2897
2985
|
```ts
|
|
2898
2986
|
constructor(x: Point | BigNumber | number | number[] | string | null, y: BigNumber | number | number[] | string | null = null, isRed: boolean = true)
|
|
2899
2987
|
```
|
|
2988
|
+
|
|
2900
2989
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
2901
2990
|
|
|
2902
2991
|
Argument Details
|
|
2903
2992
|
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2993
|
+
- **x**
|
|
2994
|
+
- 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.
|
|
2995
|
+
- **y**
|
|
2996
|
+
- If x is not a point, the y-coordinate of the point, similar to x.
|
|
2997
|
+
- **isRed**
|
|
2998
|
+
- A boolean indicating if the point is a member of the field of integers modulo the k256 prime. Default is true.
|
|
2910
2999
|
|
|
2911
3000
|
Example
|
|
2912
3001
|
|
|
@@ -2922,6 +3011,7 @@ Derives a child key with BRC-42.
|
|
|
2922
3011
|
```ts
|
|
2923
3012
|
deriveChild(privateKey: PrivateKey, invoiceNumber: string): PublicKey
|
|
2924
3013
|
```
|
|
3014
|
+
|
|
2925
3015
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
2926
3016
|
|
|
2927
3017
|
Returns
|
|
@@ -2930,10 +3020,10 @@ The derived child key.
|
|
|
2930
3020
|
|
|
2931
3021
|
Argument Details
|
|
2932
3022
|
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
3023
|
+
- **privateKey**
|
|
3024
|
+
- The private key of the other party
|
|
3025
|
+
- **invoiceNumber**
|
|
3026
|
+
- The invoice number used to derive the child key
|
|
2937
3027
|
|
|
2938
3028
|
#### Method deriveSharedSecret
|
|
2939
3029
|
|
|
@@ -2943,6 +3033,7 @@ This method multiplies the public key (an instance of Point) with a private key.
|
|
|
2943
3033
|
```ts
|
|
2944
3034
|
deriveSharedSecret(priv: PrivateKey): Point
|
|
2945
3035
|
```
|
|
3036
|
+
|
|
2946
3037
|
See also: [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey)
|
|
2947
3038
|
|
|
2948
3039
|
Returns
|
|
@@ -2951,8 +3042,8 @@ Returns the Point representing the shared secret.
|
|
|
2951
3042
|
|
|
2952
3043
|
Argument Details
|
|
2953
3044
|
|
|
2954
|
-
|
|
2955
|
-
|
|
3045
|
+
- **priv**
|
|
3046
|
+
- The private key to use in deriving the shared secret.
|
|
2956
3047
|
|
|
2957
3048
|
Throws
|
|
2958
3049
|
|
|
@@ -2972,6 +3063,7 @@ Static factory method to create a PublicKey instance from a number array.
|
|
|
2972
3063
|
```ts
|
|
2973
3064
|
static fromDER(bytes: number[]): PublicKey
|
|
2974
3065
|
```
|
|
3066
|
+
|
|
2975
3067
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
2976
3068
|
|
|
2977
3069
|
Returns
|
|
@@ -2980,8 +3072,8 @@ Returns the PublicKey created from the number array.
|
|
|
2980
3072
|
|
|
2981
3073
|
Argument Details
|
|
2982
3074
|
|
|
2983
|
-
|
|
2984
|
-
|
|
3075
|
+
- **bytes**
|
|
3076
|
+
- A number array representing a public key.
|
|
2985
3077
|
|
|
2986
3078
|
Example
|
|
2987
3079
|
|
|
@@ -3001,6 +3093,7 @@ The range represents the recovery param which can be 0,1,2,3.
|
|
|
3001
3093
|
```ts
|
|
3002
3094
|
static fromMsgHashAndCompactSignature(msgHash: BigNumber, signature: number[] | string, enc?: "hex" | "base64"): PublicKey
|
|
3003
3095
|
```
|
|
3096
|
+
|
|
3004
3097
|
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
3005
3098
|
|
|
3006
3099
|
Returns
|
|
@@ -3009,12 +3102,12 @@ A PublicKey instance derived from the message hash and compact signature.
|
|
|
3009
3102
|
|
|
3010
3103
|
Argument Details
|
|
3011
3104
|
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3105
|
+
- **msgHash**
|
|
3106
|
+
- The message hash which was signed.
|
|
3107
|
+
- **signature**
|
|
3108
|
+
- The signature in compact format.
|
|
3109
|
+
- **enc**
|
|
3110
|
+
- The encoding of the signature string.
|
|
3018
3111
|
|
|
3019
3112
|
Example
|
|
3020
3113
|
|
|
@@ -3030,6 +3123,7 @@ It multiplies the generator point 'g' on the elliptic curve by the private key.
|
|
|
3030
3123
|
```ts
|
|
3031
3124
|
static fromPrivateKey(key: PrivateKey): PublicKey
|
|
3032
3125
|
```
|
|
3126
|
+
|
|
3033
3127
|
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
3034
3128
|
|
|
3035
3129
|
Returns
|
|
@@ -3038,8 +3132,8 @@ Returns the PublicKey derived from the given PrivateKey.
|
|
|
3038
3132
|
|
|
3039
3133
|
Argument Details
|
|
3040
3134
|
|
|
3041
|
-
|
|
3042
|
-
|
|
3135
|
+
- **key**
|
|
3136
|
+
- The private key from which to derive the public key.
|
|
3043
3137
|
|
|
3044
3138
|
Example
|
|
3045
3139
|
|
|
@@ -3055,6 +3149,7 @@ Static factory method to create a PublicKey instance from a string.
|
|
|
3055
3149
|
```ts
|
|
3056
3150
|
static fromString(str: string): PublicKey
|
|
3057
3151
|
```
|
|
3152
|
+
|
|
3058
3153
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
3059
3154
|
|
|
3060
3155
|
Returns
|
|
@@ -3063,8 +3158,8 @@ Returns the PublicKey created from the string.
|
|
|
3063
3158
|
|
|
3064
3159
|
Argument Details
|
|
3065
3160
|
|
|
3066
|
-
|
|
3067
|
-
|
|
3161
|
+
- **str**
|
|
3162
|
+
- A string representing a public key.
|
|
3068
3163
|
|
|
3069
3164
|
Example
|
|
3070
3165
|
|
|
@@ -3087,8 +3182,8 @@ Returns the address encoding associated with the hash of the public key.
|
|
|
3087
3182
|
|
|
3088
3183
|
Argument Details
|
|
3089
3184
|
|
|
3090
|
-
|
|
3091
|
-
|
|
3185
|
+
- **prefix**
|
|
3186
|
+
- defaults to [0x00] for mainnet, set to [0x6f] for testnet or use the strings 'mainnet' or 'testnet'
|
|
3092
3187
|
|
|
3093
3188
|
Example
|
|
3094
3189
|
|
|
@@ -3113,8 +3208,8 @@ Returns the DER-encoded public key in number array or string.
|
|
|
3113
3208
|
|
|
3114
3209
|
Argument Details
|
|
3115
3210
|
|
|
3116
|
-
|
|
3117
|
-
|
|
3211
|
+
- **enc**
|
|
3212
|
+
- The encoding of the DER string. undefined = number array, 'hex' = hex string.
|
|
3118
3213
|
|
|
3119
3214
|
Example
|
|
3120
3215
|
|
|
@@ -3147,6 +3242,7 @@ Verify a signature of a message using this public key.
|
|
|
3147
3242
|
```ts
|
|
3148
3243
|
verify(msg: number[] | string, sig: Signature, enc?: "hex" | "utf8"): boolean
|
|
3149
3244
|
```
|
|
3245
|
+
|
|
3150
3246
|
See also: [Signature](./primitives.md#class-signature)
|
|
3151
3247
|
|
|
3152
3248
|
Returns
|
|
@@ -3155,12 +3251,12 @@ Returns true if the signature is verified successfully, otherwise false.
|
|
|
3155
3251
|
|
|
3156
3252
|
Argument Details
|
|
3157
3253
|
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3254
|
+
- **msg**
|
|
3255
|
+
- The message to verify. It can be a string or an array of numbers.
|
|
3256
|
+
- **sig**
|
|
3257
|
+
- The Signature of the message that needs verification.
|
|
3258
|
+
- **enc**
|
|
3259
|
+
- The encoding of the message. It defaults to 'utf8'.
|
|
3164
3260
|
|
|
3165
3261
|
Example
|
|
3166
3262
|
|
|
@@ -3173,6 +3269,7 @@ const isVerified = myPubKey.verify(myMessage, mySignature)
|
|
|
3173
3269
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3174
3270
|
|
|
3175
3271
|
---
|
|
3272
|
+
|
|
3176
3273
|
### Class: RIPEMD160
|
|
3177
3274
|
|
|
3178
3275
|
An implementation of RIPEMD160 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -3207,6 +3304,7 @@ h: number[]
|
|
|
3207
3304
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3208
3305
|
|
|
3209
3306
|
---
|
|
3307
|
+
|
|
3210
3308
|
### Class: Reader
|
|
3211
3309
|
|
|
3212
3310
|
```ts
|
|
@@ -3241,6 +3339,7 @@ See also: [BigNumber](./primitives.md#class-bignumber)
|
|
|
3241
3339
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3242
3340
|
|
|
3243
3341
|
---
|
|
3342
|
+
|
|
3244
3343
|
### Class: ReductionContext
|
|
3245
3344
|
|
|
3246
3345
|
A base reduction engine that provides several arithmetic operations over
|
|
@@ -3282,12 +3381,13 @@ Constructs a new ReductionContext.
|
|
|
3282
3381
|
```ts
|
|
3283
3382
|
constructor(m: BigNumber | "k256")
|
|
3284
3383
|
```
|
|
3384
|
+
|
|
3285
3385
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3286
3386
|
|
|
3287
3387
|
Argument Details
|
|
3288
3388
|
|
|
3289
|
-
|
|
3290
|
-
|
|
3389
|
+
- **m**
|
|
3390
|
+
- A BigNumber representing the modulus, or 'k256' to create a context for Koblitz curve.
|
|
3291
3391
|
|
|
3292
3392
|
Example
|
|
3293
3393
|
|
|
@@ -3303,6 +3403,7 @@ The modulus used for reduction operations.
|
|
|
3303
3403
|
```ts
|
|
3304
3404
|
m: BigNumber
|
|
3305
3405
|
```
|
|
3406
|
+
|
|
3306
3407
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3307
3408
|
|
|
3308
3409
|
#### Property prime
|
|
@@ -3312,6 +3413,7 @@ The prime number utilised in the reduction context, typically an instance of Mer
|
|
|
3312
3413
|
```ts
|
|
3313
3414
|
prime: Mersenne | null
|
|
3314
3415
|
```
|
|
3416
|
+
|
|
3315
3417
|
See also: [Mersenne](./primitives.md#class-mersenne)
|
|
3316
3418
|
|
|
3317
3419
|
#### Method add
|
|
@@ -3321,6 +3423,7 @@ Performs the addition operation on two BigNumbers in the reduction context.
|
|
|
3321
3423
|
```ts
|
|
3322
3424
|
add(a: BigNumber, b: BigNumber): BigNumber
|
|
3323
3425
|
```
|
|
3426
|
+
|
|
3324
3427
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3325
3428
|
|
|
3326
3429
|
Returns
|
|
@@ -3329,10 +3432,10 @@ Returns the result of 'a + b' in the reduction context.
|
|
|
3329
3432
|
|
|
3330
3433
|
Argument Details
|
|
3331
3434
|
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3435
|
+
- **a**
|
|
3436
|
+
- First BigNumber to add.
|
|
3437
|
+
- **b**
|
|
3438
|
+
- Second BigNumber to add.
|
|
3336
3439
|
|
|
3337
3440
|
Example
|
|
3338
3441
|
|
|
@@ -3348,6 +3451,7 @@ Converts a BigNumber from reduction context to its regular form.
|
|
|
3348
3451
|
```ts
|
|
3349
3452
|
convertFrom(num: BigNumber): BigNumber
|
|
3350
3453
|
```
|
|
3454
|
+
|
|
3351
3455
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3352
3456
|
|
|
3353
3457
|
Returns
|
|
@@ -3356,8 +3460,8 @@ Returns the converted BigNumber in its regular form.
|
|
|
3356
3460
|
|
|
3357
3461
|
Argument Details
|
|
3358
3462
|
|
|
3359
|
-
|
|
3360
|
-
|
|
3463
|
+
- **num**
|
|
3464
|
+
- The BigNumber to convert from the reduction context.
|
|
3361
3465
|
|
|
3362
3466
|
Example
|
|
3363
3467
|
|
|
@@ -3374,6 +3478,7 @@ Converts a BigNumber to its equivalent in the reduction context.
|
|
|
3374
3478
|
```ts
|
|
3375
3479
|
convertTo(num: BigNumber): BigNumber
|
|
3376
3480
|
```
|
|
3481
|
+
|
|
3377
3482
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3378
3483
|
|
|
3379
3484
|
Returns
|
|
@@ -3382,8 +3487,8 @@ Returns the converted BigNumber compatible with the reduction context.
|
|
|
3382
3487
|
|
|
3383
3488
|
Argument Details
|
|
3384
3489
|
|
|
3385
|
-
|
|
3386
|
-
|
|
3490
|
+
- **num**
|
|
3491
|
+
- The BigNumber to convert to the reduction context.
|
|
3387
3492
|
|
|
3388
3493
|
Example
|
|
3389
3494
|
|
|
@@ -3400,6 +3505,7 @@ in order to avoid creating a new BigNumber, it modifies the first one with the r
|
|
|
3400
3505
|
```ts
|
|
3401
3506
|
iadd(a: BigNumber, b: BigNumber): BigNumber
|
|
3402
3507
|
```
|
|
3508
|
+
|
|
3403
3509
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3404
3510
|
|
|
3405
3511
|
Returns
|
|
@@ -3408,10 +3514,10 @@ Returns the modified 'a' after addition with 'b' in the reduction context.
|
|
|
3408
3514
|
|
|
3409
3515
|
Argument Details
|
|
3410
3516
|
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3517
|
+
- **a**
|
|
3518
|
+
- First BigNumber to add.
|
|
3519
|
+
- **b**
|
|
3520
|
+
- Second BigNumber to add.
|
|
3415
3521
|
|
|
3416
3522
|
Example
|
|
3417
3523
|
|
|
@@ -3428,6 +3534,7 @@ Performs an in-place reduction of the given BigNumber by the modulus of the redu
|
|
|
3428
3534
|
```ts
|
|
3429
3535
|
imod(a: BigNumber): BigNumber
|
|
3430
3536
|
```
|
|
3537
|
+
|
|
3431
3538
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3432
3539
|
|
|
3433
3540
|
Returns
|
|
@@ -3436,8 +3543,8 @@ Returns the reduced result.
|
|
|
3436
3543
|
|
|
3437
3544
|
Argument Details
|
|
3438
3545
|
|
|
3439
|
-
|
|
3440
|
-
|
|
3546
|
+
- **a**
|
|
3547
|
+
- BigNumber to be reduced.
|
|
3441
3548
|
|
|
3442
3549
|
Example
|
|
3443
3550
|
|
|
@@ -3454,6 +3561,7 @@ modifying the first BigNumber with the result.
|
|
|
3454
3561
|
```ts
|
|
3455
3562
|
imul(a: BigNumber, b: BigNumber): BigNumber
|
|
3456
3563
|
```
|
|
3564
|
+
|
|
3457
3565
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3458
3566
|
|
|
3459
3567
|
Returns
|
|
@@ -3462,10 +3570,10 @@ Returns the modified 'a' after multiplication with 'b' in the reduction context.
|
|
|
3462
3570
|
|
|
3463
3571
|
Argument Details
|
|
3464
3572
|
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3573
|
+
- **a**
|
|
3574
|
+
- First BigNumber to multiply.
|
|
3575
|
+
- **b**
|
|
3576
|
+
- Second BigNumber to multiply.
|
|
3469
3577
|
|
|
3470
3578
|
Example
|
|
3471
3579
|
|
|
@@ -3482,6 +3590,7 @@ Calculates the multiplicative inverse of a BigNumber in the reduction context.
|
|
|
3482
3590
|
```ts
|
|
3483
3591
|
invm(a: BigNumber): BigNumber
|
|
3484
3592
|
```
|
|
3593
|
+
|
|
3485
3594
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3486
3595
|
|
|
3487
3596
|
Returns
|
|
@@ -3490,8 +3599,8 @@ Returns the multiplicative inverse of 'a' in the reduction context.
|
|
|
3490
3599
|
|
|
3491
3600
|
Argument Details
|
|
3492
3601
|
|
|
3493
|
-
|
|
3494
|
-
|
|
3602
|
+
- **a**
|
|
3603
|
+
- The BigNumber to find the multiplicative inverse of.
|
|
3495
3604
|
|
|
3496
3605
|
Example
|
|
3497
3606
|
|
|
@@ -3508,6 +3617,7 @@ modifying the original BigNumber with the result.
|
|
|
3508
3617
|
```ts
|
|
3509
3618
|
isqr(a: BigNumber): BigNumber
|
|
3510
3619
|
```
|
|
3620
|
+
|
|
3511
3621
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3512
3622
|
|
|
3513
3623
|
Returns
|
|
@@ -3516,8 +3626,8 @@ Returns the squared 'a' in the reduction context.
|
|
|
3516
3626
|
|
|
3517
3627
|
Argument Details
|
|
3518
3628
|
|
|
3519
|
-
|
|
3520
|
-
|
|
3629
|
+
- **a**
|
|
3630
|
+
- BigNumber to be squared.
|
|
3521
3631
|
|
|
3522
3632
|
Example
|
|
3523
3633
|
|
|
@@ -3535,6 +3645,7 @@ it modifies the first BigNumber with the result.
|
|
|
3535
3645
|
```ts
|
|
3536
3646
|
isub(a: BigNumber, b: BigNumber): BigNumber
|
|
3537
3647
|
```
|
|
3648
|
+
|
|
3538
3649
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3539
3650
|
|
|
3540
3651
|
Returns
|
|
@@ -3543,10 +3654,10 @@ Returns the modified 'a' after subtraction of 'b' in the reduction context.
|
|
|
3543
3654
|
|
|
3544
3655
|
Argument Details
|
|
3545
3656
|
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3657
|
+
- **a**
|
|
3658
|
+
- BigNumber to be subtracted from.
|
|
3659
|
+
- **b**
|
|
3660
|
+
- BigNumber to subtract.
|
|
3550
3661
|
|
|
3551
3662
|
Example
|
|
3552
3663
|
|
|
@@ -3563,6 +3674,7 @@ Multiplies two BigNumbers in the reduction context.
|
|
|
3563
3674
|
```ts
|
|
3564
3675
|
mul(a: BigNumber, b: BigNumber): BigNumber
|
|
3565
3676
|
```
|
|
3677
|
+
|
|
3566
3678
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3567
3679
|
|
|
3568
3680
|
Returns
|
|
@@ -3571,10 +3683,10 @@ Returns the result of 'a * b' in the reduction context.
|
|
|
3571
3683
|
|
|
3572
3684
|
Argument Details
|
|
3573
3685
|
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3686
|
+
- **a**
|
|
3687
|
+
- First BigNumber to multiply.
|
|
3688
|
+
- **b**
|
|
3689
|
+
- Second BigNumber to multiply.
|
|
3578
3690
|
|
|
3579
3691
|
Example
|
|
3580
3692
|
|
|
@@ -3590,6 +3702,7 @@ Negates a BigNumber in the context of the modulus.
|
|
|
3590
3702
|
```ts
|
|
3591
3703
|
neg(a: BigNumber): BigNumber
|
|
3592
3704
|
```
|
|
3705
|
+
|
|
3593
3706
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3594
3707
|
|
|
3595
3708
|
Returns
|
|
@@ -3598,8 +3711,8 @@ Returns the negation of 'a' in the reduction context.
|
|
|
3598
3711
|
|
|
3599
3712
|
Argument Details
|
|
3600
3713
|
|
|
3601
|
-
|
|
3602
|
-
|
|
3714
|
+
- **a**
|
|
3715
|
+
- BigNumber to negate.
|
|
3603
3716
|
|
|
3604
3717
|
Example
|
|
3605
3718
|
|
|
@@ -3615,6 +3728,7 @@ Raises a BigNumber to a power in the reduction context.
|
|
|
3615
3728
|
```ts
|
|
3616
3729
|
pow(a: BigNumber, num: BigNumber): BigNumber
|
|
3617
3730
|
```
|
|
3731
|
+
|
|
3618
3732
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3619
3733
|
|
|
3620
3734
|
Returns
|
|
@@ -3623,10 +3737,10 @@ Returns the result of 'a' raised to the power of 'num' in the reduction context.
|
|
|
3623
3737
|
|
|
3624
3738
|
Argument Details
|
|
3625
3739
|
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3740
|
+
- **a**
|
|
3741
|
+
- The BigNumber to be raised to a power.
|
|
3742
|
+
- **num**
|
|
3743
|
+
- The power to raise the BigNumber to.
|
|
3630
3744
|
|
|
3631
3745
|
Example
|
|
3632
3746
|
|
|
@@ -3642,6 +3756,7 @@ Performs bitwise shift left operation on a BigNumber in the reduction context.
|
|
|
3642
3756
|
```ts
|
|
3643
3757
|
shl(a: BigNumber, num: number): BigNumber
|
|
3644
3758
|
```
|
|
3759
|
+
|
|
3645
3760
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3646
3761
|
|
|
3647
3762
|
Returns
|
|
@@ -3650,10 +3765,10 @@ Returns the result of shifting 'a' left by 'num' positions in the reduction cont
|
|
|
3650
3765
|
|
|
3651
3766
|
Argument Details
|
|
3652
3767
|
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3768
|
+
- **a**
|
|
3769
|
+
- BigNumber to perform shift on.
|
|
3770
|
+
- **num**
|
|
3771
|
+
- The number of positions to shift.
|
|
3657
3772
|
|
|
3658
3773
|
Example
|
|
3659
3774
|
|
|
@@ -3669,6 +3784,7 @@ Calculates the square of a BigNumber in the reduction context.
|
|
|
3669
3784
|
```ts
|
|
3670
3785
|
sqr(a: BigNumber): BigNumber
|
|
3671
3786
|
```
|
|
3787
|
+
|
|
3672
3788
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3673
3789
|
|
|
3674
3790
|
Returns
|
|
@@ -3677,8 +3793,8 @@ Returns the result of 'a^2' in the reduction context.
|
|
|
3677
3793
|
|
|
3678
3794
|
Argument Details
|
|
3679
3795
|
|
|
3680
|
-
|
|
3681
|
-
|
|
3796
|
+
- **a**
|
|
3797
|
+
- BigNumber to be squared.
|
|
3682
3798
|
|
|
3683
3799
|
Example
|
|
3684
3800
|
|
|
@@ -3694,6 +3810,7 @@ Calculates the square root of a BigNumber in the reduction context.
|
|
|
3694
3810
|
```ts
|
|
3695
3811
|
sqrt(a: BigNumber): BigNumber
|
|
3696
3812
|
```
|
|
3813
|
+
|
|
3697
3814
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3698
3815
|
|
|
3699
3816
|
Returns
|
|
@@ -3702,8 +3819,8 @@ Returns the square root of 'a' in the reduction context.
|
|
|
3702
3819
|
|
|
3703
3820
|
Argument Details
|
|
3704
3821
|
|
|
3705
|
-
|
|
3706
|
-
|
|
3822
|
+
- **a**
|
|
3823
|
+
- The BigNumber to calculate the square root of.
|
|
3707
3824
|
|
|
3708
3825
|
Example
|
|
3709
3826
|
|
|
@@ -3719,6 +3836,7 @@ Subtracts one BigNumber from another BigNumber in the reduction context.
|
|
|
3719
3836
|
```ts
|
|
3720
3837
|
sub(a: BigNumber, b: BigNumber): BigNumber
|
|
3721
3838
|
```
|
|
3839
|
+
|
|
3722
3840
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3723
3841
|
|
|
3724
3842
|
Returns
|
|
@@ -3727,10 +3845,10 @@ Returns the result of 'a - b' in the reduction context.
|
|
|
3727
3845
|
|
|
3728
3846
|
Argument Details
|
|
3729
3847
|
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3848
|
+
- **a**
|
|
3849
|
+
- BigNumber to be subtracted from.
|
|
3850
|
+
- **b**
|
|
3851
|
+
- BigNumber to subtract.
|
|
3734
3852
|
|
|
3735
3853
|
Example
|
|
3736
3854
|
|
|
@@ -3747,12 +3865,13 @@ conditions are not met.
|
|
|
3747
3865
|
```ts
|
|
3748
3866
|
verify1(a: BigNumber): void
|
|
3749
3867
|
```
|
|
3868
|
+
|
|
3750
3869
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3751
3870
|
|
|
3752
3871
|
Argument Details
|
|
3753
3872
|
|
|
3754
|
-
|
|
3755
|
-
|
|
3873
|
+
- **a**
|
|
3874
|
+
- The BigNumber to be verified.
|
|
3756
3875
|
|
|
3757
3876
|
Example
|
|
3758
3877
|
|
|
@@ -3771,14 +3890,15 @@ conditions are not met.
|
|
|
3771
3890
|
```ts
|
|
3772
3891
|
verify2(a: BigNumber, b: BigNumber): void
|
|
3773
3892
|
```
|
|
3893
|
+
|
|
3774
3894
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3775
3895
|
|
|
3776
3896
|
Argument Details
|
|
3777
3897
|
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3898
|
+
- **a**
|
|
3899
|
+
- The first BigNumber to be verified.
|
|
3900
|
+
- **b**
|
|
3901
|
+
- The second BigNumber to be verified.
|
|
3782
3902
|
|
|
3783
3903
|
Example
|
|
3784
3904
|
|
|
@@ -3791,6 +3911,7 @@ this.verify2(new BigNumber(10).toRed(this), new BigNumber(20)); //throws an Erro
|
|
|
3791
3911
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3792
3912
|
|
|
3793
3913
|
---
|
|
3914
|
+
|
|
3794
3915
|
### Class: SHA1
|
|
3795
3916
|
|
|
3796
3917
|
An implementation of SHA1 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -3843,6 +3964,7 @@ k: number[]
|
|
|
3843
3964
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3844
3965
|
|
|
3845
3966
|
---
|
|
3967
|
+
|
|
3846
3968
|
### Class: SHA1HMAC
|
|
3847
3969
|
|
|
3848
3970
|
```ts
|
|
@@ -3862,6 +3984,7 @@ See also: [SHA1](./primitives.md#class-sha1)
|
|
|
3862
3984
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3863
3985
|
|
|
3864
3986
|
---
|
|
3987
|
+
|
|
3865
3988
|
### Class: SHA256
|
|
3866
3989
|
|
|
3867
3990
|
An implementation of SHA256 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -3914,6 +4037,7 @@ k: number[]
|
|
|
3914
4037
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3915
4038
|
|
|
3916
4039
|
---
|
|
4040
|
+
|
|
3917
4041
|
### Class: SHA256HMAC
|
|
3918
4042
|
|
|
3919
4043
|
The `SHA256HMAC` class is used to create Hash-based Message Authentication Code (HMAC) using the SHA-256 cryptographic hash function.
|
|
@@ -3951,8 +4075,8 @@ constructor(key: number[] | string)
|
|
|
3951
4075
|
|
|
3952
4076
|
Argument Details
|
|
3953
4077
|
|
|
3954
|
-
|
|
3955
|
-
|
|
4078
|
+
- **key**
|
|
4079
|
+
- The key to use to create the HMAC. Can be a number array or a string in hexadecimal format.
|
|
3956
4080
|
|
|
3957
4081
|
Example
|
|
3958
4082
|
|
|
@@ -3975,6 +4099,7 @@ Represents the inner hash of SHA-256.
|
|
|
3975
4099
|
```ts
|
|
3976
4100
|
inner: SHA256
|
|
3977
4101
|
```
|
|
4102
|
+
|
|
3978
4103
|
See also: [SHA256](./primitives.md#class-sha256)
|
|
3979
4104
|
|
|
3980
4105
|
#### Property outSize
|
|
@@ -3992,6 +4117,7 @@ Represents the outer hash of SHA-256.
|
|
|
3992
4117
|
```ts
|
|
3993
4118
|
outer: SHA256
|
|
3994
4119
|
```
|
|
4120
|
+
|
|
3995
4121
|
See also: [SHA256](./primitives.md#class-sha256)
|
|
3996
4122
|
|
|
3997
4123
|
#### Method digest
|
|
@@ -4037,6 +4163,7 @@ Updates the `SHA256HMAC` object with part of the message to be hashed.
|
|
|
4037
4163
|
```ts
|
|
4038
4164
|
update(msg: number[] | string, enc?: "hex"): SHA256HMAC
|
|
4039
4165
|
```
|
|
4166
|
+
|
|
4040
4167
|
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
4041
4168
|
|
|
4042
4169
|
Returns
|
|
@@ -4045,10 +4172,10 @@ Returns the instance of `SHA256HMAC` for chaining calls.
|
|
|
4045
4172
|
|
|
4046
4173
|
Argument Details
|
|
4047
4174
|
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4175
|
+
- **msg**
|
|
4176
|
+
- Part of the message to hash. Can be a number array or a string.
|
|
4177
|
+
- **enc**
|
|
4178
|
+
- If 'hex', then the input is encoded as hexadecimal. If undefined or not 'hex', then no encoding is performed.
|
|
4052
4179
|
|
|
4053
4180
|
Example
|
|
4054
4181
|
|
|
@@ -4059,6 +4186,7 @@ myHMAC.update('deadbeef', 'hex');
|
|
|
4059
4186
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4060
4187
|
|
|
4061
4188
|
---
|
|
4189
|
+
|
|
4062
4190
|
### Class: SHA512
|
|
4063
4191
|
|
|
4064
4192
|
An implementation of SHA512 cryptographic hash function. Extends the BaseHash class.
|
|
@@ -4112,6 +4240,7 @@ k: number[]
|
|
|
4112
4240
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4113
4241
|
|
|
4114
4242
|
---
|
|
4243
|
+
|
|
4115
4244
|
### Class: SHA512HMAC
|
|
4116
4245
|
|
|
4117
4246
|
The `SHA512HMAC` class is used to create Hash-based Message Authentication Code (HMAC) using the SHA-512 cryptographic hash function.
|
|
@@ -4149,8 +4278,8 @@ constructor(key: number[] | string)
|
|
|
4149
4278
|
|
|
4150
4279
|
Argument Details
|
|
4151
4280
|
|
|
4152
|
-
|
|
4153
|
-
|
|
4281
|
+
- **key**
|
|
4282
|
+
- The key to use to create the HMAC. Can be a number array or a string in hexadecimal format.
|
|
4154
4283
|
|
|
4155
4284
|
Example
|
|
4156
4285
|
|
|
@@ -4173,6 +4302,7 @@ Represents the inner hash of SHA-512.
|
|
|
4173
4302
|
```ts
|
|
4174
4303
|
inner: SHA512
|
|
4175
4304
|
```
|
|
4305
|
+
|
|
4176
4306
|
See also: [SHA512](./primitives.md#class-sha512)
|
|
4177
4307
|
|
|
4178
4308
|
#### Property outSize
|
|
@@ -4190,6 +4320,7 @@ Represents the outer hash of SHA-512.
|
|
|
4190
4320
|
```ts
|
|
4191
4321
|
outer: SHA512
|
|
4192
4322
|
```
|
|
4323
|
+
|
|
4193
4324
|
See also: [SHA512](./primitives.md#class-sha512)
|
|
4194
4325
|
|
|
4195
4326
|
#### Method digest
|
|
@@ -4235,6 +4366,7 @@ Updates the `SHA512HMAC` object with part of the message to be hashed.
|
|
|
4235
4366
|
```ts
|
|
4236
4367
|
update(msg: number[] | string, enc?: "hex" | "utf8"): SHA512HMAC
|
|
4237
4368
|
```
|
|
4369
|
+
|
|
4238
4370
|
See also: [SHA512HMAC](./primitives.md#class-sha512hmac)
|
|
4239
4371
|
|
|
4240
4372
|
Returns
|
|
@@ -4243,10 +4375,10 @@ Returns the instance of `SHA512HMAC` for chaining calls.
|
|
|
4243
4375
|
|
|
4244
4376
|
Argument Details
|
|
4245
4377
|
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4378
|
+
- **msg**
|
|
4379
|
+
- Part of the message to hash. Can be a number array or a string.
|
|
4380
|
+
- **enc**
|
|
4381
|
+
- If 'hex', then the input is encoded as hexadecimal. If undefined or not 'hex', then no encoding is performed.
|
|
4250
4382
|
|
|
4251
4383
|
Example
|
|
4252
4384
|
|
|
@@ -4257,6 +4389,7 @@ myHMAC.update('deadbeef', 'hex');
|
|
|
4257
4389
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4258
4390
|
|
|
4259
4391
|
---
|
|
4392
|
+
|
|
4260
4393
|
### Class: Schnorr
|
|
4261
4394
|
|
|
4262
4395
|
Class representing the Schnorr Zero-Knowledge Proof (ZKP) protocol.
|
|
@@ -4266,6 +4399,7 @@ Specifically, it allows one party to prove to another that they know the private
|
|
|
4266
4399
|
and have correctly computed a shared secret, without disclosing the private key itself.
|
|
4267
4400
|
|
|
4268
4401
|
The protocol involves two main methods:
|
|
4402
|
+
|
|
4269
4403
|
- `generateProof`: Generates a proof linking a public key `A` and a shared secret `S`, proving knowledge of the corresponding private key `a`.
|
|
4270
4404
|
- `verifyProof`: Verifies the provided proof, ensuring its validity without revealing any secret information.
|
|
4271
4405
|
|
|
@@ -4288,6 +4422,7 @@ const proof = schnorr.generateProof(a, A, B, S);
|
|
|
4288
4422
|
const isValid = schnorr.verifyProof(A.point, B.point, S.point, proof);
|
|
4289
4423
|
console.log(`Proof is valid: ${isValid}`);
|
|
4290
4424
|
```
|
|
4425
|
+
|
|
4291
4426
|
```ts
|
|
4292
4427
|
export default class Schnorr {
|
|
4293
4428
|
constructor()
|
|
@@ -4317,6 +4452,7 @@ generateProof(aArg: PrivateKey, AArg: PublicKey, BArg: PublicKey, S: Point): {
|
|
|
4317
4452
|
z: BigNumber;
|
|
4318
4453
|
}
|
|
4319
4454
|
```
|
|
4455
|
+
|
|
4320
4456
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
4321
4457
|
|
|
4322
4458
|
Returns
|
|
@@ -4325,14 +4461,14 @@ Proof (R, S', z)
|
|
|
4325
4461
|
|
|
4326
4462
|
Argument Details
|
|
4327
4463
|
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4464
|
+
- **a**
|
|
4465
|
+
- Private key corresponding to public key A
|
|
4466
|
+
- **A**
|
|
4467
|
+
- Public key
|
|
4468
|
+
- **B**
|
|
4469
|
+
- Other party's public key
|
|
4470
|
+
- **S**
|
|
4471
|
+
- Shared secret
|
|
4336
4472
|
|
|
4337
4473
|
#### Method verifyProof
|
|
4338
4474
|
|
|
@@ -4345,6 +4481,7 @@ verifyProof(A: Point, B: Point, S: Point, proof: {
|
|
|
4345
4481
|
z: BigNumber;
|
|
4346
4482
|
}): boolean
|
|
4347
4483
|
```
|
|
4484
|
+
|
|
4348
4485
|
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
4349
4486
|
|
|
4350
4487
|
Returns
|
|
@@ -4353,18 +4490,19 @@ True if the proof is valid, false otherwise
|
|
|
4353
4490
|
|
|
4354
4491
|
Argument Details
|
|
4355
4492
|
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4493
|
+
- **A**
|
|
4494
|
+
- Public key
|
|
4495
|
+
- **B**
|
|
4496
|
+
- Other party's public key
|
|
4497
|
+
- **S**
|
|
4498
|
+
- Shared secret
|
|
4499
|
+
- **proof**
|
|
4500
|
+
- Proof (R, S', z)
|
|
4364
4501
|
|
|
4365
4502
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4366
4503
|
|
|
4367
4504
|
---
|
|
4505
|
+
|
|
4368
4506
|
### Class: Signature
|
|
4369
4507
|
|
|
4370
4508
|
Represents a digital signature.
|
|
@@ -4399,14 +4537,15 @@ Creates an instance of the Signature class.
|
|
|
4399
4537
|
```ts
|
|
4400
4538
|
constructor(r: BigNumber, s: BigNumber)
|
|
4401
4539
|
```
|
|
4540
|
+
|
|
4402
4541
|
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4403
4542
|
|
|
4404
4543
|
Argument Details
|
|
4405
4544
|
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4545
|
+
- **r**
|
|
4546
|
+
- The R component of the signature.
|
|
4547
|
+
- **s**
|
|
4548
|
+
- The S component of the signature.
|
|
4410
4549
|
|
|
4411
4550
|
Example
|
|
4412
4551
|
|
|
@@ -4426,6 +4565,7 @@ The recovery factor is a number between 0 and 3.
|
|
|
4426
4565
|
```ts
|
|
4427
4566
|
CalculateRecoveryFactor(pubkey: PublicKey, msgHash: BigNumber): number
|
|
4428
4567
|
```
|
|
4568
|
+
|
|
4429
4569
|
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
4430
4570
|
|
|
4431
4571
|
Returns
|
|
@@ -4435,8 +4575,8 @@ the recovery factor: number
|
|
|
4435
4575
|
|
|
4436
4576
|
Argument Details
|
|
4437
4577
|
|
|
4438
|
-
|
|
4439
|
-
|
|
4578
|
+
- **msgHash**
|
|
4579
|
+
- The message hash.
|
|
4440
4580
|
|
|
4441
4581
|
Example
|
|
4442
4582
|
|
|
@@ -4454,6 +4594,7 @@ The recovery factor is a number between 0 and 3.
|
|
|
4454
4594
|
```ts
|
|
4455
4595
|
RecoverPublicKey(recovery: number, e: BigNumber): PublicKey
|
|
4456
4596
|
```
|
|
4597
|
+
|
|
4457
4598
|
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
4458
4599
|
|
|
4459
4600
|
Returns
|
|
@@ -4462,10 +4603,10 @@ The public key associated with the signature.
|
|
|
4462
4603
|
|
|
4463
4604
|
Argument Details
|
|
4464
4605
|
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4606
|
+
- **recovery**
|
|
4607
|
+
- The recovery factor.
|
|
4608
|
+
- **e**
|
|
4609
|
+
- The message hash.
|
|
4469
4610
|
|
|
4470
4611
|
Example
|
|
4471
4612
|
|
|
@@ -4486,6 +4627,7 @@ We could support recovery functions in future if there's demand.
|
|
|
4486
4627
|
```ts
|
|
4487
4628
|
static fromCompact(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
4488
4629
|
```
|
|
4630
|
+
|
|
4489
4631
|
See also: [Signature](./primitives.md#class-signature)
|
|
4490
4632
|
|
|
4491
4633
|
Returns
|
|
@@ -4494,10 +4636,10 @@ The decoded data in the form of Signature instance.
|
|
|
4494
4636
|
|
|
4495
4637
|
Argument Details
|
|
4496
4638
|
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4639
|
+
- **data**
|
|
4640
|
+
- The sequence to decode from Compact encoding.
|
|
4641
|
+
- **enc**
|
|
4642
|
+
- The encoding of the data string.
|
|
4501
4643
|
|
|
4502
4644
|
Example
|
|
4503
4645
|
|
|
@@ -4514,6 +4656,7 @@ If a string is provided, it is assumed to represent a hexadecimal sequence.
|
|
|
4514
4656
|
```ts
|
|
4515
4657
|
static fromDER(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
4516
4658
|
```
|
|
4659
|
+
|
|
4517
4660
|
See also: [Signature](./primitives.md#class-signature)
|
|
4518
4661
|
|
|
4519
4662
|
Returns
|
|
@@ -4522,10 +4665,10 @@ The decoded data in the form of Signature instance.
|
|
|
4522
4665
|
|
|
4523
4666
|
Argument Details
|
|
4524
4667
|
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4668
|
+
- **data**
|
|
4669
|
+
- The sequence to decode from DER encoding.
|
|
4670
|
+
- **enc**
|
|
4671
|
+
- The encoding of the data string.
|
|
4529
4672
|
|
|
4530
4673
|
Example
|
|
4531
4674
|
|
|
@@ -4551,8 +4694,8 @@ The current instance in DER encoding.
|
|
|
4551
4694
|
|
|
4552
4695
|
Argument Details
|
|
4553
4696
|
|
|
4554
|
-
|
|
4555
|
-
|
|
4697
|
+
- **enc**
|
|
4698
|
+
- The encoding to use for the output.
|
|
4556
4699
|
|
|
4557
4700
|
Example
|
|
4558
4701
|
|
|
@@ -4578,8 +4721,8 @@ The current instance in DER encoding.
|
|
|
4578
4721
|
|
|
4579
4722
|
Argument Details
|
|
4580
4723
|
|
|
4581
|
-
|
|
4582
|
-
|
|
4724
|
+
- **enc**
|
|
4725
|
+
- The encoding to use for the output.
|
|
4583
4726
|
|
|
4584
4727
|
Example
|
|
4585
4728
|
|
|
@@ -4608,8 +4751,8 @@ The current instance in DER encoding.
|
|
|
4608
4751
|
|
|
4609
4752
|
Argument Details
|
|
4610
4753
|
|
|
4611
|
-
|
|
4612
|
-
|
|
4754
|
+
- **enc**
|
|
4755
|
+
- The encoding to use for the output.
|
|
4613
4756
|
|
|
4614
4757
|
Example
|
|
4615
4758
|
|
|
@@ -4627,6 +4770,7 @@ If the data or key do not match the signature, the function returns false.
|
|
|
4627
4770
|
```ts
|
|
4628
4771
|
verify(msg: number[] | string, key: PublicKey, enc?: "hex"): boolean
|
|
4629
4772
|
```
|
|
4773
|
+
|
|
4630
4774
|
See also: [PublicKey](./primitives.md#class-publickey)
|
|
4631
4775
|
|
|
4632
4776
|
Returns
|
|
@@ -4635,12 +4779,12 @@ A boolean representing whether the signature is valid.
|
|
|
4635
4779
|
|
|
4636
4780
|
Argument Details
|
|
4637
4781
|
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4782
|
+
- **msg**
|
|
4783
|
+
- The message to verify.
|
|
4784
|
+
- **key**
|
|
4785
|
+
- The public key used to sign the original message.
|
|
4786
|
+
- **enc**
|
|
4787
|
+
- The encoding of the msg string.
|
|
4644
4788
|
|
|
4645
4789
|
Example
|
|
4646
4790
|
|
|
@@ -4653,6 +4797,7 @@ const isVerified = signature.verify(msg, publicKey);
|
|
|
4653
4797
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4654
4798
|
|
|
4655
4799
|
---
|
|
4800
|
+
|
|
4656
4801
|
### Class: SymmetricKey
|
|
4657
4802
|
|
|
4658
4803
|
`SymmetricKey` is a class that extends the `BigNumber` class and implements symmetric encryption and decryption methods.
|
|
@@ -4685,10 +4830,10 @@ Returns the decrypted message as a string or an array of numbers, depending on `
|
|
|
4685
4830
|
|
|
4686
4831
|
Argument Details
|
|
4687
4832
|
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4833
|
+
- **msg**
|
|
4834
|
+
- The encrypted message to be decrypted. It can be a string or an array of numbers.
|
|
4835
|
+
- **enc**
|
|
4836
|
+
- optional. The encoding of the message (if no encoding is provided, uses utf8 for strings, unless specified as hex).
|
|
4692
4837
|
|
|
4693
4838
|
Throws
|
|
4694
4839
|
|
|
@@ -4717,10 +4862,10 @@ Returns the encrypted message as a string or an array of numbers, depending on `
|
|
|
4717
4862
|
|
|
4718
4863
|
Argument Details
|
|
4719
4864
|
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4865
|
+
- **msg**
|
|
4866
|
+
- The message to be encrypted. It can be a string or an array of numbers.
|
|
4867
|
+
- **enc**
|
|
4868
|
+
- optional. The encoding of the message. If hex, the string is assumed to be hex, UTF-8 otherwise.
|
|
4724
4869
|
|
|
4725
4870
|
Example
|
|
4726
4871
|
|
|
@@ -4736,6 +4881,7 @@ Generates a symmetric key randomly.
|
|
|
4736
4881
|
```ts
|
|
4737
4882
|
static fromRandom(): SymmetricKey
|
|
4738
4883
|
```
|
|
4884
|
+
|
|
4739
4885
|
See also: [SymmetricKey](./primitives.md#class-symmetrickey)
|
|
4740
4886
|
|
|
4741
4887
|
Returns
|
|
@@ -4751,6 +4897,7 @@ const symmetricKey = SymmetricKey.fromRandom();
|
|
|
4751
4897
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4752
4898
|
|
|
4753
4899
|
---
|
|
4900
|
+
|
|
4754
4901
|
### Class: TransactionSignature
|
|
4755
4902
|
|
|
4756
4903
|
```ts
|
|
@@ -4796,6 +4943,7 @@ public hasLowS(): boolean
|
|
|
4796
4943
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4797
4944
|
|
|
4798
4945
|
---
|
|
4946
|
+
|
|
4799
4947
|
### Class: Writer
|
|
4800
4948
|
|
|
4801
4949
|
```ts
|
|
@@ -4831,6 +4979,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [toArray](./primitives.m
|
|
|
4831
4979
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4832
4980
|
|
|
4833
4981
|
---
|
|
4982
|
+
|
|
4834
4983
|
## Functions
|
|
4835
4984
|
|
|
4836
4985
|
| |
|
|
@@ -4856,6 +5005,7 @@ export function AES(input: number[], key: number[]): number[]
|
|
|
4856
5005
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4857
5006
|
|
|
4858
5007
|
---
|
|
5008
|
+
|
|
4859
5009
|
### Function: AESGCM
|
|
4860
5010
|
|
|
4861
5011
|
```ts
|
|
@@ -4868,6 +5018,7 @@ export function AESGCM(plainText: number[], additionalAuthenticatedData: number[
|
|
|
4868
5018
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4869
5019
|
|
|
4870
5020
|
---
|
|
5021
|
+
|
|
4871
5022
|
### Function: AESGCMDecrypt
|
|
4872
5023
|
|
|
4873
5024
|
```ts
|
|
@@ -4877,6 +5028,7 @@ export function AESGCMDecrypt(cipherText: number[], additionalAuthenticatedData:
|
|
|
4877
5028
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4878
5029
|
|
|
4879
5030
|
---
|
|
5031
|
+
|
|
4880
5032
|
### Function: ghash
|
|
4881
5033
|
|
|
4882
5034
|
```ts
|
|
@@ -4886,6 +5038,7 @@ export function ghash(input: number[], hashSubKey: number[]): number[]
|
|
|
4886
5038
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4887
5039
|
|
|
4888
5040
|
---
|
|
5041
|
+
|
|
4889
5042
|
### Function: pbkdf2
|
|
4890
5043
|
|
|
4891
5044
|
Limited SHA-512-only PBKDF2 function for use in deprecated BIP39 code.
|
|
@@ -4900,20 +5053,21 @@ The computed key
|
|
|
4900
5053
|
|
|
4901
5054
|
Argument Details
|
|
4902
5055
|
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
5056
|
+
- **password**
|
|
5057
|
+
- The PBKDF2 password
|
|
5058
|
+
- **salt**
|
|
5059
|
+
- The PBKDF2 salt
|
|
5060
|
+
- **iterations**
|
|
5061
|
+
- The number of of iterations to run
|
|
5062
|
+
- **keylen**
|
|
5063
|
+
- The length of the key
|
|
5064
|
+
- **digest**
|
|
5065
|
+
- The digest (must be sha512 for this implementation)
|
|
4913
5066
|
|
|
4914
5067
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4915
5068
|
|
|
4916
5069
|
---
|
|
5070
|
+
|
|
4917
5071
|
### Function: toArray
|
|
4918
5072
|
|
|
4919
5073
|
```ts
|
|
@@ -4926,12 +5080,13 @@ array of byte values from msg. If msg is an array, a copy is returned.
|
|
|
4926
5080
|
|
|
4927
5081
|
Argument Details
|
|
4928
5082
|
|
|
4929
|
-
|
|
4930
|
-
|
|
5083
|
+
- **enc**
|
|
5084
|
+
- Optional. Encoding to use if msg is string. Default is 'utf8'.
|
|
4931
5085
|
|
|
4932
5086
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4933
5087
|
|
|
4934
5088
|
---
|
|
5089
|
+
|
|
4935
5090
|
### Function: toBase64
|
|
4936
5091
|
|
|
4937
5092
|
Converts an array of bytes (each between 0 and 255) into a base64 encoded string.
|
|
@@ -4953,12 +5108,13 @@ The base64 encoded string.
|
|
|
4953
5108
|
|
|
4954
5109
|
Argument Details
|
|
4955
5110
|
|
|
4956
|
-
|
|
4957
|
-
|
|
5111
|
+
- **byteArray**
|
|
5112
|
+
- An array of numbers where each number is a byte (0-255).
|
|
4958
5113
|
|
|
4959
5114
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4960
5115
|
|
|
4961
5116
|
---
|
|
5117
|
+
|
|
4962
5118
|
## Types
|
|
4963
5119
|
|
|
4964
5120
|
## Enums
|
|
@@ -4992,6 +5148,7 @@ checkBit = function (byteArray: number[], byteIndex: number, bitIndex: number):
|
|
|
4992
5148
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4993
5149
|
|
|
4994
5150
|
---
|
|
5151
|
+
|
|
4995
5152
|
### Variable: encode
|
|
4996
5153
|
|
|
4997
5154
|
```ts
|
|
@@ -5012,6 +5169,7 @@ See also: [toHex](./primitives.md#variable-tohex), [toUTF8](./primitives.md#vari
|
|
|
5012
5169
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5013
5170
|
|
|
5014
5171
|
---
|
|
5172
|
+
|
|
5015
5173
|
### Variable: exclusiveOR
|
|
5016
5174
|
|
|
5017
5175
|
```ts
|
|
@@ -5028,6 +5186,7 @@ exclusiveOR = function (block0: number[], block1: number[]): number[] {
|
|
|
5028
5186
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5029
5187
|
|
|
5030
5188
|
---
|
|
5189
|
+
|
|
5031
5190
|
### Variable: fromBase58
|
|
5032
5191
|
|
|
5033
5192
|
```ts
|
|
@@ -5064,6 +5223,7 @@ fromBase58 = (str: string): number[] => {
|
|
|
5064
5223
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5065
5224
|
|
|
5066
5225
|
---
|
|
5226
|
+
|
|
5067
5227
|
### Variable: fromBase58Check
|
|
5068
5228
|
|
|
5069
5229
|
```ts
|
|
@@ -5094,6 +5254,7 @@ See also: [fromBase58](./primitives.md#variable-frombase58), [hash256](./primiti
|
|
|
5094
5254
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5095
5255
|
|
|
5096
5256
|
---
|
|
5257
|
+
|
|
5097
5258
|
### Variable: getBytes
|
|
5098
5259
|
|
|
5099
5260
|
```ts
|
|
@@ -5110,6 +5271,7 @@ getBytes = function (numericValue: number): number[] {
|
|
|
5110
5271
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5111
5272
|
|
|
5112
5273
|
---
|
|
5274
|
+
|
|
5113
5275
|
### Variable: hash160
|
|
5114
5276
|
|
|
5115
5277
|
```ts
|
|
@@ -5124,6 +5286,7 @@ See also: [RIPEMD160](./primitives.md#class-ripemd160), [SHA256](./primitives.md
|
|
|
5124
5286
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5125
5287
|
|
|
5126
5288
|
---
|
|
5289
|
+
|
|
5127
5290
|
### Variable: hash256
|
|
5128
5291
|
|
|
5129
5292
|
```ts
|
|
@@ -5138,6 +5301,7 @@ See also: [SHA256](./primitives.md#class-sha256)
|
|
|
5138
5301
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5139
5302
|
|
|
5140
5303
|
---
|
|
5304
|
+
|
|
5141
5305
|
### Variable: incrementLeastSignificantThirtyTwoBits
|
|
5142
5306
|
|
|
5143
5307
|
```ts
|
|
@@ -5160,6 +5324,7 @@ incrementLeastSignificantThirtyTwoBits = function (block: number[]): number[] {
|
|
|
5160
5324
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5161
5325
|
|
|
5162
5326
|
---
|
|
5327
|
+
|
|
5163
5328
|
### Variable: minimallyEncode
|
|
5164
5329
|
|
|
5165
5330
|
```ts
|
|
@@ -5196,6 +5361,7 @@ minimallyEncode = (buf: number[]): number[] => {
|
|
|
5196
5361
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5197
5362
|
|
|
5198
5363
|
---
|
|
5364
|
+
|
|
5199
5365
|
### Variable: multiply
|
|
5200
5366
|
|
|
5201
5367
|
```ts
|
|
@@ -5225,6 +5391,7 @@ See also: [rightShift](./primitives.md#variable-rightshift)
|
|
|
5225
5391
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5226
5392
|
|
|
5227
5393
|
---
|
|
5394
|
+
|
|
5228
5395
|
### Variable: rightShift
|
|
5229
5396
|
|
|
5230
5397
|
```ts
|
|
@@ -5247,6 +5414,7 @@ rightShift = function (block: number[]): number[] {
|
|
|
5247
5414
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5248
5415
|
|
|
5249
5416
|
---
|
|
5417
|
+
|
|
5250
5418
|
### Variable: ripemd160
|
|
5251
5419
|
|
|
5252
5420
|
```ts
|
|
@@ -5260,6 +5428,7 @@ See also: [RIPEMD160](./primitives.md#class-ripemd160)
|
|
|
5260
5428
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5261
5429
|
|
|
5262
5430
|
---
|
|
5431
|
+
|
|
5263
5432
|
### Variable: sha1
|
|
5264
5433
|
|
|
5265
5434
|
```ts
|
|
@@ -5273,6 +5442,7 @@ See also: [SHA1](./primitives.md#class-sha1)
|
|
|
5273
5442
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5274
5443
|
|
|
5275
5444
|
---
|
|
5445
|
+
|
|
5276
5446
|
### Variable: sha256
|
|
5277
5447
|
|
|
5278
5448
|
```ts
|
|
@@ -5286,6 +5456,7 @@ See also: [SHA256](./primitives.md#class-sha256)
|
|
|
5286
5456
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5287
5457
|
|
|
5288
5458
|
---
|
|
5459
|
+
|
|
5289
5460
|
### Variable: sha256hmac
|
|
5290
5461
|
|
|
5291
5462
|
```ts
|
|
@@ -5299,6 +5470,7 @@ See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
|
5299
5470
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5300
5471
|
|
|
5301
5472
|
---
|
|
5473
|
+
|
|
5302
5474
|
### Variable: sha512
|
|
5303
5475
|
|
|
5304
5476
|
```ts
|
|
@@ -5312,6 +5484,7 @@ See also: [SHA512](./primitives.md#class-sha512)
|
|
|
5312
5484
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5313
5485
|
|
|
5314
5486
|
---
|
|
5487
|
+
|
|
5315
5488
|
### Variable: sha512hmac
|
|
5316
5489
|
|
|
5317
5490
|
```ts
|
|
@@ -5325,6 +5498,7 @@ See also: [SHA512HMAC](./primitives.md#class-sha512hmac)
|
|
|
5325
5498
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5326
5499
|
|
|
5327
5500
|
---
|
|
5501
|
+
|
|
5328
5502
|
### Variable: sign
|
|
5329
5503
|
|
|
5330
5504
|
```ts
|
|
@@ -5588,6 +5762,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Curve](./primitives.md#
|
|
|
5588
5762
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5589
5763
|
|
|
5590
5764
|
---
|
|
5765
|
+
|
|
5591
5766
|
### Variable: toArray
|
|
5592
5767
|
|
|
5593
5768
|
```ts
|
|
@@ -5613,6 +5788,7 @@ toArray = (msg: any, enc?: "hex" | "utf8" | "base64"): any[] => {
|
|
|
5613
5788
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5614
5789
|
|
|
5615
5790
|
---
|
|
5791
|
+
|
|
5616
5792
|
### Variable: toBase58
|
|
5617
5793
|
|
|
5618
5794
|
```ts
|
|
@@ -5648,6 +5824,7 @@ toBase58 = (bin: number[]): string => {
|
|
|
5648
5824
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5649
5825
|
|
|
5650
5826
|
---
|
|
5827
|
+
|
|
5651
5828
|
### Variable: toBase58Check
|
|
5652
5829
|
|
|
5653
5830
|
```ts
|
|
@@ -5663,6 +5840,7 @@ See also: [hash256](./primitives.md#variable-hash256), [toBase58](./primitives.m
|
|
|
5663
5840
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5664
5841
|
|
|
5665
5842
|
---
|
|
5843
|
+
|
|
5666
5844
|
### Variable: toHex
|
|
5667
5845
|
|
|
5668
5846
|
```ts
|
|
@@ -5680,6 +5858,7 @@ See also: [zero2](./primitives.md#variable-zero2)
|
|
|
5680
5858
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5681
5859
|
|
|
5682
5860
|
---
|
|
5861
|
+
|
|
5683
5862
|
### Variable: toUTF8
|
|
5684
5863
|
|
|
5685
5864
|
```ts
|
|
@@ -5729,6 +5908,7 @@ toUTF8 = (arr: number[]): string => {
|
|
|
5729
5908
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5730
5909
|
|
|
5731
5910
|
---
|
|
5911
|
+
|
|
5732
5912
|
### Variable: verify
|
|
5733
5913
|
|
|
5734
5914
|
```ts
|
|
@@ -5898,6 +6078,7 @@ See also: [BigNumber](./primitives.md#class-bignumber), [Curve](./primitives.md#
|
|
|
5898
6078
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5899
6079
|
|
|
5900
6080
|
---
|
|
6081
|
+
|
|
5901
6082
|
### Variable: zero2
|
|
5902
6083
|
|
|
5903
6084
|
```ts
|