Keystore.scrypt
Derives a key from a password using scrypt.
Imports
Named
import { Keystore } from 'ox'
Examples
import { Keystore } from 'ox'
const [key, opts] = Keystore.scrypt({ password: 'testpassword' })
Definition
function scrypt(
options: scrypt.Options,
): [() => `0x${string}`, {
readonly iv: Uint8Array | `0x${string}` | undefined;
readonly kdfparams: {
readonly dklen: 32;
readonly n: number;
readonly p: number;
readonly r: number;
readonly salt: string;
};
readonly kdf: "scrypt";
} & {
iv: Bytes.Bytes;
}]
Source: src/core/Keystore.ts
Parameters
options
- Type:
scrypt.Options
Scrypt options.
options.iv
- Type:
0x${string} | Uint8Array
- Optional
The counter to use for the AES-CTR encryption.
options.n
- Type:
number
- Optional
Cost factor.
options.p
- Type:
number
- Optional
Parallelization factor.
options.password
- Type:
string
Password to derive key from.
options.r
- Type:
number
- Optional
Block size.
options.salt
- Type:
0x${string} | Uint8Array
- Optional
Salt to use for key derivation.
Return Type
Scrypt key.
[() =>
0x${string}, { readonly iv: Uint8Array |
0x${string} | undefined; readonly kdfparams: { readonly dklen: 32; readonly n: number; readonly p: number; readonly r: number; readonly salt: string; }; readonly kdf: "scrypt"; } & { iv: Bytes.Bytes; }]