@bsv/sdk 1.3.12 → 1.3.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/dist/cjs/package.json +15 -3
- package/dist/cjs/src/auth/Peer.js +83 -57
- package/dist/cjs/src/auth/Peer.js.map +1 -1
- package/dist/cjs/src/auth/SessionManager.js +14 -9
- package/dist/cjs/src/auth/SessionManager.js.map +1 -1
- package/dist/cjs/src/auth/certificates/Certificate.js +16 -10
- package/dist/cjs/src/auth/certificates/Certificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/MasterCertificate.js +25 -23
- package/dist/cjs/src/auth/certificates/MasterCertificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/VerifiableCertificate.js +2 -2
- package/dist/cjs/src/auth/certificates/VerifiableCertificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js +62 -46
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/cjs/src/auth/clients/AuthFetch.js +1 -0
- package/dist/cjs/src/auth/clients/AuthFetch.js.map +1 -1
- package/dist/cjs/src/auth/transports/SimplifiedFetchTransport.js +70 -43
- package/dist/cjs/src/auth/transports/SimplifiedFetchTransport.js.map +1 -1
- package/dist/cjs/src/auth/utils/createNonce.js +2 -1
- package/dist/cjs/src/auth/utils/createNonce.js.map +1 -1
- package/dist/cjs/src/auth/utils/getVerifiableCertificates.js.map +1 -1
- package/dist/cjs/src/auth/utils/validateCertificates.js +5 -2
- package/dist/cjs/src/auth/utils/validateCertificates.js.map +1 -1
- package/dist/cjs/src/auth/utils/verifyNonce.js +2 -1
- package/dist/cjs/src/auth/utils/verifyNonce.js.map +1 -1
- package/dist/cjs/src/compat/BSM.js +7 -17
- package/dist/cjs/src/compat/BSM.js.map +1 -1
- package/dist/cjs/src/compat/ECIES.js +172 -133
- package/dist/cjs/src/compat/ECIES.js.map +1 -1
- package/dist/cjs/src/compat/HD.js +63 -73
- package/dist/cjs/src/compat/HD.js.map +1 -1
- package/dist/cjs/src/compat/Mnemonic.js +102 -106
- package/dist/cjs/src/compat/Mnemonic.js.map +1 -1
- package/dist/cjs/src/compat/Utxo.js +2 -2
- package/dist/cjs/src/compat/Utxo.js.map +1 -1
- package/dist/cjs/src/compat/index.js +7 -17
- package/dist/cjs/src/compat/index.js.map +1 -1
- package/dist/cjs/src/messages/EncryptedMessage.js +3 -1
- package/dist/cjs/src/messages/EncryptedMessage.js.map +1 -1
- package/dist/cjs/src/messages/SignedMessage.js +1 -0
- package/dist/cjs/src/messages/SignedMessage.js.map +1 -1
- package/dist/cjs/src/messages/index.js +7 -17
- package/dist/cjs/src/messages/index.js.map +1 -1
- package/dist/cjs/src/overlay-tools/LookupResolver.js +54 -35
- package/dist/cjs/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/cjs/src/overlay-tools/OverlayAdminTokenTemplate.js +32 -20
- package/dist/cjs/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
- package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js +40 -28
- package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
- package/dist/cjs/src/primitives/AESGCM.js +6 -5
- package/dist/cjs/src/primitives/AESGCM.js.map +1 -1
- package/dist/cjs/src/primitives/BasePoint.js +1 -1
- package/dist/cjs/src/primitives/BasePoint.js.map +1 -1
- package/dist/cjs/src/primitives/BigNumber.js +50 -62
- package/dist/cjs/src/primitives/BigNumber.js.map +1 -1
- package/dist/cjs/src/primitives/Curve.js +46 -22
- package/dist/cjs/src/primitives/Curve.js.map +1 -1
- package/dist/cjs/src/primitives/DRBG.js +2 -8
- package/dist/cjs/src/primitives/DRBG.js.map +1 -1
- package/dist/cjs/src/primitives/ECDSA.js +51 -35
- package/dist/cjs/src/primitives/ECDSA.js.map +1 -1
- package/dist/cjs/src/primitives/Hash.js +191 -216
- package/dist/cjs/src/primitives/Hash.js.map +1 -1
- package/dist/cjs/src/primitives/JacobianPoint.js +19 -5
- package/dist/cjs/src/primitives/JacobianPoint.js.map +1 -1
- package/dist/cjs/src/primitives/K256.js.map +1 -1
- package/dist/cjs/src/primitives/Mersenne.js.map +1 -1
- package/dist/cjs/src/primitives/MontgomoryMethod.js.map +1 -1
- package/dist/cjs/src/primitives/Point.js +117 -88
- package/dist/cjs/src/primitives/Point.js.map +1 -1
- package/dist/cjs/src/primitives/Polynomial.js +4 -2
- package/dist/cjs/src/primitives/Polynomial.js.map +1 -1
- package/dist/cjs/src/primitives/PrivateKey.js +32 -33
- package/dist/cjs/src/primitives/PrivateKey.js.map +1 -1
- package/dist/cjs/src/primitives/PublicKey.js.map +1 -1
- package/dist/cjs/src/primitives/Random.js +6 -5
- package/dist/cjs/src/primitives/Random.js.map +1 -1
- package/dist/cjs/src/primitives/ReductionContext.js +1 -1
- package/dist/cjs/src/primitives/ReductionContext.js.map +1 -1
- package/dist/cjs/src/primitives/Schnorr.js +21 -15
- package/dist/cjs/src/primitives/Schnorr.js.map +1 -1
- package/dist/cjs/src/primitives/Signature.js +8 -7
- package/dist/cjs/src/primitives/Signature.js.map +1 -1
- package/dist/cjs/src/primitives/SymmetricKey.js +13 -13
- package/dist/cjs/src/primitives/SymmetricKey.js.map +1 -1
- package/dist/cjs/src/primitives/TransactionSignature.js +31 -29
- package/dist/cjs/src/primitives/TransactionSignature.js.map +1 -1
- package/dist/cjs/src/primitives/index.js +7 -17
- package/dist/cjs/src/primitives/index.js.map +1 -1
- package/dist/cjs/src/primitives/utils.js +79 -68
- package/dist/cjs/src/primitives/utils.js.map +1 -1
- package/dist/cjs/src/script/OP.js +3 -3
- package/dist/cjs/src/script/OP.js.map +1 -1
- package/dist/cjs/src/script/Script.js +12 -10
- package/dist/cjs/src/script/Script.js.map +1 -1
- package/dist/cjs/src/script/Spend.js +47 -49
- package/dist/cjs/src/script/Spend.js.map +1 -1
- package/dist/cjs/src/script/templates/P2PKH.js +24 -12
- package/dist/cjs/src/script/templates/P2PKH.js.map +1 -1
- package/dist/cjs/src/script/templates/PushDrop.js +28 -23
- package/dist/cjs/src/script/templates/PushDrop.js.map +1 -1
- package/dist/cjs/src/script/templates/RPuzzle.js +10 -6
- package/dist/cjs/src/script/templates/RPuzzle.js.map +1 -1
- package/dist/cjs/src/totp/totp.js +2 -1
- package/dist/cjs/src/totp/totp.js.map +1 -1
- package/dist/cjs/src/transaction/Beef.js +177 -154
- package/dist/cjs/src/transaction/Beef.js.map +1 -1
- package/dist/cjs/src/transaction/BeefParty.js +24 -24
- package/dist/cjs/src/transaction/BeefParty.js.map +1 -1
- package/dist/cjs/src/transaction/BeefTx.js +26 -18
- package/dist/cjs/src/transaction/BeefTx.js.map +1 -1
- package/dist/cjs/src/transaction/Broadcaster.js +3 -2
- package/dist/cjs/src/transaction/Broadcaster.js.map +1 -1
- package/dist/cjs/src/transaction/MerklePath.js +64 -37
- package/dist/cjs/src/transaction/MerklePath.js.map +1 -1
- package/dist/cjs/src/transaction/Transaction.js +111 -137
- package/dist/cjs/src/transaction/Transaction.js.map +1 -1
- package/dist/cjs/src/transaction/broadcasters/ARC.js +25 -16
- package/dist/cjs/src/transaction/broadcasters/ARC.js.map +1 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js +2 -1
- package/dist/cjs/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/cjs/src/transaction/broadcasters/WhatsOnChainBroadcaster.js.map +1 -1
- package/dist/cjs/src/transaction/chaintrackers/DefaultChainTracker.js +2 -1
- package/dist/cjs/src/transaction/chaintrackers/DefaultChainTracker.js.map +1 -1
- package/dist/cjs/src/transaction/chaintrackers/WhatsOnChain.js +3 -3
- package/dist/cjs/src/transaction/chaintrackers/WhatsOnChain.js.map +1 -1
- package/dist/cjs/src/transaction/fee-models/SatoshisPerKilobyte.js.map +1 -1
- package/dist/cjs/src/transaction/http/DefaultHttpClient.js +5 -3
- package/dist/cjs/src/transaction/http/DefaultHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/FetchHttpClient.js +5 -2
- package/dist/cjs/src/transaction/http/FetchHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js +5 -3
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/index.js.map +1 -1
- package/dist/cjs/src/transaction/index.js.map +1 -1
- package/dist/cjs/src/wallet/CachedKeyDeriver.js +91 -66
- package/dist/cjs/src/wallet/CachedKeyDeriver.js.map +1 -1
- package/dist/cjs/src/wallet/KeyDeriver.js +61 -52
- package/dist/cjs/src/wallet/KeyDeriver.js.map +1 -1
- package/dist/cjs/src/wallet/ProtoWallet.js +79 -29
- package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
- package/dist/cjs/src/wallet/WalletClient.js +7 -2
- package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
- package/dist/cjs/src/wallet/WalletError.js +2 -2
- package/dist/cjs/src/wallet/WalletError.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js +4 -3
- package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/HTTPWalletWire.js +2 -2
- package/dist/cjs/src/wallet/substrates/HTTPWalletWire.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js +1239 -1261
- package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/WalletWireTransceiver.js +102 -43
- package/dist/cjs/src/wallet/substrates/WalletWireTransceiver.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/XDM.js +8 -3
- package/dist/cjs/src/wallet/substrates/XDM.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/window.CWI.js +28 -28
- package/dist/cjs/src/wallet/substrates/window.CWI.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/mod.js +15 -15
- package/dist/esm/src/auth/Peer.js +75 -54
- package/dist/esm/src/auth/Peer.js.map +1 -1
- package/dist/esm/src/auth/SessionManager.js +14 -9
- package/dist/esm/src/auth/SessionManager.js.map +1 -1
- package/dist/esm/src/auth/certificates/Certificate.js +15 -11
- package/dist/esm/src/auth/certificates/Certificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/MasterCertificate.js +25 -23
- package/dist/esm/src/auth/certificates/MasterCertificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/VerifiableCertificate.js +2 -2
- package/dist/esm/src/auth/certificates/VerifiableCertificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js +64 -47
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/esm/src/auth/clients/AuthFetch.js +1 -0
- package/dist/esm/src/auth/clients/AuthFetch.js.map +1 -1
- package/dist/esm/src/auth/transports/SimplifiedFetchTransport.js +69 -43
- package/dist/esm/src/auth/transports/SimplifiedFetchTransport.js.map +1 -1
- package/dist/esm/src/auth/utils/createNonce.js.map +1 -1
- package/dist/esm/src/auth/utils/getVerifiableCertificates.js +1 -1
- package/dist/esm/src/auth/utils/getVerifiableCertificates.js.map +1 -1
- package/dist/esm/src/auth/utils/validateCertificates.js +6 -3
- package/dist/esm/src/auth/utils/validateCertificates.js.map +1 -1
- package/dist/esm/src/auth/utils/verifyNonce.js.map +1 -1
- package/dist/esm/src/compat/BSM.js.map +1 -1
- package/dist/esm/src/compat/ECIES.js +165 -116
- package/dist/esm/src/compat/ECIES.js.map +1 -1
- package/dist/esm/src/compat/HD.js +56 -56
- package/dist/esm/src/compat/HD.js.map +1 -1
- package/dist/esm/src/compat/Mnemonic.js +95 -89
- package/dist/esm/src/compat/Mnemonic.js.map +1 -1
- package/dist/esm/src/compat/Utxo.js +1 -1
- package/dist/esm/src/compat/Utxo.js.map +1 -1
- package/dist/esm/src/messages/EncryptedMessage.js +3 -1
- package/dist/esm/src/messages/EncryptedMessage.js.map +1 -1
- package/dist/esm/src/messages/SignedMessage.js +1 -0
- package/dist/esm/src/messages/SignedMessage.js.map +1 -1
- package/dist/esm/src/overlay-tools/LookupResolver.js +53 -35
- package/dist/esm/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/esm/src/overlay-tools/OverlayAdminTokenTemplate.js +32 -20
- package/dist/esm/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
- package/dist/esm/src/overlay-tools/SHIPBroadcaster.js +40 -28
- package/dist/esm/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
- package/dist/esm/src/primitives/AESGCM.js +1 -0
- package/dist/esm/src/primitives/AESGCM.js.map +1 -1
- package/dist/esm/src/primitives/BasePoint.js +1 -1
- package/dist/esm/src/primitives/BasePoint.js.map +1 -1
- package/dist/esm/src/primitives/BigNumber.js +50 -62
- package/dist/esm/src/primitives/BigNumber.js.map +1 -1
- package/dist/esm/src/primitives/Curve.js +45 -22
- package/dist/esm/src/primitives/Curve.js.map +1 -1
- package/dist/esm/src/primitives/DRBG.js +2 -8
- package/dist/esm/src/primitives/DRBG.js.map +1 -1
- package/dist/esm/src/primitives/ECDSA.js +50 -35
- package/dist/esm/src/primitives/ECDSA.js.map +1 -1
- package/dist/esm/src/primitives/Hash.js +188 -213
- package/dist/esm/src/primitives/Hash.js.map +1 -1
- package/dist/esm/src/primitives/JacobianPoint.js +18 -5
- package/dist/esm/src/primitives/JacobianPoint.js.map +1 -1
- package/dist/esm/src/primitives/K256.js.map +1 -1
- package/dist/esm/src/primitives/Mersenne.js.map +1 -1
- package/dist/esm/src/primitives/MontgomoryMethod.js.map +1 -1
- package/dist/esm/src/primitives/Point.js +107 -88
- package/dist/esm/src/primitives/Point.js.map +1 -1
- package/dist/esm/src/primitives/Polynomial.js +4 -2
- package/dist/esm/src/primitives/Polynomial.js.map +1 -1
- package/dist/esm/src/primitives/PrivateKey.js +25 -16
- package/dist/esm/src/primitives/PrivateKey.js.map +1 -1
- package/dist/esm/src/primitives/PublicKey.js.map +1 -1
- package/dist/esm/src/primitives/Random.js +7 -6
- package/dist/esm/src/primitives/Random.js.map +1 -1
- package/dist/esm/src/primitives/ReductionContext.js +1 -1
- package/dist/esm/src/primitives/ReductionContext.js.map +1 -1
- package/dist/esm/src/primitives/Schnorr.js +21 -15
- package/dist/esm/src/primitives/Schnorr.js.map +1 -1
- package/dist/esm/src/primitives/Signature.js +8 -7
- package/dist/esm/src/primitives/Signature.js.map +1 -1
- package/dist/esm/src/primitives/SymmetricKey.js +13 -13
- package/dist/esm/src/primitives/SymmetricKey.js.map +1 -1
- package/dist/esm/src/primitives/TransactionSignature.js +22 -12
- package/dist/esm/src/primitives/TransactionSignature.js.map +1 -1
- package/dist/esm/src/primitives/utils.js +76 -66
- package/dist/esm/src/primitives/utils.js.map +1 -1
- package/dist/esm/src/script/OP.js +3 -3
- package/dist/esm/src/script/OP.js.map +1 -1
- package/dist/esm/src/script/Script.js +12 -10
- package/dist/esm/src/script/Script.js.map +1 -1
- package/dist/esm/src/script/Spend.js +39 -32
- package/dist/esm/src/script/Spend.js.map +1 -1
- package/dist/esm/src/script/templates/P2PKH.js +26 -11
- package/dist/esm/src/script/templates/P2PKH.js.map +1 -1
- package/dist/esm/src/script/templates/PushDrop.js +29 -22
- package/dist/esm/src/script/templates/PushDrop.js.map +1 -1
- package/dist/esm/src/script/templates/RPuzzle.js +11 -6
- package/dist/esm/src/script/templates/RPuzzle.js.map +1 -1
- package/dist/esm/src/totp/totp.js +2 -1
- package/dist/esm/src/totp/totp.js.map +1 -1
- package/dist/esm/src/transaction/Beef.js +176 -154
- package/dist/esm/src/transaction/Beef.js.map +1 -1
- package/dist/esm/src/transaction/BeefParty.js +24 -24
- package/dist/esm/src/transaction/BeefParty.js.map +1 -1
- package/dist/esm/src/transaction/BeefTx.js +26 -18
- package/dist/esm/src/transaction/BeefTx.js.map +1 -1
- package/dist/esm/src/transaction/Broadcaster.js.map +1 -1
- package/dist/esm/src/transaction/MerklePath.js +61 -36
- package/dist/esm/src/transaction/MerklePath.js.map +1 -1
- package/dist/esm/src/transaction/Transaction.js +105 -138
- package/dist/esm/src/transaction/Transaction.js.map +1 -1
- package/dist/esm/src/transaction/broadcasters/ARC.js +25 -16
- package/dist/esm/src/transaction/broadcasters/ARC.js.map +1 -1
- package/dist/esm/src/transaction/broadcasters/DefaultBroadcaster.js.map +1 -1
- package/dist/esm/src/transaction/broadcasters/WhatsOnChainBroadcaster.js.map +1 -1
- package/dist/esm/src/transaction/chaintrackers/WhatsOnChain.js +3 -3
- package/dist/esm/src/transaction/chaintrackers/WhatsOnChain.js.map +1 -1
- package/dist/esm/src/transaction/fee-models/SatoshisPerKilobyte.js.map +1 -1
- package/dist/esm/src/transaction/http/DefaultHttpClient.js +3 -2
- package/dist/esm/src/transaction/http/DefaultHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/FetchHttpClient.js +4 -2
- package/dist/esm/src/transaction/http/FetchHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/NodejsHttpClient.js +5 -3
- package/dist/esm/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/index.js.map +1 -1
- package/dist/esm/src/transaction/index.js.map +1 -1
- package/dist/esm/src/wallet/CachedKeyDeriver.js +91 -66
- package/dist/esm/src/wallet/CachedKeyDeriver.js.map +1 -1
- package/dist/esm/src/wallet/KeyDeriver.js +60 -52
- package/dist/esm/src/wallet/KeyDeriver.js.map +1 -1
- package/dist/esm/src/wallet/ProtoWallet.js +75 -29
- package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
- package/dist/esm/src/wallet/WalletClient.js +7 -2
- package/dist/esm/src/wallet/WalletClient.js.map +1 -1
- package/dist/esm/src/wallet/WalletError.js +2 -2
- package/dist/esm/src/wallet/WalletError.js.map +1 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js +4 -4
- package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletWire.js +2 -2
- package/dist/esm/src/wallet/substrates/HTTPWalletWire.js.map +1 -1
- package/dist/esm/src/wallet/substrates/WalletWireProcessor.js +1239 -1261
- package/dist/esm/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
- package/dist/esm/src/wallet/substrates/WalletWireTransceiver.js +95 -43
- package/dist/esm/src/wallet/substrates/WalletWireTransceiver.js.map +1 -1
- package/dist/esm/src/wallet/substrates/XDM.js +8 -3
- package/dist/esm/src/wallet/substrates/XDM.js.map +1 -1
- package/dist/esm/src/wallet/substrates/window.CWI.js +28 -28
- package/dist/esm/src/wallet/substrates/window.CWI.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/mod.d.ts +15 -15
- package/dist/types/src/auth/Peer.d.ts +10 -10
- package/dist/types/src/auth/Peer.d.ts.map +1 -1
- package/dist/types/src/auth/SessionManager.d.ts +4 -4
- package/dist/types/src/auth/SessionManager.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/Certificate.d.ts +6 -6
- package/dist/types/src/auth/certificates/Certificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/MasterCertificate.d.ts +5 -5
- package/dist/types/src/auth/certificates/MasterCertificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts +23 -22
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts.map +1 -1
- package/dist/types/src/auth/clients/AuthFetch.d.ts.map +1 -1
- package/dist/types/src/auth/transports/SimplifiedFetchTransport.d.ts +1 -1
- package/dist/types/src/auth/transports/SimplifiedFetchTransport.d.ts.map +1 -1
- package/dist/types/src/auth/utils/createNonce.d.ts.map +1 -1
- package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts +3 -3
- package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts.map +1 -1
- package/dist/types/src/auth/utils/validateCertificates.d.ts +2 -2
- package/dist/types/src/auth/utils/validateCertificates.d.ts.map +1 -1
- package/dist/types/src/auth/utils/verifyNonce.d.ts +1 -1
- package/dist/types/src/auth/utils/verifyNonce.d.ts.map +1 -1
- package/dist/types/src/compat/BSM.d.ts +1 -1
- package/dist/types/src/compat/BSM.d.ts.map +1 -1
- package/dist/types/src/compat/ECIES.d.ts +36 -36
- package/dist/types/src/compat/ECIES.d.ts.map +1 -1
- package/dist/types/src/compat/HD.d.ts +51 -51
- package/dist/types/src/compat/HD.d.ts.map +1 -1
- package/dist/types/src/compat/Mnemonic.d.ts +79 -79
- package/dist/types/src/compat/Mnemonic.d.ts.map +1 -1
- package/dist/types/src/compat/Utxo.d.ts.map +1 -1
- package/dist/types/src/messages/EncryptedMessage.d.ts.map +1 -1
- package/dist/types/src/messages/SignedMessage.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/LookupResolver.d.ts +9 -9
- package/dist/types/src/overlay-tools/LookupResolver.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts +17 -17
- package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/SHIPBroadcaster.d.ts +14 -14
- package/dist/types/src/overlay-tools/SHIPBroadcaster.d.ts.map +1 -1
- package/dist/types/src/primitives/AESGCM.d.ts.map +1 -1
- package/dist/types/src/primitives/BasePoint.d.ts +8 -8
- package/dist/types/src/primitives/BasePoint.d.ts.map +1 -1
- package/dist/types/src/primitives/BigNumber.d.ts.map +1 -1
- package/dist/types/src/primitives/Curve.d.ts +14 -7
- package/dist/types/src/primitives/Curve.d.ts.map +1 -1
- package/dist/types/src/primitives/DRBG.d.ts.map +1 -1
- package/dist/types/src/primitives/ECDSA.d.ts +1 -1
- package/dist/types/src/primitives/ECDSA.d.ts.map +1 -1
- package/dist/types/src/primitives/Hash.d.ts +11 -11
- package/dist/types/src/primitives/Hash.d.ts.map +1 -1
- package/dist/types/src/primitives/JacobianPoint.d.ts.map +1 -1
- package/dist/types/src/primitives/Point.d.ts +14 -10
- package/dist/types/src/primitives/Point.d.ts.map +1 -1
- package/dist/types/src/primitives/Polynomial.d.ts.map +1 -1
- package/dist/types/src/primitives/PrivateKey.d.ts +2 -2
- package/dist/types/src/primitives/PrivateKey.d.ts.map +1 -1
- package/dist/types/src/primitives/PublicKey.d.ts.map +1 -1
- package/dist/types/src/primitives/Random.d.ts.map +1 -1
- package/dist/types/src/primitives/Schnorr.d.ts +14 -14
- package/dist/types/src/primitives/Schnorr.d.ts.map +1 -1
- package/dist/types/src/primitives/Signature.d.ts +1 -1
- package/dist/types/src/primitives/Signature.d.ts.map +1 -1
- package/dist/types/src/primitives/SymmetricKey.d.ts +13 -13
- package/dist/types/src/primitives/SymmetricKey.d.ts.map +1 -1
- package/dist/types/src/primitives/TransactionSignature.d.ts +4 -4
- package/dist/types/src/primitives/TransactionSignature.d.ts.map +1 -1
- package/dist/types/src/primitives/utils.d.ts +3 -6
- package/dist/types/src/primitives/utils.d.ts.map +1 -1
- package/dist/types/src/script/Script.d.ts +3 -3
- package/dist/types/src/script/Script.d.ts.map +1 -1
- package/dist/types/src/script/ScriptTemplate.d.ts +2 -2
- package/dist/types/src/script/ScriptTemplate.d.ts.map +1 -1
- package/dist/types/src/script/Spend.d.ts.map +1 -1
- package/dist/types/src/script/templates/P2PKH.d.ts.map +1 -1
- package/dist/types/src/script/templates/PushDrop.d.ts +1 -2
- package/dist/types/src/script/templates/PushDrop.d.ts.map +1 -1
- package/dist/types/src/script/templates/RPuzzle.d.ts.map +1 -1
- package/dist/types/src/totp/totp.d.ts.map +1 -1
- package/dist/types/src/transaction/Beef.d.ts +96 -96
- package/dist/types/src/transaction/Beef.d.ts.map +1 -1
- package/dist/types/src/transaction/BeefParty.d.ts +22 -22
- package/dist/types/src/transaction/BeefParty.d.ts.map +1 -1
- package/dist/types/src/transaction/BeefTx.d.ts +5 -5
- package/dist/types/src/transaction/BeefTx.d.ts.map +1 -1
- package/dist/types/src/transaction/Broadcaster.d.ts.map +1 -1
- package/dist/types/src/transaction/ChainTracker.d.ts +2 -2
- package/dist/types/src/transaction/FeeModel.d.ts.map +1 -1
- package/dist/types/src/transaction/MerklePath.d.ts.map +1 -1
- package/dist/types/src/transaction/Transaction.d.ts +4 -12
- package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
- package/dist/types/src/transaction/TransactionOutput.d.ts.map +1 -1
- package/dist/types/src/transaction/broadcasters/ARC.d.ts +1 -1
- package/dist/types/src/transaction/broadcasters/ARC.d.ts.map +1 -1
- package/dist/types/src/transaction/broadcasters/DefaultBroadcaster.d.ts.map +1 -1
- package/dist/types/src/transaction/broadcasters/WhatsOnChainBroadcaster.d.ts.map +1 -1
- package/dist/types/src/transaction/chaintrackers/DefaultChainTracker.d.ts.map +1 -1
- package/dist/types/src/transaction/chaintrackers/WhatsOnChain.d.ts.map +1 -1
- package/dist/types/src/transaction/fee-models/SatoshisPerKilobyte.d.ts.map +1 -1
- package/dist/types/src/transaction/http/DefaultHttpClient.d.ts +1 -1
- package/dist/types/src/transaction/http/DefaultHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/FetchHttpClient.d.ts +5 -5
- package/dist/types/src/transaction/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/HttpClient.d.ts +4 -4
- package/dist/types/src/transaction/http/HttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/NodejsHttpClient.d.ts +3 -3
- package/dist/types/src/transaction/http/NodejsHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/index.d.ts.map +1 -1
- package/dist/types/src/transaction/index.d.ts.map +1 -1
- package/dist/types/src/wallet/CachedKeyDeriver.d.ts +58 -58
- package/dist/types/src/wallet/CachedKeyDeriver.d.ts.map +1 -1
- package/dist/types/src/wallet/KeyDeriver.d.ts +78 -78
- package/dist/types/src/wallet/KeyDeriver.d.ts.map +1 -1
- package/dist/types/src/wallet/ProtoWallet.d.ts +10 -10
- package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
- package/dist/types/src/wallet/Wallet.interfaces.d.ts +151 -152
- package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
- package/dist/types/src/wallet/WalletClient.d.ts +5 -5
- package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts +6 -6
- package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/HTTPWalletWire.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/WalletWireProcessor.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/WalletWireTransceiver.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/XDM.d.ts +1 -1
- package/dist/types/src/wallet/substrates/XDM.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/window.CWI.d.ts +6 -6
- package/dist/types/src/wallet/substrates/window.CWI.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/auth.md +92 -82
- package/docs/compat.md +24 -24
- package/docs/messages.md +7 -5
- package/docs/overlay-tools.md +21 -21
- package/docs/primitives.md +336 -315
- package/docs/script.md +35 -35
- package/docs/swagger/dist/swagger-initializer.js +7 -7
- package/docs/swagger/dist/swagger-ui-bundle.js +1 -1
- package/docs/swagger/dist/swagger-ui-es-bundle-core.js +2 -2
- package/docs/swagger/dist/swagger-ui-es-bundle.js +1 -1
- package/docs/swagger/dist/swagger-ui-standalone-preset.js +1 -1
- package/docs/swagger/dist/swagger-ui.js +2 -2
- package/docs/totp.md +5 -5
- package/docs/transaction.md +103 -105
- package/docs/wallet-substrates.md +17 -17
- package/docs/wallet.md +202 -204
- package/mod.ts +15 -15
- package/package.json +15 -3
- package/src/auth/Peer.ts +271 -121
- package/src/auth/SessionManager.ts +17 -10
- package/src/auth/__tests/Peer.test.ts +361 -179
- package/src/auth/__tests/SessionManager.test.ts +67 -19
- package/src/auth/__tests/build.test.ts +11 -0
- package/src/auth/certificates/Certificate.ts +27 -14
- package/src/auth/certificates/MasterCertificate.ts +106 -62
- package/src/auth/certificates/VerifiableCertificate.ts +30 -8
- package/src/auth/certificates/__tests/Certificate.test.ts +32 -17
- package/src/auth/certificates/__tests/CompletedProtoWallet.ts +171 -68
- package/src/auth/certificates/__tests/MasterCertificate.test.ts +63 -47
- package/src/auth/certificates/__tests/VerifiableCertificate.test.ts +42 -31
- package/src/auth/certificates/index.ts +1 -1
- package/src/auth/clients/AuthFetch.ts +1 -0
- package/src/auth/clients/index.ts +1 -1
- package/src/auth/transports/SimplifiedFetchTransport.ts +145 -72
- package/src/auth/transports/index.ts +1 -1
- package/src/auth/utils/__tests/cryptononce.test.ts +52 -23
- package/src/auth/utils/__tests/getVerifiableCertificates.test.ts +56 -30
- package/src/auth/utils/__tests/validateCertificates.test.ts +53 -31
- package/src/auth/utils/createNonce.ts +11 -3
- package/src/auth/utils/getVerifiableCertificates.ts +12 -7
- package/src/auth/utils/validateCertificates.ts +57 -39
- package/src/auth/utils/verifyNonce.ts +6 -2
- package/src/compat/BSM.ts +10 -2
- package/src/compat/ECIES.ts +265 -141
- package/src/compat/HD.ts +81 -63
- package/src/compat/Mnemonic.ts +104 -91
- package/src/compat/Utxo.ts +8 -5
- package/src/compat/__tests/BSM.test.ts +42 -16
- package/src/compat/__tests/ECIES.test.ts +117 -52
- package/src/compat/__tests/HD.test.ts +55 -42
- package/src/compat/__tests/Mnemonic.test.ts +11 -12
- package/src/compat/__tests/Mnemonic.vectors.ts +110 -55
- package/src/messages/EncryptedMessage.ts +6 -2
- package/src/messages/SignedMessage.ts +14 -8
- package/src/messages/__tests/EncryptedMessage.test.ts +23 -24
- package/src/messages/__tests/SignedMessage.test.ts +17 -11
- package/src/overlay-tools/LookupResolver.ts +108 -56
- package/src/overlay-tools/OverlayAdminTokenTemplate.ts +52 -23
- package/src/overlay-tools/SHIPBroadcaster.ts +135 -59
- package/src/overlay-tools/__tests/LookupResolver.test.ts +723 -323
- package/src/overlay-tools/__tests/OverlayAdminTokenTemplate.test.ts +50 -22
- package/src/overlay-tools/__tests/SHIPBroadcaster.test.ts +607 -290
- package/src/primitives/AESGCM.ts +2 -0
- package/src/primitives/BasePoint.ts +4 -4
- package/src/primitives/BigNumber.ts +99 -90
- package/src/primitives/Curve.ts +117 -46
- package/src/primitives/DRBG.ts +9 -11
- package/src/primitives/ECDSA.ts +109 -63
- package/src/primitives/Hash.ts +492 -321
- package/src/primitives/JacobianPoint.ts +67 -19
- package/src/primitives/Point.ts +254 -152
- package/src/primitives/Polynomial.ts +8 -3
- package/src/primitives/PrivateKey.ts +41 -17
- package/src/primitives/PublicKey.ts +13 -3
- package/src/primitives/Random.ts +14 -8
- package/src/primitives/ReductionContext.ts +1 -1
- package/src/primitives/Schnorr.ts +40 -18
- package/src/primitives/Signature.ts +26 -16
- package/src/primitives/SymmetricKey.ts +14 -14
- package/src/primitives/TransactionSignature.ts +41 -17
- package/src/primitives/__tests/AESGCM.test.ts +457 -151
- package/src/primitives/__tests/BRC42.private.vectors.ts +30 -15
- package/src/primitives/__tests/BRC42.public.vectors.ts +30 -15
- package/src/primitives/__tests/BigNumber.arithmatic.test.ts +344 -125
- package/src/primitives/__tests/BigNumber.binary.test.ts +148 -67
- package/src/primitives/__tests/BigNumber.constructor.test.ts +65 -25
- package/src/primitives/__tests/BigNumber.dhGroup.test.ts +15 -11
- package/src/primitives/__tests/BigNumber.fixtures.ts +16 -8
- package/src/primitives/__tests/BigNumber.serializers.test.ts +41 -15
- package/src/primitives/__tests/BigNumber.utils.test.ts +132 -42
- package/src/primitives/__tests/Curve.unit.test.ts +75 -53
- package/src/primitives/__tests/DRBG.test.ts +1 -1
- package/src/primitives/__tests/DRBG.vectors.ts +45 -75
- package/src/primitives/__tests/ECDH.test.ts +15 -8
- package/src/primitives/__tests/ECDSA.test.ts +12 -6
- package/src/primitives/__tests/HMAC.test.ts +24 -18
- package/src/primitives/__tests/Hash.test.ts +57 -46
- package/src/primitives/__tests/PBKDF2.vectors.ts +130 -117
- package/src/primitives/__tests/PrivateKey.split.test.ts +33 -11
- package/src/primitives/__tests/PrivateKey.test.ts +11 -10
- package/src/primitives/__tests/PublicKey.test.ts +64 -53
- package/src/primitives/__tests/Random.test.ts +1 -1
- package/src/primitives/__tests/Reader.test.ts +240 -219
- package/src/primitives/__tests/ReductionContext.test.ts +98 -61
- package/src/primitives/__tests/Schnorr.test.ts +249 -237
- package/src/primitives/__tests/SymmetricKey.test.ts +18 -15
- package/src/primitives/__tests/SymmetricKey.vectors.ts +16 -8
- package/src/primitives/__tests/Writer.test.ts +23 -13
- package/src/primitives/__tests/bug-31.test.ts +6 -10
- package/src/primitives/__tests/utils.test.ts +70 -19
- package/src/primitives/utils.ts +103 -79
- package/src/script/Script.ts +18 -12
- package/src/script/ScriptTemplate.ts +3 -5
- package/src/script/Spend.ts +306 -108
- package/src/script/__tests/Script.test.ts +73 -55
- package/src/script/__tests/Spend.test.ts +208 -83
- package/src/script/__tests/SpendComplex.test.ts +19 -13
- package/src/script/__tests/script.invalid.vectors.ts +428 -1796
- package/src/script/__tests/script.valid.vectors.ts +728 -2764
- package/src/script/templates/P2PKH.ts +34 -12
- package/src/script/templates/PushDrop.ts +65 -31
- package/src/script/templates/RPuzzle.ts +29 -8
- package/src/script/templates/__tests/PushDrop.test.ts +146 -41
- package/src/totp/__tests/totp.test.ts +45 -44
- package/src/totp/totp.ts +3 -2
- package/src/transaction/Beef.ts +269 -174
- package/src/transaction/BeefParty.ts +41 -31
- package/src/transaction/BeefTx.ts +36 -26
- package/src/transaction/Broadcaster.ts +10 -6
- package/src/transaction/ChainTracker.ts +2 -2
- package/src/transaction/FeeModel.ts +0 -1
- package/src/transaction/MerklePath.ts +124 -59
- package/src/transaction/Transaction.ts +188 -187
- package/src/transaction/TransactionOutput.ts +0 -1
- package/src/transaction/__tests/Beef.test.ts +390 -287
- package/src/transaction/__tests/MerklePath.test.ts +59 -26
- package/src/transaction/__tests/Transaction.benchmarks.test.ts +231 -201
- package/src/transaction/__tests/Transaction.test.ts +758 -482
- package/src/transaction/__tests/bigtx.vectors.ts +2 -1
- package/src/transaction/__tests/bump.invalid.vectors.ts +24 -6
- package/src/transaction/__tests/bump.valid.vectors.ts +6 -2
- package/src/transaction/__tests/tx.invalid.vectors.ts +881 -185
- package/src/transaction/__tests/tx.valid.vectors.ts +1210 -257
- package/src/transaction/broadcasters/ARC.ts +69 -38
- package/src/transaction/broadcasters/DefaultBroadcaster.ts +9 -3
- package/src/transaction/broadcasters/WhatsOnChainBroadcaster.ts +20 -7
- package/src/transaction/broadcasters/__tests/ARC.test.ts +127 -59
- package/src/transaction/broadcasters/__tests/WhatsOnChainBroadcaster.test.ts +27 -18
- package/src/transaction/chaintrackers/DefaultChainTracker.ts +1 -1
- package/src/transaction/chaintrackers/WhatsOnChain.ts +27 -11
- package/src/transaction/chaintrackers/__tests/WhatsOnChainChainTracker.test.ts +59 -23
- package/src/transaction/fee-models/SatoshisPerKilobyte.ts +9 -5
- package/src/transaction/http/DefaultHttpClient.ts +5 -4
- package/src/transaction/http/FetchHttpClient.ts +18 -9
- package/src/transaction/http/HttpClient.ts +27 -22
- package/src/transaction/http/NodejsHttpClient.ts +23 -9
- package/src/transaction/http/index.ts +5 -1
- package/src/transaction/index.ts +5 -1
- package/src/wallet/CachedKeyDeriver.ts +151 -82
- package/src/wallet/KeyDeriver.ts +186 -105
- package/src/wallet/ProtoWallet.ts +121 -52
- package/src/wallet/Wallet.interfaces.ts +167 -156
- package/src/wallet/WalletClient.ts +314 -59
- package/src/wallet/WalletError.ts +2 -2
- package/src/wallet/__tests/CachedKeyDeriver.test.ts +86 -27
- package/src/wallet/__tests/KeyDeriver.test.ts +136 -33
- package/src/wallet/__tests/ProtoWallet.test.ts +190 -102
- package/src/wallet/substrates/HTTPWalletJSON.ts +250 -67
- package/src/wallet/substrates/HTTPWalletWire.ts +7 -3
- package/src/wallet/substrates/WalletWireCalls.ts +2 -2
- package/src/wallet/substrates/WalletWireProcessor.ts +1412 -1277
- package/src/wallet/substrates/WalletWireTransceiver.ts +713 -138
- package/src/wallet/substrates/XDM.ts +425 -36
- package/src/wallet/substrates/__tests/WalletWire.integration.test.ts +488 -225
- package/src/wallet/substrates/__tests/XDM.test.ts +232 -234
- package/src/wallet/substrates/window.CWI.ts +520 -61
package/docs/primitives.md
CHANGED
|
@@ -33,21 +33,21 @@ export default abstract class BasePoint {
|
|
|
33
33
|
curve: Curve;
|
|
34
34
|
type: "affine" | "jacobian";
|
|
35
35
|
precomputed: {
|
|
36
|
-
doubles
|
|
36
|
+
doubles?: {
|
|
37
37
|
step: number;
|
|
38
|
-
points:
|
|
39
|
-
}
|
|
40
|
-
naf
|
|
41
|
-
wnd:
|
|
42
|
-
points:
|
|
43
|
-
}
|
|
44
|
-
beta
|
|
38
|
+
points: BasePoint[];
|
|
39
|
+
};
|
|
40
|
+
naf?: {
|
|
41
|
+
wnd: number;
|
|
42
|
+
points: BasePoint[];
|
|
43
|
+
};
|
|
44
|
+
beta?: BasePoint | null;
|
|
45
45
|
} | null;
|
|
46
46
|
constructor(type: "affine" | "jacobian")
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
See also: [Curve](#class-curve)
|
|
50
|
+
See also: [Curve](./primitives.md#class-curve)
|
|
51
51
|
|
|
52
52
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
53
53
|
|
|
@@ -203,7 +203,7 @@ export default class BigNumber {
|
|
|
203
203
|
}
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
-
See also: [ReductionContext](#class-reductioncontext), [toArray](#variable-toarray), [toHex](#variable-tohex)
|
|
206
|
+
See also: [ReductionContext](./primitives.md#class-reductioncontext), [toArray](./primitives.md#variable-toarray), [toHex](./primitives.md#variable-tohex)
|
|
207
207
|
|
|
208
208
|
<details>
|
|
209
209
|
|
|
@@ -270,7 +270,7 @@ Reduction context of the big number.
|
|
|
270
270
|
```ts
|
|
271
271
|
red: ReductionContext | null
|
|
272
272
|
```
|
|
273
|
-
See also: [ReductionContext](#class-reductioncontext)
|
|
273
|
+
See also: [ReductionContext](./primitives.md#class-reductioncontext)
|
|
274
274
|
|
|
275
275
|
#### Property wordSize
|
|
276
276
|
|
|
@@ -309,7 +309,7 @@ The multiplicative inverse is a number which when multiplied with the current Bi
|
|
|
309
309
|
```ts
|
|
310
310
|
_invmp(p: BigNumber): BigNumber
|
|
311
311
|
```
|
|
312
|
-
See also: [BigNumber](#class-bignumber)
|
|
312
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
313
313
|
|
|
314
314
|
Returns
|
|
315
315
|
|
|
@@ -336,7 +336,7 @@ This method modifies the existing BigNumber instance.
|
|
|
336
336
|
```ts
|
|
337
337
|
_ishlnsubmul(num: BigNumber, mul, shift: number): this
|
|
338
338
|
```
|
|
339
|
-
See also: [BigNumber](#class-bignumber)
|
|
339
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
340
340
|
|
|
341
341
|
Returns
|
|
342
342
|
|
|
@@ -367,7 +367,7 @@ This operation does not affect the actual object but instead returns a new insta
|
|
|
367
367
|
```ts
|
|
368
368
|
abs(): BigNumber
|
|
369
369
|
```
|
|
370
|
-
See also: [BigNumber](#class-bignumber)
|
|
370
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
371
371
|
|
|
372
372
|
Returns
|
|
373
373
|
|
|
@@ -388,7 +388,7 @@ Add `num` to `this` BigNumber.
|
|
|
388
388
|
```ts
|
|
389
389
|
add(num: BigNumber): BigNumber
|
|
390
390
|
```
|
|
391
|
-
See also: [BigNumber](#class-bignumber)
|
|
391
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
392
392
|
|
|
393
393
|
Returns
|
|
394
394
|
|
|
@@ -414,7 +414,7 @@ Returns a new BigNumber that is the result of adding a plain number to the origi
|
|
|
414
414
|
```ts
|
|
415
415
|
addn(num: number): BigNumber
|
|
416
416
|
```
|
|
417
|
-
See also: [BigNumber](#class-bignumber)
|
|
417
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
418
418
|
|
|
419
419
|
Returns
|
|
420
420
|
|
|
@@ -440,7 +440,7 @@ set in the result only if the corresponding bit is set in both operands.
|
|
|
440
440
|
```ts
|
|
441
441
|
and(num: BigNumber): BigNumber
|
|
442
442
|
```
|
|
443
|
-
See also: [BigNumber](#class-bignumber)
|
|
443
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
444
444
|
|
|
445
445
|
Returns
|
|
446
446
|
|
|
@@ -548,7 +548,7 @@ Creates a copy of the current BigNumber instance.
|
|
|
548
548
|
```ts
|
|
549
549
|
clone(): BigNumber
|
|
550
550
|
```
|
|
551
|
-
See also: [BigNumber](#class-bignumber)
|
|
551
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
552
552
|
|
|
553
553
|
Returns
|
|
554
554
|
|
|
@@ -568,7 +568,7 @@ Compare this big number with another big number.
|
|
|
568
568
|
```ts
|
|
569
569
|
cmp(num: BigNumber): 1 | 0 | -1
|
|
570
570
|
```
|
|
571
|
-
See also: [BigNumber](#class-bignumber)
|
|
571
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
572
572
|
|
|
573
573
|
Returns
|
|
574
574
|
|
|
@@ -623,7 +623,7 @@ The copy method copies the state of this BigNumber into an exsiting `dest` BigNu
|
|
|
623
623
|
```ts
|
|
624
624
|
copy(dest: BigNumber): void
|
|
625
625
|
```
|
|
626
|
-
See also: [BigNumber](#class-bignumber)
|
|
626
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
627
627
|
|
|
628
628
|
Argument Details
|
|
629
629
|
|
|
@@ -646,7 +646,7 @@ Divides a BigNumber instance by another BigNumber and returns result. This does
|
|
|
646
646
|
```ts
|
|
647
647
|
div(num: BigNumber): BigNumber
|
|
648
648
|
```
|
|
649
|
-
See also: [BigNumber](#class-bignumber)
|
|
649
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
650
650
|
|
|
651
651
|
Returns
|
|
652
652
|
|
|
@@ -672,7 +672,7 @@ Returns the rounded quotient after division of one `BigNumber` by another `BigNu
|
|
|
672
672
|
```ts
|
|
673
673
|
divRound(num: BigNumber): BigNumber
|
|
674
674
|
```
|
|
675
|
-
See also: [BigNumber](#class-bignumber)
|
|
675
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
676
676
|
|
|
677
677
|
Returns
|
|
678
678
|
|
|
@@ -699,7 +699,7 @@ If the mode parameter is not provided, both division and modulus results are ret
|
|
|
699
699
|
```ts
|
|
700
700
|
divmod(num: BigNumber, mode?: "div" | "mod", positive?: boolean): any
|
|
701
701
|
```
|
|
702
|
-
See also: [BigNumber](#class-bignumber)
|
|
702
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
703
703
|
|
|
704
704
|
Returns
|
|
705
705
|
|
|
@@ -730,7 +730,7 @@ Returns the quotient `BigNumber` after division of one `BigNumber` by a primitiv
|
|
|
730
730
|
```ts
|
|
731
731
|
divn(num: number): BigNumber
|
|
732
732
|
```
|
|
733
|
-
See also: [BigNumber](#class-bignumber)
|
|
733
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
734
734
|
|
|
735
735
|
Returns
|
|
736
736
|
|
|
@@ -761,7 +761,7 @@ egcd(p: BigNumber): {
|
|
|
761
761
|
gcd: BigNumber;
|
|
762
762
|
}
|
|
763
763
|
```
|
|
764
|
-
See also: [BigNumber](#class-bignumber)
|
|
764
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
765
765
|
|
|
766
766
|
Returns
|
|
767
767
|
|
|
@@ -787,7 +787,7 @@ Compares the current BigNumber with the given number and returns whether they're
|
|
|
787
787
|
```ts
|
|
788
788
|
eq(num: BigNumber): boolean
|
|
789
789
|
```
|
|
790
|
-
See also: [BigNumber](#class-bignumber)
|
|
790
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
791
791
|
|
|
792
792
|
Returns
|
|
793
793
|
|
|
@@ -860,7 +860,7 @@ Forces the current BigNumber into a reduction context, irrespective of the BigNu
|
|
|
860
860
|
```ts
|
|
861
861
|
forceRed(ctx: ReductionContext): this
|
|
862
862
|
```
|
|
863
|
-
See also: [ReductionContext](#class-reductioncontext)
|
|
863
|
+
See also: [ReductionContext](./primitives.md#class-reductioncontext)
|
|
864
864
|
|
|
865
865
|
Returns
|
|
866
866
|
|
|
@@ -886,7 +886,7 @@ Creates a BigNumber from a number representing the "bits" value in a block heade
|
|
|
886
886
|
```ts
|
|
887
887
|
static fromBits(bits: number, strict: boolean = false): BigNumber
|
|
888
888
|
```
|
|
889
|
-
See also: [BigNumber](#class-bignumber)
|
|
889
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
890
890
|
|
|
891
891
|
Returns
|
|
892
892
|
|
|
@@ -917,7 +917,7 @@ Creates a BigNumber from a hexadecimal string.
|
|
|
917
917
|
```ts
|
|
918
918
|
static fromHex(hex: string, endian?: "little" | "big"): BigNumber
|
|
919
919
|
```
|
|
920
|
-
See also: [BigNumber](#class-bignumber)
|
|
920
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
921
921
|
|
|
922
922
|
Returns
|
|
923
923
|
|
|
@@ -942,7 +942,7 @@ Creates a BigNumber from a JSON-serialized string.
|
|
|
942
942
|
```ts
|
|
943
943
|
static fromJSON(str: string): BigNumber
|
|
944
944
|
```
|
|
945
|
-
See also: [BigNumber](#class-bignumber)
|
|
945
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
946
946
|
|
|
947
947
|
Returns
|
|
948
948
|
|
|
@@ -967,7 +967,7 @@ Creates a BigNumber from a number.
|
|
|
967
967
|
```ts
|
|
968
968
|
static fromNumber(n: number): BigNumber
|
|
969
969
|
```
|
|
970
|
-
See also: [BigNumber](#class-bignumber)
|
|
970
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
971
971
|
|
|
972
972
|
Returns
|
|
973
973
|
|
|
@@ -993,7 +993,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
993
993
|
```ts
|
|
994
994
|
fromRed(): BigNumber
|
|
995
995
|
```
|
|
996
|
-
See also: [BigNumber](#class-bignumber)
|
|
996
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
997
997
|
|
|
998
998
|
Returns
|
|
999
999
|
|
|
@@ -1015,7 +1015,7 @@ Creates a BigNumber from the format used in Bitcoin scripts.
|
|
|
1015
1015
|
```ts
|
|
1016
1016
|
static fromScriptNum(num: number[], requireMinimal?: boolean, maxNumSize?: number): BigNumber
|
|
1017
1017
|
```
|
|
1018
|
-
See also: [BigNumber](#class-bignumber)
|
|
1018
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1019
1019
|
|
|
1020
1020
|
Returns
|
|
1021
1021
|
|
|
@@ -1048,7 +1048,7 @@ Creates a BigNumber from a signed magnitude number.
|
|
|
1048
1048
|
```ts
|
|
1049
1049
|
static fromSm(num: number[], endian: "big" | "little" = "big"): BigNumber
|
|
1050
1050
|
```
|
|
1051
|
-
See also: [BigNumber](#class-bignumber)
|
|
1051
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1052
1052
|
|
|
1053
1053
|
Returns
|
|
1054
1054
|
|
|
@@ -1075,7 +1075,7 @@ Creates a BigNumber from a string, considering an optional base.
|
|
|
1075
1075
|
```ts
|
|
1076
1076
|
static fromString(str: string, base?: number | "hex"): BigNumber
|
|
1077
1077
|
```
|
|
1078
|
-
See also: [BigNumber](#class-bignumber)
|
|
1078
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1079
1079
|
|
|
1080
1080
|
Returns
|
|
1081
1081
|
|
|
@@ -1102,7 +1102,7 @@ Converts this big number from two's complement with a specified bit width.
|
|
|
1102
1102
|
```ts
|
|
1103
1103
|
fromTwos(width: number): BigNumber
|
|
1104
1104
|
```
|
|
1105
|
-
See also: [BigNumber](#class-bignumber)
|
|
1105
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1106
1106
|
|
|
1107
1107
|
Returns
|
|
1108
1108
|
|
|
@@ -1128,7 +1128,7 @@ Computes and returns the greatest common divisor (GCD) of this BigNumber and the
|
|
|
1128
1128
|
```ts
|
|
1129
1129
|
gcd(num: BigNumber): BigNumber
|
|
1130
1130
|
```
|
|
1131
|
-
See also: [BigNumber](#class-bignumber)
|
|
1131
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1132
1132
|
|
|
1133
1133
|
Returns
|
|
1134
1134
|
|
|
@@ -1154,7 +1154,7 @@ Checks if this BigNumber instance is greater than another BigNumber.
|
|
|
1154
1154
|
```ts
|
|
1155
1155
|
gt(num: BigNumber): boolean
|
|
1156
1156
|
```
|
|
1157
|
-
See also: [BigNumber](#class-bignumber)
|
|
1157
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1158
1158
|
|
|
1159
1159
|
Returns
|
|
1160
1160
|
|
|
@@ -1180,7 +1180,7 @@ Checks if this BigNumber instance is greater than or equal to another BigNumber.
|
|
|
1180
1180
|
```ts
|
|
1181
1181
|
gte(num: BigNumber): boolean
|
|
1182
1182
|
```
|
|
1183
|
-
See also: [BigNumber](#class-bignumber)
|
|
1183
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1184
1184
|
|
|
1185
1185
|
Returns
|
|
1186
1186
|
|
|
@@ -1273,7 +1273,7 @@ Add `num` to `this` BigNumber in-place.
|
|
|
1273
1273
|
```ts
|
|
1274
1274
|
iadd(num: BigNumber): this
|
|
1275
1275
|
```
|
|
1276
|
-
See also: [BigNumber](#class-bignumber)
|
|
1276
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1277
1277
|
|
|
1278
1278
|
Returns
|
|
1279
1279
|
|
|
@@ -1299,7 +1299,7 @@ Performs an in-place addition of a plain number to the BigNumber.
|
|
|
1299
1299
|
```ts
|
|
1300
1300
|
iaddn(num: number): BigNumber
|
|
1301
1301
|
```
|
|
1302
|
-
See also: [BigNumber](#class-bignumber)
|
|
1302
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1303
1303
|
|
|
1304
1304
|
Returns
|
|
1305
1305
|
|
|
@@ -1331,7 +1331,7 @@ checks for negative values before operation.
|
|
|
1331
1331
|
```ts
|
|
1332
1332
|
iand(num: BigNumber): BigNumber
|
|
1333
1333
|
```
|
|
1334
|
-
See also: [BigNumber](#class-bignumber)
|
|
1334
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1335
1335
|
|
|
1336
1336
|
Returns
|
|
1337
1337
|
|
|
@@ -1357,7 +1357,7 @@ Performs an in-place division of a `BigNumber` by a primitive number.
|
|
|
1357
1357
|
```ts
|
|
1358
1358
|
idivn(num: number): BigNumber
|
|
1359
1359
|
```
|
|
1360
|
-
See also: [BigNumber](#class-bignumber)
|
|
1360
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1361
1361
|
|
|
1362
1362
|
Returns
|
|
1363
1363
|
|
|
@@ -1414,7 +1414,7 @@ Performs an in-place multiplication of the BigNumber instance by a given BigNumb
|
|
|
1414
1414
|
```ts
|
|
1415
1415
|
imul(num: BigNumber): BigNumber
|
|
1416
1416
|
```
|
|
1417
|
-
See also: [BigNumber](#class-bignumber)
|
|
1417
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1418
1418
|
|
|
1419
1419
|
Returns
|
|
1420
1420
|
|
|
@@ -1442,7 +1442,7 @@ If negavtive number is provided, the resulting BigNumber will be inversely negat
|
|
|
1442
1442
|
```ts
|
|
1443
1443
|
imuln(num: number): BigNumber
|
|
1444
1444
|
```
|
|
1445
|
-
See also: [BigNumber](#class-bignumber)
|
|
1445
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1446
1446
|
|
|
1447
1447
|
Returns
|
|
1448
1448
|
|
|
@@ -1467,7 +1467,7 @@ Negates the big number in-place.
|
|
|
1467
1467
|
```ts
|
|
1468
1468
|
ineg(): BigNumber
|
|
1469
1469
|
```
|
|
1470
|
-
See also: [BigNumber](#class-bignumber)
|
|
1470
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1471
1471
|
|
|
1472
1472
|
Returns
|
|
1473
1473
|
|
|
@@ -1488,7 +1488,7 @@ In-place method that performs a bitwise NOT operation on a BigNumber up to a spe
|
|
|
1488
1488
|
```ts
|
|
1489
1489
|
inotn(width: number): BigNumber
|
|
1490
1490
|
```
|
|
1491
|
-
See also: [BigNumber](#class-bignumber)
|
|
1491
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1492
1492
|
|
|
1493
1493
|
Returns
|
|
1494
1494
|
|
|
@@ -1533,7 +1533,7 @@ Computes and returns the modular multiplicative inverse of this BigNumber in the
|
|
|
1533
1533
|
```ts
|
|
1534
1534
|
invm(num: BigNumber): BigNumber
|
|
1535
1535
|
```
|
|
1536
|
-
See also: [BigNumber](#class-bignumber)
|
|
1536
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1537
1537
|
|
|
1538
1538
|
Returns
|
|
1539
1539
|
|
|
@@ -1560,7 +1560,7 @@ that neither of the numbers can be negative. Stores the result in this BigNumber
|
|
|
1560
1560
|
```ts
|
|
1561
1561
|
ior(num: BigNumber): BigNumber
|
|
1562
1562
|
```
|
|
1563
|
-
See also: [BigNumber](#class-bignumber)
|
|
1563
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1564
1564
|
|
|
1565
1565
|
Returns
|
|
1566
1566
|
|
|
@@ -1746,7 +1746,7 @@ Performs in-place multiplication of the BigNumber instance by itself.
|
|
|
1746
1746
|
```ts
|
|
1747
1747
|
isqr(): BigNumber
|
|
1748
1748
|
```
|
|
1749
|
-
See also: [BigNumber](#class-bignumber)
|
|
1749
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1750
1750
|
|
|
1751
1751
|
Returns
|
|
1752
1752
|
|
|
@@ -1766,7 +1766,7 @@ Subtract `num` from `this` BigNumber in-place.
|
|
|
1766
1766
|
```ts
|
|
1767
1767
|
isub(num: BigNumber): BigNumber
|
|
1768
1768
|
```
|
|
1769
|
-
See also: [BigNumber](#class-bignumber)
|
|
1769
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1770
1770
|
|
|
1771
1771
|
Returns
|
|
1772
1772
|
|
|
@@ -1792,7 +1792,7 @@ Performs an in-place subtraction of a plain number from the BigNumber.
|
|
|
1792
1792
|
```ts
|
|
1793
1793
|
isubn(num: number): BigNumber
|
|
1794
1794
|
```
|
|
1795
|
-
See also: [BigNumber](#class-bignumber)
|
|
1795
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1796
1796
|
|
|
1797
1797
|
Returns
|
|
1798
1798
|
|
|
@@ -1824,7 +1824,7 @@ in both operands.
|
|
|
1824
1824
|
```ts
|
|
1825
1825
|
iuand(num: BigNumber): BigNumber
|
|
1826
1826
|
```
|
|
1827
|
-
See also: [BigNumber](#class-bignumber)
|
|
1827
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1828
1828
|
|
|
1829
1829
|
Returns
|
|
1830
1830
|
|
|
@@ -1851,7 +1851,7 @@ the result in this BigNumber.
|
|
|
1851
1851
|
```ts
|
|
1852
1852
|
iuor(num: BigNumber): BigNumber
|
|
1853
1853
|
```
|
|
1854
|
-
See also: [BigNumber](#class-bignumber)
|
|
1854
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1855
1855
|
|
|
1856
1856
|
Returns
|
|
1857
1857
|
|
|
@@ -1902,7 +1902,7 @@ Performs an in-place unsigned bitwise right shift operation on the BigNumber ins
|
|
|
1902
1902
|
```ts
|
|
1903
1903
|
iushrn(bits: number, hint?: number, extended?: BigNumber): this
|
|
1904
1904
|
```
|
|
1905
|
-
See also: [BigNumber](#class-bignumber)
|
|
1905
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1906
1906
|
|
|
1907
1907
|
Returns
|
|
1908
1908
|
|
|
@@ -1933,7 +1933,7 @@ corresponding bits in the operands are different.
|
|
|
1933
1933
|
```ts
|
|
1934
1934
|
iuxor(num: BigNumber): this
|
|
1935
1935
|
```
|
|
1936
|
-
See also: [BigNumber](#class-bignumber)
|
|
1936
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1937
1937
|
|
|
1938
1938
|
Returns
|
|
1939
1939
|
|
|
@@ -1962,7 +1962,7 @@ checks for negative values before operation.
|
|
|
1962
1962
|
```ts
|
|
1963
1963
|
ixor(num: BigNumber): this
|
|
1964
1964
|
```
|
|
1965
|
-
See also: [BigNumber](#class-bignumber)
|
|
1965
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1966
1966
|
|
|
1967
1967
|
Returns
|
|
1968
1968
|
|
|
@@ -1988,7 +1988,7 @@ Checks if this BigNumber instance is less than another BigNumber.
|
|
|
1988
1988
|
```ts
|
|
1989
1989
|
lt(num: BigNumber): boolean
|
|
1990
1990
|
```
|
|
1991
|
-
See also: [BigNumber](#class-bignumber)
|
|
1991
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
1992
1992
|
|
|
1993
1993
|
Returns
|
|
1994
1994
|
|
|
@@ -2014,7 +2014,7 @@ Checks if this BigNumber instance is less than or equal to another BigNumber.
|
|
|
2014
2014
|
```ts
|
|
2015
2015
|
lte(num: BigNumber): boolean
|
|
2016
2016
|
```
|
|
2017
|
-
See also: [BigNumber](#class-bignumber)
|
|
2017
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2018
2018
|
|
|
2019
2019
|
Returns
|
|
2020
2020
|
|
|
@@ -2088,7 +2088,7 @@ Returns a new BigNumber that keeps only the lower bits of the original number.
|
|
|
2088
2088
|
```ts
|
|
2089
2089
|
maskn(bits): BigNumber
|
|
2090
2090
|
```
|
|
2091
|
-
See also: [BigNumber](#class-bignumber)
|
|
2091
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2092
2092
|
|
|
2093
2093
|
Returns
|
|
2094
2094
|
|
|
@@ -2113,7 +2113,7 @@ Returns the bigger value between two BigNumbers
|
|
|
2113
2113
|
```ts
|
|
2114
2114
|
static max(left: BigNumber, right: BigNumber): BigNumber
|
|
2115
2115
|
```
|
|
2116
|
-
See also: [BigNumber](#class-bignumber)
|
|
2116
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2117
2117
|
|
|
2118
2118
|
Returns
|
|
2119
2119
|
|
|
@@ -2141,7 +2141,7 @@ Returns the smaller value between two BigNumbers
|
|
|
2141
2141
|
```ts
|
|
2142
2142
|
static min(left: BigNumber, right: BigNumber): BigNumber
|
|
2143
2143
|
```
|
|
2144
|
-
See also: [BigNumber](#class-bignumber)
|
|
2144
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2145
2145
|
|
|
2146
2146
|
Returns
|
|
2147
2147
|
|
|
@@ -2169,7 +2169,7 @@ Returns the remainder after division of one `BigNumber` by another `BigNumber`.
|
|
|
2169
2169
|
```ts
|
|
2170
2170
|
mod(num: BigNumber): BigNumber
|
|
2171
2171
|
```
|
|
2172
|
-
See also: [BigNumber](#class-bignumber)
|
|
2172
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2173
2173
|
|
|
2174
2174
|
Returns
|
|
2175
2175
|
|
|
@@ -2221,7 +2221,7 @@ Directly transfers the attributes of the source BigNumber to the destination Big
|
|
|
2221
2221
|
```ts
|
|
2222
2222
|
static move(dest: BigNumber, src: BigNumber): void
|
|
2223
2223
|
```
|
|
2224
|
-
See also: [BigNumber](#class-bignumber)
|
|
2224
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2225
2225
|
|
|
2226
2226
|
Argument Details
|
|
2227
2227
|
|
|
@@ -2247,7 +2247,7 @@ It creates a new BigNumber to store the result.
|
|
|
2247
2247
|
```ts
|
|
2248
2248
|
mul(num: BigNumber): BigNumber
|
|
2249
2249
|
```
|
|
2250
|
-
See also: [BigNumber](#class-bignumber)
|
|
2250
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2251
2251
|
|
|
2252
2252
|
Returns
|
|
2253
2253
|
|
|
@@ -2274,7 +2274,7 @@ It chooses the multiplication method based on the lengths of the numbers to opti
|
|
|
2274
2274
|
```ts
|
|
2275
2275
|
mulTo(num: BigNumber, out: BigNumber): BigNumber
|
|
2276
2276
|
```
|
|
2277
|
-
See also: [BigNumber](#class-bignumber)
|
|
2277
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2278
2278
|
|
|
2279
2279
|
Returns
|
|
2280
2280
|
|
|
@@ -2304,7 +2304,7 @@ It performs the multiplication operation in-place to a cloned BigNumber.
|
|
|
2304
2304
|
```ts
|
|
2305
2305
|
muln(num: number): BigNumber
|
|
2306
2306
|
```
|
|
2307
|
-
See also: [BigNumber](#class-bignumber)
|
|
2307
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2308
2308
|
|
|
2309
2309
|
Returns
|
|
2310
2310
|
|
|
@@ -2329,7 +2329,7 @@ Negates the big number and returns a new instance.
|
|
|
2329
2329
|
```ts
|
|
2330
2330
|
neg(): BigNumber
|
|
2331
2331
|
```
|
|
2332
|
-
See also: [BigNumber](#class-bignumber)
|
|
2332
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2333
2333
|
|
|
2334
2334
|
Returns
|
|
2335
2335
|
|
|
@@ -2369,7 +2369,7 @@ Performs a bitwise NOT operation on a BigNumber up to a specified bit width. Ret
|
|
|
2369
2369
|
```ts
|
|
2370
2370
|
notn(width: number): BigNumber
|
|
2371
2371
|
```
|
|
2372
|
-
See also: [BigNumber](#class-bignumber)
|
|
2372
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2373
2373
|
|
|
2374
2374
|
Returns
|
|
2375
2375
|
|
|
@@ -2398,7 +2398,7 @@ the corresponding bit in the first operand or the second operand is
|
|
|
2398
2398
|
```ts
|
|
2399
2399
|
or(num: BigNumber): BigNumber
|
|
2400
2400
|
```
|
|
2401
|
-
See also: [BigNumber](#class-bignumber)
|
|
2401
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2402
2402
|
|
|
2403
2403
|
Returns
|
|
2404
2404
|
|
|
@@ -2424,7 +2424,7 @@ Raises the BigNumber instance to the power of the specified BigNumber.
|
|
|
2424
2424
|
```ts
|
|
2425
2425
|
pow(num: BigNumber): BigNumber
|
|
2426
2426
|
```
|
|
2427
|
-
See also: [BigNumber](#class-bignumber)
|
|
2427
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2428
2428
|
|
|
2429
2429
|
Returns
|
|
2430
2430
|
|
|
@@ -2451,7 +2451,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
2451
2451
|
```ts
|
|
2452
2452
|
redAdd(num: BigNumber): BigNumber
|
|
2453
2453
|
```
|
|
2454
|
-
See also: [BigNumber](#class-bignumber)
|
|
2454
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2455
2455
|
|
|
2456
2456
|
Returns
|
|
2457
2457
|
|
|
@@ -2479,7 +2479,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
2479
2479
|
```ts
|
|
2480
2480
|
redIAdd(num: BigNumber): BigNumber
|
|
2481
2481
|
```
|
|
2482
|
-
See also: [BigNumber](#class-bignumber)
|
|
2482
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2483
2483
|
|
|
2484
2484
|
Returns
|
|
2485
2485
|
|
|
@@ -2507,7 +2507,7 @@ Expects that this BigNumber is within the reduction context i.e., it has been re
|
|
|
2507
2507
|
```ts
|
|
2508
2508
|
redIMul(num: BigNumber): BigNumber
|
|
2509
2509
|
```
|
|
2510
|
-
See also: [BigNumber](#class-bignumber)
|
|
2510
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2511
2511
|
|
|
2512
2512
|
Returns
|
|
2513
2513
|
|
|
@@ -2536,7 +2536,7 @@ if it has a `red` field that points to a reduction context object.
|
|
|
2536
2536
|
```ts
|
|
2537
2537
|
redISqr(): BigNumber
|
|
2538
2538
|
```
|
|
2539
|
-
See also: [BigNumber](#class-bignumber)
|
|
2539
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2540
2540
|
|
|
2541
2541
|
Returns
|
|
2542
2542
|
|
|
@@ -2562,7 +2562,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
2562
2562
|
```ts
|
|
2563
2563
|
redISub(num: BigNumber): BigNumber
|
|
2564
2564
|
```
|
|
2565
|
-
See also: [BigNumber](#class-bignumber)
|
|
2565
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2566
2566
|
|
|
2567
2567
|
Returns
|
|
2568
2568
|
|
|
@@ -2590,7 +2590,7 @@ The method works only on numbers that have a reduction context set.
|
|
|
2590
2590
|
```ts
|
|
2591
2591
|
redInvm(): BigNumber
|
|
2592
2592
|
```
|
|
2593
|
-
See also: [BigNumber](#class-bignumber)
|
|
2593
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2594
2594
|
|
|
2595
2595
|
Returns
|
|
2596
2596
|
|
|
@@ -2616,7 +2616,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
2616
2616
|
```ts
|
|
2617
2617
|
redMul(num: BigNumber): BigNumber
|
|
2618
2618
|
```
|
|
2619
|
-
See also: [BigNumber](#class-bignumber)
|
|
2619
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2620
2620
|
|
|
2621
2621
|
Returns
|
|
2622
2622
|
|
|
@@ -2644,7 +2644,7 @@ The method works only on numbers that have a reduction context set.
|
|
|
2644
2644
|
```ts
|
|
2645
2645
|
redNeg(): BigNumber
|
|
2646
2646
|
```
|
|
2647
|
-
See also: [BigNumber](#class-bignumber)
|
|
2647
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2648
2648
|
|
|
2649
2649
|
Returns
|
|
2650
2650
|
|
|
@@ -2670,7 +2670,7 @@ Note that 'num' must not have a reduction context set.
|
|
|
2670
2670
|
```ts
|
|
2671
2671
|
redPow(num: BigNumber): BigNumber
|
|
2672
2672
|
```
|
|
2673
|
-
See also: [BigNumber](#class-bignumber)
|
|
2673
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2674
2674
|
|
|
2675
2675
|
Returns
|
|
2676
2676
|
|
|
@@ -2702,7 +2702,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
2702
2702
|
```ts
|
|
2703
2703
|
redShl(num: number): BigNumber
|
|
2704
2704
|
```
|
|
2705
|
-
See also: [BigNumber](#class-bignumber)
|
|
2705
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2706
2706
|
|
|
2707
2707
|
Returns
|
|
2708
2708
|
|
|
@@ -2732,7 +2732,7 @@ if it has a `red` field that points to a reduction context object.
|
|
|
2732
2732
|
```ts
|
|
2733
2733
|
redSqr(): BigNumber
|
|
2734
2734
|
```
|
|
2735
|
-
See also: [BigNumber](#class-bignumber)
|
|
2735
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2736
2736
|
|
|
2737
2737
|
Returns
|
|
2738
2738
|
|
|
@@ -2761,7 +2761,7 @@ field that points to a reduction context object.
|
|
|
2761
2761
|
```ts
|
|
2762
2762
|
redSqrt(): BigNumber
|
|
2763
2763
|
```
|
|
2764
|
-
See also: [BigNumber](#class-bignumber)
|
|
2764
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2765
2765
|
|
|
2766
2766
|
Returns
|
|
2767
2767
|
|
|
@@ -2787,7 +2787,7 @@ Throws an error in case the number is not in a reduction context.
|
|
|
2787
2787
|
```ts
|
|
2788
2788
|
redSub(num: BigNumber): BigNumber
|
|
2789
2789
|
```
|
|
2790
|
-
See also: [BigNumber](#class-bignumber)
|
|
2790
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2791
2791
|
|
|
2792
2792
|
Returns
|
|
2793
2793
|
|
|
@@ -2842,7 +2842,7 @@ Performs a bitwise left shift operation on a clone of the BigNumber instance.
|
|
|
2842
2842
|
```ts
|
|
2843
2843
|
shln(bits): BigNumber
|
|
2844
2844
|
```
|
|
2845
|
-
See also: [BigNumber](#class-bignumber)
|
|
2845
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2846
2846
|
|
|
2847
2847
|
Returns
|
|
2848
2848
|
|
|
@@ -2868,7 +2868,7 @@ Performs a bitwise right shift operation on a clone of the BigNumber instance.
|
|
|
2868
2868
|
```ts
|
|
2869
2869
|
shrn(bits): BigNumber
|
|
2870
2870
|
```
|
|
2871
|
-
See also: [BigNumber](#class-bignumber)
|
|
2871
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2872
2872
|
|
|
2873
2873
|
Returns
|
|
2874
2874
|
|
|
@@ -2894,7 +2894,7 @@ Squares the BigNumber instance.
|
|
|
2894
2894
|
```ts
|
|
2895
2895
|
sqr(): BigNumber
|
|
2896
2896
|
```
|
|
2897
|
-
See also: [BigNumber](#class-bignumber)
|
|
2897
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2898
2898
|
|
|
2899
2899
|
Returns
|
|
2900
2900
|
|
|
@@ -2934,7 +2934,7 @@ Subtract `num` from `this` BigNumber.
|
|
|
2934
2934
|
```ts
|
|
2935
2935
|
sub(num: BigNumber): BigNumber
|
|
2936
2936
|
```
|
|
2937
|
-
See also: [BigNumber](#class-bignumber)
|
|
2937
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2938
2938
|
|
|
2939
2939
|
Returns
|
|
2940
2940
|
|
|
@@ -2960,7 +2960,7 @@ Returns a new BigNumber that is the result of subtracting a plain number from th
|
|
|
2960
2960
|
```ts
|
|
2961
2961
|
subn(num: number): BigNumber
|
|
2962
2962
|
```
|
|
2963
|
-
See also: [BigNumber](#class-bignumber)
|
|
2963
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
2964
2964
|
|
|
2965
2965
|
Returns
|
|
2966
2966
|
|
|
@@ -3036,7 +3036,7 @@ a binary number, where each array index is a bit.
|
|
|
3036
3036
|
```ts
|
|
3037
3037
|
static toBitArray(num: BigNumber): Array<0 | 1>
|
|
3038
3038
|
```
|
|
3039
|
-
See also: [BigNumber](#class-bignumber)
|
|
3039
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3040
3040
|
|
|
3041
3041
|
Returns
|
|
3042
3042
|
|
|
@@ -3171,7 +3171,7 @@ Throws an error in case the number is either negative or already in a reduction
|
|
|
3171
3171
|
```ts
|
|
3172
3172
|
toRed(ctx: ReductionContext): BigNumber
|
|
3173
3173
|
```
|
|
3174
|
-
See also: [BigNumber](#class-bignumber), [ReductionContext](#class-reductioncontext)
|
|
3174
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [ReductionContext](./primitives.md#class-reductioncontext)
|
|
3175
3175
|
|
|
3176
3176
|
Returns
|
|
3177
3177
|
|
|
@@ -3272,7 +3272,7 @@ Converts this big number to two's complement with a specified bit width.
|
|
|
3272
3272
|
```ts
|
|
3273
3273
|
toTwos(width: number): BigNumber
|
|
3274
3274
|
```
|
|
3275
|
-
See also: [BigNumber](#class-bignumber)
|
|
3275
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3276
3276
|
|
|
3277
3277
|
Returns
|
|
3278
3278
|
|
|
@@ -3299,7 +3299,7 @@ Performs a bitwise AND operation without considering signed bit
|
|
|
3299
3299
|
```ts
|
|
3300
3300
|
uand(num: BigNumber): BigNumber
|
|
3301
3301
|
```
|
|
3302
|
-
See also: [BigNumber](#class-bignumber)
|
|
3302
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3303
3303
|
|
|
3304
3304
|
Returns
|
|
3305
3305
|
|
|
@@ -3325,7 +3325,7 @@ Performs an unsigned comparison between this BigNumber instance and another.
|
|
|
3325
3325
|
```ts
|
|
3326
3326
|
ucmp(num: BigNumber): 1 | 0 | -1
|
|
3327
3327
|
```
|
|
3328
|
-
See also: [BigNumber](#class-bignumber)
|
|
3328
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3329
3329
|
|
|
3330
3330
|
Returns
|
|
3331
3331
|
|
|
@@ -3351,7 +3351,7 @@ Returns the remainder after unsigned division of one `BigNumber` by another `Big
|
|
|
3351
3351
|
```ts
|
|
3352
3352
|
umod(num: BigNumber): BigNumber
|
|
3353
3353
|
```
|
|
3354
|
-
See also: [BigNumber](#class-bignumber)
|
|
3354
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3355
3355
|
|
|
3356
3356
|
Returns
|
|
3357
3357
|
|
|
@@ -3380,7 +3380,7 @@ similar to the `or` method.
|
|
|
3380
3380
|
```ts
|
|
3381
3381
|
uor(num: BigNumber): BigNumber
|
|
3382
3382
|
```
|
|
3383
|
-
See also: [BigNumber](#class-bignumber)
|
|
3383
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3384
3384
|
|
|
3385
3385
|
Returns
|
|
3386
3386
|
|
|
@@ -3406,7 +3406,7 @@ Performs an unsigned bitwise shift left operation on a clone of the BigNumber in
|
|
|
3406
3406
|
```ts
|
|
3407
3407
|
ushln(bits): BigNumber
|
|
3408
3408
|
```
|
|
3409
|
-
See also: [BigNumber](#class-bignumber)
|
|
3409
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3410
3410
|
|
|
3411
3411
|
Returns
|
|
3412
3412
|
|
|
@@ -3432,7 +3432,7 @@ Performs an unsigned bitwise shift right operation on a clone of the BigNumber i
|
|
|
3432
3432
|
```ts
|
|
3433
3433
|
ushrn(bits): BigNumber
|
|
3434
3434
|
```
|
|
3435
|
-
See also: [BigNumber](#class-bignumber)
|
|
3435
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3436
3436
|
|
|
3437
3437
|
Returns
|
|
3438
3438
|
|
|
@@ -3458,7 +3458,7 @@ Performs an unsigned XOR operation on this BigNumber with the supplied BigNumber
|
|
|
3458
3458
|
```ts
|
|
3459
3459
|
uxor(num: BigNumber): BigNumber
|
|
3460
3460
|
```
|
|
3461
|
-
See also: [BigNumber](#class-bignumber)
|
|
3461
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3462
3462
|
|
|
3463
3463
|
Returns
|
|
3464
3464
|
|
|
@@ -3485,7 +3485,7 @@ set in the result only if the corresponding bits in the operands are different.
|
|
|
3485
3485
|
```ts
|
|
3486
3486
|
xor(num: BigNumber): BigNumber
|
|
3487
3487
|
```
|
|
3488
|
-
See also: [BigNumber](#class-bignumber)
|
|
3488
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3489
3489
|
|
|
3490
3490
|
Returns
|
|
3491
3491
|
|
|
@@ -3547,13 +3547,20 @@ export default class Curve {
|
|
|
3547
3547
|
tinv: BigNumber;
|
|
3548
3548
|
zeroA: boolean;
|
|
3549
3549
|
threeA: boolean;
|
|
3550
|
-
endo:
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3550
|
+
endo: {
|
|
3551
|
+
beta: BigNumber;
|
|
3552
|
+
lambda: BigNumber;
|
|
3553
|
+
basis: Array<{
|
|
3554
|
+
a: BigNumber;
|
|
3555
|
+
b: BigNumber;
|
|
3556
|
+
}>;
|
|
3557
|
+
} | undefined;
|
|
3558
|
+
_endoWnafT1: BigNumber[];
|
|
3559
|
+
_endoWnafT2: BigNumber[];
|
|
3560
|
+
_wnafT1: BigNumber[];
|
|
3561
|
+
_wnafT2: BigNumber[];
|
|
3562
|
+
_wnafT3: BigNumber[];
|
|
3563
|
+
_wnafT4: BigNumber[];
|
|
3557
3564
|
_bitLength: number;
|
|
3558
3565
|
static assert(expression: unknown, message: string = "Elliptic curve assertion failed"): void
|
|
3559
3566
|
getNAF(num: BigNumber, w: number, bits: number): number[]
|
|
@@ -3570,12 +3577,10 @@ export default class Curve {
|
|
|
3570
3577
|
b: BigNumber;
|
|
3571
3578
|
}>;
|
|
3572
3579
|
} | undefined
|
|
3573
|
-
;
|
|
3574
3580
|
_getEndoRoots(num: BigNumber): [
|
|
3575
3581
|
BigNumber,
|
|
3576
3582
|
BigNumber
|
|
3577
3583
|
]
|
|
3578
|
-
;
|
|
3579
3584
|
_getEndoBasis(lambda: BigNumber): [
|
|
3580
3585
|
{
|
|
3581
3586
|
a: BigNumber;
|
|
@@ -3591,11 +3596,10 @@ export default class Curve {
|
|
|
3591
3596
|
k2: BigNumber;
|
|
3592
3597
|
}
|
|
3593
3598
|
validate(point: Point): boolean
|
|
3594
|
-
;
|
|
3595
3599
|
}
|
|
3596
3600
|
```
|
|
3597
3601
|
|
|
3598
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point), [ReductionContext](#class-reductioncontext)
|
|
3602
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point), [ReductionContext](./primitives.md#class-reductioncontext)
|
|
3599
3603
|
|
|
3600
3604
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
3601
3605
|
|
|
@@ -3621,7 +3625,7 @@ export default class DRBG {
|
|
|
3621
3625
|
}
|
|
3622
3626
|
```
|
|
3623
3627
|
|
|
3624
|
-
See also: [SHA256HMAC](#class-sha256hmac)
|
|
3628
|
+
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
3625
3629
|
|
|
3626
3630
|
<details>
|
|
3627
3631
|
|
|
@@ -3658,7 +3662,7 @@ Generates HMAC using the K value of the instance. This method is used internally
|
|
|
3658
3662
|
```ts
|
|
3659
3663
|
hmac(): SHA256HMAC
|
|
3660
3664
|
```
|
|
3661
|
-
See also: [SHA256HMAC](#class-sha256hmac)
|
|
3665
|
+
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
3662
3666
|
|
|
3663
3667
|
Returns
|
|
3664
3668
|
|
|
@@ -3732,7 +3736,7 @@ export default class JacobianPoint extends BasePoint {
|
|
|
3732
3736
|
}
|
|
3733
3737
|
```
|
|
3734
3738
|
|
|
3735
|
-
See also: [BasePoint](#class-basepoint), [BigNumber](#class-bignumber), [Point](#class-point)
|
|
3739
|
+
See also: [BasePoint](./primitives.md#class-basepoint), [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
3736
3740
|
|
|
3737
3741
|
<details>
|
|
3738
3742
|
|
|
@@ -3745,7 +3749,7 @@ Constructs a new `JacobianPoint` instance.
|
|
|
3745
3749
|
```ts
|
|
3746
3750
|
constructor(x: string | BigNumber | null, y: string | BigNumber | null, z: string | BigNumber | null)
|
|
3747
3751
|
```
|
|
3748
|
-
See also: [BigNumber](#class-bignumber)
|
|
3752
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3749
3753
|
|
|
3750
3754
|
Argument Details
|
|
3751
3755
|
|
|
@@ -3773,7 +3777,7 @@ The `x` coordinate of the point in the Jacobian form.
|
|
|
3773
3777
|
```ts
|
|
3774
3778
|
x: BigNumber
|
|
3775
3779
|
```
|
|
3776
|
-
See also: [BigNumber](#class-bignumber)
|
|
3780
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3777
3781
|
|
|
3778
3782
|
#### Property y
|
|
3779
3783
|
|
|
@@ -3782,7 +3786,7 @@ The `y` coordinate of the point in the Jacobian form.
|
|
|
3782
3786
|
```ts
|
|
3783
3787
|
y: BigNumber
|
|
3784
3788
|
```
|
|
3785
|
-
See also: [BigNumber](#class-bignumber)
|
|
3789
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3786
3790
|
|
|
3787
3791
|
#### Property z
|
|
3788
3792
|
|
|
@@ -3791,7 +3795,7 @@ The `z` coordinate of the point in the Jacobian form.
|
|
|
3791
3795
|
```ts
|
|
3792
3796
|
z: BigNumber
|
|
3793
3797
|
```
|
|
3794
|
-
See also: [BigNumber](#class-bignumber)
|
|
3798
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3795
3799
|
|
|
3796
3800
|
#### Property zOne
|
|
3797
3801
|
|
|
@@ -3810,7 +3814,7 @@ when either one of the points is the point at infinity, it will return the other
|
|
|
3810
3814
|
```ts
|
|
3811
3815
|
add(p: JacobianPoint): JacobianPoint
|
|
3812
3816
|
```
|
|
3813
|
-
See also: [JacobianPoint](#class-jacobianpoint)
|
|
3817
|
+
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
3814
3818
|
|
|
3815
3819
|
Returns
|
|
3816
3820
|
|
|
@@ -3836,7 +3840,7 @@ Point doubling operation in the Jacobian coordinates. A special case is when the
|
|
|
3836
3840
|
```ts
|
|
3837
3841
|
dbl(): JacobianPoint
|
|
3838
3842
|
```
|
|
3839
|
-
See also: [JacobianPoint](#class-jacobianpoint)
|
|
3843
|
+
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
3840
3844
|
|
|
3841
3845
|
Returns
|
|
3842
3846
|
|
|
@@ -3856,7 +3860,7 @@ Multiple doubling operation. It doubles the Jacobian point as many times as the
|
|
|
3856
3860
|
```ts
|
|
3857
3861
|
dblp(pow: number): JacobianPoint
|
|
3858
3862
|
```
|
|
3859
|
-
See also: [JacobianPoint](#class-jacobianpoint)
|
|
3863
|
+
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
3860
3864
|
|
|
3861
3865
|
Returns
|
|
3862
3866
|
|
|
@@ -3881,7 +3885,7 @@ Equality check operation. It checks whether the affine or Jacobian point is equa
|
|
|
3881
3885
|
```ts
|
|
3882
3886
|
eq(p: Point | JacobianPoint): boolean
|
|
3883
3887
|
```
|
|
3884
|
-
See also: [JacobianPoint](#class-jacobianpoint), [Point](#class-point)
|
|
3888
|
+
See also: [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point)
|
|
3885
3889
|
|
|
3886
3890
|
Returns
|
|
3887
3891
|
|
|
@@ -3909,7 +3913,7 @@ of a point in projective coordinates.
|
|
|
3909
3913
|
```ts
|
|
3910
3914
|
eqXToP(x: BigNumber): boolean
|
|
3911
3915
|
```
|
|
3912
|
-
See also: [BigNumber](#class-bignumber)
|
|
3916
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
3913
3917
|
|
|
3914
3918
|
Returns
|
|
3915
3919
|
|
|
@@ -3974,7 +3978,7 @@ the affine point to Jacobian, and then preforms the addition.
|
|
|
3974
3978
|
```ts
|
|
3975
3979
|
mixedAdd(p: Point): JacobianPoint
|
|
3976
3980
|
```
|
|
3977
|
-
See also: [JacobianPoint](#class-jacobianpoint), [Point](#class-point)
|
|
3981
|
+
See also: [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point)
|
|
3978
3982
|
|
|
3979
3983
|
Returns
|
|
3980
3984
|
|
|
@@ -4000,7 +4004,7 @@ Negation operation. It returns the additive inverse of the Jacobian point.
|
|
|
4000
4004
|
```ts
|
|
4001
4005
|
neg(): JacobianPoint
|
|
4002
4006
|
```
|
|
4003
|
-
See also: [JacobianPoint](#class-jacobianpoint)
|
|
4007
|
+
See also: [JacobianPoint](./primitives.md#class-jacobianpoint)
|
|
4004
4008
|
|
|
4005
4009
|
Returns
|
|
4006
4010
|
|
|
@@ -4020,7 +4024,7 @@ Converts the `JacobianPoint` object instance to standard affine `Point` format a
|
|
|
4020
4024
|
```ts
|
|
4021
4025
|
toP(): Point
|
|
4022
4026
|
```
|
|
4023
|
-
See also: [Point](#class-point)
|
|
4027
|
+
See also: [Point](./primitives.md#class-point)
|
|
4024
4028
|
|
|
4025
4029
|
Returns
|
|
4026
4030
|
|
|
@@ -4060,7 +4064,7 @@ export default class K256 extends Mersenne {
|
|
|
4060
4064
|
}
|
|
4061
4065
|
```
|
|
4062
4066
|
|
|
4063
|
-
See also: [BigNumber](#class-bignumber), [Mersenne](#class-mersenne)
|
|
4067
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Mersenne](./primitives.md#class-mersenne)
|
|
4064
4068
|
|
|
4065
4069
|
<details>
|
|
4066
4070
|
|
|
@@ -4089,7 +4093,7 @@ Multiplies a BigNumber ('num') with the constant 'K' in-place and returns the re
|
|
|
4089
4093
|
```ts
|
|
4090
4094
|
imulK(num: BigNumber): BigNumber
|
|
4091
4095
|
```
|
|
4092
|
-
See also: [BigNumber](#class-bignumber)
|
|
4096
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4093
4097
|
|
|
4094
4098
|
Returns
|
|
4095
4099
|
|
|
@@ -4115,7 +4119,7 @@ rules. This method modifies the input and output big numbers.
|
|
|
4115
4119
|
```ts
|
|
4116
4120
|
split(input: BigNumber, output: BigNumber): void
|
|
4117
4121
|
```
|
|
4118
|
-
See also: [BigNumber](#class-bignumber)
|
|
4122
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4119
4123
|
|
|
4120
4124
|
Argument Details
|
|
4121
4125
|
|
|
@@ -4152,11 +4156,11 @@ export class KeyShares {
|
|
|
4152
4156
|
integrity: string;
|
|
4153
4157
|
constructor(points: PointInFiniteField[], threshold: number, integrity: string)
|
|
4154
4158
|
static fromBackupFormat(shares: string[]): KeyShares
|
|
4155
|
-
toBackupFormat()
|
|
4159
|
+
toBackupFormat(): string[]
|
|
4156
4160
|
}
|
|
4157
4161
|
```
|
|
4158
4162
|
|
|
4159
|
-
See also: [PointInFiniteField](#class-pointinfinitefield)
|
|
4163
|
+
See also: [PointInFiniteField](./primitives.md#class-pointinfinitefield)
|
|
4160
4164
|
|
|
4161
4165
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
4162
4166
|
|
|
@@ -4179,7 +4183,7 @@ export default class Mersenne {
|
|
|
4179
4183
|
}
|
|
4180
4184
|
```
|
|
4181
4185
|
|
|
4182
|
-
See also: [BigNumber](#class-bignumber)
|
|
4186
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4183
4187
|
|
|
4184
4188
|
<details>
|
|
4185
4189
|
|
|
@@ -4211,7 +4215,7 @@ The constant subtracted from 2^n to derive a pseudo-Mersenne prime.
|
|
|
4211
4215
|
```ts
|
|
4212
4216
|
k: BigNumber
|
|
4213
4217
|
```
|
|
4214
|
-
See also: [BigNumber](#class-bignumber)
|
|
4218
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4215
4219
|
|
|
4216
4220
|
#### Property n
|
|
4217
4221
|
|
|
@@ -4236,7 +4240,7 @@ BigNumber equivalent to 2^n - k.
|
|
|
4236
4240
|
```ts
|
|
4237
4241
|
p: BigNumber
|
|
4238
4242
|
```
|
|
4239
|
-
See also: [BigNumber](#class-bignumber)
|
|
4243
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4240
4244
|
|
|
4241
4245
|
#### Method imulK
|
|
4242
4246
|
|
|
@@ -4245,7 +4249,7 @@ Performs an in-place multiplication of the parameter by constant k.
|
|
|
4245
4249
|
```ts
|
|
4246
4250
|
imulK(num: BigNumber): BigNumber
|
|
4247
4251
|
```
|
|
4248
|
-
See also: [BigNumber](#class-bignumber)
|
|
4252
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4249
4253
|
|
|
4250
4254
|
Returns
|
|
4251
4255
|
|
|
@@ -4270,7 +4274,7 @@ it is less than the square of the pseudo-Mersenne prime.
|
|
|
4270
4274
|
```ts
|
|
4271
4275
|
ireduce(num: BigNumber): BigNumber
|
|
4272
4276
|
```
|
|
4273
|
-
See also: [BigNumber](#class-bignumber)
|
|
4277
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4274
4278
|
|
|
4275
4279
|
Returns
|
|
4276
4280
|
|
|
@@ -4295,7 +4299,7 @@ to meet the magnitude of the pseudo-Mersenne prime.
|
|
|
4295
4299
|
```ts
|
|
4296
4300
|
split(input: BigNumber, out: BigNumber): void
|
|
4297
4301
|
```
|
|
4298
|
-
See also: [BigNumber](#class-bignumber)
|
|
4302
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4299
4303
|
|
|
4300
4304
|
Argument Details
|
|
4301
4305
|
|
|
@@ -4342,7 +4346,7 @@ export default class MontgomoryMethod extends ReductionContext {
|
|
|
4342
4346
|
}
|
|
4343
4347
|
```
|
|
4344
4348
|
|
|
4345
|
-
See also: [BigNumber](#class-bignumber), [ReductionContext](#class-reductioncontext)
|
|
4349
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [ReductionContext](./primitives.md#class-reductioncontext)
|
|
4346
4350
|
|
|
4347
4351
|
<details>
|
|
4348
4352
|
|
|
@@ -4353,7 +4357,7 @@ See also: [BigNumber](#class-bignumber), [ReductionContext](#class-reductioncont
|
|
|
4353
4357
|
```ts
|
|
4354
4358
|
constructor(m: BigNumber | "k256")
|
|
4355
4359
|
```
|
|
4356
|
-
See also: [BigNumber](#class-bignumber)
|
|
4360
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4357
4361
|
|
|
4358
4362
|
Argument Details
|
|
4359
4363
|
|
|
@@ -4367,7 +4371,7 @@ The modular multiplicative inverse of `m` mod `r`.
|
|
|
4367
4371
|
```ts
|
|
4368
4372
|
minv: BigNumber
|
|
4369
4373
|
```
|
|
4370
|
-
See also: [BigNumber](#class-bignumber)
|
|
4374
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4371
4375
|
|
|
4372
4376
|
#### Property r
|
|
4373
4377
|
|
|
@@ -4376,7 +4380,7 @@ The 2^shift, shifted left by the bit length of modulus `m`.
|
|
|
4376
4380
|
```ts
|
|
4377
4381
|
r: BigNumber
|
|
4378
4382
|
```
|
|
4379
|
-
See also: [BigNumber](#class-bignumber)
|
|
4383
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4380
4384
|
|
|
4381
4385
|
#### Property r2
|
|
4382
4386
|
|
|
@@ -4385,7 +4389,7 @@ The square of `r` modulo `m`.
|
|
|
4385
4389
|
```ts
|
|
4386
4390
|
r2: BigNumber
|
|
4387
4391
|
```
|
|
4388
|
-
See also: [BigNumber](#class-bignumber)
|
|
4392
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4389
4393
|
|
|
4390
4394
|
#### Property rinv
|
|
4391
4395
|
|
|
@@ -4394,7 +4398,7 @@ The modular multiplicative inverse of `r` mod `m`.
|
|
|
4394
4398
|
```ts
|
|
4395
4399
|
rinv: BigNumber
|
|
4396
4400
|
```
|
|
4397
|
-
See also: [BigNumber](#class-bignumber)
|
|
4401
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4398
4402
|
|
|
4399
4403
|
#### Property shift
|
|
4400
4404
|
|
|
@@ -4411,7 +4415,7 @@ Converts a number from the Montgomery domain back to the original domain.
|
|
|
4411
4415
|
```ts
|
|
4412
4416
|
convertFrom(num: BigNumber): BigNumber
|
|
4413
4417
|
```
|
|
4414
|
-
See also: [BigNumber](#class-bignumber)
|
|
4418
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4415
4419
|
|
|
4416
4420
|
Returns
|
|
4417
4421
|
|
|
@@ -4436,7 +4440,7 @@ Converts a number into the Montgomery domain.
|
|
|
4436
4440
|
```ts
|
|
4437
4441
|
convertTo(num: BigNumber): BigNumber
|
|
4438
4442
|
```
|
|
4439
|
-
See also: [BigNumber](#class-bignumber)
|
|
4443
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4440
4444
|
|
|
4441
4445
|
Returns
|
|
4442
4446
|
|
|
@@ -4461,7 +4465,7 @@ Performs an in-place multiplication of two numbers in the Montgomery domain.
|
|
|
4461
4465
|
```ts
|
|
4462
4466
|
imul(a: BigNumber, b: BigNumber): BigNumber
|
|
4463
4467
|
```
|
|
4464
|
-
See also: [BigNumber](#class-bignumber)
|
|
4468
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4465
4469
|
|
|
4466
4470
|
Returns
|
|
4467
4471
|
|
|
@@ -4488,7 +4492,7 @@ Calculates the modular multiplicative inverse of a number in the Montgomery doma
|
|
|
4488
4492
|
```ts
|
|
4489
4493
|
invm(a: BigNumber): BigNumber
|
|
4490
4494
|
```
|
|
4491
|
-
See also: [BigNumber](#class-bignumber)
|
|
4495
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4492
4496
|
|
|
4493
4497
|
Returns
|
|
4494
4498
|
|
|
@@ -4513,7 +4517,7 @@ Performs the multiplication of two numbers in the Montgomery domain.
|
|
|
4513
4517
|
```ts
|
|
4514
4518
|
mul(a: BigNumber, b: BigNumber): BigNumber
|
|
4515
4519
|
```
|
|
4516
|
-
See also: [BigNumber](#class-bignumber)
|
|
4520
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4517
4521
|
|
|
4518
4522
|
Returns
|
|
4519
4523
|
|
|
@@ -4585,12 +4589,10 @@ export default class Point extends BasePoint {
|
|
|
4585
4589
|
neg(_precompute?: boolean): Point
|
|
4586
4590
|
dblp(k: number): Point
|
|
4587
4591
|
toJ(): JPoint
|
|
4588
|
-
;
|
|
4589
|
-
;
|
|
4590
4592
|
}
|
|
4591
4593
|
```
|
|
4592
4594
|
|
|
4593
|
-
See also: [BasePoint](#class-basepoint), [BigNumber](#class-bignumber), [encode](#variable-encode)
|
|
4595
|
+
See also: [BasePoint](./primitives.md#class-basepoint), [BigNumber](./primitives.md#class-bignumber), [encode](./primitives.md#variable-encode)
|
|
4594
4596
|
|
|
4595
4597
|
<details>
|
|
4596
4598
|
|
|
@@ -4601,7 +4603,7 @@ See also: [BasePoint](#class-basepoint), [BigNumber](#class-bignumber), [encode]
|
|
|
4601
4603
|
```ts
|
|
4602
4604
|
constructor(x: BigNumber | number | number[] | string | null, y: BigNumber | number | number[] | string | null, isRed: boolean = true)
|
|
4603
4605
|
```
|
|
4604
|
-
See also: [BigNumber](#class-bignumber)
|
|
4606
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4605
4607
|
|
|
4606
4608
|
Argument Details
|
|
4607
4609
|
|
|
@@ -4634,7 +4636,7 @@ The x-coordinate of the point.
|
|
|
4634
4636
|
```ts
|
|
4635
4637
|
x: BigNumber | null
|
|
4636
4638
|
```
|
|
4637
|
-
See also: [BigNumber](#class-bignumber)
|
|
4639
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4638
4640
|
|
|
4639
4641
|
#### Property y
|
|
4640
4642
|
|
|
@@ -4643,7 +4645,7 @@ The y-coordinate of the point.
|
|
|
4643
4645
|
```ts
|
|
4644
4646
|
y: BigNumber | null
|
|
4645
4647
|
```
|
|
4646
|
-
See also: [BigNumber](#class-bignumber)
|
|
4648
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4647
4649
|
|
|
4648
4650
|
#### Method add
|
|
4649
4651
|
|
|
@@ -4652,7 +4654,7 @@ Adds another Point to this Point, returning a new Point.
|
|
|
4652
4654
|
```ts
|
|
4653
4655
|
add(p: Point): Point
|
|
4654
4656
|
```
|
|
4655
|
-
See also: [Point](#class-point)
|
|
4657
|
+
See also: [Point](./primitives.md#class-point)
|
|
4656
4658
|
|
|
4657
4659
|
Returns
|
|
4658
4660
|
|
|
@@ -4678,7 +4680,7 @@ Doubles the current point.
|
|
|
4678
4680
|
```ts
|
|
4679
4681
|
dbl(): Point
|
|
4680
4682
|
```
|
|
4681
|
-
See also: [Point](#class-point)
|
|
4683
|
+
See also: [Point](./primitives.md#class-point)
|
|
4682
4684
|
|
|
4683
4685
|
Example
|
|
4684
4686
|
|
|
@@ -4697,7 +4699,7 @@ a point at infinity is still infinity.
|
|
|
4697
4699
|
```ts
|
|
4698
4700
|
dblp(k: number): Point
|
|
4699
4701
|
```
|
|
4700
|
-
See also: [Point](#class-point)
|
|
4702
|
+
See also: [Point](./primitives.md#class-point)
|
|
4701
4703
|
|
|
4702
4704
|
Returns
|
|
4703
4705
|
|
|
@@ -4754,7 +4756,7 @@ Checks if the Point instance is equal to another given Point.
|
|
|
4754
4756
|
```ts
|
|
4755
4757
|
eq(p: Point): boolean
|
|
4756
4758
|
```
|
|
4757
|
-
See also: [Point](#class-point)
|
|
4759
|
+
See also: [Point](./primitives.md#class-point)
|
|
4758
4760
|
|
|
4759
4761
|
Returns
|
|
4760
4762
|
|
|
@@ -4782,7 +4784,7 @@ The function verifies the integrity of the provided data and throws errors if in
|
|
|
4782
4784
|
```ts
|
|
4783
4785
|
static fromDER(bytes: number[]): Point
|
|
4784
4786
|
```
|
|
4785
|
-
See also: [Point](#class-point)
|
|
4787
|
+
See also: [Point](./primitives.md#class-point)
|
|
4786
4788
|
|
|
4787
4789
|
Returns
|
|
4788
4790
|
|
|
@@ -4815,7 +4817,7 @@ JSON points into proper Point objects.
|
|
|
4815
4817
|
```ts
|
|
4816
4818
|
static fromJSON(obj: string | any[], isRed: boolean): Point
|
|
4817
4819
|
```
|
|
4818
|
-
See also: [Point](#class-point)
|
|
4820
|
+
See also: [Point](./primitives.md#class-point)
|
|
4819
4821
|
|
|
4820
4822
|
Returns
|
|
4821
4823
|
|
|
@@ -4844,7 +4846,7 @@ The function verifies the integrity of the provided data and throws errors if in
|
|
|
4844
4846
|
```ts
|
|
4845
4847
|
static fromString(str: string): Point
|
|
4846
4848
|
```
|
|
4847
|
-
See also: [Point](#class-point)
|
|
4849
|
+
See also: [Point](./primitives.md#class-point)
|
|
4848
4850
|
|
|
4849
4851
|
Returns
|
|
4850
4852
|
|
|
@@ -4876,7 +4878,7 @@ y coordinate is odd.
|
|
|
4876
4878
|
```ts
|
|
4877
4879
|
static fromX(x: BigNumber | number | number[] | string, odd: boolean): Point
|
|
4878
4880
|
```
|
|
4879
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point)
|
|
4881
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
4880
4882
|
|
|
4881
4883
|
Returns
|
|
4882
4884
|
|
|
@@ -4907,7 +4909,7 @@ Returns X coordinate of point
|
|
|
4907
4909
|
```ts
|
|
4908
4910
|
getX(): BigNumber
|
|
4909
4911
|
```
|
|
4910
|
-
See also: [BigNumber](#class-bignumber)
|
|
4912
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4911
4913
|
|
|
4912
4914
|
Example
|
|
4913
4915
|
|
|
@@ -4923,7 +4925,7 @@ Returns X coordinate of point
|
|
|
4923
4925
|
```ts
|
|
4924
4926
|
getY(): BigNumber
|
|
4925
4927
|
```
|
|
4926
|
-
See also: [BigNumber](#class-bignumber)
|
|
4928
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
4927
4929
|
|
|
4928
4930
|
Example
|
|
4929
4931
|
|
|
@@ -4978,7 +4980,7 @@ step. Instead of returning a regular Point, the result is a JacobianPoint.
|
|
|
4978
4980
|
```ts
|
|
4979
4981
|
jmulAdd(k1: BigNumber, p2: Point, k2: BigNumber): JPoint
|
|
4980
4982
|
```
|
|
4981
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point)
|
|
4983
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
4982
4984
|
|
|
4983
4985
|
Returns
|
|
4984
4986
|
|
|
@@ -5008,7 +5010,7 @@ Multiplies this Point by a scalar value, returning a new Point.
|
|
|
5008
5010
|
```ts
|
|
5009
5011
|
mul(k: BigNumber | number | number[] | string): Point
|
|
5010
5012
|
```
|
|
5011
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point)
|
|
5013
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
5012
5014
|
|
|
5013
5015
|
Returns
|
|
5014
5016
|
|
|
@@ -5034,7 +5036,7 @@ Multiplies this Point by k1, adds the resulting Point to the result of p2 multip
|
|
|
5034
5036
|
```ts
|
|
5035
5037
|
mulAdd(k1: BigNumber, p2: Point, k2: BigNumber): Point
|
|
5036
5038
|
```
|
|
5037
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point)
|
|
5039
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
5038
5040
|
|
|
5039
5041
|
Returns
|
|
5040
5042
|
|
|
@@ -5064,7 +5066,7 @@ Negate a point. The negation of a point P is the mirror of P about x-axis.
|
|
|
5064
5066
|
```ts
|
|
5065
5067
|
neg(_precompute?: boolean): Point
|
|
5066
5068
|
```
|
|
5067
|
-
See also: [Point](#class-point)
|
|
5069
|
+
See also: [Point](./primitives.md#class-point)
|
|
5068
5070
|
|
|
5069
5071
|
Example
|
|
5070
5072
|
|
|
@@ -5113,7 +5115,7 @@ toJSON(): [
|
|
|
5113
5115
|
}?
|
|
5114
5116
|
]
|
|
5115
5117
|
```
|
|
5116
|
-
See also: [BigNumber](#class-bignumber)
|
|
5118
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
5117
5119
|
|
|
5118
5120
|
Returns
|
|
5119
5121
|
|
|
@@ -5185,7 +5187,7 @@ export class PointInFiniteField {
|
|
|
5185
5187
|
}
|
|
5186
5188
|
```
|
|
5187
5189
|
|
|
5188
|
-
See also: [BigNumber](#class-bignumber)
|
|
5190
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
5189
5191
|
|
|
5190
5192
|
<details>
|
|
5191
5193
|
|
|
@@ -5229,7 +5231,7 @@ export default class Polynomial {
|
|
|
5229
5231
|
}
|
|
5230
5232
|
```
|
|
5231
5233
|
|
|
5232
|
-
See also: [BigNumber](#class-bignumber), [PointInFiniteField](#class-pointinfinitefield), [PrivateKey](#class-privatekey)
|
|
5234
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [PointInFiniteField](./primitives.md#class-pointinfinitefield), [PrivateKey](./primitives.md#class-privatekey)
|
|
5233
5235
|
|
|
5234
5236
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
5235
5237
|
|
|
@@ -5253,7 +5255,7 @@ export default class PrivateKey extends BigNumber {
|
|
|
5253
5255
|
modN: BigNumber;
|
|
5254
5256
|
}
|
|
5255
5257
|
isValid(): boolean
|
|
5256
|
-
sign(msg: number[] | string, enc?: "hex" | "utf8", forceLowS: boolean = true, customK?:
|
|
5258
|
+
sign(msg: number[] | string, enc?: "hex" | "utf8", forceLowS: boolean = true, customK?: ((iter: number) => BigNumber) | BigNumber): Signature
|
|
5257
5259
|
verify(msg: number[] | string, sig: Signature, enc?: "hex"): boolean
|
|
5258
5260
|
toPublicKey(): PublicKey
|
|
5259
5261
|
toWif(prefix: number[] = [128]): string
|
|
@@ -5269,7 +5271,7 @@ export default class PrivateKey extends BigNumber {
|
|
|
5269
5271
|
}
|
|
5270
5272
|
```
|
|
5271
5273
|
|
|
5272
|
-
See also: [BigNumber](#class-bignumber), [KeyShares](#class-keyshares), [Point](#class-point), [PublicKey](#class-publickey), [Signature](#class-signature), [sign](#variable-sign), [toHex](#variable-tohex), [verify](#variable-verify)
|
|
5274
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [KeyShares](./primitives.md#class-keyshares), [Point](./primitives.md#class-point), [PublicKey](./primitives.md#class-publickey), [Signature](./primitives.md#class-signature), [sign](./compat.md#variable-sign), [toHex](./primitives.md#variable-tohex), [verify](./compat.md#variable-verify)
|
|
5273
5275
|
|
|
5274
5276
|
<details>
|
|
5275
5277
|
|
|
@@ -5280,7 +5282,7 @@ See also: [BigNumber](#class-bignumber), [KeyShares](#class-keyshares), [Point](
|
|
|
5280
5282
|
```ts
|
|
5281
5283
|
constructor(number: BigNumber | number | string | number[] = 0, base: number | "be" | "le" | "hex" = 10, endian: "be" | "le" = "be", modN: "apply" | "nocheck" | "error" = "apply")
|
|
5282
5284
|
```
|
|
5283
|
-
See also: [BigNumber](#class-bignumber)
|
|
5285
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
5284
5286
|
|
|
5285
5287
|
Argument Details
|
|
5286
5288
|
|
|
@@ -5291,7 +5293,7 @@ Argument Details
|
|
|
5291
5293
|
+ **endian**
|
|
5292
5294
|
+ The endianness provided. By default is 'big endian'. Ignored if number is BigNumber.
|
|
5293
5295
|
+ **modN**
|
|
5294
|
-
+ Optional. Default 'apply. If 'apply', apply modN to input to guarantee a valid PrivateKey. If 'error', if input is out of field throw Error('Input is out of field'). If 'nocheck', assumes input is in field.
|
|
5296
|
+
+ 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.
|
|
5295
5297
|
|
|
5296
5298
|
Example
|
|
5297
5299
|
|
|
@@ -5311,7 +5313,7 @@ checkInField(): {
|
|
|
5311
5313
|
modN: BigNumber;
|
|
5312
5314
|
}
|
|
5313
5315
|
```
|
|
5314
|
-
See also: [BigNumber](#class-bignumber)
|
|
5316
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
5315
5317
|
|
|
5316
5318
|
Returns
|
|
5317
5319
|
|
|
@@ -5324,7 +5326,7 @@ Derives a child key with BRC-42.
|
|
|
5324
5326
|
```ts
|
|
5325
5327
|
deriveChild(publicKey: PublicKey, invoiceNumber: string): PrivateKey
|
|
5326
5328
|
```
|
|
5327
|
-
See also: [PrivateKey](#class-privatekey), [PublicKey](#class-publickey)
|
|
5329
|
+
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
5328
5330
|
|
|
5329
5331
|
Returns
|
|
5330
5332
|
|
|
@@ -5344,7 +5346,7 @@ Derives a shared secret from the public key.
|
|
|
5344
5346
|
```ts
|
|
5345
5347
|
deriveSharedSecret(key: PublicKey): Point
|
|
5346
5348
|
```
|
|
5347
|
-
See also: [Point](#class-point), [PublicKey](#class-publickey)
|
|
5349
|
+
See also: [Point](./primitives.md#class-point), [PublicKey](./primitives.md#class-publickey)
|
|
5348
5350
|
|
|
5349
5351
|
Returns
|
|
5350
5352
|
|
|
@@ -5372,7 +5374,7 @@ const sharedSecret = privateKey.deriveSharedSecret(publicKey);
|
|
|
5372
5374
|
```ts
|
|
5373
5375
|
static fromBackupShares(shares: string[]): PrivateKey
|
|
5374
5376
|
```
|
|
5375
|
-
See also: [PrivateKey](#class-privatekey)
|
|
5377
|
+
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
5376
5378
|
|
|
5377
5379
|
Returns
|
|
5378
5380
|
|
|
@@ -5394,7 +5396,7 @@ Generates a private key from a hexadecimal string.
|
|
|
5394
5396
|
```ts
|
|
5395
5397
|
static fromHex(str: string): PrivateKey
|
|
5396
5398
|
```
|
|
5397
|
-
See also: [PrivateKey](#class-privatekey)
|
|
5399
|
+
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
5398
5400
|
|
|
5399
5401
|
Returns
|
|
5400
5402
|
|
|
@@ -5416,7 +5418,7 @@ Combines shares to reconstruct the private key.
|
|
|
5416
5418
|
```ts
|
|
5417
5419
|
static fromKeyShares(keyShares: KeyShares): PrivateKey
|
|
5418
5420
|
```
|
|
5419
|
-
See also: [KeyShares](#class-keyshares), [PrivateKey](#class-privatekey)
|
|
5421
|
+
See also: [KeyShares](./primitives.md#class-keyshares), [PrivateKey](./primitives.md#class-privatekey)
|
|
5420
5422
|
|
|
5421
5423
|
Returns
|
|
5422
5424
|
|
|
@@ -5436,7 +5438,7 @@ Generates a private key randomly.
|
|
|
5436
5438
|
```ts
|
|
5437
5439
|
static fromRandom(): PrivateKey
|
|
5438
5440
|
```
|
|
5439
|
-
See also: [PrivateKey](#class-privatekey)
|
|
5441
|
+
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
5440
5442
|
|
|
5441
5443
|
Returns
|
|
5442
5444
|
|
|
@@ -5455,7 +5457,7 @@ Generates a private key from a string.
|
|
|
5455
5457
|
```ts
|
|
5456
5458
|
static fromString(str: string, base: number | "hex" = "hex"): PrivateKey
|
|
5457
5459
|
```
|
|
5458
|
-
See also: [PrivateKey](#class-privatekey)
|
|
5460
|
+
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
5459
5461
|
|
|
5460
5462
|
Returns
|
|
5461
5463
|
|
|
@@ -5479,7 +5481,7 @@ Generates a private key from a WIF (Wallet Import Format) string.
|
|
|
5479
5481
|
```ts
|
|
5480
5482
|
static fromWif(wif: string, prefixLength: number = 1): PrivateKey
|
|
5481
5483
|
```
|
|
5482
|
-
See also: [PrivateKey](#class-privatekey)
|
|
5484
|
+
See also: [PrivateKey](./primitives.md#class-privatekey)
|
|
5483
5485
|
|
|
5484
5486
|
Returns
|
|
5485
5487
|
|
|
@@ -5511,9 +5513,9 @@ true if the PrivateKey's current BigNumber value lies in the field limited by cu
|
|
|
5511
5513
|
Signs a message using the private key.
|
|
5512
5514
|
|
|
5513
5515
|
```ts
|
|
5514
|
-
sign(msg: number[] | string, enc?: "hex" | "utf8", forceLowS: boolean = true, customK?:
|
|
5516
|
+
sign(msg: number[] | string, enc?: "hex" | "utf8", forceLowS: boolean = true, customK?: ((iter: number) => BigNumber) | BigNumber): Signature
|
|
5515
5517
|
```
|
|
5516
|
-
See also: [BigNumber](#class-bignumber), [Signature](#class-signature)
|
|
5518
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Signature](./primitives.md#class-signature)
|
|
5517
5519
|
|
|
5518
5520
|
Returns
|
|
5519
5521
|
|
|
@@ -5608,7 +5610,7 @@ Splits the private key into shares using Shamir's Secret Sharing Scheme.
|
|
|
5608
5610
|
```ts
|
|
5609
5611
|
toKeyShares(threshold: number, totalShares: number): KeyShares
|
|
5610
5612
|
```
|
|
5611
|
-
See also: [KeyShares](#class-keyshares)
|
|
5613
|
+
See also: [KeyShares](./primitives.md#class-keyshares)
|
|
5612
5614
|
|
|
5613
5615
|
Returns
|
|
5614
5616
|
|
|
@@ -5639,7 +5641,7 @@ The public key is generated by multiplying the base point G of the curve and the
|
|
|
5639
5641
|
```ts
|
|
5640
5642
|
toPublicKey(): PublicKey
|
|
5641
5643
|
```
|
|
5642
|
-
See also: [PublicKey](#class-publickey)
|
|
5644
|
+
See also: [PublicKey](./primitives.md#class-publickey)
|
|
5643
5645
|
|
|
5644
5646
|
Returns
|
|
5645
5647
|
|
|
@@ -5712,7 +5714,7 @@ Verifies a message's signature using the public key associated with this private
|
|
|
5712
5714
|
```ts
|
|
5713
5715
|
verify(msg: number[] | string, sig: Signature, enc?: "hex"): boolean
|
|
5714
5716
|
```
|
|
5715
|
-
See also: [Signature](#class-signature)
|
|
5717
|
+
See also: [Signature](./primitives.md#class-signature)
|
|
5716
5718
|
|
|
5717
5719
|
Returns
|
|
5718
5720
|
|
|
@@ -5761,7 +5763,7 @@ export default class PublicKey extends Point {
|
|
|
5761
5763
|
}
|
|
5762
5764
|
```
|
|
5763
5765
|
|
|
5764
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point), [PrivateKey](#class-privatekey), [Signature](#class-signature), [verify](#variable-verify)
|
|
5766
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [Signature](./primitives.md#class-signature), [verify](./compat.md#variable-verify)
|
|
5765
5767
|
|
|
5766
5768
|
<details>
|
|
5767
5769
|
|
|
@@ -5772,7 +5774,7 @@ See also: [BigNumber](#class-bignumber), [Point](#class-point), [PrivateKey](#cl
|
|
|
5772
5774
|
```ts
|
|
5773
5775
|
constructor(x: Point | BigNumber | number | number[] | string | null, y: BigNumber | number | number[] | string | null = null, isRed: boolean = true)
|
|
5774
5776
|
```
|
|
5775
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point)
|
|
5777
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
5776
5778
|
|
|
5777
5779
|
Argument Details
|
|
5778
5780
|
|
|
@@ -5797,7 +5799,7 @@ Derives a child key with BRC-42.
|
|
|
5797
5799
|
```ts
|
|
5798
5800
|
deriveChild(privateKey: PrivateKey, invoiceNumber: string): PublicKey
|
|
5799
5801
|
```
|
|
5800
|
-
See also: [PrivateKey](#class-privatekey), [PublicKey](#class-publickey)
|
|
5802
|
+
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
5801
5803
|
|
|
5802
5804
|
Returns
|
|
5803
5805
|
|
|
@@ -5818,7 +5820,7 @@ This method multiplies the public key (an instance of Point) with a private key.
|
|
|
5818
5820
|
```ts
|
|
5819
5821
|
deriveSharedSecret(priv: PrivateKey): Point
|
|
5820
5822
|
```
|
|
5821
|
-
See also: [Point](#class-point), [PrivateKey](#class-privatekey)
|
|
5823
|
+
See also: [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey)
|
|
5822
5824
|
|
|
5823
5825
|
Returns
|
|
5824
5826
|
|
|
@@ -5847,7 +5849,7 @@ Static factory method to create a PublicKey instance from a number array.
|
|
|
5847
5849
|
```ts
|
|
5848
5850
|
static fromDER(bytes: number[]): PublicKey
|
|
5849
5851
|
```
|
|
5850
|
-
See also: [PublicKey](#class-publickey)
|
|
5852
|
+
See also: [PublicKey](./primitives.md#class-publickey)
|
|
5851
5853
|
|
|
5852
5854
|
Returns
|
|
5853
5855
|
|
|
@@ -5876,7 +5878,7 @@ The range represents the recovery param which can be 0,1,2,3.
|
|
|
5876
5878
|
```ts
|
|
5877
5879
|
static fromMsgHashAndCompactSignature(msgHash: BigNumber, signature: number[] | string, enc?: "hex" | "base64"): PublicKey
|
|
5878
5880
|
```
|
|
5879
|
-
See also: [BigNumber](#class-bignumber), [PublicKey](#class-publickey)
|
|
5881
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
5880
5882
|
|
|
5881
5883
|
Returns
|
|
5882
5884
|
|
|
@@ -5905,7 +5907,7 @@ It multiplies the generator point 'g' on the elliptic curve by the private key.
|
|
|
5905
5907
|
```ts
|
|
5906
5908
|
static fromPrivateKey(key: PrivateKey): PublicKey
|
|
5907
5909
|
```
|
|
5908
|
-
See also: [PrivateKey](#class-privatekey), [PublicKey](#class-publickey)
|
|
5910
|
+
See also: [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
5909
5911
|
|
|
5910
5912
|
Returns
|
|
5911
5913
|
|
|
@@ -5930,7 +5932,7 @@ Static factory method to create a PublicKey instance from a string.
|
|
|
5930
5932
|
```ts
|
|
5931
5933
|
static fromString(str: string): PublicKey
|
|
5932
5934
|
```
|
|
5933
|
-
See also: [PublicKey](#class-publickey)
|
|
5935
|
+
See also: [PublicKey](./primitives.md#class-publickey)
|
|
5934
5936
|
|
|
5935
5937
|
Returns
|
|
5936
5938
|
|
|
@@ -6022,7 +6024,7 @@ Verify a signature of a message using this public key.
|
|
|
6022
6024
|
```ts
|
|
6023
6025
|
verify(msg: number[] | string, sig: Signature, enc?: "hex" | "utf8"): boolean
|
|
6024
6026
|
```
|
|
6025
|
-
See also: [Signature](#class-signature)
|
|
6027
|
+
See also: [Signature](./primitives.md#class-signature)
|
|
6026
6028
|
|
|
6027
6029
|
Returns
|
|
6028
6030
|
|
|
@@ -6118,7 +6120,7 @@ export class Reader {
|
|
|
6118
6120
|
}
|
|
6119
6121
|
```
|
|
6120
6122
|
|
|
6121
|
-
See also: [BigNumber](#class-bignumber)
|
|
6123
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6122
6124
|
|
|
6123
6125
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
6124
6126
|
|
|
@@ -6155,7 +6157,7 @@ export default class ReductionContext {
|
|
|
6155
6157
|
}
|
|
6156
6158
|
```
|
|
6157
6159
|
|
|
6158
|
-
See also: [BigNumber](#class-bignumber), [Mersenne](#class-mersenne)
|
|
6160
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Mersenne](./primitives.md#class-mersenne)
|
|
6159
6161
|
|
|
6160
6162
|
<details>
|
|
6161
6163
|
|
|
@@ -6168,7 +6170,7 @@ Constructs a new ReductionContext.
|
|
|
6168
6170
|
```ts
|
|
6169
6171
|
constructor(m: BigNumber | "k256")
|
|
6170
6172
|
```
|
|
6171
|
-
See also: [BigNumber](#class-bignumber)
|
|
6173
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6172
6174
|
|
|
6173
6175
|
Argument Details
|
|
6174
6176
|
|
|
@@ -6189,7 +6191,7 @@ The modulus used for reduction operations.
|
|
|
6189
6191
|
```ts
|
|
6190
6192
|
m: BigNumber
|
|
6191
6193
|
```
|
|
6192
|
-
See also: [BigNumber](#class-bignumber)
|
|
6194
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6193
6195
|
|
|
6194
6196
|
#### Property prime
|
|
6195
6197
|
|
|
@@ -6198,7 +6200,7 @@ The prime number utilised in the reduction context, typically an instance of Mer
|
|
|
6198
6200
|
```ts
|
|
6199
6201
|
prime: Mersenne | null
|
|
6200
6202
|
```
|
|
6201
|
-
See also: [Mersenne](#class-mersenne)
|
|
6203
|
+
See also: [Mersenne](./primitives.md#class-mersenne)
|
|
6202
6204
|
|
|
6203
6205
|
#### Method add
|
|
6204
6206
|
|
|
@@ -6207,7 +6209,7 @@ Performs the addition operation on two BigNumbers in the reduction context.
|
|
|
6207
6209
|
```ts
|
|
6208
6210
|
add(a: BigNumber, b: BigNumber): BigNumber
|
|
6209
6211
|
```
|
|
6210
|
-
See also: [BigNumber](#class-bignumber)
|
|
6212
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6211
6213
|
|
|
6212
6214
|
Returns
|
|
6213
6215
|
|
|
@@ -6234,7 +6236,7 @@ Converts a BigNumber from reduction context to its regular form.
|
|
|
6234
6236
|
```ts
|
|
6235
6237
|
convertFrom(num: BigNumber): BigNumber
|
|
6236
6238
|
```
|
|
6237
|
-
See also: [BigNumber](#class-bignumber)
|
|
6239
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6238
6240
|
|
|
6239
6241
|
Returns
|
|
6240
6242
|
|
|
@@ -6260,7 +6262,7 @@ Converts a BigNumber to its equivalent in the reduction context.
|
|
|
6260
6262
|
```ts
|
|
6261
6263
|
convertTo(num: BigNumber): BigNumber
|
|
6262
6264
|
```
|
|
6263
|
-
See also: [BigNumber](#class-bignumber)
|
|
6265
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6264
6266
|
|
|
6265
6267
|
Returns
|
|
6266
6268
|
|
|
@@ -6286,7 +6288,7 @@ in order to avoid creating a new BigNumber, it modifies the first one with the r
|
|
|
6286
6288
|
```ts
|
|
6287
6289
|
iadd(a: BigNumber, b: BigNumber): BigNumber
|
|
6288
6290
|
```
|
|
6289
|
-
See also: [BigNumber](#class-bignumber)
|
|
6291
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6290
6292
|
|
|
6291
6293
|
Returns
|
|
6292
6294
|
|
|
@@ -6314,7 +6316,7 @@ Performs an in-place reduction of the given BigNumber by the modulus of the redu
|
|
|
6314
6316
|
```ts
|
|
6315
6317
|
imod(a: BigNumber): BigNumber
|
|
6316
6318
|
```
|
|
6317
|
-
See also: [BigNumber](#class-bignumber)
|
|
6319
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6318
6320
|
|
|
6319
6321
|
Returns
|
|
6320
6322
|
|
|
@@ -6340,7 +6342,7 @@ modifying the first BigNumber with the result.
|
|
|
6340
6342
|
```ts
|
|
6341
6343
|
imul(a: BigNumber, b: BigNumber): BigNumber
|
|
6342
6344
|
```
|
|
6343
|
-
See also: [BigNumber](#class-bignumber)
|
|
6345
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6344
6346
|
|
|
6345
6347
|
Returns
|
|
6346
6348
|
|
|
@@ -6368,7 +6370,7 @@ Calculates the multiplicative inverse of a BigNumber in the reduction context.
|
|
|
6368
6370
|
```ts
|
|
6369
6371
|
invm(a: BigNumber): BigNumber
|
|
6370
6372
|
```
|
|
6371
|
-
See also: [BigNumber](#class-bignumber)
|
|
6373
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6372
6374
|
|
|
6373
6375
|
Returns
|
|
6374
6376
|
|
|
@@ -6394,7 +6396,7 @@ modifying the original BigNumber with the result.
|
|
|
6394
6396
|
```ts
|
|
6395
6397
|
isqr(a: BigNumber): BigNumber
|
|
6396
6398
|
```
|
|
6397
|
-
See also: [BigNumber](#class-bignumber)
|
|
6399
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6398
6400
|
|
|
6399
6401
|
Returns
|
|
6400
6402
|
|
|
@@ -6421,7 +6423,7 @@ it modifies the first BigNumber with the result.
|
|
|
6421
6423
|
```ts
|
|
6422
6424
|
isub(a: BigNumber, b: BigNumber): BigNumber
|
|
6423
6425
|
```
|
|
6424
|
-
See also: [BigNumber](#class-bignumber)
|
|
6426
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6425
6427
|
|
|
6426
6428
|
Returns
|
|
6427
6429
|
|
|
@@ -6449,7 +6451,7 @@ Multiplies two BigNumbers in the reduction context.
|
|
|
6449
6451
|
```ts
|
|
6450
6452
|
mul(a: BigNumber, b: BigNumber): BigNumber
|
|
6451
6453
|
```
|
|
6452
|
-
See also: [BigNumber](#class-bignumber)
|
|
6454
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6453
6455
|
|
|
6454
6456
|
Returns
|
|
6455
6457
|
|
|
@@ -6476,7 +6478,7 @@ Negates a BigNumber in the context of the modulus.
|
|
|
6476
6478
|
```ts
|
|
6477
6479
|
neg(a: BigNumber): BigNumber
|
|
6478
6480
|
```
|
|
6479
|
-
See also: [BigNumber](#class-bignumber)
|
|
6481
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6480
6482
|
|
|
6481
6483
|
Returns
|
|
6482
6484
|
|
|
@@ -6501,7 +6503,7 @@ Raises a BigNumber to a power in the reduction context.
|
|
|
6501
6503
|
```ts
|
|
6502
6504
|
pow(a: BigNumber, num: BigNumber): BigNumber
|
|
6503
6505
|
```
|
|
6504
|
-
See also: [BigNumber](#class-bignumber)
|
|
6506
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6505
6507
|
|
|
6506
6508
|
Returns
|
|
6507
6509
|
|
|
@@ -6528,7 +6530,7 @@ Performs bitwise shift left operation on a BigNumber in the reduction context.
|
|
|
6528
6530
|
```ts
|
|
6529
6531
|
shl(a: BigNumber, num: number): BigNumber
|
|
6530
6532
|
```
|
|
6531
|
-
See also: [BigNumber](#class-bignumber)
|
|
6533
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6532
6534
|
|
|
6533
6535
|
Returns
|
|
6534
6536
|
|
|
@@ -6555,7 +6557,7 @@ Calculates the square of a BigNumber in the reduction context.
|
|
|
6555
6557
|
```ts
|
|
6556
6558
|
sqr(a: BigNumber): BigNumber
|
|
6557
6559
|
```
|
|
6558
|
-
See also: [BigNumber](#class-bignumber)
|
|
6560
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6559
6561
|
|
|
6560
6562
|
Returns
|
|
6561
6563
|
|
|
@@ -6580,7 +6582,7 @@ Calculates the square root of a BigNumber in the reduction context.
|
|
|
6580
6582
|
```ts
|
|
6581
6583
|
sqrt(a: BigNumber): BigNumber
|
|
6582
6584
|
```
|
|
6583
|
-
See also: [BigNumber](#class-bignumber)
|
|
6585
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6584
6586
|
|
|
6585
6587
|
Returns
|
|
6586
6588
|
|
|
@@ -6605,7 +6607,7 @@ Subtracts one BigNumber from another BigNumber in the reduction context.
|
|
|
6605
6607
|
```ts
|
|
6606
6608
|
sub(a: BigNumber, b: BigNumber): BigNumber
|
|
6607
6609
|
```
|
|
6608
|
-
See also: [BigNumber](#class-bignumber)
|
|
6610
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6609
6611
|
|
|
6610
6612
|
Returns
|
|
6611
6613
|
|
|
@@ -6633,7 +6635,7 @@ conditions are not met.
|
|
|
6633
6635
|
```ts
|
|
6634
6636
|
verify1(a: BigNumber): void
|
|
6635
6637
|
```
|
|
6636
|
-
See also: [BigNumber](#class-bignumber)
|
|
6638
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6637
6639
|
|
|
6638
6640
|
Argument Details
|
|
6639
6641
|
|
|
@@ -6657,7 +6659,7 @@ conditions are not met.
|
|
|
6657
6659
|
```ts
|
|
6658
6660
|
verify2(a: BigNumber, b: BigNumber): void
|
|
6659
6661
|
```
|
|
6660
|
-
See also: [BigNumber](#class-bignumber)
|
|
6662
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
6661
6663
|
|
|
6662
6664
|
Argument Details
|
|
6663
6665
|
|
|
@@ -6751,7 +6753,7 @@ export class SHA1HMAC {
|
|
|
6751
6753
|
}
|
|
6752
6754
|
```
|
|
6753
6755
|
|
|
6754
|
-
See also: [SHA1](#class-sha1)
|
|
6756
|
+
See also: [SHA1](./primitives.md#class-sha1)
|
|
6755
6757
|
|
|
6756
6758
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
6757
6759
|
|
|
@@ -6776,7 +6778,6 @@ export class SHA256 extends BaseHash {
|
|
|
6776
6778
|
k: number[];
|
|
6777
6779
|
constructor()
|
|
6778
6780
|
_update(msg: number[], start?: number): void
|
|
6779
|
-
;
|
|
6780
6781
|
_digest(): number[]
|
|
6781
6782
|
_digestHex(): string
|
|
6782
6783
|
}
|
|
@@ -6836,7 +6837,7 @@ export class SHA256HMAC {
|
|
|
6836
6837
|
}
|
|
6837
6838
|
```
|
|
6838
6839
|
|
|
6839
|
-
See also: [SHA256](#class-sha256)
|
|
6840
|
+
See also: [SHA256](./primitives.md#class-sha256)
|
|
6840
6841
|
|
|
6841
6842
|
<details>
|
|
6842
6843
|
|
|
@@ -6880,7 +6881,7 @@ Represents the inner hash of SHA-256.
|
|
|
6880
6881
|
```ts
|
|
6881
6882
|
inner: SHA256
|
|
6882
6883
|
```
|
|
6883
|
-
See also: [SHA256](#class-sha256)
|
|
6884
|
+
See also: [SHA256](./primitives.md#class-sha256)
|
|
6884
6885
|
|
|
6885
6886
|
#### Property outSize
|
|
6886
6887
|
|
|
@@ -6897,7 +6898,7 @@ Represents the outer hash of SHA-256.
|
|
|
6897
6898
|
```ts
|
|
6898
6899
|
outer: SHA256
|
|
6899
6900
|
```
|
|
6900
|
-
See also: [SHA256](#class-sha256)
|
|
6901
|
+
See also: [SHA256](./primitives.md#class-sha256)
|
|
6901
6902
|
|
|
6902
6903
|
#### Method digest
|
|
6903
6904
|
|
|
@@ -6942,7 +6943,7 @@ Updates the `SHA256HMAC` object with part of the message to be hashed.
|
|
|
6942
6943
|
```ts
|
|
6943
6944
|
update(msg: number[] | string, enc?: "hex"): SHA256HMAC
|
|
6944
6945
|
```
|
|
6945
|
-
See also: [SHA256HMAC](#class-sha256hmac)
|
|
6946
|
+
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
6946
6947
|
|
|
6947
6948
|
Returns
|
|
6948
6949
|
|
|
@@ -6985,10 +6986,10 @@ export class SHA512 extends BaseHash {
|
|
|
6985
6986
|
W: number[];
|
|
6986
6987
|
k: number[];
|
|
6987
6988
|
constructor()
|
|
6988
|
-
_prepareBlock(msg, start)
|
|
6989
|
-
_update(msg, start)
|
|
6990
|
-
_digest()
|
|
6991
|
-
_digestHex()
|
|
6989
|
+
_prepareBlock(msg: number[], start: number): void
|
|
6990
|
+
_update(msg: any, start: number): void
|
|
6991
|
+
_digest(): number[]
|
|
6992
|
+
_digestHex(): number[]
|
|
6992
6993
|
}
|
|
6993
6994
|
```
|
|
6994
6995
|
|
|
@@ -7046,7 +7047,7 @@ export class SHA512HMAC {
|
|
|
7046
7047
|
}
|
|
7047
7048
|
```
|
|
7048
7049
|
|
|
7049
|
-
See also: [SHA512](#class-sha512)
|
|
7050
|
+
See also: [SHA512](./primitives.md#class-sha512)
|
|
7050
7051
|
|
|
7051
7052
|
<details>
|
|
7052
7053
|
|
|
@@ -7090,7 +7091,7 @@ Represents the inner hash of SHA-512.
|
|
|
7090
7091
|
```ts
|
|
7091
7092
|
inner: SHA512
|
|
7092
7093
|
```
|
|
7093
|
-
See also: [SHA512](#class-sha512)
|
|
7094
|
+
See also: [SHA512](./primitives.md#class-sha512)
|
|
7094
7095
|
|
|
7095
7096
|
#### Property outSize
|
|
7096
7097
|
|
|
@@ -7107,7 +7108,7 @@ Represents the outer hash of SHA-512.
|
|
|
7107
7108
|
```ts
|
|
7108
7109
|
outer: SHA512
|
|
7109
7110
|
```
|
|
7110
|
-
See also: [SHA512](#class-sha512)
|
|
7111
|
+
See also: [SHA512](./primitives.md#class-sha512)
|
|
7111
7112
|
|
|
7112
7113
|
#### Method digest
|
|
7113
7114
|
|
|
@@ -7152,7 +7153,7 @@ Updates the `SHA512HMAC` object with part of the message to be hashed.
|
|
|
7152
7153
|
```ts
|
|
7153
7154
|
update(msg: number[] | string, enc?: "hex" | "utf8"): SHA512HMAC
|
|
7154
7155
|
```
|
|
7155
|
-
See also: [SHA512HMAC](#class-sha512hmac)
|
|
7156
|
+
See also: [SHA512HMAC](./primitives.md#class-sha512hmac)
|
|
7156
7157
|
|
|
7157
7158
|
Returns
|
|
7158
7159
|
|
|
@@ -7223,7 +7224,7 @@ export default class Schnorr {
|
|
|
7223
7224
|
}
|
|
7224
7225
|
```
|
|
7225
7226
|
|
|
7226
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point), [PrivateKey](#class-privatekey), [PublicKey](#class-publickey)
|
|
7227
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
7227
7228
|
|
|
7228
7229
|
<details>
|
|
7229
7230
|
|
|
@@ -7240,7 +7241,7 @@ generateProof(aArg: PrivateKey, AArg: PublicKey, BArg: PublicKey, S: Point): {
|
|
|
7240
7241
|
z: BigNumber;
|
|
7241
7242
|
}
|
|
7242
7243
|
```
|
|
7243
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point), [PrivateKey](#class-privatekey), [PublicKey](#class-publickey)
|
|
7244
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point), [PrivateKey](./primitives.md#class-privatekey), [PublicKey](./primitives.md#class-publickey)
|
|
7244
7245
|
|
|
7245
7246
|
Returns
|
|
7246
7247
|
|
|
@@ -7268,7 +7269,7 @@ verifyProof(A: Point, B: Point, S: Point, proof: {
|
|
|
7268
7269
|
z: BigNumber;
|
|
7269
7270
|
}): boolean
|
|
7270
7271
|
```
|
|
7271
|
-
See also: [BigNumber](#class-bignumber), [Point](#class-point)
|
|
7272
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Point](./primitives.md#class-point)
|
|
7272
7273
|
|
|
7273
7274
|
Returns
|
|
7274
7275
|
|
|
@@ -7307,7 +7308,7 @@ export default class Signature {
|
|
|
7307
7308
|
static fromCompact(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
7308
7309
|
constructor(r: BigNumber, s: BigNumber)
|
|
7309
7310
|
verify(msg: number[] | string, key: PublicKey, enc?: "hex"): boolean
|
|
7310
|
-
toString(enc?: "hex" | "base64")
|
|
7311
|
+
toString(enc?: "hex" | "base64"): number[] | string
|
|
7311
7312
|
toDER(enc?: "hex" | "base64"): number[] | string
|
|
7312
7313
|
toCompact(recovery: number, compressed: boolean, enc?: "hex" | "base64"): number[] | string
|
|
7313
7314
|
RecoverPublicKey(recovery: number, e: BigNumber): PublicKey
|
|
@@ -7315,7 +7316,7 @@ export default class Signature {
|
|
|
7315
7316
|
}
|
|
7316
7317
|
```
|
|
7317
7318
|
|
|
7318
|
-
See also: [BigNumber](#class-bignumber), [PublicKey](#class-publickey), [verify](#variable-verify)
|
|
7319
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey), [verify](./compat.md#variable-verify)
|
|
7319
7320
|
|
|
7320
7321
|
<details>
|
|
7321
7322
|
|
|
@@ -7328,7 +7329,7 @@ Creates an instance of the Signature class.
|
|
|
7328
7329
|
```ts
|
|
7329
7330
|
constructor(r: BigNumber, s: BigNumber)
|
|
7330
7331
|
```
|
|
7331
|
-
See also: [BigNumber](#class-bignumber)
|
|
7332
|
+
See also: [BigNumber](./primitives.md#class-bignumber)
|
|
7332
7333
|
|
|
7333
7334
|
Argument Details
|
|
7334
7335
|
|
|
@@ -7355,7 +7356,7 @@ The recovery factor is a number between 0 and 3.
|
|
|
7355
7356
|
```ts
|
|
7356
7357
|
CalculateRecoveryFactor(pubkey: PublicKey, msgHash: BigNumber): number
|
|
7357
7358
|
```
|
|
7358
|
-
See also: [BigNumber](#class-bignumber), [PublicKey](#class-publickey)
|
|
7359
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
7359
7360
|
|
|
7360
7361
|
Returns
|
|
7361
7362
|
|
|
@@ -7383,7 +7384,7 @@ The recovery factor is a number between 0 and 3.
|
|
|
7383
7384
|
```ts
|
|
7384
7385
|
RecoverPublicKey(recovery: number, e: BigNumber): PublicKey
|
|
7385
7386
|
```
|
|
7386
|
-
See also: [BigNumber](#class-bignumber), [PublicKey](#class-publickey)
|
|
7387
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [PublicKey](./primitives.md#class-publickey)
|
|
7387
7388
|
|
|
7388
7389
|
Returns
|
|
7389
7390
|
|
|
@@ -7415,7 +7416,7 @@ We could support recovery functions in future if there's demand.
|
|
|
7415
7416
|
```ts
|
|
7416
7417
|
static fromCompact(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
7417
7418
|
```
|
|
7418
|
-
See also: [Signature](#class-signature)
|
|
7419
|
+
See also: [Signature](./primitives.md#class-signature)
|
|
7419
7420
|
|
|
7420
7421
|
Returns
|
|
7421
7422
|
|
|
@@ -7443,7 +7444,7 @@ If a string is provided, it is assumed to represent a hexadecimal sequence.
|
|
|
7443
7444
|
```ts
|
|
7444
7445
|
static fromDER(data: number[] | string, enc?: "hex" | "base64"): Signature
|
|
7445
7446
|
```
|
|
7446
|
-
See also: [Signature](#class-signature)
|
|
7447
|
+
See also: [Signature](./primitives.md#class-signature)
|
|
7447
7448
|
|
|
7448
7449
|
Returns
|
|
7449
7450
|
|
|
@@ -7528,7 +7529,7 @@ If 'base64', it will return a base64 string.
|
|
|
7528
7529
|
Otherwise, it will return an array of numbers.
|
|
7529
7530
|
|
|
7530
7531
|
```ts
|
|
7531
|
-
toString(enc?: "hex" | "base64")
|
|
7532
|
+
toString(enc?: "hex" | "base64"): number[] | string
|
|
7532
7533
|
```
|
|
7533
7534
|
|
|
7534
7535
|
Returns
|
|
@@ -7556,7 +7557,7 @@ If the data or key do not match the signature, the function returns false.
|
|
|
7556
7557
|
```ts
|
|
7557
7558
|
verify(msg: number[] | string, key: PublicKey, enc?: "hex"): boolean
|
|
7558
7559
|
```
|
|
7559
|
-
See also: [PublicKey](#class-publickey)
|
|
7560
|
+
See also: [PublicKey](./primitives.md#class-publickey)
|
|
7560
7561
|
|
|
7561
7562
|
Returns
|
|
7562
7563
|
|
|
@@ -7598,7 +7599,7 @@ export default class SymmetricKey extends BigNumber {
|
|
|
7598
7599
|
}
|
|
7599
7600
|
```
|
|
7600
7601
|
|
|
7601
|
-
See also: [BigNumber](#class-bignumber)
|
|
7602
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [decrypt](./messages.md#variable-decrypt), [encrypt](./messages.md#variable-encrypt)
|
|
7602
7603
|
|
|
7603
7604
|
<details>
|
|
7604
7605
|
|
|
@@ -7671,7 +7672,7 @@ Generates a symmetric key randomly.
|
|
|
7671
7672
|
```ts
|
|
7672
7673
|
static fromRandom(): SymmetricKey
|
|
7673
7674
|
```
|
|
7674
|
-
See also: [SymmetricKey](#class-symmetrickey)
|
|
7675
|
+
See also: [SymmetricKey](./primitives.md#class-symmetrickey)
|
|
7675
7676
|
|
|
7676
7677
|
Returns
|
|
7677
7678
|
|
|
@@ -7718,7 +7719,7 @@ export default class TransactionSignature extends Signature {
|
|
|
7718
7719
|
}
|
|
7719
7720
|
```
|
|
7720
7721
|
|
|
7721
|
-
See also: [BigNumber](#class-bignumber), [Script](#class-script), [Signature](#class-signature), [TransactionInput](#interface-transactioninput), [TransactionOutput](#interface-transactionoutput)
|
|
7722
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Script](./script.md#class-script), [Signature](./primitives.md#class-signature), [TransactionInput](./transaction.md#interface-transactioninput), [TransactionOutput](./transaction.md#interface-transactionoutput)
|
|
7722
7723
|
|
|
7723
7724
|
<details>
|
|
7724
7725
|
|
|
@@ -7769,7 +7770,7 @@ export class Writer {
|
|
|
7769
7770
|
}
|
|
7770
7771
|
```
|
|
7771
7772
|
|
|
7772
|
-
See also: [BigNumber](#class-bignumber), [toArray](#variable-toarray)
|
|
7773
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [toArray](./primitives.md#variable-toarray)
|
|
7773
7774
|
|
|
7774
7775
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
7775
7776
|
|
|
@@ -7968,7 +7969,7 @@ encode = (arr: number[], enc?: "hex" | "utf8"): string | number[] => {
|
|
|
7968
7969
|
}
|
|
7969
7970
|
```
|
|
7970
7971
|
|
|
7971
|
-
See also: [toHex](#variable-tohex), [toUTF8](#variable-toutf8)
|
|
7972
|
+
See also: [toHex](./primitives.md#variable-tohex), [toUTF8](./primitives.md#variable-toutf8)
|
|
7972
7973
|
|
|
7973
7974
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
7974
7975
|
|
|
@@ -7993,19 +7994,19 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
7993
7994
|
|
|
7994
7995
|
```ts
|
|
7995
7996
|
fromBase58 = (str: string): number[] => {
|
|
7996
|
-
if (
|
|
7997
|
+
if (str === "" || typeof str !== "string") {
|
|
7997
7998
|
throw new Error(`Expected base58 string but got “${str}”`);
|
|
7998
7999
|
}
|
|
7999
|
-
|
|
8000
|
-
|
|
8000
|
+
const match: string[] | null = str.match(/[IOl0]/gmu);
|
|
8001
|
+
if (match !== null) {
|
|
8002
|
+
throw new Error(`Invalid base58 character “${match.join("")}”`);
|
|
8001
8003
|
}
|
|
8002
8004
|
const lz = str.match(/^1+/gmu);
|
|
8003
|
-
const psz: number = lz ? lz[0].length : 0;
|
|
8005
|
+
const psz: number = (lz !== null) ? lz[0].length : 0;
|
|
8004
8006
|
const size = ((str.length - psz) * (Math.log(58) / Math.log(256)) + 1) >>> 0;
|
|
8005
8007
|
const uint8 = new Uint8Array([
|
|
8006
8008
|
...new Uint8Array(psz),
|
|
8007
|
-
...str
|
|
8008
|
-
.match(/./gmu)
|
|
8009
|
+
...(str.match(/./gmu) ?? [])
|
|
8009
8010
|
.map((i) => base58chars.indexOf(i))
|
|
8010
8011
|
.reduce((acc, i) => {
|
|
8011
8012
|
acc = acc.map((j) => {
|
|
@@ -8028,7 +8029,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
8028
8029
|
### Variable: fromBase58Check
|
|
8029
8030
|
|
|
8030
8031
|
```ts
|
|
8031
|
-
fromBase58Check = (str: string, enc?: "hex", prefixLength: number = 1) => {
|
|
8032
|
+
fromBase58Check = (str: string, enc?: "hex", prefixLength: number = 1): any => {
|
|
8032
8033
|
const bin = fromBase58(str);
|
|
8033
8034
|
let prefix: string | number[] = bin.slice(0, prefixLength);
|
|
8034
8035
|
let data: string | number[] = bin.slice(prefixLength, -4);
|
|
@@ -8047,7 +8048,7 @@ fromBase58Check = (str: string, enc?: "hex", prefixLength: number = 1) => {
|
|
|
8047
8048
|
}
|
|
8048
8049
|
```
|
|
8049
8050
|
|
|
8050
|
-
See also: [fromBase58](#variable-frombase58), [hash256](#variable-hash256), [toHex](#variable-tohex)
|
|
8051
|
+
See also: [fromBase58](./primitives.md#variable-frombase58), [hash256](./primitives.md#variable-hash256), [toHex](./primitives.md#variable-tohex)
|
|
8051
8052
|
|
|
8052
8053
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8053
8054
|
|
|
@@ -8077,7 +8078,7 @@ hash160 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
|
|
|
8077
8078
|
}
|
|
8078
8079
|
```
|
|
8079
8080
|
|
|
8080
|
-
See also: [RIPEMD160](#class-ripemd160), [SHA256](#class-sha256)
|
|
8081
|
+
See also: [RIPEMD160](./primitives.md#class-ripemd160), [SHA256](./primitives.md#class-sha256)
|
|
8081
8082
|
|
|
8082
8083
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8083
8084
|
|
|
@@ -8091,7 +8092,7 @@ hash256 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
|
|
|
8091
8092
|
}
|
|
8092
8093
|
```
|
|
8093
8094
|
|
|
8094
|
-
See also: [SHA256](#class-sha256)
|
|
8095
|
+
See also: [SHA256](./primitives.md#class-sha256)
|
|
8095
8096
|
|
|
8096
8097
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8097
8098
|
|
|
@@ -8179,7 +8180,7 @@ multiply = function (block0: number[], block1: number[]): number[] {
|
|
|
8179
8180
|
}
|
|
8180
8181
|
```
|
|
8181
8182
|
|
|
8182
|
-
See also: [checkBit](#variable-checkbit), [exclusiveOR](#variable-exclusiveor), [rightShift](#variable-rightshift)
|
|
8183
|
+
See also: [checkBit](./primitives.md#variable-checkbit), [exclusiveOR](./primitives.md#variable-exclusiveor), [rightShift](./primitives.md#variable-rightshift)
|
|
8183
8184
|
|
|
8184
8185
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8185
8186
|
|
|
@@ -8214,7 +8215,7 @@ ripemd160 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
|
|
|
8214
8215
|
}
|
|
8215
8216
|
```
|
|
8216
8217
|
|
|
8217
|
-
See also: [RIPEMD160](#class-ripemd160)
|
|
8218
|
+
See also: [RIPEMD160](./primitives.md#class-ripemd160)
|
|
8218
8219
|
|
|
8219
8220
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8220
8221
|
|
|
@@ -8227,7 +8228,7 @@ sha1 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
|
|
|
8227
8228
|
}
|
|
8228
8229
|
```
|
|
8229
8230
|
|
|
8230
|
-
See also: [SHA1](#class-sha1)
|
|
8231
|
+
See also: [SHA1](./primitives.md#class-sha1)
|
|
8231
8232
|
|
|
8232
8233
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8233
8234
|
|
|
@@ -8240,7 +8241,7 @@ sha256 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
|
|
|
8240
8241
|
}
|
|
8241
8242
|
```
|
|
8242
8243
|
|
|
8243
|
-
See also: [SHA256](#class-sha256)
|
|
8244
|
+
See also: [SHA256](./primitives.md#class-sha256)
|
|
8244
8245
|
|
|
8245
8246
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8246
8247
|
|
|
@@ -8253,7 +8254,7 @@ sha256hmac = (key: number[] | string, msg: number[] | string, enc?: "hex"): numb
|
|
|
8253
8254
|
}
|
|
8254
8255
|
```
|
|
8255
8256
|
|
|
8256
|
-
See also: [SHA256HMAC](#class-sha256hmac)
|
|
8257
|
+
See also: [SHA256HMAC](./primitives.md#class-sha256hmac)
|
|
8257
8258
|
|
|
8258
8259
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8259
8260
|
|
|
@@ -8266,7 +8267,7 @@ sha512 = (msg: number[] | string, enc?: "hex" | "utf8"): number[] => {
|
|
|
8266
8267
|
}
|
|
8267
8268
|
```
|
|
8268
8269
|
|
|
8269
|
-
See also: [SHA512](#class-sha512)
|
|
8270
|
+
See also: [SHA512](./primitives.md#class-sha512)
|
|
8270
8271
|
|
|
8271
8272
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8272
8273
|
|
|
@@ -8279,7 +8280,7 @@ sha512hmac = (key: number[] | string, msg: number[] | string, enc?: "hex"): numb
|
|
|
8279
8280
|
}
|
|
8280
8281
|
```
|
|
8281
8282
|
|
|
8282
|
-
See also: [SHA512HMAC](#class-sha512hmac)
|
|
8283
|
+
See also: [SHA512HMAC](./primitives.md#class-sha512hmac)
|
|
8283
8284
|
|
|
8284
8285
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8285
8286
|
|
|
@@ -8287,7 +8288,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
8287
8288
|
### Variable: sign
|
|
8288
8289
|
|
|
8289
8290
|
```ts
|
|
8290
|
-
sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: BigNumber |
|
|
8291
|
+
sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: BigNumber | ((iter: number) => BigNumber)): Signature => {
|
|
8291
8292
|
if (typeof BigInt === "function") {
|
|
8292
8293
|
const zero = BigInt(0);
|
|
8293
8294
|
const one = BigInt(1);
|
|
@@ -8330,19 +8331,19 @@ sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: Bi
|
|
|
8330
8331
|
return k;
|
|
8331
8332
|
}
|
|
8332
8333
|
}
|
|
8333
|
-
function generateK(): bigint {
|
|
8334
|
+
function generateK(customK?: BigNumber | ((iter: number) => BigNumber)): bigint {
|
|
8334
8335
|
if (typeof customK === "function") {
|
|
8335
|
-
const
|
|
8336
|
-
const
|
|
8337
|
-
return BigInt("0x" +
|
|
8336
|
+
const kbn = customK(iter);
|
|
8337
|
+
const kstr = kbn.toString(16);
|
|
8338
|
+
return BigInt("0x" + kstr);
|
|
8338
8339
|
}
|
|
8339
|
-
else if (BigNumber.isBN(customK)) {
|
|
8340
|
-
const
|
|
8341
|
-
return BigInt("0x" +
|
|
8340
|
+
else if ((customK != null) && BigNumber.isBN(customK)) {
|
|
8341
|
+
const kstr = customK.toString(16);
|
|
8342
|
+
return BigInt("0x" + kstr);
|
|
8342
8343
|
}
|
|
8343
8344
|
else {
|
|
8344
|
-
const
|
|
8345
|
-
return BigInt("0x" +
|
|
8345
|
+
const khex = drbg.generate(bytes);
|
|
8346
|
+
return BigInt("0x" + khex);
|
|
8346
8347
|
}
|
|
8347
8348
|
}
|
|
8348
8349
|
function mod(a: bigint, m: bigint): bigint {
|
|
@@ -8405,21 +8406,30 @@ sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: Bi
|
|
|
8405
8406
|
}): {
|
|
8406
8407
|
x: bigint;
|
|
8407
8408
|
y: bigint;
|
|
8408
|
-
}
|
|
8409
|
+
} {
|
|
8409
8410
|
let N = P;
|
|
8410
|
-
let Q
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8411
|
+
let Q: {
|
|
8412
|
+
x: bigint;
|
|
8413
|
+
y: bigint;
|
|
8414
|
+
} | null = null;
|
|
8415
|
+
while (k > BigInt(0)) {
|
|
8416
|
+
if (k % BigInt(2) === BigInt(1)) {
|
|
8417
|
+
Q = Q === null ? N : (pointAdd(Q, N) ?? Q);
|
|
8414
8418
|
}
|
|
8415
|
-
N = pointAdd(N, N);
|
|
8416
|
-
k >>=
|
|
8419
|
+
N = pointAdd(N, N) ?? N;
|
|
8420
|
+
k >>= BigInt(1);
|
|
8421
|
+
}
|
|
8422
|
+
if (Q === null) {
|
|
8423
|
+
throw new Error("Scalar multiplication resulted in an invalid point.");
|
|
8417
8424
|
}
|
|
8418
8425
|
return Q;
|
|
8419
8426
|
}
|
|
8420
|
-
|
|
8421
|
-
|
|
8427
|
+
let validSignature = false;
|
|
8428
|
+
while (!validSignature) {
|
|
8422
8429
|
iter += 1;
|
|
8430
|
+
validSignature = true;
|
|
8431
|
+
iter += 1;
|
|
8432
|
+
let k = generateK(customK);
|
|
8423
8433
|
k = truncateToN(k, n, true);
|
|
8424
8434
|
if (k <= one || k >= ns1) {
|
|
8425
8435
|
if (customK instanceof BigNumber) {
|
|
@@ -8461,9 +8471,9 @@ sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: Bi
|
|
|
8461
8471
|
if (forceLowS && s > n / two) {
|
|
8462
8472
|
s = n - s;
|
|
8463
8473
|
}
|
|
8464
|
-
const
|
|
8465
|
-
const
|
|
8466
|
-
return new Signature(
|
|
8474
|
+
const rbn = new BigNumber(r.toString(16), 16);
|
|
8475
|
+
const sbn = new BigNumber(s.toString(16), 16);
|
|
8476
|
+
return new Signature(rbn, sbn);
|
|
8467
8477
|
}
|
|
8468
8478
|
}
|
|
8469
8479
|
else {
|
|
@@ -8480,7 +8490,12 @@ sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: Bi
|
|
|
8480
8490
|
: BigNumber.isBN(customK)
|
|
8481
8491
|
? customK
|
|
8482
8492
|
: new BigNumber(drbg.generate(bytes), 16);
|
|
8483
|
-
|
|
8493
|
+
if (k != null) {
|
|
8494
|
+
k = truncateToN(k, true);
|
|
8495
|
+
}
|
|
8496
|
+
else {
|
|
8497
|
+
throw new Error("k is undefined");
|
|
8498
|
+
}
|
|
8484
8499
|
if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) {
|
|
8485
8500
|
if (BigNumber.isBN(customK)) {
|
|
8486
8501
|
throw new Error("Invalid fixed custom K value (must be more than 1 and less than N-1)");
|
|
@@ -8524,10 +8539,11 @@ sign = (msg: BigNumber, key: BigNumber, forceLowS: boolean = false, customK?: Bi
|
|
|
8524
8539
|
return new Signature(r, s);
|
|
8525
8540
|
}
|
|
8526
8541
|
}
|
|
8542
|
+
throw new Error("Failed to generate a valid signature");
|
|
8527
8543
|
}
|
|
8528
8544
|
```
|
|
8529
8545
|
|
|
8530
|
-
See also: [BigNumber](#class-bignumber), [Curve](#class-curve), [DRBG](#class-drbg), [Signature](#class-signature), [toArray](#variable-toarray)
|
|
8546
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Curve](./primitives.md#class-curve), [DRBG](./primitives.md#class-drbg), [Signature](./primitives.md#class-signature), [toArray](./primitives.md#variable-toarray)
|
|
8531
8547
|
|
|
8532
8548
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8533
8549
|
|
|
@@ -8538,7 +8554,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
8538
8554
|
toArray = (msg: any, enc?: "hex" | "utf8" | "base64"): any[] => {
|
|
8539
8555
|
if (Array.isArray(msg))
|
|
8540
8556
|
return msg.slice();
|
|
8541
|
-
if (
|
|
8557
|
+
if (msg === undefined)
|
|
8542
8558
|
return [];
|
|
8543
8559
|
if (typeof msg !== "string") {
|
|
8544
8560
|
return Array.from(msg, (item: any) => item | 0);
|
|
@@ -8565,7 +8581,7 @@ toBase58 = (bin: number[]): string => {
|
|
|
8565
8581
|
for (let i = 0; i < base58chars.length; ++i) {
|
|
8566
8582
|
base58Map[base58chars.charCodeAt(i)] = i;
|
|
8567
8583
|
}
|
|
8568
|
-
const result = [];
|
|
8584
|
+
const result: number[] = [];
|
|
8569
8585
|
for (const byte of bin) {
|
|
8570
8586
|
let carry = byte;
|
|
8571
8587
|
for (let j = 0; j < result.length; ++j) {
|
|
@@ -8573,13 +8589,13 @@ toBase58 = (bin: number[]): string => {
|
|
|
8573
8589
|
result[j] = base58chars.charCodeAt(x % 58);
|
|
8574
8590
|
carry = (x / 58) | 0;
|
|
8575
8591
|
}
|
|
8576
|
-
while (carry) {
|
|
8592
|
+
while (carry !== 0) {
|
|
8577
8593
|
result.push(base58chars.charCodeAt(carry % 58));
|
|
8578
8594
|
carry = (carry / 58) | 0;
|
|
8579
8595
|
}
|
|
8580
8596
|
}
|
|
8581
8597
|
for (const byte of bin) {
|
|
8582
|
-
if (byte)
|
|
8598
|
+
if (byte !== 0)
|
|
8583
8599
|
break;
|
|
8584
8600
|
else
|
|
8585
8601
|
result.push("1".charCodeAt(0));
|
|
@@ -8595,14 +8611,14 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
|
|
|
8595
8611
|
### Variable: toBase58Check
|
|
8596
8612
|
|
|
8597
8613
|
```ts
|
|
8598
|
-
toBase58Check = (bin: number[], prefix: number[] = [0]) => {
|
|
8614
|
+
toBase58Check = (bin: number[], prefix: number[] = [0]): string => {
|
|
8599
8615
|
let hash = hash256([...prefix, ...bin]);
|
|
8600
8616
|
hash = [...prefix, ...bin, ...hash.slice(0, 4)];
|
|
8601
8617
|
return toBase58(hash);
|
|
8602
8618
|
}
|
|
8603
8619
|
```
|
|
8604
8620
|
|
|
8605
|
-
See also: [hash256](#variable-hash256), [toBase58](#variable-tobase58)
|
|
8621
|
+
See also: [hash256](./primitives.md#variable-hash256), [toBase58](./primitives.md#variable-tobase58)
|
|
8606
8622
|
|
|
8607
8623
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8608
8624
|
|
|
@@ -8619,7 +8635,7 @@ toHex = (msg: number[]): string => {
|
|
|
8619
8635
|
}
|
|
8620
8636
|
```
|
|
8621
8637
|
|
|
8622
|
-
See also: [zero2](#variable-zero2)
|
|
8638
|
+
See also: [zero2](./primitives.md#variable-zero2)
|
|
8623
8639
|
|
|
8624
8640
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8625
8641
|
|
|
@@ -8657,7 +8673,10 @@ toUTF8 = (arr: number[]): string => {
|
|
|
8657
8673
|
const byte3 = arr[i + 2];
|
|
8658
8674
|
const byte4 = arr[i + 3];
|
|
8659
8675
|
skip = 3;
|
|
8660
|
-
const codePoint = ((byte & 7) << 18) |
|
|
8676
|
+
const codePoint = ((byte & 7) << 18) |
|
|
8677
|
+
((byte2 & 63) << 12) |
|
|
8678
|
+
((byte3 & 63) << 6) |
|
|
8679
|
+
(byte4 & 63);
|
|
8661
8680
|
const surrogate1 = 55296 + ((codePoint - 65536) >> 10);
|
|
8662
8681
|
const surrogate2 = 56320 + ((codePoint - 65536) & 1023);
|
|
8663
8682
|
result += String.fromCharCode(surrogate1, surrogate2);
|
|
@@ -8687,20 +8706,19 @@ verify = (msg: BigNumber, sig: Signature, key: Point): boolean => {
|
|
|
8687
8706
|
};
|
|
8688
8707
|
const mod = (a: bigint, m: bigint): bigint => ((a % m) + m) % m;
|
|
8689
8708
|
const modInv = (a: bigint, m: bigint): bigint => {
|
|
8690
|
-
let [
|
|
8691
|
-
let [
|
|
8709
|
+
let [oldr, r] = [a, m];
|
|
8710
|
+
let [olds, s] = [BigInt(1), BigInt(0)];
|
|
8692
8711
|
while (r !== zero) {
|
|
8693
|
-
const q =
|
|
8694
|
-
[
|
|
8695
|
-
[
|
|
8712
|
+
const q = oldr / r;
|
|
8713
|
+
[oldr, r] = [r, oldr - q * r];
|
|
8714
|
+
[olds, s] = [s, olds - q * s];
|
|
8696
8715
|
}
|
|
8697
|
-
if (
|
|
8716
|
+
if (oldr > one)
|
|
8698
8717
|
return zero;
|
|
8699
|
-
return mod(
|
|
8718
|
+
return mod(olds, m);
|
|
8700
8719
|
};
|
|
8701
8720
|
const modMul = (a: bigint, b: bigint, m: bigint): bigint => mod(a * b, m);
|
|
8702
8721
|
const modSub = (a: bigint, b: bigint, m: bigint): bigint => mod(a - b, m);
|
|
8703
|
-
const modAdd = (a: bigint, b: bigint, m: bigint): bigint => mod(a + b, m);
|
|
8704
8722
|
const four = BigInt(4);
|
|
8705
8723
|
const eight = BigInt(8);
|
|
8706
8724
|
interface JacobianPoint {
|
|
@@ -8713,11 +8731,11 @@ verify = (msg: BigNumber, sig: Signature, key: Point): boolean => {
|
|
|
8713
8731
|
if (Y1 === zero) {
|
|
8714
8732
|
return { X: zero, Y: one, Z: zero };
|
|
8715
8733
|
}
|
|
8716
|
-
const
|
|
8717
|
-
const S = modMul(four, modMul(X1,
|
|
8734
|
+
const Y1sq = modMul(Y1, Y1, p);
|
|
8735
|
+
const S = modMul(four, modMul(X1, Y1sq, p), p);
|
|
8718
8736
|
const M = modMul(three, modMul(X1, X1, p), p);
|
|
8719
8737
|
const X3 = modSub(modMul(M, M, p), modMul(two, S, p), p);
|
|
8720
|
-
const Y3 = modSub(modMul(M, modSub(S, X3, p), p), modMul(eight, modMul(
|
|
8738
|
+
const Y3 = modSub(modMul(M, modSub(S, X3, p), p), modMul(eight, modMul(Y1sq, Y1sq, p), p), p);
|
|
8721
8739
|
const Z3 = modMul(two, modMul(Y1, Z1, p), p);
|
|
8722
8740
|
return { X: X3, Y: Y3, Z: Z3 };
|
|
8723
8741
|
};
|
|
@@ -8794,11 +8812,14 @@ verify = (msg: BigNumber, sig: Signature, key: Point): boolean => {
|
|
|
8794
8812
|
return false;
|
|
8795
8813
|
}
|
|
8796
8814
|
const ZInv2 = modMul(ZInv, ZInv, p);
|
|
8797
|
-
const
|
|
8798
|
-
const v = mod(
|
|
8815
|
+
const x1affine = modMul(R.X, ZInv2, p);
|
|
8816
|
+
const v = mod(x1affine, n);
|
|
8799
8817
|
return v === r;
|
|
8800
8818
|
};
|
|
8801
8819
|
const hash = BigInt("0x" + msg.toString(16));
|
|
8820
|
+
if ((key.x == null) || (key.y == null)) {
|
|
8821
|
+
throw new Error("Invalid public key: missing coordinates.");
|
|
8822
|
+
}
|
|
8802
8823
|
const publicKey = {
|
|
8803
8824
|
x: BigInt("0x" + key.x.toString(16)),
|
|
8804
8825
|
y: BigInt("0x" + key.y.toString(16))
|
|
@@ -8832,7 +8853,7 @@ verify = (msg: BigNumber, sig: Signature, key: Point): boolean => {
|
|
|
8832
8853
|
}
|
|
8833
8854
|
```
|
|
8834
8855
|
|
|
8835
|
-
See also: [BigNumber](#class-bignumber), [Curve](#class-curve), [JacobianPoint](#class-jacobianpoint), [Point](#class-point), [Signature](#class-signature)
|
|
8856
|
+
See also: [BigNumber](./primitives.md#class-bignumber), [Curve](./primitives.md#class-curve), [JacobianPoint](./primitives.md#class-jacobianpoint), [Point](./primitives.md#class-point), [Signature](./primitives.md#class-signature)
|
|
8836
8857
|
|
|
8837
8858
|
Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
|
|
8838
8859
|
|