# Keystore

WASM implementation of Ox's synchronous PBKDF2-HMAC-SHA256 primitive.

## Examples

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

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

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

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Keystore.decrypt`](/wasm/crypto/Keystore/decrypt) | Decrypts a [JSON keystore](https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/) into a private key. |
| [`Keystore.encrypt`](/wasm/crypto/Keystore/encrypt) | Encrypts a private key as a [JSON keystore](https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/) using a derived key. |
| [`Keystore.engine`](/wasm/crypto/Keystore/engine) | Compiles the WASM implementation of the [`Keystore`](/api/Keystore) PBKDF2 primitive, without installing it. |
| [`Keystore.pbkdf2`](/wasm/crypto/Keystore/pbkdf2) | Derives a key from a password using [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2). |
| [`Keystore.pbkdf2Async`](/wasm/crypto/Keystore/pbkdf2Async) | Derives a key from a password using [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2). |
| [`Keystore.scrypt`](/wasm/crypto/Keystore/scrypt) | Derives a key from a password using [scrypt](https://en.wikipedia.org/wiki/Scrypt). |
| [`Keystore.scryptAsync`](/wasm/crypto/Keystore/scryptAsync) | Derives a key from a password using [scrypt](https://en.wikipedia.org/wiki/Scrypt). |
| [`Keystore.toKey`](/wasm/crypto/Keystore/toKey) | Extracts a Key from a JSON Keystore to use for decryption. |
| [`Keystore.toKeyAsync`](/wasm/crypto/Keystore/toKeyAsync) | Extracts a Key asynchronously from a JSON Keystore to use for decryption. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Keystore.MemoryError`](/wasm/crypto/Keystore/errors#keystorememoryerror) | Thrown when a WASM module cannot grow its memory to the required size. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Keystore.DeriveOpts`](/wasm/crypto/Keystore/types#keystorederiveopts) | Derivation Options. |
| [`Keystore.Key`](/wasm/crypto/Keystore/types#keystorekey) | Key. |
| [`Keystore.Keystore`](/wasm/crypto/Keystore/types#keystorekeystore) | Keystore. |
| [`Keystore.Pbkdf2DeriveOpts`](/wasm/crypto/Keystore/types#keystorepbkdf2deriveopts) | PBKDF2 Derivation Options. |
| [`Keystore.ScryptDeriveOpts`](/wasm/crypto/Keystore/types#keystorescryptderiveopts) | Scrypt Derivation Options. |
