@ayni.org/vs-agent-plugin-ayni-flow
v0.4.0
Published
VS Agent plugin for the Ayni Flow Profile 1.0: the ayni-flow envelope and its carrier protocols as Credo modules, Admin API v2 routes and webhook events (CC-VSA-005, CC-VSA-007, CC-VSA-010, CC-VSA-012, CC-VSA-013)
Readme
@ayni.org/vs-agent-plugin-ayni-flow
A VS Agent plugin that serves the Ayni Flow Profile 1.0 to the Ayni
app: the ayni-flow/1.0 envelope and its carrier protocols (authenticate, authorize, confirm, link-session,
session-grant, sign-tx, notify, reissue) and the peer-status/1.0 protocol as Credo modules, their Admin API v2
routes, message routing and webhook events. It implements CC-VSA-005, CC-VSA-007, CC-VSA-010, CC-VSA-012 and the
plugin's part of CC-VSA-013 of
2060-io/ayni-spec v4/companion-changes.md.
Install into a VS Agent image
FROM veranalabs/vs-agent:<version with the plugin loader>
RUN pnpm add @ayni.org/vs-agent-plugin-ayni-flow@<version>env:
VS_AGENT_PLUGIN_PACKAGES: "@ayni.org/vs-agent-plugin-ayni-flow" # loaded by VS Agent's generic plugin loader
AYNI_FLOW_SIDE: "service" # default; `holder` for tests and toolingand https://didcomm.org/ayni-flow/* in discovery.json, so that VS Agent queries each new peer for flow
support (FLOW-CAP-002); the disclosure arrives on the existing connection event.
Releases
The package is published from this repository's release workflow through npm trusted publishing, with a provenance statement: no publish token exists. To check that an installed version was built here:
npm view @ayni.org/vs-agent-plugin-ayni-flow dist.attestations
npm audit signaturesAdmin API (v2)
| Route | Does |
|-------|------|
| POST /v2/didcomm/ayni-flow/flows | open a flow (kind, title, origin, expiresTime; optional description, steps and link, an app link of at most 2048 characters the holder offers on its sheet); returns flowId. 409 for a second authenticate flow on a connection while one is open (FLOW-SIGNIN-001) |
| GET /v2/didcomm/ayni-flow/flows[/{flowId}] | list or read flows |
| POST /v2/didcomm/ayni-flow/flows/{flowId}/close | close with outcome, reason, references |
| POST /v2/didcomm/ayni-flow/flows/{flowId}/problem-report | refuse or fail with a §11 code |
| POST /v2/didcomm/authorize, /confirm, /link-session, /sign-tx | send the request (flowId sets ~thread.pthid); an authorize request may carry approvals, the approvals needed and the other approvers (FLOW-AUTH-004) |
| POST /v2/didcomm/{protocol}/{threadId}/response | answer a received request |
| POST /v2/didcomm/session-grant/{threadId}/grant | answer a session-grant request |
| POST /v2/didcomm/reissue | the holder's side: ask an issuer to issue a credential again, reason: restore with the backup's credentialId, schemaId, credDefId, issuedAt, or reason: missing with jsonSchemaCredentialId alone, for a schema the issuer lists in issuable. The webhook event carries request.reference as sent, in camelCase |
| POST /v2/didcomm/reissue/{threadId}/answered | record that a reissue was answered |
| POST /v2/didcomm/notify | send a notification |
| POST /v2/didcomm/peer-status | tell a peer where it stands: the rule by which it is identified, the methods and combinations accepted (a credential method with the organizations whose credentials are accepted), how to obtain what it lacks, what an identified peer may enrol and has enrolled, the credentials an identified peer may ask again when it holds none (issuable: jsonSchemaCredentialId and label each), whether it is identified, what is open to it |
| POST /v2/didcomm/peer-status/query, GET /v2/didcomm/peer-status/{connectionId} | ask a peer for its status of this agent; read the last status sent and received on a connection |
| POST /v2/didcomm/revocation-notification | send revocation_notification/2.0/revoke |
| POST /v2/didcomm/authenticate | ask the person to authenticate inside an authenticate flow (flowId): purpose, methods, combinations, text for a step-up |
| POST /v2/didcomm/authenticate/{threadId}/step, .../step-result | announce a step of the combination chosen (the identifying methods first) or send it again; end it passed, failed or expired. A face-match step whose consent the person declined (consent: false) ends failed with reason: consent-declined, after which a new choice is awaited |
| POST /v2/didcomm/authenticate/{threadId}/choice, .../answer | the holder's side, for tests and tooling: a choice in answer to the request, or again after a consent-declined step without the declined method; an answer, a consent true or false |
| POST /v2/didcomm/authenticate-enrol/{threadId}/challenge | answer an enrol-request with a passkey's creation options or an authenticator app's secret; again after a wrong code with the same secret, error: "wrong-code" and triesLeft, the codes left (2, then 1), three codes in all for an authenticator app (a fourth challenge is refused; the first carries neither field, nor does a passkey's). The secret is sent, never kept |
| POST /v2/didcomm/authenticate-enrol, .../{threadId}/answer, .../unenrol | the holder's side, for tests and tooling |
| GET /v2/didcomm/authenticate[-enrol][/{threadId}], POST .../{threadId}/fail | read authentications and enrolments, record a controller-side failure |
| GET /v2/didcomm/{protocol}[/{threadId}], POST .../{threadId}/fail | read exchanges, record a controller-side failure |
Webhook events
didcomm.ayni-flow.state-changed (the flow DTO plus previousState; a peer's problem report arrives as state:
failed with errorCode and closedBy: peer), didcomm.{authorize,confirm,link-session,session-grant,sign-tx,
reissue}.state-changed (the exchange DTO plus previousState), didcomm.notify.notification-received, didcomm.peer-status.status-received (what a peer says of this agent, with the status it replaces) didcomm.peer-status.query-received (a peer asks; answered tells whether the plugin sent the status it holds) and didcomm.peer-status.authenticate-received (a peer asks to be asked for its credential: the controller opens an authenticate flow).
didcomm.authenticate.state-changed (the authentication DTO plus previousState: choice-received with the
combination, answer-received with the answer on its step in steps; a consent declined arrives as
answer-received with consent: false, the step-result-sent that ends it consent-declined carries
awaitingChoice: true and declinedMethods, and the new choice arrives as choice-received again, the attempt
before kept in earlierAttempts), didcomm.authenticate.enrol-state-changed
(the enrolment DTO plus previousState: request-received with its type, answer-received with the answer;
never an authenticator app's secret) and didcomm.authenticate.unenrol-received (type; the controller answers with
a peer status whose enrolled no longer lists it).
In code
import { createVsAgent, setupBaseDidComm } from '@verana-labs/vs-agent-sdk'
import { setupAyniFlowProtocols } from '@ayni.org/vs-agent-plugin-ayni-flow'
const agent = createVsAgent({ plugins: [setupBaseDidComm(options), setupAyniFlowProtocols({ side: 'service' })], ... })