Documentation
¶
Overview ¶
Package statuslist implements EUDI credential revocation checking: the IETF Token Status List mechanism (draft-ietf-oauth-status-list) in JWT and CWT form, and the ARF Attestation Revocation List ("Identifier List") mechanism (ARF 2.9 Topic 7). It is framework-free: Fetcher, Cache and the clock are injected, all JOSE/COSE verification goes through go-eudi-crypto, and no attribute values ever appear in errors or provenance.
Index ¶
Constants ¶
const DefaultMaxDecompressed = 1 << 20 // 1 MiB ⇒ up to ~8.3M single-bit entries
DefaultMaxDecompressed caps the inflated status list byte array (zip-bomb defence). Overridable via WithMaxDecompressed.
const ShortLivedThreshold = 24 * time.Hour
ShortLivedThreshold is the ARF Topic 7 VCR_01 validity below which a revocation check is exempt. The 24h value originates from ETSI EN 319 411-1 v1.4.1 REV-6.2.4-03A and is not configurable.
Variables ¶
var ( ErrUnsupported = errors.New("statuslist: unsupported reference kind or token format") ErrFetch = errors.New("statuslist: status list could not be fetched") ErrKeyUnresolved = errors.New("statuslist: issuer key could not be resolved") ErrVerify = errors.New("statuslist: status list token signature verification failed") ErrMalformed = errors.New("statuslist: malformed status list token") ErrSubMismatch = errors.New("statuslist: token sub does not equal the referenced list URI") ErrUnknownBitWidth = errors.New("statuslist: status list bits must be 1, 2, 4 or 8") ErrIndexOutOfRange = errors.New("statuslist: status index out of range for the list") ErrDecompress = errors.New("statuslist: status list decompression failed") ErrDecompressTooBig = errors.New("statuslist: decompressed status list exceeds size cap") ErrExpired = errors.New("statuslist: status list token expired beyond MaxStale") // ErrWrongType is returned when a Status List Token's `typ` (JOSE header / // COSE label 16) is absent or not the expected status-list media type // ([Token Status List §5.1/§5.2]). Fail closed. ErrWrongType = errors.New("statuslist: wrong or missing typ") // ErrIssuedInFuture is returned when a token's iat is later than now+ClockSkew // ([Token Status List §5] / RFC 8392 iat). Fail closed. ErrIssuedInFuture = errors.New("statuslist: token issued in the future") )
Sentinel errors. Framework-free: callers (eudi-verifier-core) map these to problem codes — a StatusRevoked/StatusSuspended verdict to err:revocation:revoked (suspended=true detail), an inconclusive result to err:revocation:unavailable. None carry attribute values; they may carry list URIs, indices and kids.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Get(key string) ([]byte, bool)
Set(key string, val []byte, ttl time.Duration)
}
Cache is an opaque, TTL-aware byte cache for fetched lists. It enforces its own expiry: Get returns ok=false once an entry's ttl has elapsed.
type CheckInput ¶
type CheckInput struct {
Ref StatusRef
IssuerKeyResolver KeyResolver
Policy Policy
// CredentialValidity is the referenced credential's remaining technical
// validity. When 0 < CredentialValidity < ShortLivedThreshold the check is
// skipped (ARF Topic 7 VCR_01). Zero means "unknown" ⇒ never skip.
CredentialValidity time.Duration
}
CheckInput is one revocation query.
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker performs revocation checks. Construct with NewChecker.
func NewChecker ¶
NewChecker returns a Checker. cache may be nil (caching disabled).
func (*Checker) Check ¶
func (c *Checker) Check(ctx context.Context, in CheckInput) (Status, Provenance, error)
Check resolves the revocation status of the referenced credential. Fail closed by default: an inconclusive result returns StatusUnknown with a non-nil error unless the client policy explicitly opts into fail-open (Policy.AllowFailOpen == true).
The ARF Topic 7 VCR_01 short-lived exemption is applied first, before any fetch (Task 6).
type Fetcher ¶
Fetcher retrieves a status list / identifier list document by URI. In services it wraps the platform-kit httpclient (correlation propagation); in tests it is a fake with no network (framework-free; no network in unit tests).
type KeyResolver ¶
type KeyResolver func(ctx context.Context, listURI string, token []byte) (stdcrypto.PublicKey, error)
KeyResolver resolves the verification key of a status list token's issuer. It is injected so trust-anchor resolution stays in the trust layer: go-statuslist never dereferences jku/x5u/kid to fetch keys. It receives the list URI and the raw (unverified) token, from which a trust resolver may read the kid / x5c header to select the key.
type Option ¶
type Option func(*Checker)
Option configures a Checker.
func WithClock ¶
WithClock injects the clock used for exp/ttl/short-lived reasoning (no wall clock). Ignored if nil.
func WithClockSkew ¶
WithClockSkew tolerates a clock difference between issuer and verifier when checking iat (not-in-future) and exp ([Token Status List §5]). It is distinct from Policy.MaxStale, which is a deliberate staleness grace beyond exp; the two compose. Values < 0 are ignored.
func WithMaxDecompressed ¶
WithMaxDecompressed overrides the inflated-size cap (zip-bomb defence). Values <= 0 are ignored.
type Outcome ¶
type Outcome string
Outcome records HOW a status verdict was reached. It is a stable, value-free string surfaced verbatim in the verification report (fail closed).
const ( OutcomeChecked Outcome = "checked" // list fetched, verified, entry read OutcomeCached Outcome = "checked-cached" // served from a fresh cache entry OutcomeSkippedShortLived Outcome = "skipped-short-lived" // ARF Topic 7 VCR_01 <24h exemption OutcomeSkippedFailOpen Outcome = "skipped-fail-open" // inconclusive + explicit fail-open flag (AllowFailOpen=true) )
Outcome values.
type Policy ¶
type Policy struct {
AllowFailOpen bool // false (zero value): inconclusive status ⇒ error; true: ⇒ StatusUnknown, recorded fail-open
MaxStale time.Duration // grace beyond a token's exp during which a served list is still accepted (marked Stale)
}
Policy is the per-client revocation policy (fail-closed default). The zero value is fail-closed; AllowFailOpen is the explicit per-client opt-out that is recorded in Provenance and shown in the verification report.
type Provenance ¶
type Provenance struct {
Mechanism string // "token-status-list" | "identifier-list"
URI string // list URI consulted (StatusRef.URI)
Format string // "jwt" | "cwt" | ""
Index int // token status list entry index consulted
ID string // identifier consulted (identifier list)
Bits int // status list bit width (token status list)
Outcome Outcome // how the verdict was reached
FromCache bool // served from cache
Stale bool // served within the MaxStale grace past the token exp
FailOpen bool // policy allowed proceeding without a conclusive status
CheckedAt time.Time // clock() at the moment of the check
}
Provenance records how a verdict was reached; identifiers and outcomes only, never attribute values. Embedded verbatim in the stored verification report.
type RefKind ¶
type RefKind int
RefKind selects the revocation mechanism. A Relying Party that verifies revocation must support both (ARF Topic 7 VCR_12).
type Status ¶
type Status int
Status is the resolved revocation status of a referenced credential. The first four values map to [Token Status List §7] status types; a fetched list entry only ever produces one of them.
const ( StatusValid Status = iota // [Token Status List §7]: 0x00 VALID StatusRevoked // [Token Status List §7]: 0x01 INVALID StatusSuspended // [Token Status List §7]: 0x02 SUSPENDED StatusUnknown // status type unrecognised, or status not determinable under policy // StatusSkippedShortLived is NOT a Token Status List value: Check returns // it when the ARF Topic 7 VCR_01 <24h validity exemption legitimately // skips the check. It is mirrored in Provenance.Outcome // (OutcomeSkippedShortLived) so it appears verbatim in the verification // report. Grouped separately from the four real status values on purpose. StatusSkippedShortLived )
Status values. The first four map to [Token Status List §7] status types.
type StatusRef ¶
type StatusRef struct {
Kind RefKind
URI string // status list / identifier list URI (status_list.uri)
Index int // token status list entry index (status_list.idx); RefTokenStatusList
ID string // credential identifier; RefIdentifierList
Format TokenFormat // encoding hint for the fetched token; FormatAuto sniffs
}
StatusRef identifies the revocation datum to consult. The caller extracts it from a credential's status claim: [Token Status List §6] status_list{uri, idx} for RefTokenStatusList, or the credential identifier + list URI for RefIdentifierList.
type TokenFormat ¶
type TokenFormat int
TokenFormat selects the status list token encoding; FormatAuto sniffs.
const ( FormatAuto TokenFormat = iota // compact JWS ⇒ JWT, else CWT FormatJWT // [Token Status List §5.1] (statuslist+jwt) FormatCWT // [Token Status List §5.2] (application/statuslist+cwt) )
TokenFormat values.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package spec holds the on-the-wire constants of the IETF Token Status List (draft-ietf-oauth-status-list-12) that this verifier and any interoperating issuer must agree on.
|
Package spec holds the on-the-wire constants of the IETF Token Status List (draft-ietf-oauth-status-list-12) that this verifier and any interoperating issuer must agree on. |