# Authentication.verify

Verifies a signature using the Credential's public key and the challenge which was signed.

## Imports

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

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

## Examples

```ts twoslash
import { Registration, Authentication } from 'ox/webauthn'

const credential = await Registration.create({
  name: 'Example'
})

const { metadata, signature } = await Authentication.sign({
  credentialId: credential.id,
  challenge: '0xdeadbeef'
})

const result = Authentication.verify({
  // [!code focus]
  metadata, // [!code focus]
  challenge: '0xdeadbeef', // [!code focus]
  publicKey: credential.publicKey, // [!code focus]
  signature // [!code focus]
}) // [!code focus]
// @log: true
```

## Definition

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

**Source:** [src/webauthn/Authentication.ts](https://github.com/wevm/ox/blob/main/src/webauthn/Authentication.ts#L702)

## Parameters

### options

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

Options.

#### options.challenge

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

The challenge to verify.

#### options.metadata

* **Type:** `{ authenticatorData: 0x${string}; challengeIndex?: number; clientDataJSON: string; typeIndex?: number; userVerificationRequired?: boolean; }`

The metadata to verify the signature with.

#### options.origin

* **Type:** `string | string[]`
* **Optional**

Expected origin(s). If provided, the `clientDataJSON` origin will be validated.

#### options.publicKey

* **Type:** `{ prefix: number; x: 0x${string}; y: 0x${string}; }`

The public key to verify the signature with.

#### options.rpId

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

Expected relying party ID. If provided, the `rpIdHash` in `authenticatorData` will be validated.

#### options.signature

* **Type:** `{ r: 0x${string}; s: 0x${string}; yParity?: number; }`

The signature to verify.

## Return Type

Whether the signature is valid.

`boolean`
