# Keystore.scryptAsync

Derives a key from a password using [scrypt](https://en.wikipedia.org/wiki/Scrypt).

## Imports

:::code-group
```ts [Named]
import { Keystore } from 'ox'
```

```ts [Entrypoint]
import * as Keystore from 'ox/Keystore'
```
:::

## Examples

```ts twoslash
import { Keystore } from 'ox'

const [key, opts] = await Keystore.scryptAsync({
  password: 'testpassword'
})
```

## Definition

```ts
function scryptAsync(
  options: scrypt.Options,
): Promise<[() => `0x${string}`, {
    readonly iv: `0x${string}` | Uint8Array | 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](https://github.com/wevm/ox/blob/main/src/core/Keystore.ts#L580)

## 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.

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