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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

### Fixed

- **First-time setup no longer stops at "This Trust Context is already in use"**
([#632](https://github.com/OpenVTC/openvtc/issues/632)). The context probe counted every
DID in the context, including the `did:key` admin identity setup had just rotated into
it, so every fresh context read as holding one persona. It now counts persona methods
only (`did:webvh` and `scid:vh`), the same set the rebuild plan lists; `openvtc-core`
exports them as `context_probe::PERSONA_DID_METHODS`.

### Documentation

- **Linux runtime libraries** ([#633](https://github.com/OpenVTC/openvtc/issues/633)). The
README names `libpcsclite.so.1` and `libdbus-1.so.3`, which the Linux binary needs
before it will start, with the package for each distribution.

## [0.9.0] - 2026-11-24 (cut to release/0.9)

### Added
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,36 @@ directory; OpenVTC creates it if it does not exist.
3. A Personal Network Manager (`pnm`) that can grant OpenVTC access to the VTA,
or a VTA administrator who will run the grant for you.

### Linux runtime libraries

The Linux `openvtc` binary links two system libraries dynamically, so they must
be installed before it will start — including the pre-built download, and even
if you never use a hardware token:

| Library | Why | Debian / Ubuntu | Fedora | Arch |
| ----------------- | ------------------------------------------- | --------------- | ---------------- | ---------- |
| `libpcsclite.so.1` | PC/SC, for hardware tokens (`openpgp-card`) | `libpcsclite1` | `pcsc-lite-libs` | `pcsclite` |
| `libdbus-1.so.3` | Secret Service keyring | `libdbus-1-3` | `dbus-libs` | `dbus` |

Desktop installs usually have both already. Server images, containers and WSL
often lack `libpcsclite1`, and the binary then fails before OpenVTC can explain
anything:

```text
openvtc: error while loading shared libraries: libpcsclite.so.1: cannot open shared object file
```

On Debian or Ubuntu:

```bash
sudo apt install libpcsclite1 libdbus-1-3
```

Using a hardware token additionally needs the PC/SC daemon (`pcscd`) running. To
build without hardware token support, and so without the PC/SC dependency, see
`--no-default-features` below. Building from source needs the development
packages instead (`libpcsclite-dev libdbus-1-dev pkgconf` on Debian/Ubuntu).

## Feature Flags

| Flag | Description | Default |
Expand Down
23 changes: 21 additions & 2 deletions openvtc-core/src/context_probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ use serde::{Deserialize, Serialize};
use tracing::debug;
use vta_sdk::client::VtaClient;

/// The `vta/dids/list` method profiles an OpenVTC persona is minted under:
/// `did:webvh` and its `did:scid` presentation (`scid:vh`).
///
/// Deliberately excludes `key`: the long-term admin identity setup provisions
/// is a `did:key` in the same context, and it is OpenVTC's own credential, not
/// an account's persona. The probe and the rebuild plan share this list so the
/// two cannot disagree about what a persona is.
pub const PERSONA_DID_METHODS: &[&str] = &["webvh", "scid:vh"];

/// What a probe found in a Trust Context.
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct ContextContents {
Expand Down Expand Up @@ -117,10 +126,20 @@ impl ProbeOutcome {
/// authenticated to (D6). Runs on every setup rather than behind a flag,
/// because a user who needs the answer is by definition not expecting to.
pub async fn probe(client: &VtaClient, context_id: &str) -> ProbeOutcome {
// Every method's identities (`vta/dids/list`): any DID at all means the
// context is in use.
// Persona identities only. `vta/dids/list` with no method filter also
// returns the `did:key` admin identity setup has just rotated into this
// context, so counting "any DID at all" reported every fresh context as
// holding one persona (#632). The `class` filter is no help: the VTA
// records a class for `did:webs` only, so `class: "persona"` would hide
// every `did:webvh` persona and read an occupied context as empty.
let filter = vta_sdk::client::DidListFilter {
context_id: Some(context_id.to_string()),
methods: Some(
PERSONA_DID_METHODS
.iter()
.map(|m| (*m).to_string())
.collect(),
),
..Default::default()
};
let dids = match client.list_dids(&filter).await {
Expand Down
7 changes: 6 additions & 1 deletion openvtc-core/src/rebuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,12 @@ pub async fn plan(
// method-neutral `vta/dids/list`.
let filter = vta_sdk::client::DidListFilter {
context_id: Some(context_id.to_string()),
methods: Some(vec!["webvh".to_string(), "scid:vh".to_string()]),
methods: Some(
crate::context_probe::PERSONA_DID_METHODS
.iter()
.map(|m| (*m).to_string())
.collect(),
),
..Default::default()
};
let dids = client
Expand Down
72 changes: 72 additions & 0 deletions openvtc-core/tests/mockvta_bootstrap_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
//! `grant_super_admin`, the `pnm acl create` step) drives
//! `provision_admin_rotated_via_rest`, which returns a freshly-minted
//! long-term admin DID + key (not the setup pair).
//! * `probe_reads_a_fresh_context_as_empty_after_admin_rotation` — #632: the
//! context probe does not count the rotated admin `did:key` as a persona.
//! * `bootstrap_creates_top_context_and_lists_webvh_server` — the rest of the
//! State-A VTA surface: an authenticated client creates the account's
//! top-level context and sees a seeded webvh hosting server in the catalogue.
Expand Down Expand Up @@ -82,6 +84,68 @@ async fn admin_rotation_provisions_against_mock_vta() {
mock.shutdown().await;
}

/// #632: setup probes the context *after* rotating the setup DID into the
/// long-term admin `did:key`, which the VTA records in that same context. The
/// probe must not count OpenVTC's own admin identity as a persona, or every
/// first-time setup stops at "This Trust Context is already in use".
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
#[ignore = "slow: spins up a provisionable VTA + URL-direct admin-rotation round-trip"]
async fn probe_reads_a_fresh_context_as_empty_after_admin_rotation() {
use openvtc_core::context_probe::{ProbeOutcome, probe};
use vta_sdk::client::DidListFilter;

let mock = MockVta::start_provisionable().await;
let setup = EphemeralSetupKey::generate().expect("generate setup key");
mock.grant_super_admin(&setup.did).await;

let reply = provision_admin_rotated_via_rest(
mock.base_url(),
mock.vta_did(),
setup.did.clone(),
setup.private_key_multibase().to_string(),
ProvisionAsk::vta_admin_rotated("ctx1"),
)
.await
.expect("URL-direct admin rotation round-trips against MockVta");

// Authenticate as the rotated admin, as the wizard does before probing.
let token = mock.ctx.mint_token(&reply.admin_did, "admin", vec![]).await;
let client = VtaClient::authenticated(
mock.base_url(),
ClientIdentity::did_key(
reply.admin_did.clone(),
reply.admin_private_key_mb.clone(),
mock.vta_did(),
),
token,
)
.await;

// The precondition that made #632 happen: the admin did:key is listed in
// the context it was provisioned for. Without it this test proves nothing.
let everything = client
.list_dids(&DidListFilter {
context_id: Some("ctx1".to_string()),
..Default::default()
})
.await
.expect("list every DID in ctx1");
assert!(
everything
.iter()
.any(|d| d.did.to_string() == reply.admin_did),
"the rotated admin DID should be listed in ctx1, got {:?}",
everything
.iter()
.map(|d| d.did.to_string())
.collect::<Vec<_>>()
);

assert_eq!(probe(&client, "ctx1").await, ProbeOutcome::Empty);

mock.shutdown().await;
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
#[ignore = "slow: spins up a provisionable VTA"]
async fn bootstrap_creates_top_context_and_lists_webvh_server() {
Expand Down Expand Up @@ -207,5 +271,13 @@ async fn persona_did_webvh_mint_round_trips() {
);
assert!(!minted.scid.is_empty(), "minted DID must carry an SCID");

// The other half of #632: filtering the probe down to persona methods must
// still see a real persona, so an occupied context is never read as empty.
let probed = openvtc_core::context_probe::probe(&client, "ctx1").await;
let contents = probed
.contents()
.expect("a context holding a persona is occupied");
assert_eq!(contents.persona_dids, vec![minted.did.clone()]);

mock.shutdown().await;
}
Loading