Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,256 changes: 718 additions & 538 deletions Cargo.lock

Large diffs are not rendered by default.

60 changes: 40 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
resolver = "3"

[workspace.package]
version = "0.34.0"
version = "0.35.0"
edition = "2024"
rust-version = "1.95.0"
authors = ["Glenn Gore <glenn@affinidi.com>"]
Expand All @@ -22,13 +22,13 @@ publish = true

[workspace.dependencies]
# VGI shared primitives (sshsig codec, commit handling, DID key extraction).
vgi-core = { version = "0.34.0", path = "crates/vgi-core" }
vgi-core = { version = "0.35.0", path = "crates/vgi-core" }
# Forge-neutral adapter trait and types for the git-namespaces bridge.
vgi-forge = { version = "0.34.0", path = "crates/vgi-forge" }
vgi-forge = { version = "0.35.0", path = "crates/vgi-forge" }
# The adapters and the verifier, for the bridge.
vgi-forge-github = { version = "0.34.0", path = "crates/vgi-forge-github" }
vgi-forge-forgejo = { version = "0.34.0", path = "crates/vgi-forge-forgejo" }
verify-trust = { version = "0.34.0", path = "crates/verify-trust" }
vgi-forge-github = { version = "0.35.0", path = "crates/vgi-forge-github" }
vgi-forge-forgejo = { version = "0.35.0", path = "crates/vgi-forge-forgejo" }
verify-trust = { version = "0.35.0", path = "crates/verify-trust" }
# Trust Registry query client (registry authorization queries).
#
# Held on a git `rev` for several releases while the registry workspace caught
Expand Down Expand Up @@ -151,7 +151,18 @@ verify-trust = { version = "0.34.0", path = "crates/verify-trust" }
# **0.31** is the trql-client on trust-tasks 0.37 / affinidi-tdk 0.37 (registry
# PR #182; no source change), so the alias is retired again and verify-trust
# names the workspace's single `trust-tasks-rs` directly.
#
# The vta-sdk 0.92 (Fig) step reopens the split once more: the workspace moves
# to trust-tasks 0.41 / affinidi-tdk 0.49 / messaging-sdk 0.50, while
# trql-client 0.31 — still the registry's latest release — declares
# `trust-tasks-rs ^0.37.2`. verify-trust's `TrqlTransport` impls name its
# `TrustTask` through the `trust-tasks-trql` alias again. As before it is the
# weak form: verify-trust and the bridge take trql-client's default (HTTPS)
# feature only, so the second node is trust-tasks-rs alone (no second
# affinidi-tdk or messaging stack). Retire the alias when a trql-client on
# trust-tasks 0.41 is published.
trql-client = "0.31.0"
trust-tasks-trql = { package = "trust-tasks-rs", version = "0.37.2", default-features = false }
# VTA client for signing with DID-held keys, and the `display_name` module
# (NameBook / shorten_did / verified agent names) shared with the PNM, CNM
# and VTC operator CLIs so every surface abbreviates a DID the same way.
Expand Down Expand Up @@ -382,8 +393,11 @@ trql-client = "0.31.0"
# 0.80 -> 0.86 keeps OpenVTC on one vta-sdk: it moves to 0.86 (Dependabot,
# OpenVTC #618) and passes a `VtaClient` to `did_git_sign::vta::sign_sshsig`.
# Same trust-tasks 0.37 / affinidi-tdk 0.37 / messaging-sdk 0.45 line.
vta-sdk = { version = "0.86", default-features = false }
affinidi-tdk = "0.37"
#
# 0.86 -> 0.92 is the Fig release line: trust-tasks 0.41, affinidi-tdk 0.49,
# messaging-sdk 0.50, messaging-didcomm 0.16 and the test mediator 0.55.
vta-sdk = { version = "0.92", default-features = false }
affinidi-tdk = "0.49"
# **Security floor**, named for it alone. 0.27.2 (with the DIDComm crate's
# 0.15.9 below) binds an authcrypt message's reported sender to the key the
# key agreement actually used — `skid` must equal the `apu` party info, and
Expand All @@ -396,8 +410,12 @@ affinidi-tdk = "0.37"
# `affinidi-messaging-didcomm = "0.15"`, and against 0.15.9 its unpack calls
# the deprecated `decrypt`, which now refuses every authcrypt message — the
# 0.26 line cannot receive DIDComm at all on the fixed crate.
affinidi-messaging-sdk = "0.45"
affinidi-messaging-didcomm = "0.15.9"
#
# Fig: affinidi-tdk 0.49 itself requires messaging-sdk ^0.50 and
# messaging-didcomm ^0.16, past both floors, so the DIDComm crate is no
# longer named (verify-trust and the bridge never call it) and verify-trust no
# longer names the SDK. The bridge still names the SDK because it uses it.
affinidi-messaging-sdk = "0.50"
# Named directly for one reason: the **floor**. The verifier resolves DIDs a
# pull-request author chose — the `Signed-by-DID` trailer and the committer
# header are attacker-supplied on a fork PR — so which hosts resolution may
Expand Down Expand Up @@ -427,17 +445,17 @@ affinidi-messaging-didcomm = "0.15.9"
#
# No feature is chosen here: `affinidi-tdk` already takes this crate with its
# default features, so this line adds a version requirement and nothing else.
affinidi-did-resolver-cache-sdk = "0.8.43"
affinidi-did-resolver-cache-sdk = "0.9"
# did:scid identity rules (the `scid` module, 0.4.4): a `?src=` locator is not
# part of the identity. Default features off: only the identifier helpers.
# 0.4.5 is the first that compiles that way (0.4.4's `KeyMaterial::generate`
# named every curve's generator), which a package built alone, such as
# `cargo test -p vgi-forge-forgejo`, depends on.
affinidi-did-common = { version = "0.4.5", default-features = false }
affinidi-did-common = { version = "0.5", default-features = false }
multibase = "0.9"
# Test-only: build real did:webvh logs (verify-trust's deactivated-signer test).
didwebvh-rs = "0.8.2"
affinidi-secrets-resolver = "0.5"
didwebvh-rs = "0.8.3"
affinidi-secrets-resolver = "0.6"
pgp = "0.21"
clap = { version = "4.6", features = ["derive"] }
tokio = "1.53"
Expand Down Expand Up @@ -514,7 +532,7 @@ wiremock = "0.6"
# registry on the same mediator really answers, and an `ExplicitAllow`
# mediator really refuses. Dev-only. 0.11 is the line on the messaging SDK
# 0.30 / TDK 0.20 that verify-trust's transports and the bridge use.
affinidi-messaging-test-mediator = { version = "0.51", features = ["tsp"] }
affinidi-messaging-test-mediator = { version = "0.55", features = ["tsp"] }

# ── the bridge (vgi-bridge) ─────────────────────────────────────────────────
# The per-community service that holds the forge credentials and runs the
Expand Down Expand Up @@ -562,22 +580,24 @@ affinidi-messaging-test-mediator = { version = "0.51", features = ["tsp"] }
#
# 0.37 is the line vta-sdk 0.80 is on. The bridge's pinned git-ns bundles are
# unchanged; only the generator's runtime moves.
trust-tasks-rs = { version = "0.37.2", default-features = false }
#
# 0.41 is the line vta-sdk 0.92 (Fig) is on.
trust-tasks-rs = { version = "0.41.0", default-features = false }
# Build dependency of `vgi-bridge`: generates `vgi_bridge::specs` from the
# vendored bundles. `trust-tasks check` (trust-tasks-cli) verifies them. 0.1.2
# is the release that generates for trust-tasks-rs 0.36.
trust-tasks-build = "0.1.3"
trust-tasks-build = "0.2.1"
# Data Integrity sign/verify for Trust Task documents (eddsa-jcs-2022), on the
# same line as the payload types. Its affinidi-data-integrity and DID-resolver
# dependencies are the versions the TDK already builds here.
trust-tasks-proof = "0.37.2"
trust-tasks-proof = "0.41.0"
# The DIDComm delivery layer over the mediator websocket — the stack
# vtc-service uses. Both are already in the graph through affinidi-tdk's
# messaging SDK; they are named so the bridge keeps the proven sender of each
# inbound message, which vta-sdk's session helpers drop (and those helpers also
# flush the mediator inbox on connect, which would lose queued jobs).
affinidi-messaging-delivery = "0.1.20"
affinidi-messaging-core = "0.1.11"
affinidi-messaging-delivery = "0.3.4"
affinidi-messaging-core = "0.1.15"
# The bridge's HTTP surface (GitHub App registration, setup and webhooks;
# Forgejo OAuth redirects and webhooks). axum is the VTI stack's server
# (vtc-service, vta-service); hyper, hyper-util and tower under it are already
Expand Down
86 changes: 54 additions & 32 deletions crates/did-git-sign/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,48 @@ fn in_subtree(root: &str, context: &str) -> bool {
.is_some_and(|rest| rest.starts_with('/'))
}

/// A DID the VTA lists, as the picker needs it: the identifier and the
/// context that holds it.
#[derive(Debug, Clone, PartialEq, Eq)]
struct ListedDid {
did: String,
context_id: String,
}

/// The DID methods offered for signing: did:webvh and did:scid (its
/// `scid:vh` profile), the ones `webvh/dids/list` returned before the VTA's
/// method-neutral `vta/dids/list`.
const SIGNING_METHODS: [&str; 2] = ["webvh", "scid:vh"];

/// Every signing DID the caller can see (`vta/dids/list`, read to the end),
/// optionally narrowed to one context. A DID the VTA files under no context
/// cannot be placed in the picker's subtree, so it is left out.
async fn list_signing_dids(
client: &vta_sdk::client::VtaClient,
context_id: Option<&str>,
) -> Result<Vec<ListedDid>> {
let filter = vta_sdk::client::DidListFilter {
context_id: context_id.map(str::to_string),
methods: Some(SIGNING_METHODS.iter().map(|m| m.to_string()).collect()),
..Default::default()
};
Ok(client
.list_dids(&filter)
.await
.map_err(|e| anyhow::anyhow!("failed to list DIDs: {e}"))?
.into_iter()
.filter_map(|d| {
Some(ListedDid {
did: d.did.to_string(),
context_id: d.context_id?,
})
})
.collect())
}

/// The DIDs held in `root` or any of its sub-contexts, ordered by context and
/// then DID so the picker is stable.
fn dids_in_subtree(
dids: &[vta_sdk::webvh::WebvhDidRecord],
root: &str,
) -> Vec<vta_sdk::webvh::WebvhDidRecord> {
fn dids_in_subtree(dids: &[ListedDid], root: &str) -> Vec<ListedDid> {
let mut found: Vec<_> = dids
.iter()
.filter(|d| in_subtree(root, &d.context_id))
Expand Down Expand Up @@ -723,10 +759,7 @@ fn context_label(id: &str, name: &str, dids: usize, primary: Option<&str>) -> St

/// A DID in the picker: its name when the book has one, and the context it
/// lives in, since the candidates now span a subtree.
fn did_label(
book: &vta_sdk::display_name::NameBook,
did: &vta_sdk::webvh::WebvhDidRecord,
) -> String {
fn did_label(book: &vta_sdk::display_name::NameBook, did: &ListedDid) -> String {
format!("{} — in {}", names::inline(book, &did.did), did.context_id)
}

Expand Down Expand Up @@ -795,16 +828,12 @@ async fn interactive_select(
bail!("no contexts found in VTA — create a context first");
}

// Every DID the caller can see, in one round trip. `webvh/dids/list`
// filters `contextId` exactly, so asking per context would miss a persona
// in a sub-context (where openvtc puts every one); with no filter it
// returns each DID whose context the caller's ACL covers, and that check
// is subtree-aware. The subtree is then selected here.
let all_dids = client
.list_dids_webvh(None, None)
.await
.map_err(|e| anyhow::anyhow!("failed to list DIDs: {e}"))?
.dids;
// Every DID the caller can see. `vta/dids/list` filters `contextId`
// exactly, so asking per context would miss a persona in a sub-context
// (where openvtc puts every one); with no context filter it returns each
// DID whose context the caller's ACL covers, and that check is
// subtree-aware. The subtree is then selected here.
let all_dids = list_signing_dids(client, None).await?;

let context_labels: Vec<String> = contexts
.contexts
Expand Down Expand Up @@ -844,11 +873,7 @@ async fn interactive_select(
.interact()?)
})?;
create_context_did(client, &context.id, presentation).await?;
let listed = client
.list_dids_webvh(Some(&context.id), None)
.await
.map_err(|e| anyhow::anyhow!("failed to list DIDs: {e}"))?
.dids;
let listed = list_signing_dids(client, Some(&context.id)).await?;
dids = dids_in_subtree(&listed, &context.id);
if dids.is_empty() {
bail!(
Expand All @@ -859,8 +884,7 @@ async fn interactive_select(
}

// A DID is what the operator is choosing between here, so this is the
// picker that most needs a name. `list_dids_webvh` carries no label of
// its own, so the names come from the book: an ACL label if the VTA has
// picker that most needs a name. The names come from the book: an ACL label if the VTA has
// one, otherwise an agent name when asked for.
names::resolve_agent_names_into(
book,
Expand Down Expand Up @@ -1968,13 +1992,11 @@ mod tests {
assert!(existing.contains("pnm acl create") && !existing.contains("contexts create"));
}

fn did_record(did: &str, context: &str) -> vta_sdk::webvh::WebvhDidRecord {
serde_json::from_value(serde_json::json!({
"did": did, "serverId": "s", "mnemonic": "m", "scid": "Qm", "contextId": context,
"portable": true, "logEntryCount": 1,
"createdAt": "2026-01-01T00:00:00Z", "updatedAt": "2026-01-01T00:00:00Z"
}))
.expect("record")
fn did_record(did: &str, context: &str) -> ListedDid {
ListedDid {
did: did.to_string(),
context_id: context.to_string(),
}
}

#[test]
Expand Down
10 changes: 3 additions & 7 deletions crates/verify-trust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@ tsp = ["affinidi-tdk/tsp"]
vgi-core = { workspace = true }
trql-client = { workspace = true }
# `TrustTask`, for the mediator transports' `TrqlTransport` impls: the
# workspace's single trust-tasks line, which trql-client 0.31 is on too.
trust-tasks-rs = { workspace = true }
# trust-tasks line trql-client 0.31 is on, which is not the workspace's (see
# the `trust-tasks-trql` note in the workspace manifest).
trust-tasks-trql = { workspace = true }
async-trait = { workspace = true }
uuid = { workspace = true }
base64 = { workspace = true }
affinidi-tdk = { workspace = true }
# Security floors, not new code: the messaging SDK and DIDComm crate the TDK
# already builds, at the releases that bind an authcrypt sender to the key
# actually used. See the workspace manifest.
affinidi-messaging-sdk = { workspace = true }
affinidi-messaging-didcomm = { workspace = true }
# The resolver the TDK above builds, named directly so `build_resolver` can
# state the host policy it runs under. See the workspace manifest.
affinidi-did-resolver-cache-sdk = { workspace = true }
Expand Down
16 changes: 8 additions & 8 deletions crates/verify-trust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,7 @@ mod tests {
struct FakeChannel {
authorized: bool,
v0_1_only: bool,
rejection: Option<trust_tasks_rs::ErrorPayload>,
rejection: Option<trust_tasks_trql::ErrorPayload>,
failure: Option<TrqlError>,
seen: std::sync::Mutex<Vec<serde_json::Value>>,
}
Expand All @@ -2518,7 +2518,7 @@ mod tests {
}
}

fn rejecting(rejection: trust_tasks_rs::ErrorPayload) -> Self {
fn rejecting(rejection: trust_tasks_trql::ErrorPayload) -> Self {
Self {
rejection: Some(rejection),
..Self::answering(false)
Expand All @@ -2541,8 +2541,8 @@ mod tests {

async fn exchange(
&self,
request: trust_tasks_rs::TrustTask<serde_json::Value>,
) -> Result<trust_tasks_rs::TrustTask<serde_json::Value>, TrqlError> {
request: trust_tasks_trql::TrustTask<serde_json::Value>,
) -> Result<trust_tasks_trql::TrustTask<serde_json::Value>, TrqlError> {
let typed = request;
let request = serde_json::to_value(&typed).unwrap();
assert_eq!(request["recipient"], "did:example:registry");
Expand Down Expand Up @@ -2573,8 +2573,8 @@ mod tests {
if asked_v0_2 {
let error = typed.reject_with(
"urn:uuid:error",
trust_tasks_rs::ErrorPayload::new(
trust_tasks_rs::StandardCode::UnsupportedVersion,
trust_tasks_trql::ErrorPayload::new(
trust_tasks_trql::StandardCode::UnsupportedVersion,
),
);
return Ok(
Expand Down Expand Up @@ -2775,7 +2775,7 @@ mod tests {
/// fallback is not asked — not a denial blamed on the signer.
#[tokio::test]
async fn a_retryable_rejection_fails_closed_as_unavailable() {
use trust_tasks_rs::{ErrorPayload, StandardCode};
use trust_tasks_trql::{ErrorPayload, StandardCode};
for rejection in [
ErrorPayload::new(StandardCode::Unavailable),
ErrorPayload::new(StandardCode::PermissionDenied).with_retryable(true),
Expand Down Expand Up @@ -2828,7 +2828,7 @@ mod tests {
/// after the fallback resource has been asked too.
#[tokio::test]
async fn a_final_rejection_is_unauthorized_after_the_fallback() {
use trust_tasks_rs::{ErrorPayload, StandardCode};
use trust_tasks_trql::{ErrorPayload, StandardCode};
let channel = Arc::new(FakeChannel::rejecting(ErrorPayload::new(
StandardCode::PermissionDenied,
)));
Expand Down
2 changes: 1 addition & 1 deletion crates/verify-trust/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use trql_client::{
HttpsTransport, HttpsTransportConfig, ServiceCapabilities, TransportChoice, TransportKind,
TrqlClient, TrqlError, TrqlTransport,
};
use trust_tasks_rs::TrustTask;
use trust_tasks_trql::TrustTask;

#[cfg(any(feature = "didcomm", feature = "tsp"))]
pub use mediated::EphemeralIdentity;
Expand Down
6 changes: 1 addition & 5 deletions crates/vgi-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ trust-tasks-proof = { workspace = true }
# the TDK's messaging SDK (ATM, built with TSP), its delivery layer, and
# vta-sdk's DID-secrets-bundle helpers and TSP binding envelope.
affinidi-tdk = { workspace = true, features = ["tsp"] }
# Security floors, not new code: the messaging SDK and DIDComm crate the TDK
# already builds, at the releases that bind an authcrypt sender to the key
# actually used. See the workspace manifest.
affinidi-messaging-sdk = { workspace = true }
affinidi-messaging-didcomm = { workspace = true }
affinidi-messaging-delivery = { workspace = true }
affinidi-messaging-core = { workspace = true }
# VTA mode (`crate::vta`): the client, the session transports (DIDComm, with
Expand Down Expand Up @@ -147,4 +143,4 @@ vta-sdk = { workspace = true, features = ["test-loopback"] }
# A fixed verification-method resolver for the key-rotation test (a
# did:webvh resolved without the network). Already in the graph through
# trust-tasks-proof.
affinidi-data-integrity = "0.8"
affinidi-data-integrity = "0.9.2"
2 changes: 1 addition & 1 deletion crates/vgi-bridge/bridge.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ master_key_file = "/home/ops/vgi-bridge/master-key"
# setup pins this to the commit of its own release tag; by hand:
# gh api repos/OpenVTC/verifiable-git-infrastructure/commits/<version> --jq .sha
action = "OpenVTC/verifiable-git-infrastructure/.github/actions/verify-trust@<40-hex commit>"
version = "v0.34.0"
version = "v0.35.0"
# Required by the Forgejo plan: SHA-256 of the release tarball.
# sha256 = "<64 hex>"
# required_check = "Verify commit trust"
Expand Down
Loading