Skip to main content
reference

Crypto

Class representing instance of Crypto API

Methods

signData

Creates a signature of data using given key.

signData(data, privateKey)

NameTypeDescription
dataUint8Arraybuffer to sign
privateKeystringkey used to sign data

TypeDescription
Promise<Uint8Array> signature

generatePrivateKey

Generates a new private ECC key.

generatePrivateKey(randomSeed)

NameTypeDescription
randomSeedstring | undefinedoptional string used as the base to generate the new key

TypeDescription
Promise<string> generated ECC key in WIF format

derivePrivateKey

Generates a new private ECC key from a password using pbkdf2.

derivePrivateKey(password, salt)

NameTypeDescription
passwordstringthe password used to generate the new key
saltstringrandom string (additional input for the hashing function)

TypeDescription
Promise<string> generated ECC key in WIF format

derivePublicKey

Generates a new public ECC key as a pair to an existing private key.

derivePublicKey(privateKey)

NameTypeDescription
privateKeystringprivate ECC key in WIF format

TypeDescription
Promise<string> generated ECC key in BASE58DER format

generateKeySymmetric

Generates a new symmetric key.

generateKeySymmetric()

TypeDescription
Promise<Uint8Array> generated key.

encryptDataSymmetric

Encrypts buffer with a given key using AES.

encryptDataSymmetric(data, symmetricKey)

NameTypeDescription
dataUint8Arraybuffer to encrypt
symmetricKeyUint8Arraykey used to encrypt data

TypeDescription
Promise<Uint8Array> encrypted data buffer

decryptDataSymmetric

Decrypts buffer with a given key using AES.

decryptDataSymmetric(data, symmetricKey)

NameTypeDescription
dataUint8Arraybuffer to decrypt
symmetricKeyUint8Arraykey used to decrypt data

TypeDescription
Promise<Uint8Array> plain (decrypted) data buffer

convertPEMKeytoWIFKey

Converts given private key in PEM format to its WIF format.

convertPEMKeytoWIFKey(pemKey)

NameTypeDescription
pemKeystringprivate key to convert

TypeDescription
Promise<string> private key in WIF format