Skip to content

Keystore.scryptAsync

Derives a key from a password using scrypt.

Imports

Named
import { Keystore } from 'ox'

Examples

import { Keystore } from 'ox'
 
const key = await Keystore.scryptAsync({ password: 'testpassword' })

Definition

function scryptAsync(
  options: scrypt.Options,
): Promise<{
    readonly iv: Uint8Array | `0x${string}` | undefined;
    readonly key: () => string;
    readonly kdfparams: {
        readonly dklen: 32;
        readonly n: number;
        readonly p: 8;
        readonly r: 1;
        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.password

  • Type: string

Password to derive key from.

options.salt

  • Type: 0x${string} | Uint8Array
  • Optional

Salt to use for key derivation.

Return Type

Scrypt key.

Promise<{ readonly iv: Uint8Array | 0x${string} | undefined; readonly key: () => string; readonly kdfparams: { readonly dklen: 32; readonly n: number; readonly p: 8; readonly r: 1; readonly salt: string; }; readonly kdf: "scrypt"; } & { iv: Bytes.Bytes; }>