CryptoApi
Class representing instance of Crypto API
Methods
signData
Creates a signature of data using given key.
Params
data
Uint8Array
buffer to sign
privateKey
string
key used to sign data
Returns
Promise<Uint8Array>
·
signature
verifySignature
Validate a signature of data using given key.
Params
data
Uint8Array
buffer
signature
Uint8Array
signature of data to verify
publicKey
string
public ECC key in BASE58DER format used to validate data
Returns
`` · data validation result
generatePrivateKey
Generates a new private ECC key.
Params
randomSeed
string | undefined
optional string used as the base to generate the new key
Returns
Promise<string>
·
generated ECC key in WIF format
derivePrivateKey
(deprecated) Generates a new private ECC key from a password using pbkdf2.
Params
password
string
the password used to generate the new key
salt
string
random string (additional input for the hashing function)
Returns
Promise<string>
·
generated ECC key in WIF format
derivePrivateKey2
Generates a new private ECC key from a password using pbkdf2.
Params
password
string
the password used to generate the new key
salt
string
random string (additional input for the hashing function)
Returns
Promise<string>
·
generated ECC key in WIF format
derivePublicKey
Generates a new public ECC key as a pair to an existing private key.
Params
privateKey
string
private ECC key in WIF format
Returns
Promise<string>
·
generated ECC key in BASE58DER format
generateKeySymmetric
Generates a new symmetric key.
Returns
Promise<Uint8Array>
·
generated key.
encryptDataSymmetric
Encrypts buffer with a given key using AES.
Params
data
Uint8Array
buffer to encrypt
symmetricKey
Uint8Array
key used to encrypt data
Returns
Promise<Uint8Array>
·
encrypted data buffer
decryptDataSymmetric
Decrypts buffer with a given key using AES.
Params
data
Uint8Array
buffer to decrypt
symmetricKey
Uint8Array
key used to decrypt data
Returns
Promise<Uint8Array>
·
plain (decrypted) data buffer
convertPEMKeytoWIFKey
Converts given private key in PEM format to its WIF format.
Params
pemKey
string
private key to convert
Returns
Promise<string>
·
private key in WIF format
generateBip39
Generates ECC key and BIP-39 mnemonic from a password using BIP-39.
Params
strength
number
size of BIP-39 entropy, must be a multiple of 32
password
string
the password used to generate the Key
Returns
Promise<BIP39>
·
object containing ECC Key and associated with it BIP-39 mnemonic and entropy
fromMnemonic
Generates ECC key using BIP-39 mnemonic.
Params
mnemonic
string
the BIP-39 entropy used to generate the Key
password
string
the password used to generate the Key
Returns
Promise<BIP39>
·
BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
fromEntropy
Generates ECC key using BIP-39 entropy.
Params
entropy
Uint8Array
the BIP-39 entropy used to generate the Key
password
string
the password used to generate the Key
Returns
Promise<BIP39>
·
object containing ECC Key and associated with it BIP-39 mnemonic and entropy
entropyToMnemonic
Converts BIP-39 entropy to mnemonic.
Params
entropy
Uint8Array
BIP-39 entropy
Returns
Promise<string>
·
BIP-39 mnemonic
mnemonicToEntropy
Converts BIP-39 mnemonic to entropy.
Params
mnemonic
string
BIP-39 mnemonic
Returns
Promise<Uint8Array>
·
BIP-39 entropy
mnemonicToSeed
Generates a seed used to generate a key using BIP-39 mnemonic with PBKDF2.
Params
mnemonic
string
BIP-39 mnemonic
password
string
the password used to generate the seed
Returns
Promise<Uint8Array>
·
generated seed
We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.