Skip to content

feat!: directed community grants, context-v3 salting (Working Draft 0.7.0) - #50

Merged
stormer78 merged 3 commits into
mainfrom
feat/fig-0.16
Nov 24, 2026
Merged

stormer78 merged 3 commits into
mainfrom
feat/fig-0.16

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

Implements DTG Core Credentials Working Draft 0.7.0 for the VTI Fig release.

Directed community identifiers (trustoverip/dtgwg-cred-spec#86)

A community-issued VMC declares directed at minimum, public where the community is open to outsiders. Only pairwise is refused now (IssuerScopeTooNarrow { minimum: Directed }, at parse and in validate()/sign()), and new_member_vmc_for acknowledges a directed grant.

Breaking API: new_vmc(issuer, issuer_scope, subject, …) and new_community_role_vac(community, issuer_scope, member, …) take the community's declaration. new_community_role_vac refuses pairwise. Pass IssuerScope::Public to keep the 0.15 behaviour. VIC docs state the same minimum. It isn't enforced there, because a VIC doesn't say whether its issuer is the community.

Salting under context v3 (trustoverip/dtgwg-cred-spec#87), behind context-v3 (off by default)

The registry hasn't published contexts/v3.jsonld, and until its digest is recorded the spec says issuers MUST NOT emit salt. With the feature on:

  • Constructors list DTG_CONTEXT_V3 (https://registry.trustoverip.org/dtg/context/v3) and draw a 32-byte base58btc z… salt in build(), not in sign(), so a re-proof keeps it (including signing via another backend after validate()) and a re-issue redraws it.
  • A parse accepts v3 only with a salt that decodes to exactly 32 bytes (InvalidSalt).
  • with_purposes keeps v3.

In every build, feature on or off, a salt under v1/v2 is refused (InvalidSalt). Before this change it passed through DTGCommon::extra. The crate has no selective-disclosure path, and the field docs say salt must be mandatory-disclosure.

The salt is drawn with rand 0.10. It's already in the normal dependency graph through the affinidi crates and is now an optional dependency of the feature, so the feature adds no new crate.

Docs

Tests

  • tests/salt.rs covers v1/v2 salt refusal in every build, v3 unrecognized when the feature is off, v3 issue/parse, fresh salt per issue, refusal of a missing, short, long or wrong-base salt, salted acknowledgement, and re-proof keeping the salt.
  • New scope tests: directed and public grants accepted, pairwise refused, acknowledging a directed grant, and the directed role VAC verifying while a pairwise one is refused.
  • The golden v1 wire-form tests are gated to builds without context-v3.

….7.0)

- A community-issued VMC is `directed` at minimum and `public` where the
  community is open to outsiders (dtgwg-cred-spec#86): only `pairwise` is
  refused. `new_vmc` and `new_community_role_vac` take an `IssuerScope`;
  the role VAC refuses `pairwise`. `new_member_vmc_for` acknowledges a
  `directed` grant.
- Salting under context v3 (dtgwg-cred-spec#87) behind the off-by-default
  `context-v3` feature: constructors list DTG_CONTEXT_V3 and draw a fresh
  32-byte base58btc salt at build time (kept on re-proof, redrawn on
  re-issue); v3 without a 32-byte salt is refused. A `salt` under v1/v2 is
  refused in every build.
- README: Working Draft 0.7.0, contexts v1/v2 supported, v3 pending;
  0.16 upgrade ordering (verifiers before issuers emit `directed`).
- "member VTC" wording reads VTC or VTN (dtgwg-cred-spec#83).

BREAKING CHANGE: `new_vmc` and `new_community_role_vac` gain an
`issuer_scope` parameter; `DTGCommon` gains `salt`; a `salt` under v1/v2
is now refused.

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
@stormer78
stormer78 requested a review from a team as a code owner November 24, 2026 15:56
…alts

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
@stormer78
stormer78 merged commit cf858d3 into main Nov 24, 2026
7 checks passed
@stormer78
stormer78 deleted the feat/fig-0.16 branch November 24, 2026 16:01
stormer78 added a commit that referenced this pull request Nov 24, 2026
…ng (#51)

Releases #50.

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant