# Keystore.engine

Compiles the WASM implementations of the [`Keystore`](/api/Keystore) synchronous key-derivation primitives, without installing them.

Most callers can use [`Engine.install`](/wasm/crypto/Engine/install). Install this factory explicitly when an application has benchmarked and selected WASM scrypt.

This provider stays synchronous and leaves AES and asynchronous key derivation on Ox's default implementation.

Scrypt uses a standalone artifact and grows memory only when called. WebAssembly cannot shrink that capacity. The provider clears its contents and enforces Noble's 1 GiB temporary-workspace limit.

The aggregate [`Engine.install`](/wasm/crypto/Engine/install) installs only PBKDF2 from this provider. Install this factory explicitly to opt into scrypt, whose relative performance depends on its parameters and runtime.

Copied inputs, derived output, and the complete workspace are cleared after every return or trap.

## Imports

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

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

## Examples

```ts twoslash
// @noErrors
import { Engine } from 'ox'
import { Keystore } from 'ox/wasm'

await Engine.install({ Keystore: Keystore.engine() })

Keystore.scrypt({ password: 'testpassword' })
```

## Definition

```ts
function engine(): Promise<engine.ReturnType>
```

**Source:** [src/wasm/Keystore.ts](https://github.com/wevm/ox/blob/main/src/wasm/Keystore.ts#L46)

## Return Type

The WASM implementations of synchronous PBKDF2-HMAC-SHA256 and scrypt.

`Promise<engine.ReturnType>`
