Token Status List (draft-ietf-oauth-status-list), issuer and verifier
README.md

status-list #

Token Status List
(draft-ietf-oauth-status-list):
the status of a referenced token, such as an SD-JWT VC, kept as an entry of
1, 2, 4 or 8 bits in a compressed list its issuer publishes as a signed
Status List Token. HAIP 1.0 section 6.1 makes it the status mechanism of
SD-JWT VC.

  • Status_list.t is the list: a byte array of fixed-width entries, which
    travels as a ZLIB stream (RFC 1950, RFC 1951).
  • Status_list.Status is an entry's value: VALID, INVALID, SUSPENDED or
    another the application gives a meaning.
  • Status_list.Reference is the status claim a referenced token carries:
    an index and the URI of the list.
  • Status_list.Jwt_token and Status_list.Cwt_token sign and verify the
    two forms of the token, through nox-jwt and through cose, over the claims
    of Status_list.Token.
  • Status_list.Issuer allocates random indices, sets statuses and gives the
    token's claims.
  • status-list.eio fetches a token over HTTP with requests.

The core reads no clock and does no I/O: a verifier passes the token's bytes
and the time.

An issuer and a verifier #

# let key =
    match Crypto_ec.P256.Dsa.priv_of_octets (String.make 31 '\000' ^ "\001") with
    | Ok priv -> Jwt.Jwk.of_private_key (`P256 priv)
    | Error _ -> assert false;;
val key : Jwt.Jwk.t = <abstr>
# let time n = Option.get (Ptime.of_span (Ptime.Span.of_int_s n));;
val time : int -> Ptime.t = <fun>
# let g = Crypto_rng.v ~seed:"readme" (module Crypto_rng.Fortuna);;
val g : Crypto_rng.g = <abstr>
# let issuer = Status_list.Issuer.v ~uri:"https://example.com/statuslists/1" 1024;;
val issuer : Status_list.Issuer.t = <abstr>
# let reference = Result.get_ok (Status_list.Issuer.allocate ~g issuer);;
val reference : Status_list.Reference.t = <abstr>
# Status_list.Issuer.set issuer (Status_list.Reference.idx reference)
    Status_list.Status.Invalid;;
- : unit = ()
# let token =
    Status_list.Issuer.token ~iat:(time 1686920170) ~exp:(time 2291720170)
      ~ttl:43200 issuer
    |> Status_list.Jwt_token.sign ~alg:Jwt.Algorithm.ES256 ~key ~kid:"12"
    |> Result.get_ok;;
val token : string =
  ...
# let public = Option.get (Jwt.Jwk.public key);;
val public : Jwt.Jwk.t = <abstr>
# Result.bind
    (Status_list.Jwt_token.verify ~key:public token)
    (Status_list.Token.check ~now:(time 1686920200) reference)
  |> Result.get_ok
  |> Fmt.str "%a" Status_list.Status.pp;;
- : string = "INVALID"

A verifier that fetches the token itself calls Status_list_eio.check, which
asks for application/statuslist+jwt, refuses a response of another media
type, and passes the time it read the token as fetched_at, so that a copy
older than its ttl is refused as stale.

References #