Skip to content

Instantly share code, notes, and snippets.

@pims
Last active August 31, 2024 06:35
Show Gist options
  • Save pims/bee1a5743f606dc52374becf867fb310 to your computer and use it in GitHub Desktop.
Save pims/bee1a5743f606dc52374becf867fb310 to your computer and use it in GitHub Desktop.
# copied from https://github.com/Ajnasz/sekret.link/blob/441806f29fce8a6dbbcfff22a93c3e8d52d12962/hurl/createdelete.hurl
# Create a new entry
POST {{api_host}}/api/
content-type: application/json
{
"name": "John Doe",
"email": "[email protected]"
}
HTTP 200
[Captures]
entry_uuid: header "x-entry-uuid"
entry_key: header "x-entry-key"
entry_expire: header "x-entry-expire"
entry_delete_key: header "x-entry-delete-key"
# Delete an entry
DELETE {{api_host}}/api/{{entry_uuid}}/{{entry_key}}/{{entry_delete_key}}
HTTP 202
# Get an entry
GET {{api_host}}/api/{{entry_uuid}}/{{entry_key}}
HTTP 404
##############################
# Prerequisites
##############################
# Issuer create DID
POST {{ issuer_url }}/cloud-agent/did-registrar/dids
{
"documentTemplate": {
"publicKeys": [
{
"id": "iss-key",
"purpose": "assertionMethod"
}
],
"services": []
}
}
HTTP 201
[Captures]
issuer_did: jsonpath "$.longFormDid" regex "(did:prism:[a-z0-9]+):.+$"
# Issuer publish DID
POST {{ issuer_url }}/cloud-agent/did-registrar/dids/{{ issuer_did }}/publications
HTTP 202
# Issuer wait for DID to be published
GET {{ issuer_url }}/cloud-agent/did-registrar/dids/{{ issuer_did }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.status" == "PUBLISHED"
# Holder create DID
POST {{ holder_url }}/cloud-agent/did-registrar/dids
{
"documentTemplate": {
"publicKeys": [
{
"id": "auth-key",
"purpose": "authentication"
}
],
"services": []
}
}
HTTP 201
[Captures]
holder_did: jsonpath "$.longFormDid"
##############################
# Issuance Connection
##############################
# Inviter create connection
POST {{ issuer_url }}/cloud-agent/connections
{
"label": "My Connection"
}
HTTP 201
[Captures]
raw_invitation: jsonpath "$.invitation.invitationUrl" regex ".*_oob=(.*)$"
issuer_connection_id: jsonpath "$.connectionId"
# Invitee accept connection
POST {{ holder_url }}/cloud-agent/connection-invitations
{
"invitation": "{{ raw_invitation }}"
}
HTTP 200
[Captures]
holder_connection_id: jsonpath "$.connectionId"
# Wait for inviter connection status
GET {{ issuer_url }}/cloud-agent/connections/{{ issuer_connection_id }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.state" == "ConnectionResponseSent"
# Wait for invitee connection status
GET {{ holder_url }}/cloud-agent/connections/{{ holder_connection_id }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.state" == "ConnectionResponseReceived"
##############################
# Issuance
##############################
# Issuer create credential offer
POST {{ issuer_url }}/cloud-agent/issue-credentials/credential-offers
{
"claims": {
"emailAddress": "[email protected]",
"givenName": "Alice",
"familyName": "Wonderland"
},
"credentialFormat": "JWT",
"issuingDID": "{{ issuer_did }}",
"connectionId": "{{ issuer_connection_id }}"
}
HTTP 201
[Captures]
issuer_cred_record_id: jsonpath "$.recordId"
didcomm_issuing_thid: jsonpath "$.thid"
# Holder wait for OfferReceived state
GET {{ holder_url }}/cloud-agent/issue-credentials/records
[QueryStringParams]
thid: {{ didcomm_issuing_thid }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.contents[0].protocolState" == "OfferReceived"
[Captures]
holder_cred_record_id: jsonpath "$.contents[0].recordId"
# Holder accept a credential-offer
POST {{ holder_url }}/cloud-agent/issue-credentials/records/{{ holder_cred_record_id }}/accept-offer
{
"subjectId": "{{ holder_did }}"
}
HTTP 200
# Holder wait for CredentialReceived state
GET {{ holder_url }}/cloud-agent/issue-credentials/records/{{ holder_cred_record_id }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.protocolState" == "CredentialReceived"
# Issuer wait for CredentialSent state
GET {{ issuer_url }}/cloud-agent/issue-credentials/records/{{ issuer_cred_record_id }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.protocolState" == "CredentialSent"
##############################
# Presentation Connection
##############################
# Inviter create connection
POST {{ verifier_url }}/cloud-agent/connections
{
"label": "My Connection"
}
HTTP 201
[Captures]
raw_invitation: jsonpath "$.invitation.invitationUrl" regex ".*_oob=(.*)$"
verifier_connection_id: jsonpath "$.connectionId"
# Invitee accept connection
POST {{ holder_url }}/cloud-agent/connection-invitations
{
"invitation": "{{ raw_invitation }}"
}
HTTP 200
[Captures]
holder_connection_id: jsonpath "$.connectionId"
# Wait for inviter connection status
GET {{ verifier_url }}/cloud-agent/connections/{{ verifier_connection_id }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.state" == "ConnectionResponseSent"
# Wait for invitee connection status
GET {{ holder_url }}/cloud-agent/connections/{{ holder_connection_id }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.state" == "ConnectionResponseReceived"
##############################
# Presentation
##############################
# Verifier create presentation request
POST {{ verifier_url }}/cloud-agent/present-proof/presentations
{
"connectionId": "{{ verifier_connection_id }}",
"proofs":[],
"options": {
"challenge": "11c91493-01b3-4c4d-ac36-b336bab5bddf",
"domain": "https://prism-verifier.com"
}
}
HTTP 201
[Captures]
verifier_presentation_id: jsonpath "$.presentationId"
didcomm_presentation_thid: jsonpath "$.thid"
# Holder wait for RequestReceived state
GET {{ holder_url }}/cloud-agent/present-proof/presentations
[QueryStringParams]
thid: {{ didcomm_presentation_thid }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.contents[0].status" == "RequestReceived"
[Captures]
holder_presentation_id: jsonpath "$.contents[0].presentationId"
# Holder accept presentation request
PATCH {{ holder_url }}/cloud-agent/present-proof/presentations/{{ holder_presentation_id }}
{
"action": "request-accept",
"proofId": ["{{ holder_cred_record_id }}"]
}
HTTP 200
# Holder wait for PresentationSent state
GET {{ holder_url }}/cloud-agent/present-proof/presentations
[QueryStringParams]
thid: {{ didcomm_presentation_thid }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.contents[0].status" == "PresentationSent"
# Verfiier wait for PresentationVerified state
GET {{ verifier_url }}/cloud-agent/present-proof/presentations
[QueryStringParams]
thid: {{ didcomm_presentation_thid }}
[Options]
retry: -1
HTTP 200
[Asserts]
jsonpath "$.contents[0].status" == "PresentationVerified"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment