trust_tasks_capability_client library
Client-side wire helpers for the capability Trust Task families —
governance/capability/* (enable / disable / list a community capability)
and git-trust/* (grant / revoke commit-signing trust).
This package owns the documents, not a transport: it builds request
documents, parses inbound envelope replies, and classifies them. Signing is
deliberately not here — attach a Data Integrity proof with
package:trust_tasks_proof (over the document minus its proof member,
eddsa-jcs-2022) — so this package stays free of any crypto dependency, and
a capability producer and a management UI cannot drift on the contract.
Classes
- CapabilityListing
-
A
listresponse: the community's capabilities. - CapabilityRejected
-
A
trust-task-errordocument. - CapabilityReply
-
The classification of a
governance/capability/*reply. - CapabilitySummary
- One capability entry as rendered by a management UI.
- CapabilityToggled
-
An
enable/disableacknowledgement. - ReplyPolicy
-
How much a caller is willing to infer from a non-conforming peer. The default
infers nothing: an outcome is decided from the error
codealone. - WriteIdempotentSuccess
- Rejected because the end state already holds.
- WriteOutcome
-
The classification of a
git-trustwrite reply. - WriteRejected
- Any other rejection: the machine-readable code and human detail.
- WriteSuccess
-
The
#responsedocument acknowledged the write.
Constants
- capabilityDisableType → const String
- capabilityEnableType → const String
- capabilityListType → const String
-
governance/capability/*type URIs. - gitTrustAlreadyGrantedCode → const String
-
The extended error code
git-trust/grantdeclares for "an active grant already exists" (SPEC §8.5) — the control surface for idempotent success, never decided from the non-normative free-textmessage. - gitTrustAlreadyGrantedCodeCamel → const String
- The lowerCamelCase spellings the registry may normalise to (SPEC §4.10 rule 4). Accepting both means that normalisation is not a flag day.
- gitTrustGrantType → const String
-
git-trust/*type URIs. - gitTrustNotGrantedCode → const String
-
The
git-trust/revokecounterpart. - gitTrustNotGrantedCodeCamel → const String
- gitTrustRevokeType → const String
- trustTaskEnvelopeType → const String
-
The
trust_tasks_didcommbinding envelope type a registry's DIDComm handler listens for.
Functions
-
answersRequest(
CapabilityDocument reply, CapabilityDocument request) → bool -
Whether
replyanswersrequest— the four equalities the HTTPS clients apply to a response (SPEC §4.9, §8.1), for a client that holds the request it sent: -
buildDocument(
String issuerDid, String recipientDid, String typeUri, Map< String, dynamic> payload) → CapabilityDocument -
Build a capability Trust Task addressed
issuerDid→recipientDid. -
buildGitTrustGrant(
String authorityDid, String registryDid, String subjectDid, String resource) → CapabilityDocument -
Build a
git-trust/grant: grantsubjectDidcommit-signing trust forresource(an org ororg/reposlug). -
buildGitTrustRevoke(
String authorityDid, String registryDid, String subjectDid, String resource, {String? reason}) → CapabilityDocument -
Build a
git-trust/revoke. A nullreasonis omitted. -
buildListDocument(
String issuerDid, String vtcDid) → CapabilityDocument -
Build a
governance/capability/listrequest (statusall). -
buildToggleDocument(
String issuerDid, String vtcDid, String slug, String version, {required bool enable}) → CapabilityDocument -
Build a
governance/capability/enableor/disablerequest. On enable,config.authoritydefaults to the community's own DID. -
classifyGitTrustReply(
CapabilityDocument doc, String expectedThreadId, {ReplyPolicy policy = const ReplyPolicy()}) → WriteOutcome? -
Classify the reply to a
git-trust/grantorgit-trust/revokewrite. -
classifyGitTrustReplyTo(
CapabilityDocument reply, CapabilityDocument request, {ReplyPolicy policy = const ReplyPolicy()}) → WriteOutcome? -
Classify the reply to the
git-trust/grantorgit-trust/revokedocumentrequest— the form to use when you hold the request you sent. -
correlationThread(
CapabilityDocument doc) → String -
The thread an exchange started by
docis correlated by: its ownthreadId, or itsidwhere it opens the exchange (SPEC §4.9's fallback). Hold this from the moment you send a request; every reply-classifying function wants it asexpectedThreadId. -
isFrameworkError(
CapabilityDocument doc) → bool -
Whether
docis a framework error document:trust-task-errorunder the registry's authority. The same slug under another authority is some other publisher's specification, not a refusal. -
isRegistryType(
String typeUri) → bool -
Whether
typeUriis under the registry's authority. -
isResponseVariant(
String typeUri) → bool - Whether a Type URI names the success-response variant.
-
newAttempt(
CapabilityDocument previous) → CapabilityDocument -
A new attempt at the request
previouscarried: the same addressing, type and payload under a freshid, a freshissuedAt, and noproof. -
parseCapabilityReply(
CapabilityDocument doc, String expectedThreadId) → CapabilityReply? -
Classify a
governance/capability/*reply document.nullwhen it is not part of this family, is not threaded toexpectedThreadId, or does not carry the members its kind requires (a listing'scapabilitieslist, each entry'smanifest.capabilityand booleanenabled; a toggle'scapabilityand booleanenabled) — a reply that cannot say what it reports is not read as reporting "disabled". -
parseCapabilityReplyTo(
CapabilityDocument reply, CapabilityDocument request) → CapabilityReply? -
Classify the reply to the
governance/capability/*documentrequest— the form to use when you hold the request you sent.nullunlessreplyanswersrequest(answersRequest); otherwise as parseCapabilityReply. -
parseEnvelopeDocument(
Object? body) → (String, CapabilityDocument)? -
Parse a DIDComm envelope body into
(threadId, document), ornullwhen the body is not a threaded Trust Task document. -
parseEnvelopeDocumentFor(
Object? body, String expectedThreadId) → CapabilityDocument? -
Parse a DIDComm envelope body into the document it carries, only if that
document is threaded to
expectedThreadId.nullcovers both "not a Trust Task document" and "belongs to another exchange". -
parseEnvelopeReply(
Object? body, String expectedThreadId) → CapabilityReply? -
Parse an inbound envelope body directly into a reply to the request threaded
expectedThreadId— the entry point for a UI's inbound dispatch, which holds only the body value.nullwhen the body is not agovernance/capability/*reply, or belongs to a different exchange. -
repliesTo(
CapabilityDocument reply, String expectedThreadId) → bool -
Whether
replyis threaded toexpectedThreadId— SPEC §4.9 correlation, and the precondition for acting on any reply. A reply with nothreadIdmatches nothing. -
slugOf(
String typeUri) → String? -
The slug of a Type URI, or
nullwhen it is not a Trust Task Type URI.
Typedefs
-
CapabilityDocument
= TrustTaskDocument<
Map< String, dynamic> > - A capability document: a Trust Task whose payload is an open JSON object.