fix(auth): realign vti-didcomm-js REST auth to the current VTA wire contract (D8-F2) - #5
Merged
Merged
Conversation
This was referenced Jul 16, 2026
vta-rest-auth.js sent the removed legacy DIDComm message types (https://affinidi.com/atm/1.0/authenticate[/refresh]) and parsed response envelopes the VTA stopped emitting months ago ({sessionId, data:{challenge}} and {data:{accessToken,...}}), so REST auth via this library could not succeed against a current VTA. Verified against vta-service/src/routes/auth.rs and the generated vta-sdk protocols::auth wire types: - send https://trusttasks.org/spec/auth/authenticate/0.1 and .../auth/refresh/0.1 (the constants the VTA's msg.typ check accepts); - parse the flat ChallengeResponse {challenge, sessionId, expiresAt} (no data envelope); - parse AuthenticateResponse {session, tokens}, converting the OAuth-style relative expiresIn/refreshExpiresIn to absolute Unix-second accessExpiresAt/refreshExpiresAt against session.issuedAt (mirrors AuthenticateResponse::{access,refresh}_expires_at_epoch), so the public authenticate()/refresh() return contract is unchanged. Challenge request still sends {did} (current VTA accepts it as a one-release alias of the canonical subject). Tests updated to the current shapes. Bump 0.6.0 -> 0.6.1; also corrects the long-stale package-lock version field (0.2.0 -> 0.6.1). Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
stormer78
force-pushed
the
fix/rest-auth-current-wire
branch
from
July 16, 2026 03:37
82c4f05 to
208a47e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
src/vta-rest-auth.jswas speaking a wire contract the VTA hasn't emitted oraccepted in months, so REST authentication via this library could not succeed
against a current VTA at all (D8-F2 in the networking-remediation plan).
Two independent drifts, both verified against
vta-service/src/routes/auth.rsand the generated
vta-sdk::protocols::authtypes:https://affinidi.com/atm/1.0/authenticatehttps://trusttasks.org/spec/auth/authenticate/0.1.../atm/1.0/authenticate/refreshhttps://trusttasks.org/spec/auth/refresh/0.1{ sessionId, data: { challenge } }ChallengeResponse{ challenge, sessionId, expiresAt }{ data: { accessToken, accessExpiresAt, … } }AuthenticateResponse{ session, tokens }The legacy message-type aliases were explicitly removed server-side (
auth.rs:179/
auth.rs:350reject anything else); theMessage.typthe VTA checks maps fromthe DIDComm plaintext
typefield (#[serde(rename = "type")]), which is whatthese constants set.
Relative → absolute lifetimes
The current
TokenBundlecarries OAuth 2.0-style relative lifetimes(
expiresIn/refreshExpiresIn, seconds from issuance), not absolutetimestamps. The library now converts them to absolute Unix-second
accessExpiresAt/refreshExpiresAtagainstsession.issuedAt— mirroring theRust
AuthenticateResponse::{access,refresh}_expires_at_epochhelpers — so thepublic
authenticate()/refresh()return contract is unchanged.Deliberately unchanged
The challenge request still sends
{ did }: the currentChallengeRequestaccepts it as a one-release deserialize alias of the canonical
subject, so{ did }works against both current and not-yet-upgraded VTAs. A comment notessubjectis canonical for when the alias is removed.Tests
test/vta-rest-auth.test.jsupdated to the current wire shapes (flatchallenge,
{ session, tokens }, new message types, relative→absolute expiryassertions).
roundtrip-rustvectors that needthe pre-built Rust helper), 0 fail.
npm run build:typesclean.Version
0.6.0 → 0.6.1(patch — fixes a broken path to match the server). Also correctsthe
package-lock.jsonversionfield, stale at 0.2.0 since before 0.4.Part of D8 (browser / JS-client interop). This is R3.6 (verify message
type + shape against the current Rust server) applied to the auth path.