Crypto
Class representing instance of Crypto API
Methods
signData
Creates a signature of data using given key.
signData(data, privateKey)
Name | Type | Description |
---|---|---|
data | Uint8Array | buffer to sign |
privateKey | string | key used to sign data |
Type | Description |
---|---|
Promise<Uint8Array> | signature |
generatePrivateKey
Generates a new private ECC key.
generatePrivateKey(randomSeed)
Name | Type | Description |
---|---|---|
randomSeed | string | undefined | optional string used as the base to generate the new key |
Type | Description |
---|---|
Promise<string> | generated ECC key in WIF format |
derivePrivateKey
Generates a new private ECC key from a password using pbkdf2.
derivePrivateKey(password, salt)
Name | Type | Description |
---|---|---|
password | string | the password used to generate the new key |
salt | string | random string (additional input for the hashing function) |
Type | Description |
---|---|
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)
Name | Type | Description |
---|---|---|
privateKey | string | private ECC key in WIF format |
Type | Description |
---|---|
Promise<string> | generated ECC key in BASE58DER format |
generateKeySymmetric
Generates a new symmetric key.
generateKeySymmetric()
Type | Description |
---|---|
Promise<Uint8Array> | generated key. |
encryptDataSymmetric
Encrypts buffer with a given key using AES.
encryptDataSymmetric(data, symmetricKey)
Name | Type | Description |
---|---|---|
data | Uint8Array | buffer to encrypt |
symmetricKey | Uint8Array | key used to encrypt data |
Type | Description |
---|---|
Promise<Uint8Array> | encrypted data buffer |
decryptDataSymmetric
Decrypts buffer with a given key using AES.
decryptDataSymmetric(data, symmetricKey)
Name | Type | Description |
---|---|---|
data | Uint8Array | buffer to decrypt |
symmetricKey | Uint8Array | key used to decrypt data |
Type | Description |
---|---|
Promise<Uint8Array> | plain (decrypted) data buffer |
convertPEMKeytoWIFKey
Converts given private key in PEM format to its WIF format.
convertPEMKeytoWIFKey(pemKey)
Name | Type | Description |
---|---|---|
pemKey | string | private key to convert |
Type | Description |
---|---|
Promise<string> | private key in WIF format |