* Allow keypair generation from input string * Add keyfile encryption/decryption * Pass secret through n rounds * Split definition types * Additional cleanups * Pass salt as blake2b input * Move kdf hashing to util-cypto * Dangling comma * Pull through secret as string | Uint8Array * Update documentation
1.9 KiB
1.9 KiB
nacl
Implements NaCl secret-key authenticated encryption, public-key authenticated encryption, hashing, and public-key signatures
- naclDecrypt Decrypts a message using the supplied secretKey and nonce
- naclEncrypt Encrypts a message using the supplied secretKey and nonce
- naclSign Signs a message using the supplied secretKey
- naclSign Verifies the signature on the supplied message.
naclDecrypt
Decrypts a message using the supplied secretKey and nonce
naclDecrypt (message: Uint8Array, secretKey: Uint8Array, nonce: Uint8Array): Uint8Array
Returns an decrypted message, using the secretKey and nonce.
import { naclDecrypt } from '@polkadot/util-crypto';
naclDecrypt([...], [...], [...]) // => [...]
naclEncrypt
Encrypts a message using the supplied secretKey and nonce
naclEncrypt (message: Uint8Array, secretKey: Uint8Array, nonce?: Uint8Array): { encrypted: Uint8Array, nonce: Uint8Array }
Returns an encrypted message, using the secretKey and nonce. If the nonce was not supplied, a random value is generated.
import { naclEncrypt } from '@polkadot/util-crypto';
naclSign([...], [...]) // => [...]
naclSign
Signs a message using the supplied secretKey
naclSign (message: Uint8Array, secretKey: Uint8Array): Uint8Array
Returns message signature of message, using the secretKey.
import { naclSign } from '@polkadot/util-crypto';
naclSign([...], [...]) // => [...]
naclSign
Verifies the signature on the supplied message.
naclVerify (message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean
Verifies the signature on message with the supplied plublicKey. Returns true on sucess, false otherwise.
import { naclVerify } from '@polkadot/util-crypto';
naclVerify([...], [...], [...]) // => true/false