function · Browser and Node

# checkTrailRef

Checks a trailRef {i, s, d} against a witness: fetches the entry, its receipts and the controller's KEL, and verifies them. Use httpWitnessClient inside a Trust Task handler, so the check doesn't await a TSP request.

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

Import:

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

## Declaration

Signature:

```ts
checkTrailRef(ref: {
    i: Qb64;
    s: string | number;
    d: Qb64;
}, witness: WitnessClient, opts?: VerifyOptions): Promise<TrailRefCheck>;
```

### Parameters

**`ref` (required)**

`{ i: Qb64; s: string | number; d: Qb64; }`

**`witness` (required)**

`WitnessClient`

**`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<TrailRefCheck>`

[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/checkTrailRef/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
