# Bls.verify

Verifies a payload was signed by the provided public key(s).

## Imports

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

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

## Examples

```ts twoslash
import { Bls, Hex } from 'ox'

const payload = Hex.random(32)
const privateKey = Bls.randomPrivateKey()

const publicKey = Bls.getPublicKey({ privateKey })
const signature = Bls.sign({ payload, privateKey })

const verified = Bls.verify({
  // [!code focus]
  payload, // [!code focus]
  publicKey, // [!code focus]
  signature // [!code focus]
}) // [!code focus]
```

### Verify Aggregated Signatures

We can also pass a public key and signature that was aggregated with [`Bls.aggregate`](/api/Bls/aggregate) to `Bls.verify`.

```ts twoslash
import { Bls, Hex } from 'ox'

const payload = Hex.random(32)
const privateKeys = Array.from({ length: 100 }, () =>
  Bls.randomPrivateKey()
)

const publicKeys = privateKeys.map((privateKey) =>
  Bls.getPublicKey({ privateKey })
)
const signatures = privateKeys.map((privateKey) =>
  Bls.sign({ payload, privateKey })
)

const publicKey = Bls.aggregate(publicKeys) // [!code focus]
const signature = Bls.aggregate(signatures) // [!code focus]

const valid = Bls.verify({ payload, publicKey, signature }) // [!code focus]
```

## Definition

```ts
function verify(
  options: verify.Options,
): boolean
```

**Source:** [src/core/Bls.ts](https://github.com/wevm/ox/blob/main/src/core/Bls.ts#L767)

## Parameters

### options

* **Type:** `verify.Options`

Verification options.

#### options.payload

* **Type:** `0x${string} | Uint8Array`

Payload that was signed.

#### options.publicKey

* **Type:** `0x${string} | Uint8Array | { x: { c0: 0x${string}; c1: 0x${string}; }; y: { c0: 0x${string}; c1: 0x${string}; }; z: { c0: 0x${string}; c1: 0x${string}; }; }`

Public key (G2). Accepts a structured [`BlsPoint.G2`](/api/BlsPoint/types#g2), a hex
string, or a `Uint8Array`.

#### options.signature

* **Type:** `0x${string} | Uint8Array | { x: 0x${string}; y: 0x${string}; z: 0x${string}; }`

Signature (G1). Accepts a structured [`BlsPoint.G1`](/api/BlsPoint/types#g1), a hex
string, or a `Uint8Array`.

#### options.suite

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

Ciphersuite to use for verification. Defaults to "Basic".

## Return Type

Whether the payload was signed by the provided public key.

`boolean`
