Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflows and exchanges endpoints. #382

Merged
merged 16 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
20 changes: 20 additions & 0 deletions exchanges.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>W3C CCG - VC Verifier API</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">

<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url='./exchanges.yml'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>
376 changes: 376 additions & 0 deletions exchanges.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,376 @@
openapi: 3.0.0
info:
version: "0.0.3-unstable"
title: VC Exchanges API
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
description: This is an Experimental Open API Specification for the [VC Data Model](https://www.w3.org/TR/vc-data-model/).
license:
name: W3C Software and Document License
url: http://www.w3.org/Consortium/Legal/copyright-software.
contact:
name: GitHub Source Code
url: https://github.com/w3c-ccg/vc-api
paths:
/workflows:
post:
summary: Creates a new workflow and returns its information in the response body.
tags:
- Credentials
security:
- networkAuth: []
- oAuth2: []
- zCap: []
operationId: createWorkflow
description: Creates a new workflow and returns workflowId in the response body.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateWorkflowRequest"
responses:
"200":
description: Workflow successfully created!
content:
application/json:
schema:
$ref: "#/components/schemas/CreateWorkflowResponse"
"400":
description: Invalid input
"401":
description: Not Authorized
"500":
description: Internal Error
/workflows/{localWorkflowId}:
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
get:
summary: Gets the configuration of an existing workflow and returns it in the response body.
tags:
- Credentials
security:
- networkAuth: []
- oAuth2: []
- zCap: []
operationId: getWorkflowConfiguration
description: Gets the configuration of an existing workflow and returns it in the response body.
responses:
"200":
description: Workflow configuration retrieved!
content:
application/json:
schema:
$ref: "#/components/schemas/GetWorkflowResponse"
"400":
description: Invalid input
"401":
description: Not Authorized
"500":
description: Internal Error
/workflows/{localWorkflowId}/exchanges:
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
post:
summary: Creates a new exchange and returns exchangeId and time to live in the response body.
tags:
- Credentials
security:
- networkAuth: []
- oAuth2: []
- zCap: []
operationId: createExchange
description: Creates a new exchange and returns exchangeId and time to live in the response body.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateExchangeRequest"
responses:
"200":
description: Exchange successfully created!
content:
application/json:
schema:
$ref: "#/components/schemas/CreateExchangeResponse"
"400":
description: Invalid input
"401":
description: Not Authorized
"500":
description: Internal Error
/workflows/{localWorkflowId}/exchanges/{localExchangeId}:
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
get:
summary: Gets the state of an existing exchange and returns it in the response body.
tags:
- Credentials
security:
- networkAuth: []
- oAuth2: []
- zCap: []
operationId: getExchangeConfiguration
description: Gets the configuration of an existing exchange and returns it in the response body.
responses:
"200":
description: Exchange configuration retrieved!
content:
application/json:
schema:
$ref: "#/components/schemas/GetExchangeResponse"
"400":
description: Invalid input
"401":
description: Not Authorized
"500":
description: Internal Error
post:
summary: Participate in an exchange. Posting an empty body will start the exchange or return what the exchange is expecting to complete the next step.
tags:
- Credentials
security:
- networkAuth: []
- oAuth2: []
- zCap: []
operationId: participateInExchange
description: Participate in an exchange. Posting an empty body will start the exchange or return what the exchange is expecting to complete the next step.
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
- $ref: "./components/Credential.yml#/components/schemas/Credential"
description: Either a credential to be issued or a Verifiable Presentation.
responses:
"200":
description: Exchange progressed.
content:
application/json:
schema:
$ref: "#/components/schemas/ExchangeParticipationResponse"
"400":
description: Invalid input
"401":
description: Not Authorized
"500":
description: Internal Error
components:
schemas:
CreateWorkflowRequest:
type: object
additionalProperties: false
description: Object containing information for creating a workflow.
properties:
required:
type: object
properties:
steps:
type: object
properties:
stepName:
type: object
properties:
step:
$ref: "#/components/schemas/WorkflowStep"
initialStep:
type: string
description: The step from the above set that the exchange starts on.
options:
type: object
properties:
controller:
type: string
description: The controller of the instance.
authorization:
type: object
description: Authorization scheme information (e.g. OAuth2 configuration).
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
credentialTemplates:
type: array
description: One or more VC templates for issuance.
items:
type: object
properties:
type:
type: string
template:
type: string
CreateWorkflowResponse:
type: object
additionalProperties: false
description: Object containing information about a created workflow.
properties:
workflowId:
type: string
description: The URL that uniquely identifies the created workflow.
GetWorkflowResponse:
type: object
additionalProperties: false
description: Object containing information about a workflow.
properties:
stepInformation:
type: object
description: Information about the steps required for the workflow.
properties:
exchanges:
type: array
description: The identifiers of the current exchanges associated with the workflow instance.
items:
type: string
steps:
type: object
properties:
stepName:
type: object
properties:
step:
$ref: "#/components/schemas/WorkflowStep"
initialStep:
type: string
description: The step from the above set that the exchange starts on.
options:
type: object
properties:
controller:
type: string
description: The controller of the instance.
authorization:
type: object
description: Authorization scheme information (e.g. OAuth2 configuration).
wes-smith marked this conversation as resolved.
Show resolved Hide resolved
credentialTemplates:
type: array
description: One or more VC templates for issuance.
items:
brianorwhatever marked this conversation as resolved.
Show resolved Hide resolved
type: object
properties:
type:
type: string
description: The type of template.
template:
type: string
description: The template itself.
CreateExchangeRequest:
type: object
additionalProperties: false
description: Object containing information about the exchange to be created.
properties:
ttl:
type: string
description: Time to live for the exchange (ms).
variables:
type: array
description: Template variables to be used in the exchange. MAY be empty.
items:
type: object
CreateExchangeResponse:
type: object
additionalProperties: false
description: Object containing information about a created exchange.
properties:
exchangeId:
type: string
description: The URL that uniquely identifies the exchange.
sequence:
type: string
description: A sequence number for the exchange. Set to "0" on creation.
ttl:
type: string
description: The time to live for the created exchange.
variables:
type: array
description: Template variables to be used in the exchange.
items:
type: object
state:
type: string
description: The status ("pending" | "complete" | "invalid") of the exchange, set to "pending" on creation.
step:
type: string
description: The semantic string ID for the current step.
ExchangeParticipationResponse:
type: object
additionalProperties: false
description: Either what the exchange is expecting next or a result of the exchange.
properties:
response:
oneOf:
- type: object
properties:
verifiablePresentationRequest:
$ref: "./components/VerifiablePresentationRequest.yml#/components/schemas/VerifiablePresentationRequest"
- type: object
properties:
verifiablePresentation:
$ref: "./components/VerifiablePresentation.yml#/components/schemas/VerifiablePresentation"
- type: object
properties:
redirectUrl:
type: string
description: The URL the exchange wishes to redirect the client to.
GetExchangeResponse:
type: object
additionalProperties: false
description: Object containing information about an active exchange.
properties:
exchangeId:
type: string
description: The URL that uniquely identifies the exchange.
ttl:
type: string
description: The time to live for the exchange.
nextStep:
type: string
description: The interaction the exchange is expecting to happen next.
completedSteps:
type: array
description: The steps completed by the exchange previously.
items:
type: string
WorkflowStep:
type: object
additionalProperties: false
description: Object containing information about a workflow step.
oneOf:
- $ref: "#/components/schemas/StepData"
- type: object
properties:
stepTemplate:
$ref: "#/components/schemas/StepTemplate"
VerifiableCredentialTemplate:
type: object
additionalProperties: false
description: A Verifiable Credential template.
properties:
type:
type: string
description: The type of template.
template:
type: string
description: The VC template.
StepTemplate:
type: object
additionalProperties: false
description: A template for a workflow step. Either this must be present or the other step data must be present, but not both sets.
properties:
type:
type: string
description: The type of template.
template:
type: string
description: The step template.
StepData:
type: object
additionalProperties: false
description: Step data to be included if a template is not used.
properties:
createChallenge:
type: string
description:
verifiablePresentationRequest:
type: object
description: The VPR to send to the user in this step.
$ref: "./components/VerifiablePresentationRequest.yml#/components/schemas/VerifiablePresentationRequest"
nextStep:
type: string
description: The name of the next step in the sequence.
openId:
type: object
description: Optional information to trigger OID4VP
properties:
createAuthorizationRequest:
type: string
description: If present, auto-generate the OID4VP authorization request from the VPR. Either this or authorizationRequest must be present, but not both.
authorizationRequest:
type: object
Loading
Loading