Skip to content
Wallet and Entity Collection draft updates
Documentation menu

6.6. Check the status of an exact Trust Mark JWT

Feature guides / 6. Trust Marks · Example context

Maya's wallet needs a current answer about the exact JWT it received. The auditor's signed Status response binds its answer to that token. Status endpoint; Wallet revocation guidance.

Ask with trusted issuer evidence

Wallet discovery supplies the verified mark and issuer context. Core's fetchTrustMarkStatus() is needed for the remote status request because the role has no equivalent method. An Authority can inspect its own issued records with getTrustMarkStatus(jwt); that local operation does not authenticate another issuer.

import type { CryptoEngine } from "@oidfed/crypto";
import { CredentialVerifierRole } from "@oidfed/wallet";
import { fetchTrustMarkStatus, type TrustAnchorSet } from "@oidfed/core";

export async function verifierStatus(engine: CryptoEngine, anchors: TrustAnchorSet) {
  const holder = await CredentialVerifierRole.discover("https://car-rental.example", anchors, {
    engine,
    trustMarkVerification: { mode: "resolve" },
  });
  if (!holder.ok) return holder;
  const mark = holder.value.trustChain.trustMarks.find(
    mark => mark.trustMarkType === "https://licence-federation.example/marks/approved-verifier",
  );
  if (!mark?.jwt || !mark.issuerEvidence) throw new Error("Verified issuer evidence is required");
  const status = await fetchTrustMarkStatus({
    engine,
    jwt: mark.jwt, issuerEvidence: mark.issuerEvidence,
    expectedSubject: holder.value.entityId, expectedTrustMarkType: mark.trustMarkType,
    freshness: { maxAgeSeconds: 60 },
  });
  if (!status.ok) return status;
  if (status.value.status !== "active") throw new Error("Accreditation is not active");
  return status;
}

Without freshness, a signed response can be accepted regardless of its age. The object overload still rejects future timestamps beyond the configured clock tolerance. Car Rental Company's verifier sets the age limit above because it needs recent status; signature verification alone does not provide that assurance.

The maximum age is an application choice. The helper checks signature, issuer, exact token, time, and proof expiry. It supports the spec's signed-status alternative without first requiring local verification of the mark signature. Only active means active; extensions may define other statuses. A returned verificationExpiresAt does not refresh when a cached result is read again.

This request reveals the JWT being checked. If the application only needs membership, type-only Listing avoids sending the subject; short-lived marks are another §19.2 option. Listing cannot establish the status of this exact JWT.

An issuer's trustMarkStatusPolicy can add claims or report a framework status such as suspension. It receives immutable base status and record data and cannot turn an inactive mark into active. Unknown JWTs receive 404. The older positional fetchTrustMarkStatus(endpoint, jwt, keys, options) remains available for low-level composition.

A status callback can take time while the auditor checks its records. The issuer rechecks eligibility before returning active. If the mark or its delegation expires while the response is being signed, the operation fails instead of returning stale active evidence. A local Resolve assessment also respects the auditor's custom status, such as suspended.

Choose a useful freshness window

A signed active response describes the issuer's answer at its iat. Maya's wallet must decide how recent that answer must be for this transaction. Configure the evidence-aware client's freshness options for the risk of the operation, and treat a stale or unverifiable answer as an unsuccessful status check.

The query identifies the mark being checked to the issuer. If that disclosure matters, consider a type-only Listing query or suitably short-lived marks, as Federation's privacy guidance describes. This choice belongs to the integrator; it does not require a different privacy-specific API. A successful status answer still does not replace issuer or holder trust validation.

Choose a response-age policy

The object overload of fetchTrustMarkStatus() uses a trusted issuer context and binds the signed response to the exact JWT. It supports the signed-status verification alternative in §7.3, so it does not require the caller to verify that JWT's signature locally first.

import type { CryptoEngine } from "@oidfed/crypto";
import { fetchTrustMarkStatus } from "@oidfed/core";
import { type FederationTrustMarkIssuerEvidence } from "@oidfed/core";

export async function checkAuditorStatus(
  engine: CryptoEngine,
  rawTrustMarkJwt: string,
  issuerEvidence: FederationTrustMarkIssuerEvidence,
) {
  const status = await fetchTrustMarkStatus({
    engine,
    jwt: rawTrustMarkJwt,
    issuerEvidence,
    expectedSubject: "https://car-rental.example",
    expectedTrustMarkType: "https://licence-federation.example/marks/approved-verifier",
    freshness: { maxAgeSeconds: 60 }, // Application policy, not a specification default.
  });
  if (!status.ok) throw new Error(status.error.description);
  if (status.value.status !== "active") throw new Error("Accreditation is not active");
  return status;
}

Omitting freshness imposes no maximum response age. The object overload still rejects future iat values beyond the configured clock tolerance, but an old signed active response does not establish recent status. Choose freshness.maxAgeSeconds when your application needs that guarantee; Federation defines no universal age limit.

Additional status strings and claims are preserved; treat only active as active. The evidence-aware object overload rejects future-issued responses with the configured clock tolerance. A selected maximum age and any issuer-proof or response expiry bound verificationExpiresAt. Re-reading a result does not renew that deadline. The existing positional fetchTrustMarkStatus(endpoint, jwt, keys, options) overload remains available.

Status queries reveal the exact JWT being checked. fetchTrustMarkList(endpoint, { trustMarkType }) omits the subject and lets the application test membership locally; { trustMarkType, sub } narrows the response but discloses the subject. Listing membership does not prove that a particular JWT remains active. These are the privacy choices described in §19.2.

Next: 6.7. Check whether a subject is currently listed for a mark type

View source on GitHub