* 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
22 lines
705 B
Markdown
22 lines
705 B
Markdown
# kdf
|
|
|
|
Create Keys for use in encryption (rounds & salt) based on inputs
|
|
|
|
- [kdfAsU8a](#kdfasu8a) Create Uint8Array key based on inputs
|
|
|
|
## kdfAsU8a
|
|
|
|
Create Uint8Array key based on inputs
|
|
|
|
```js
|
|
kdfAsU8a (secret: Uint8Array | string, rounds?: number, salt?: Uint8Array): { key: Uint8Array, rounds: number, salt: Uint8Array }
|
|
```
|
|
|
|
|
|
From either a `string` or a `Uint8Array` input, create a key with an optional (or random) salt based on the number of rounds with Blake2. Return return the result key as a `Uint8Array` in addition to the salt used and rounds employed.
|
|
|
|
```js
|
|
import { kdfAsU8a } from '@polkadot/util-crypto';
|
|
|
|
kdfAsU8a('123') // => { key: Uint8Array, rounds: number, salt: Uint8Array }
|
|
``` |