Skip to content

cloud evidence

NAME

phyware cloud evidence — stakeholder query commands for sealed Evidence Lockers.

SYNOPSIS

phyware cloud evidence events    [OPTIONS] <LOCKER_ID> --grant-token <TOKEN>
phyware cloud evidence manifest  [OPTIONS] <LOCKER_ID> --grant-token <TOKEN>
phyware cloud evidence package   [OPTIONS] <LOCKER_ID> --grant-token <TOKEN> [--out <FILE>]
phyware cloud evidence verify    [OPTIONS] <LOCKER_ID> --grant-token <TOKEN>
phyware cloud evidence verify-manifest <MANIFEST> --public-key <PEM> [--output <FORMAT>]

DESCRIPTION

These commands let an authorized stakeholder (regulator, insurer, legal counsel, auditor, or operator) query a sealed Evidence Locker without needing a tenant API key. Authentication is via a Bearer grant token issued by the locker operator with phyware cloud lockers grants issue. See issue #77.

events

Returns events copied into the locker (paginated). Each query is recorded in the locker's append-only audit log.

manifest

Returns the locker's signed manifest: - scope, event count, Merkle root and sealed timestamp; - each event's content hash, with the signature, sequence and TPM attestation results recorded when the locker was sealed.

No event payloads. PhyCloud signs the manifest with its ES256 manifest key. If the server has no key, signature is null and signature_error explains why.

package

Downloads the sealed locker as one evidence package: an NDJSON file holding the signed manifest, then every event as stored, with its chain hashes and, when PhyCloud kept it, the event exactly as the device sent it. It is written to <LOCKER_ID>.evidence.ndjson unless --out says otherwise (--out - writes to stdout).

Anyone can check a package offline with the open verifier, udm verify, from PhyUDM. It checks the manifest signature against a key you pin, the Merkle root, every content hash and chain link, and re-checks every device signature without trusting PhyCloud. The format is defined in PhyUDM's spec/evidence-package.md.

phyware cloud evidence package lk_abc123
udm verify lk_abc123.evidence.ndjson --trust-key phycloud-manifest.pem

udm verify exits 0 when the package verifies, 1 if a check fails and 3 if it is intact but not signed by a pinned key.

verify-manifest

Checks a saved manifest offline, making no network calls:

  1. PhyCloud's ES256 signature, against a verification key file;
  2. the Merkle root, recomputed from the listed events' content hashes with the tree the manifest names (rfc9162-sha256 from manifest version 3, sha256-sorted-pairs before);
  3. the event count.

Exits with status 1 if any check fails. Get the verification key once from GET /api/v1/evidence/signing-key (or from the operator) and keep it.

verify

Recomputes the Merkle root from the locker's events and compares it against the value sealed at seal time. Use to verify the locker has not been tampered with.

OPTIONS

Flag Type Required Default Env
--url string No http://localhost:8000 PHYCLOUD_URL
--api-key string No — PHYCLOUD_API_KEY
--output enum No table —
--grant-token string Yes — PHYCLOUD_GRANT_TOKEN
--offset integer No 0 —
--limit integer No 100 —

ARGUMENTS

Name Required Description
LOCKER_ID Yes Unique locker identifier

INPUT

None — all parameters are passed as flags / arguments.

OUTPUT

events returns an array of:

Field Type Description
id integer Locker-event row id
event_id string Original PhyCloud event id
content_hash string SHA-256 content hash of the event
previous_hash string Hash of the previous event in the chain
sequence_number integer Sequence number from PhyCloud
event_data object Full UDM event payload
original_ingested_at string When PhyCloud first ingested the event
copied_at string When the event was copied into the locker

manifest returns:

Field Type Description
locker_id string Unique locker identifier
name string Locker name
status string Locker status
event_count integer Number of events
merkle_root string Sealed Merkle root
events array Per event: event_id, sequence_number, content_hash, signature_status, signer_key_id, sequence_status, attestation (quote_id, quote_status)
signatures object Events per signature status
signature object algorithm (es256), key_id, value (hex r‖s); null if unsigned

verify-manifest returns valid, signature_valid, merkle_root_valid, event_count_valid, key_id and errors.

verify returns:

Field Type Description
valid boolean True if recomputed root matches stored
computed_root string Recomputed Merkle root
stored_root string Merkle root sealed at creation time

EXIT CODES

Code Meaning
0 Success
1 Generic / connection error
2 Authentication / authorisation error
3 Resource not found
4 Validation error
5 Server-side error

EXAMPLES

# Stakeholder workflow with a grant token
export PHYCLOUD_GRANT_TOKEN=<token-from-grants-issue>

# 1. Inspect the manifest
phyware cloud evidence manifest lk_abc123

# 2. Verify integrity
phyware cloud evidence verify lk_abc123

# 3. Pull events
phyware cloud evidence events lk_abc123 --output json

# 4. Take the whole locker away and verify it offline
phyware cloud evidence package lk_abc123
udm verify lk_abc123.evidence.ndjson --trust-key phycloud-manifest.pem

# Paginate through events
phyware cloud evidence events lk_abc123 --offset 100 --limit 50

# Extract content hashes
phyware cloud evidence events lk_abc123 -o json | jq '[.[].content_hash]'

# Verify and check the boolean flag
phyware cloud evidence verify lk_abc123 -o json | jq -r '.valid'

AGENT NOTES

--grant-token (or PHYCLOUD_GRANT_TOKEN) is required — the tenant --api-key is ignored on these endpoints. Every query is recorded in the locker's audit log under the stakeholder's name. Use manifest first (lightweight), then verify, then events (which can be large).

SEE ALSO

ERRORS

Code Message Remediation
FORBIDDEN Invalid or insufficient grant token Verify the grant token has read_events
NOT_FOUND Locker not found Check LOCKER_ID
EXPIRED Grant token expired or revoked Request a fresh grant from the locker operator