# Registration.verify

Verifies a WebAuthn registration (credential creation) response. Validates the `clientDataJSON`, `attestationObject`, authenticator flags, challenge, origin, and relying party ID, then extracts the credential ID and public key.

## Imports

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

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

## Examples

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

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

const result = Registration.verify({
  // [!code focus]
  credential, // [!code focus]
  challenge: '0x69abb4b5a0de4bc62a2a201f8d25bae9', // [!code focus]
  origin: 'https://example.com', // [!code focus]
  rpId: 'example.com' // [!code focus]
}) // [!code focus]
// @log: {
// @log:   credential: {
// @log:     id: 'oZ48...',
// @log:     publicKey: { prefix: 4, x: 51421...5123n, y: 12345...6789n },
// @log:   },
// @log:   counter: 0,
// @log:   userVerified: true,
// @log: }
```

## Definition

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

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

## Parameters

### options

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

Verification options.

#### options.attestation

* **Type:** `"required" | "none"`
* **Optional**

Attestation verification mode.

* `'none'` (default): accept `fmt: "none"` attestation (no cryptographic binding of authData to clientDataJSON).
* `'required'`: attestation signature must be present and valid (`packed` self-attestation).

#### options.attestationObject

* **Type:** `ArrayBuffer`

#### options.challenge

* **Type:** `0x${string} | Uint8Array | ((challenge: string) => boolean)`

Challenge to verify. Either the raw hex/bytes originally generated, or a
function that receives the base64url challenge string and returns whether
it is valid (for async/DB lookups).

#### options.clientDataJSON

* **Type:** `ArrayBuffer`

#### options.credential

* **Type:** `{ attestationObject: ArrayBuffer; clientDataJSON: ArrayBuffer; id?: string; raw?: PublicKeyCredential; }`

The credential response from `Registration.create()`.

#### options.id

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

#### options.origin

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

Expected origin(s) (e.g. `"https://example.com"`).

#### options.raw

* **Type:** `PublicKeyCredential`
* **Optional**

#### options.rpId

* **Type:** `string`

Relying party ID (e.g. `"example.com"`).

#### options.userVerification

* **Type:** `UserVerificationRequirement`
* **Optional**

The user verification requirement.

## Return Type

The verified registration result.

`verify.ReturnType`
