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

# AesGcm.decrypt

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

Decrypts encrypted data using AES-GCM.

## Imports

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

## Examples

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

const key = await AesGcm.getKey({ password: 'qwerty' })
const secret = Hex.fromString('i am a secret message')

const encrypted = await AesGcm.encrypt(secret, key)

const decrypted = await AesGcm.decrypt(encrypted, key) // [!code focus]
// @log: Hex.fromString('i am a secret message')
```

## Definition

```ts
function decrypt<value, as>(
  value: value | Bytes.Bytes | Hex.Hex,
  key: CryptoKey,
  options?: decrypt.Options<as>,
): Promise<decrypt.ReturnType<as>>
```

## Parameters

### value

* **Type:** `value | Bytes.Bytes | Hex.Hex`

The data to encrypt.

### key

* **Type:** `CryptoKey`

The `CryptoKey` to use for encryption.

### options

* **Type:** `decrypt.Options<as>`
* **Optional**

Decryption options.

#### options.as

* **Type:** `as | "Bytes" | "Hex"`
* **Optional**

The output format.

## Return Type

The decrypted data.

`Promise<decrypt.ReturnType<as>>`
