Skip to content
Wallet and Entity Collection draft updates
Documentation menu

6.9. Renew or revoke accreditation

Feature guides / 6. Trust Marks · Example context

The auditor renews Car Rental Company's approval after another assessment. Later, if the approval is withdrawn, it revokes the stored accreditation and Car Rental Company removes its publication. Mark and delegation expiry; Status values.

Keep renewal and revocation explicit

import type { TrustAnchor, Intermediate } from "@oidfed/authority";
import type { TrustMarkIssuerContext } from "@oidfed/core";
import type { Leaf } from "@oidfed/leaf";

type Issuer = Leaf | TrustAnchor | Intermediate;
const type = "https://licence-federation.example/marks/approved-verifier";
const subject = "https://car-rental.example";

export async function renewVerifierMark(auditor: Issuer, shop: Leaf, issuerEvidence: TrustMarkIssuerContext) {
  const jwt = await auditor.issueTrustMark(subject, type, { ttlSeconds: 600, renewal: "renew" });
  await shop.attachTrustMark(jwt, {
    issuerEvidence, expectedTrustMarkType: type, replacement: "same-issuer-and-type",
  });
}
export function revokeVerifierMarks(auditor: Issuer) {
  return auditor.revokeTrustMark(type, subject);
}
// The holder separately removes its publication with removeTrustMark({ issuer, trustMarkType }).

Renewal preserves earlier issued JWTs. revokeTrustMark(type, subject) revokes all active matching records belonging to this issuer. listTrustMarksForSubject(subject) reports currently eligible records. Revocation affects Status and Listing; removal affects the holder's EC. These operations need separate host authorization.

Delegation expiry participates in eligibility. Updating a delegation map does not rewrite existing JWTs; renew affected marks before their embedded delegation stops being valid. Policy setters replace owned configuration atomically and do not erase remote caches. Consumers decide whether their action needs a fresh Status response or can rely on evidence until its deadline.

Production adapters must serialize competing reuse, renewal, and revocation operations. Memory storage coordinates only this process. A deployment with multiple issuers or workers needs the same guarantees in its durable store.

Coordinate the issuer and holder

Renewal starts at the issuer, while publication happens at the holder. Arrange delivery of the replacement JWT, validate it, and update Car Rental Company's published references. The old JWT can remain in consumers' caches until its lifetime or the applicable status policy makes it unusable.

Revocation changes authoritative issuer state for matching marks. It cannot erase JWTs already copied elsewhere, so consumers need the verification and freshness policy appropriate to the federation. Record the administrative reason outside the public mark if it contains confidential information. Test both the issuer's subsequent response and the holder's updated publication.

Managed issuance, renewal, and policy updates

Authorities with storage.trustMarks use the shared issuer service for issuance, status, retrieval, and listing. A Trust Anchor can declare accepted issuers and owners; an Intermediate can issue marks without becoming a Trust Anchor.

import { type TrustAnchor } from "@oidfed/authority";

export async function maintainAccreditation(ta: TrustAnchor, subject: string, type: string) {
  const jwt = await ta.issueTrustMark(subject, type, {
    ttlSeconds: 600,
    renewal: "renew",
    logoUri: "https://auditor.example/logo.png",
    additionalClaims: { "organization_name#fr": "Car Rental Company" },
  });
  await ta.revokeTrustMark(type, subject);
  const remaining = await ta.listTrustMarksForSubject(subject);
  return { issuedJwt: jwt, remaining };
}

Default renewal: "reuse" returns an eligible stored JWT. Explicit options that conflict with that JWT fail; use renewal: "renew" to request new issuance. Renewal preserves earlier records and does not promise different JWT bytes within one clock tick. Revocation covers every active record issued by this authority for the type and subject. Listing and retrieval consider all candidates before selecting the newest eligible mark, so an expired delegation in a newer record cannot hide an older valid one. Selection uses exact issuer time and includes signature, profile, and delegation validity.

Lifetime precedence is per-call, per-type trustMarkDefaults, trustMarkIssuer.defaults, the authority-wide trustMarkTtlSeconds fallback, then the library default of 86,400 seconds. The authority-wide fallback applies to TrustAnchor and Intermediate; Leaf and standalone issuer services use their own configured defaults.

A selected lifetime mode replaces the lower-precedence mode as a whole: noExpiry: true omits exp, and a higher-precedence TTL restores an expiry. Supplying both noExpiry: true and ttlSeconds at the same level is an error. noExpiry: false selects the default expiring lifetime at that level, using 86,400 seconds if no TTL is supplied. Changing defaults affects new issuance. Use the keyring’s selection context to choose a signer by issuer, subject, or Trust Mark type. The issuer checks the resulting mark against its Federation Entity Keys before storage.

Use trustMarkIssuer.issuerEvidence to supply independently trusted owner policy for delegated issuance. Configure delegation JWTs with trustMarkDelegations, or replace them through setTrustMarkDelegations(). Owner approval and delivery happen outside Federation; listing an issuer in anchor policy does not replace a required owner delegation. issueTrustMarkDelegation(subject, type, options) supports explicit lifetime, reference, and extension claims.

setTrustMarkIssuers() and setTrustMarkOwners() are Trust Anchor operations. They validate and sign a prospective EC before replacing owned configuration. Inputs are copied, including nested owner keys. Local changes do not invalidate already cached evidence at other entities.

As holders, both authority classes expose getTrustMarks(), attachTrustMark(), fetchAndAttachTrustMark(), and removeTrustMark(). Attachment verifies the subject and issuer evidence before publishing. Removal changes the EC and does not revoke the issuer's record.

trustMarkStatusPolicy receives frozen { baseStatus, record } and may return a custom status and additional claims. It cannot revive an inactive mark or replace reserved response claims. trustMarkRequestExtensions registers per-parameter validation callbacks for the three endpoints; unknown parameters remain ignored. Callback failures produce controlled errors.

For shared advanced configuration, trustMarkIssuer accepts defaults, trustMarkDefaults, issuerEvidence, trustMarkStatusPolicy, and trustMarkRequestExtensions. When both are supplied, the top-level authority option overrides its nested equivalent. Prefer one location for each setting.

Next: 6.10. Verify older Trust Mark signatures after rotation

View source on GitHub