Repository navigation
feat!: add taskDigestMultibase, so a VWC binds to the witness/session it cites - #31
Merged
Merged
Conversation
… it cites witness/session/submit (dtgwg-trust-tasks-tf), Conformance item 1, requires the delivered VWC to carry `taskContext` equal to the `id` of the witness/session document that opened the session, and `taskDigestMultibase` equal to that document's task digest (Trust Tasks §4.9.3). The member's schema is left to DTG Core Credentials, which proposes it in trustoverip/dtgwg-cred-spec#56. This crate had no way to produce it, so no VWC it built could conform to the only issuing flow the specifications define. - `DTGCommon::task_digest_multibase` (top-level, beside `taskContext`) and accessors. A VWC without it still deserializes. - `task_digest_multibase_json`: JCS over the document minus its top-level `proof`, sha2-256 multihash, base58btc. The §Digest Encoding computation over a Trust Task document. - `DTGCredential::new_vwc_for_session` reads both halves of the citation from the session document and refuses anything but the opening witness/session (`NotAWitnessSession`). `new_vwc` is deprecated. - `with_task_citation` / `set_task_citation` for any credential type. - `cites_task` checks both halves, comparing decoded multihash bytes, and never falls back to an `id`-only match. Breaking: `DTGCommon` gains a public field (exhaustive struct literals only). The vector is the one vetting/session/0.1 publishes, reproduced here. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
Merged
stormer78
added a commit
that referenced
this pull request
Sep 22, 2026
Cuts 0.11.0, the first published release since 0.9.1. 0.10.0 was merged and versioned but never tagged, so it never reached crates.io; 0.11.0 carries its changes together with the taskDigestMultibase work merged in #31. - Cargo.toml: 0.10.0 -> 0.11.0 - CHANGELOG.md: [Unreleased] moves under [0.11.0] - 2026-09-22, with an "Upgrading from 0.9" section for consumers crossing both releases at once; the [0.10.0] section is marked as never published - README.md: the upgrade-ordering table gains a 0.11.0 row and notes that 0.10.0 first ships in 0.11.0 No code changes. The affinidi-tdk 0.12 -> 0.16 bump (#30) is a dev-dependency only and is not user-visible. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
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.
Adds
taskDigestMultibase. The only VWC-issuing flow the specifications define requires it, and this crate had no way to produce it.Specification dependency: trustoverip/dtgwg-cred-spec#56 defines the member in DTG Core Credentials. It is approved but not merged. This PR can merge once #56 is accepted.
What the specifications require
witness/session/submit/0.1(dtgwg-trust-tasks-tf), Conformance item 1: the VWC in the witness's response MUST carry two members.taskContextMUST equal theidof thewitness/sessiondocument that opened this session.taskDigestMultibaseMUST be that document's task digest. The same spec says the member's schema "belongs to DTG Core Credentials".witness/session/0.1'soutcomeEvidencedeclares the binding at/payload/vwc/taskContextand/payload/vwc/taskDigestMultibase. Both are top-level members of the VWC.multibase(multihash(H(JCS(document ∖ proof)))):proofis removed; aproofinsidepayloadis content and stays;His any multihash algorithm, with SHA-256 RECOMMENDED;DigestMultibaseform (zoru);ids.taskContextis REQUIRED, OPTIONAL otherwise". It adds the property as the sixth member under §Digest Encoding, so an issuer emits sha2-256 and base58btc. That is a valid narrowing of §4.9.3, and it makes the task digest exactlydigest_multibase_jsoncomputed over a Trust Task document.API
DTGCommon::task_digest_multibase+ accessorstask_digest_multibase_json(&doc)proof, and the two must not stand in for each other. VTI #1630 fixed exactly that confusion.DTGCredential::new_vwc_for_session(issuer, subject, from, until, &session, digest, ctx) -> ResulttaskContextandtaskDigestMultibasefrom the session document, so the pair cannot disagree. The edge digest is REQUIRED. Refuses anything except the openingwitness/session(NotAWitnessSession): asubmitdocument, a#response, or a document whosethreadIdis not its ownid, whichwitness/sessionConformance item 1 requires.with_task_citation/set_task_citationvetting/sessionstatement).cites_task(&doc) -> Result<bool>idand recomputes the digest, comparing decoded bytes. A credential with notaskDigestMultibasereturnsOk(false), never anid-only match. An unimplemented algorithm is an error.new_vwcWhy this breaks the API
DTGCommonis not#[non_exhaustive]. Its fields are public, and every constructor builds it with..Default::default(). Adding a field therefore breaks exhaustive struct literals only, which is the same break 0.3.0 made forcredentialStatus. I chose that over the fully additive alternative, which would keep the member inDTGCommon::extra, for two reasons:taskContext, which is already a modelled field.extrais documented as holding members this library does not model, and it would accept a non-string value without complaint.Marking
DTGCommon#[non_exhaustive]now would be worse: it forbids..Default::default()outside the crate.new_vwckeeps its signature and is deprecated rather than given a new required parameter, following the pattern 0.10.0 used fornew_member_vmc→_for.The wire is unchanged for a credential that lacks the member. An older release carries the member through a round trip in
extra, so this release has no upgrade-ordering constraint. I have not bumped the version. The CHANGELOG entry is under[Unreleased], and#[deprecated(since = "0.11.0")]assumes the next release is 0.11.0.Tests (
tests/task_citation.rs, 22)vetting/session/0.1prints a session document and thetaskDigestMultibaseof it (zQmWAWEtpUqE3xd3LUpZ8GryGrZMCqH1A5D7bZcayvEfJTK).task_digest_multibase_jsonreproduces it. The four steps are also recomputed by hand. The Vetting Statement printed there parses, andcites_taskaccepts it against that session.proof(signed, unsigned and re-signed copies give one value) and keeps aproofnested inpayload.taskDigestMultibaseat the top level. It parses back into the modelled field (notextra), still cites its session, anddigest_multibase()agrees with the digest of the wire form.u…) spelling of the same multihash is accepted.UnsupportedDigestAlgorithm, notfalse.idwith different content is refused.submitdocument, the#response, a mismatched or missingthreadId, a missingid, and an inverted validity window.Verification
cargo fmt --all --check: passcargo clippy --all-targets --all-features -- -D warnings: pass. Also passes with--no-default-features.cargo test --all-features: 186 passed, 0 failedcargo test --no-default-features: 170 passed, 0 failedcargo doc --no-deps --all-features: no warningsNot addressed here
main. It is no longerWitnessCredential. The spec now expresses it as aStatementCredentialunder thedtg:witnessedpredicate profile (dtgwg-cred-spec#45). This crate,new_vwc_for_sessionincluded, still builds the WD02WitnessCredentialshape. That migration is separate work.taskDigestMultibaseis a top-level member either way, so this change carries over.vwcDigestMultibase. Inwitness/session/submit#responseit is taken over the credential including itsproof, unlike every digest this crate computes.digest_multibaseis the wrong function for it.Refs OpenVTC/verifiable-trust-infrastructure#1068.