toip.tools

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/eventlogView source
TypeScriptImport
import { checkTrailRef } from "@toip-tools/eventlog";

Declaration

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

Parameters

refrequired
{ i: Qb64; s: string | number; d: Qb64; }
witnessrequired
WitnessClient
optsoptional
VerifyOptions

Default: {}

Fields of opts
allowUnwitnessedoptional
boolean | undefined

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

firstSeenoptional
LogStore | undefined

Compare with this store's first-seen copies.

clockoptional
Clock | undefined
verifySigoptional
((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.

webauthnoptional
false | WebAuthnPolicy | undefined

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

Returns

Promise<TrailRefCheck>