packages/session that defines the ttr+stepup proof and how a relying service authorizes it. It is one of
the Tuturuuu session slices.
Profile
No other member is accepted. The 60-second identity lifetime cap does not
apply to this class.
Canonical parameters
canonicalJson(value) sits beside parseStrictJson and is the only
serializer either side uses:
- values are
null, booleans, safe integers (with-0rejected), strings, arrays and plain objects. Binary values such as keys and digests are passed as canonical base64url strings; raw byte arrays are rejected, so both sides encode them the same way before hashing; a plain object is one whose prototype isObject.prototypeornulland that has only own enumerable string-keyed data properties; - object members sorted recursively by UTF-16 code unit order;
- no whitespace;
- strings escape only
",\and U+0000 to U+001F, the control characters as\u00XXin lowercase hex; lone surrogates are rejected; no Unicode normalization; - arrays keep their order;
undefined, functions, symbols, bigints, non-integer numbers, sparse arrays and any other object are rejected rather than dropped.
paramsHash(act, params) is SHA-256 over the UTF-8 bytes of
"ttr-stepup/v1|" + act + "|" + canonicalJson(params), with act checked
against the closed ttr+stepup act list first. The vault and Web import this function; neither
reimplements it. Golden vectors cover escapes, key order, nesting, null,
booleans, a null-prototype object and every rejected input.
Verification is not authorization
keysis the step-up class key lookup ({ key, class, notBefore, notAfter }) from slice 2a, and the verifier isverifyToken('stepup', …)followed by the checks below, so class, denial,notBeforeandnotAfterapply.- The verifier rejects a proof whose
subdiffers fromsubjectwithsubject_mismatch, and the consume port accepts a nonce only when its stored challenge belongs to thatsubject, so a proof minted for another user’s session cannot spend this user’s challenge. - The verifier checks signature, profile and times, requires
amr ⊆ allowedAmr ∩ { totp, passkey }, and comparesphwithconstantTimeEqualafter decoding exactly 32 bytes. The relying service computesexpectedParamsHashfrom its own stored challenge. StepUpVerifiedgrants nothing.authorizeStepUp(verified, port)callsconsume, and onlyconsumedauthorizes the action. The port accepts only a nonce the service issued for thatchallengeIdbefore minting, rejects a usedjtiornonce, and keeps both untilexp.unknown_nonceandreplayedare distinct failure reasons;unavailablefails closed.- The consume transaction stores only
jti,nonceandchallengeId. Afterconsumed,authorizeStepUpasks an injectedSessionLivenessPortwhethersidis live with generationgen. The port is an uncached, authoritative check with a fresh epoch read, never the 30-second read cache. Onlylivereturnsauthorized;revoked,supersededandunavailablefail closed, and the consumed nonce stays spent. - A relying service runs any charged or effectful step, such as a quota
charge or an evaluation, in a later transaction and only after
authorized, so a dead session or an unavailable liveness check never costs the user quota. - Tests cover a valid proof, each member’s violation,
pwdinamr, a wrongphlength, an unknown nonce, a replayedjti, a replayed nonce with a newjti, a 300-second proof accepted and a 301-second one rejected, consume failing closed, liveness returningrevoked,supersededandunavailablewith no charged step run, and a live proof whosesubis a different user.