-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update the connectionless documentation
Signed-off-by: chereseeriepa <cherese.eriepa@outlook.com>
- Loading branch information
1 parent
6af1f61
commit b842b5f
Showing
2 changed files
with
166 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,175 @@ | ||
# Edge SDK Connectionless Presentation | ||
## Requirements | ||
1. A working Identus Mediator and an Identus Cloud Agent. | ||
2. A holder who already has a JWT Credential issued by a known issuer (prism:did) [Holder A] | ||
|
||
## User Flow | ||
|
||
> NOTE: | ||
> | ||
> Please follow the [Quick started guide](../../docs/quick-start) to complete steps 1, 2 | ||
```mermaid | ||
sequenceDiagram | ||
autonumber | ||
actor Peer | ||
actor Admin | ||
participant Verifier | ||
## Flow | ||
1. The verifier will need to generate an invitation url as follows: | ||
Admin->> Verifier: Request a Connectionless Presentation Invitation | ||
Verifier->> Admin: Connectionless Presentation Invitation | ||
``` | ||
curl --location 'http:///cloud-agent/present-proof/presentations/invitation' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"goalCode" : "present-vp", | ||
"goal" : "Request proof of vaccination information", | ||
"proofs": [], | ||
"options": { | ||
"challenge": "11c91493-01b3-4c4d-ac36-b336bab5bddf", | ||
"domain": "https://prism-verifier.com" | ||
} | ||
} | ||
``` | ||
Admin->>Peer: Connectionless Presentation Invitation (OOB) | ||
The response will look as follows: | ||
Peer ->> Peer: Parse the OOB | ||
Peer ->> Verifier: Accept the Connectionless Presentation Invitation (OOB) | ||
Verifier ->> Peer: Connectionless Presentation Request | ||
Peer ->> Verifier: Presentation | ||
Admin ->> Verifier: Get Presentation | ||
Verifier ->> Admin: Verified | ||
``` | ||
{ | ||
"presentationId": "715bc063-cd61-4049-834c-465b3eb19042", | ||
"thid": "71a16da3-97ff-460a-b5f9-25a61fe864f4", | ||
"role": "Verifier", | ||
"status": "InvitationGenerated", | ||
"proofs": [], | ||
"data": [], | ||
"goalCode": "present-vp", | ||
"goal": "Request proof of vaccination information", | ||
"myDid": "did:peer:2.Ez6LSt2C1xviB7nFEUHJAyWqvDF2xyJtQHWafQMxmy1SySoH6.Vz6MkgMChqZVQ47G88EBY6QZoPbBsCqByhtyfA3TQpyBKn7Ej.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHA6Ly8xOTIuMTY4LjEuNDQ6ODAwMC9kaWRjb21tIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfX0", | ||
"invitation": { | ||
"id": "71a16da3-97ff-460a-b5f9-25a61fe864f4", | ||
"type": "https://didcomm.org/out-of-band/2.0/invitation", | ||
"from": "did:peer:2.Ez6LSt2C1xviB7nFEUHJAyWqvDF2xyJtQHWafQMxmy1SySoH6.Vz6MkgMChqZVQ47G88EBY6QZoPbBsCqByhtyfA3TQpyBKn7Ej.SeyJ0IjoiZG0iLCJzIjp7InVyaSI6Imh0dHA6Ly8xOTIuMTY4LjEuNDQ6ODAwMC9kaWRjb21tIiwiciI6W10sImEiOlsiZGlkY29tbS92MiJdfX0", | ||
"invitationUrl": "https://my.domain.com/path?_oob=eyJpZCI6IjcxYTE2ZGEzLTk3ZmYtNDYwYS1iNWY5LTI1YTYxZmU4NjRmNCIsInR5cGUiOiJodHRwczovL2RpZGNvbW0ub3JnL291dC1vZi1iYW5kLzIuMC9pbnZpdGF0aW9uIiwiZnJvbSI6ImRpZDpwZWVyOjIuRXo2TFN0MkMxeHZpQjduRkVVSEpBeVdxdkRGMnh5SnRRSFdhZlFNeG15MVN5U29INi5WejZNa2dNQ2hxWlZRNDdHODhFQlk2UVpvUGJCc0NxQnlodHlmQTNUU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MjU1ZWJkZGU5ODdiIiwiaW5wdXRfZGVzY3JpcHRvcnMiOltdfX19LCJmb3JtYXQiOiJwcmlzbS9qd3QifV0sInRoaWQiOiI3MWExNmRhMy05N2ZmLTQ2MGEtYjVmOS0yNWE2MWZlODY0ZjQiLCJmcm9tIjoiZGlkOnBlZXI6Mi5FejZMU3QyQzF4dmlCN25GRVVISkF5V3F2REYyeHlKdFFIV2FmUU14bXkxU3lTb0g2LlZ6Nk1rZ01DaHFaVlE0N0c4OEVCWTZRWm9QYkJzQ3FCeWh0eWZBM1RRcHlCS243RWouU2V5SjBJam9pWkcwaUxDSnpJanA3SW5WeWFTSTZJbWgwZEhBNkx5OHhPVEl1TVRZNExqRXVORFE2T0RBd01DOWthV1JqYjIxdElpd2ljaUk2VzEwc0ltRWlPbHNpWkdsa1kyOXRiUzkyTWlKZGZYMCJ9fX1dLCJjcmVhdGVkX3RpbWUiOjE3MjQ0MjY1NjgsImV4cGlyZXNfdGltZSI6MTcyNDQyNjg2OH0=" | ||
}, | ||
"metaRetries": 5 | ||
} | ||
``` | ||
|
||
The Verifier will make this available to the holder in shape of QA code, link, etc. | ||
## Steps | ||
|
||
1. **Admin** requests a connectionless presentation request invitation from the **Verifier** | ||
|
||
```bash | ||
curl --location 'http://localhost:9000/cloud-agent/present-proof/presentations/invitation' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"goalCode" : "present-vp", | ||
"goal" : "Request presentation", | ||
"proofs": [], | ||
"options": { | ||
"challenge": "a6af4ea1-2f11-43de-bd17-e0182e55f919", | ||
"domain": "http://localhost:9000/cloud-agent" | ||
} | ||
}' | ||
``` | ||
|
||
2. The **Verifier** sends back the `Connectionless Presentation Request Invitation` | ||
- Response example: | ||
|
||
```json | ||
{ | ||
"presentationId": "76b2b571-8456-4413-8dd3-d8f5186fd472", | ||
"thid": "9d99f0b4-25b7-47e6-8816-1687c86dc3f1", | ||
"role": "Verifier", | ||
"status": "InvitationGenerated", | ||
"proofs": [], | ||
"data": [], | ||
"requestData": [ | ||
{ | ||
"options": { | ||
"challenge": "a6af4ea1-2f11-43de-bd17-e0182e55f919", | ||
"domain" : "http://localhost:9000/cloud-agent" | ||
}, | ||
"presentation_definition" : { | ||
"id": "070cd2f8-e8cc-4ae4-94bd-3ac886fed6df", | ||
"input_descriptors": [], | ||
"name": null, | ||
"purpose": null, | ||
"format" : null | ||
} | ||
} | ||
], | ||
"goalCode": "present-vp", | ||
"goal": "Request presentation", | ||
"myDid": "did:peer:2.Ez6LS...", | ||
"invitation": { | ||
"id": "9d99f0b4-25b7-47e6-8816-1687c86dc3f1", | ||
"type": "https://didcomm.org/out-of-band/2.0/invitation", | ||
"from": "did:peer:2.Ez6LS...9", | ||
"invitationUrl": "https://my.domain.com/path?_oob=eyJpZCI6IjlkOTlmMGI0LTI1YjctNDdlNi04ODE2LTE2ODdjODZkYzNmMSIsInR5cGUiOiJodHRwczovL2RpZGNvbW0ub3JnL291dC1vZi1iYW5kLzIuMC9pbnZpdGF0aW9uIiwiZnJvbSI6ImRpZDpwZWVyOjIuRXo2TFNpb2Foa3lncmZ0cnpLUWM2aXNyVngyTEhoSlFpQTF1U0ZCeHBXMW02aE56SC5WejZNa2VvdlE5bUVoVm9TcXJucUhkYVltRjhHRTdvOXlXWTJvVmlrdThFelhLNGloLlNleUowSWpvaVpHMGlMQ0p6SWpwN0luVnlhU0k2SW1oMGRIQTZMeTh4T1RJdU1UWTRMalk0TGpZeU9qa3dNREF2Wkdsa1kyOXRiU0lzSW5JaU9sdGRMQ0poSWpwYkltUnBaR052YlcwdmRqSWlYWDE5IiwiYm9keSI6eyJnb2FsX2NvZGUiOiJwcmVzZW50LXZwIiwiZ29hbCI6IlJlcXVlc3QgcHJlc2VudGF0aW9uIiwiYWNjZXB0IjpbImRpZGNvbW0vdjIiXX0sImF0dGFjaG1lbnRzIjpbeyJpZCI6ImZjMGQ1MWY0LTlhMmItNDVmOS1hM2E0LWJkNmQwZTE2MzZjZCIsIm1lZGlhX3R5c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1TVRZNExqWTRMall5T2prd01EQXZaR2xrWTI5dGJTSXNJbklpT2x0ZExDSmhJanBiSW1ScFpHTnZiVzB2ZGpJaVhYMTkifX19XSwiY3JlYXRlZF90aW1lIjoxNzMwMTY3MTIxLCJleHBpcmVzX3RpbWUiOjE3MzAxNjc0MjF9" | ||
}, | ||
"metaRetries": 5 | ||
} | ||
``` | ||
|
||
3. The **Admin** forwards the `invitationUrl` to the **Peer**. | ||
|
||
4. The **Peer** validates the `invitationUrl` with `agent.parseInvitation`: | ||
|
||
```typescript | ||
const oob = await agent.parseInvitation(invitationUrl) | ||
``` | ||
|
||
2. The holder then opens its the Edge Agent Wallet SDK, "Connections tab" and will pase the invitation link in the field. | ||
5. The **Peer** accepts the invitation using `agent.acceptInvitation`: | ||
|
||
Once the invitation is parsed, the user will then be able to see a new Verification request, choose one of the available credentials and send the proof as the verifier requested. | ||
```typescript | ||
await agent.acceptInvitation(oob) | ||
``` | ||
|
||
6. The **Verifier** sends the presentation request to the **Peer**. | ||
|
||
7. The **Peer** listens for the presentation request and prepares the presentation of the verifiable credential. | ||
|
||
```typescript | ||
agent.addListener(SDK.ListenerKey.MESSAGE, async (newMessages: SDK.Domain.Message[]) => { | ||
const presentationRequests = newMessages.filter( | ||
(message) => message.piuri === SDK.ProtocolType.DidcommRequestPresentation | ||
) | ||
const credentials = await agent.pluto.getAllCredentials() | ||
const lastCredential = lastCredentials.at(-1) | ||
if (presentationRequests.length) { | ||
for (const requestMessage of presentationRequests) { | ||
try { | ||
const presentationRequest = await SDK.RequestPresentation.fromMessage(requestMessage) | ||
const presentation = await agent.createPresentationForRequestProof(presentationRequest, lastCredential) | ||
await agent.sendMessage(presentation.makeMessage()) | ||
} catch (err) { | ||
console.error('Error presenting the credential:', err) | ||
} | ||
} | ||
} | ||
}) | ||
``` | ||
8. The **Admin** requests the presentation from the **Verifier** | ||
```bash | ||
curl -X GET "http://localhost:9000/present-proof/presentations/76b2b571-8456-4413-8dd3-d8f5186fd472" \ | ||
-H "accept: application/json" \ | ||
-H "Content-Type: application/json" \ | ||
-H "apikey: [[VERIFIER_API_KEY]]" | ||
``` | ||
9. The **Verifier** responds that the Credential is verified | ||
- Response example: | ||
```json | ||
{ | ||
"presentationId": "76b2b571-8456-4413-8dd3-d8f5186fd472", | ||
"thid": "9d99f0b4-25b7-47e6-8816-1687c86dc3f1", | ||
"role": "Verifier", | ||
"status": "PresentationVerified", | ||
"proofs": [], | ||
"data": [ | ||
"eyJhbGciOiJFUzI...." | ||
], | ||
"requestData": [ | ||
{ | ||
"options": { | ||
"challenge": "a6af4ea1-2f11-43de-bd17-e0182e55f919", | ||
"domain" : "http://localhost:9000/cloud-agent" | ||
}, | ||
"presentation_definition" : { | ||
"id": "070cd2f8-e8cc-4ae4-94bd-3ac886fed6df", | ||
"input_descriptors": [], | ||
"name": null, | ||
"purpose": null, | ||
"format" : null | ||
} | ||
} | ||
], | ||
"goalCode": "present-vp", | ||
"goal": "Request presentation", | ||
"myDid": "did:peer:2.Ez6LS...", | ||
"invitation": { | ||
"id": "9d99f0b4-25b7-47e6-8816-1687c86dc3f1", | ||
"type": "https://didcomm.org/out-of-band/2.0/invitation", | ||
"from": "did:peer:2.Ez6LS...9", | ||
"invitationUrl": "https://my.domain.com/path?_oob=eyJpZCI6IjlkOTlmMGI0LTI1YjctNDdlNi04ODE2LTE2ODdjODZkYzNmMSIsInR5cGUiOiJodHRwczovL2RpZGNvbW0ub3JnL291dC1vZi1iYW5kLzIuMC9pbnZpdGF0aW9uIiwiZnJvbSI6ImRpZDpwZWVyOjIuRXo2TFNpb2Foa3lncmZ0cnpLUWM2aXNyVngyTEhoSlFpQTF1U0ZCeHBXMW02aE56SC5WejZNa2VvdlE5bUVoVm9TcXJucUhkYVltRjhHRTdvOXlXWTJvVmlrdThFelhLNGloLlNleUowSWpvaVpHMGlMQ0p6SWpwN0luVnlhU0k2SW1oMGRIQTZMeTh4T1RJdU1UWTRMalk0TGpZeU9qa3dNREF2Wkdsa1kyOXRiU0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