function · Browser and Node

# verifySignature

Checks a signature made outside the log against the key state it names, and whether it was anchored while that key was current.

`@toip-tools/eventlog` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/eventlog/src/verify.ts#L75)

Import:

```ts
import { verifySignature } from "@toip-tools/eventlog";
```

## Declaration

Signature:

```ts
verifySignature(input: {
    bytes: Uint8Array;
    sig: KeyRefSig;
    kel: KelResult;
    trails?: TrailResult[];
}, opts?: VerifyOptions): Promise<SignatureCheck>;
```

### Parameters

**`input` (required)**

`{ bytes: Uint8Array; sig: KeyRefSig; kel: KelResult; trails?: TrailResult[]; }`

**Fields of `input`**

- **`bytes` (required)**: `Uint8Array<ArrayBufferLike>`
- **`sig` (required)**: `KeyRefSig`
- **`kel` (required)**: `KelResult`
- **`trails` (optional)**: `TrailResult[] | undefined`

**`opts` (optional)**

`VerifyOptions`

Default: `{}`

**Fields of `opts`**

**`allowUnwitnessed` (optional)**

`boolean | undefined`

Don't require witness receipts (a controller checking its own log).

**`firstSeen` (optional)**

`LogStore | undefined`

Compare with this store's first-seen copies.

**`clock` (optional)**

`Clock | undefined`

**`verifySig` (optional)**

`((input: { key: Qb64; message: Uint8Array; sig: IndexedSig; }) => Promise<boolean | undefined> | boolean | undefined) | undefined`

A pluggable verifier, tried first. Return undefined to fall back to the built-in checks.

**`webauthn` (optional)**

`false | WebAuthnPolicy | undefined`

How to check WebAuthn-wrapped signatures. `false` rejects them.

### Returns

`Promise<SignatureCheck>`

[Usage guide](https://toip.tools/toolkit/eventlog/#usage) · [Error handling](https://toip.tools/toolkit/eventlog/#errors) · [All exports](https://toip.tools/toolkit/eventlog/api/)

---

This is the Markdown version of https://toip.tools/toolkit/eventlog/api/verifySignature/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
