> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://viem-oon1tnou6-wevm.vercel.app/api/mcp` to find what you need.

# AesGcm.fromMnemonic

:::info
`AesGcm.fromMnemonic` is a re-export of ox's [`AesGcm.fromMnemonic`](https://oxlib.sh/api/AesGcm/fromMnemonic). Refer to the ox documentation for the full reference.
:::

Derives an AES-256-GCM key from a BIP-39 mnemonic.

This is equivalent to passing `Mnemonic.toSeed(mnemonic, { passphrase })` to [`AesGcm.fromSeed`](/docs/utilities/aesgcm/fromSeed).

## Imports

```ts
import { AesGcm } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { AesGcm } from 'viem/utils'

const key = await AesGcm.fromMnemonic(
  'test test test test test test test test test test test junk'
)
```

## Definition

```ts
function fromMnemonic(
  mnemonic: string,
  options?: fromMnemonic.Options,
): Promise<CryptoKey>
```

## Parameters

### mnemonic

* **Type:** `string`

BIP-39 mnemonic phrase.

### options

* **Type:** `fromMnemonic.Options`
* **Optional**

Options.

#### options.passphrase

* **Type:** `string`
* **Optional**

Optional BIP-39 passphrase.

## Return Type

A nonextractable AES-256-GCM key for encryption and decryption.

`Promise<CryptoKey>`
