Skip to Content
atrib protocol docs

Verify a record

Check a record's signature, its place in the log, and its anchors, without trusting the explorer.

Checking a record answers three separate questions, each with its own evidence. Once you hold the evidence, every check runs offline. The inclusion and anchor checks are pure functions, so anyone with the same inputs gets the same answer.

QuestionEvidence
Did this key sign these bytes?The record and its creator_key.
Was the record in the log by a given point?An inclusion proof and a checkpoint.
Can someone other than the log vouch for it?One or more anchor proofs.
pnpm add @atrib/verify

The signature

import { verifyRecord } from '@atrib/verify'

const result = await verifyRecord(record)
// result.valid, result.signatureOk, result.warnings

verifyRecord serializes the record without signature using JCS, checks the Ed25519 signature against creator_key, and checks the record's shape: the spec version, a valid event_type URI, a 32-character context_id, and a timestamp no more than five minutes in the future. All of these must pass. The timestamp rule is the one input from outside: it reads the current time. A record that fails one of the shape checks is reported as a failed signature, with signatureOk: false, so check the fields before you suspect the key.

A valid signature proves the holder of that key signed the record. It does not prove the key belongs to anyone in particular. To tie a key to a name, look it up in the key directory or keep your own list of trusted keys.

The log

The log returns a proof bundle when a record is submitted, and anyone can fetch one later from https://log.atrib.dev/v1/proof/<hash>, where <hash> is the record hash as 64 hex characters without the sha256: prefix. The bundle holds an RFC 6962 inclusion proof and a checkpoint, the log's signed statement of its size and root hash.

To check it, rebuild the 90-byte log entry from the record, hash it as a leaf, walk the proof up to a root, and compare that root with the checkpoint. Then check the checkpoint's signature against the log's public key. Pin that key once, from https://log.atrib.dev/v1/pubkey, rather than fetching it on every check. The response gives the key as base64url in public_key, with the log's origin beside it. Decode it to bytes for verifyHandoffClaims:

const { public_key, origin } = await (await fetch('https://log.atrib.dev/v1/pubkey')).json()
const logPublicKey = new Uint8Array(Buffer.from(public_key, 'base64url'))

verifyHandoffClaims runs the signature and log checks together. It is built for an agent accepting another agent's record before citing it:

import { handoffClaimsFromEvidencePacket, verifyHandoffClaims } from '@atrib/verify'

const claims = handoffClaimsFromEvidencePacket({
  required_record_hashes: [recordHash],
  records: [{ record_hash: recordHash, record, proof }],
})

const result = await verifyHandoffClaims(claims, {
  trusted_creator_keys: [signerKey],
  require_log_inclusion: true,
  log_public_key: logPublicKey,
})
// result.all_accepted

Anchors

A proof from one log still asks you to trust that log's operator. An anchor is any independent service that accepts a 32-byte hash and later proves it existed by a stated time. atrib logs, Sigstore Rekor, RFC 3161 timestamp authorities and OpenTimestamps all qualify. Anyone can anchor an existing record later, without the signing key.

Pass the record's anchor proofs and your own trust policy to verifyRecord:

const result = await verifyRecord(record, {
  proofBundle: { record_hash, log_proofs },
  anchorTrust: {
    trust_material: {
      logs: {
        [logId]: {
          // keyed by the log_id each log_proofs entry names
          origin,
          pubkey_b64: Buffer.from(public_key, 'base64url').toString('base64'),
        },
      },
    },
  },
})
// result.anchor_plurality

proofBundle here is an anchor bundle, with one entry in log_proofs per anchor. It is not the log's proof bundle above: an atrib log entry also needs the log's id, the index and the 90-byte entry bytes. The entry shapes are in spec §2.11.3 and §2.11.9. anchorTrust takes each log's key as standard base64, not base64url.

The verifier counts anchors as independent by type and id. Two logs run by the same operator count as two unless you say otherwise in operator_groups. It checks atrib log and Rekor proofs in full. For RFC 3161 and OpenTimestamps proofs it checks only that they name this record's hash; it does not check the timestamp token or the .ots file itself, yet a complete proof that names the hash still counts toward plurality_met. Verify those proofs with their own tools before you rely on them.

What verification does not tell you

A record that passes every check was signed by that key and committed to the log when the proofs say. It does not show that the action did what the record claims, or that the records it cites shaped the decision. Evidence signed by someone else, such as a tool's own receipt or a counterparty's signature, is what narrows that gap.

See spec §1.4, §2.7 and §2.11.7 for the full procedures.