Jwt
A signed token (RFC 7519) in JWS compact form, three parts of unpadded Base64url joined by ., at most 8,192 characters; an unsecured token, with no signature, is never one. crypto.verify_jwt checks it. A secret value (chunk 5.5r2): never sent, logged, stored or shown, and compared in constant time.
Security; not ordered; since Jadpo 0.1.0.
Make one
It comes from outside your code, a secret value that never appears in it.
text.parse(raw, as: Jwt) reads one from its text; text that isn't one at all fails malformed, such as "".
Text, JSON and storage
text.parse reads one from its text, as it is typed. Nothing writes it: text.from and text.format don't take it, JSON writes it as "<redacted Jwt>", and it is never stored.
Shown to people
text.format doesn't take it: a Jwt is never shown.
Operations
crypto.verify_jwt(token: Jwt, keys: List<Jwk>, issuer: Text?, audience: Text?, as: Type?) -> JwtClaims: The registered claims oftokenonce it holds: signed by one ofkeyswith that key's own algorithm (Ed25519, RS256 for an RSA key, ES256 for a P-256 key), never the one the token names, sononeand every other algorithm failinvalid_signature; not expired, not used before itsnbfand not issued later than now, against the clock with 30 seconds' leeway (expired,not_yet_valid); issued byissuerwhen one is given (wrong_issuer); and foraudience, or for no audience when none is given (wrong_audience). A token that isn't one, or has noexp, ismalformed. Withas:, an object type of the application's, it gives instead the token's claims the type names, read asjson.readreads it, a registered one asJwtClaimsholds it, and failsmismatchwhen they aren't the type. It reads the clock, so it is called only in actions.
Like every standard type, it also has the contract's own operations: text.parse, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-jwt.md.Built from Jadpo main at e00e61f.