diff --git a/prism-agent/service/connect.md b/prism-agent/service/connect.md deleted file mode 100644 index 806b7f926a..0000000000 --- a/prism-agent/service/connect.md +++ /dev/null @@ -1,51 +0,0 @@ -### Running multiple instances of Prism Agent ---- - -#### Starting an instance for `Inviter` on port `8080` - -```bash -# From the root directory -PORT=8080 docker-compose -p inviter -f infrastructure/local/docker-compose.yml up -``` - -#### Starting an instance for `Invitee` on port `8090` - -```bash -# From the root directory -PORT=8090 docker-compose -p invitee -f infrastructure/local/docker-compose.yml up -``` - -### Executing the `Connect` flow ---- - -- **Inviter** - Create a connection record containing the invitation -```bash -curl -X 'POST' \ - 'http://localhost:8080/prism-agent/connections' \ - -H 'Content-Type: application/json' \ - -d '{ - "label": "Connect with Alice" - }' | jq -``` - -- **Inviter** - Retrieving the list of connections -```bash -curl -X 'GET' 'http://localhost:8080/prism-agent/connections' | jq -``` - -- **Invitee** - Accept OOB invitation - -Replace `{RAW_INVITATION}` with the value of the '_oob' query string parameter from the invitation URL above -```bash -curl -X 'POST' \ - 'http://localhost:8090/prism-agent/connection-invitations' \ - -H 'Content-Type: application/json' \ - -d '{ - "invitation": "{RAW_INVITATION}" - }' | jq -``` - -- **Invitee** - Retrieving the list of connections -```bash -curl -X 'GET' 'http://localhost:8090/prism-agent/connections' | jq -``` diff --git a/prism-agent/service/did.md b/prism-agent/service/did.md deleted file mode 100644 index f7c0ae5eb4..0000000000 --- a/prism-agent/service/did.md +++ /dev/null @@ -1,50 +0,0 @@ -### Running single instance of Prism Agent ---- - -#### Starting an instance on port `8080` - -Follow the instruction on `./infrastructure/local/README.md` for local deployment. - -```bash -./infrastructure/local/run.sh -p 8080 -``` - -### Executing a simple DID lifecycle flow ---- - -- **Organization** creates a new unpublised DID stored in Prism Agent -```bash -curl --location --request POST 'http://localhost:8080/prism-agent/did-registrar/dids' \ - --header 'Content-Type: application/json' \ - --header 'Accept: application/json' \ - --data-raw '{ - "documentTemplate": { - "publicKeys": [ - { - "id": "auth0", - "purpose": "authentication" - } - ], - "services": [] - } - }' -``` - -- **Organization** lists all the DIDs in Prism Agent -```bash -curl --location --request GET 'http://localhost:8080/prism-agent/did-registrar/dids' \ - --header 'Accept: application/json' -``` - -- **Organization** publishes the DID in Prism Agent to the blockchain -Replace `DID_REF` by the DID on Prism Agent that should be published -```bash -curl --location --request POST 'http://localhost:8080/prism-agent/did-registrar/dids/{DID_REF}/publications' \ ---header 'Accept: application/json' -``` -- **Organization** resolves the DID document of Prism DID -Replace `DID_REF` by the DID on Prism Agent that should be resolved -```bash -curl --location --request GET 'http://localhost:8080/prism-agent/dids/{DID_REF}' \ ---header 'Accept: application/json' -``` diff --git a/prism-agent/service/issue.md b/prism-agent/service/issue.md deleted file mode 100644 index c935249c91..0000000000 --- a/prism-agent/service/issue.md +++ /dev/null @@ -1,118 +0,0 @@ -### Running multiple instances of Prism Agent ---- - -#### Starting an instance for `Issuer` on port `8080` - -```bash -# From the root directory -PORT=8080 docker-compose -p issuer -f infrastructure/local/docker-compose.yml up -``` - -#### Starting an instance for `Holder` on port `8090` - -```bash -# From the root directory -PORT=8090 docker-compose -p holder -f infrastructure/local/docker-compose.yml up -``` - -### Executing the `Issue` flow ---- - -- **Issuer** - Create a DID that will be used for issuing a VC with at least 1 `assertionMethod` key - -```bash -curl --location --request POST 'http://localhost:8080/prism-agent/did-registrar/dids' \ - --header 'Content-Type: application/json' \ - --header 'Accept: application/json' \ - --data-raw '{ - "documentTemplate": { - "publicKeys": [ - { - "id": "my-issuing-key", - "purpose": "assertionMethod" - } - ], - "services": [] - } - }' -``` - -- **Issuer** - Publish an issuing DID to the blockchain - -Replace `DID_REF` by the DID on Prism Agent that should be published -```bash -curl --location --request POST 'http://localhost:8080/prism-agent/did-registrar/dids/{DID_REF}/publications' \ ---header 'Accept: application/json' -``` - -- **Holder** - Create a Prism DID to receive a credential - -Holder also needs a Prism DID to be used as a VC subject, but it is not required to be published. -The holder DID must have at least 1 `authentication` key for presenting credentials later in the process. - -```bash -curl --location --request POST 'http://localhost:8090/prism-agent/did-registrar/dids' \ - --header 'Content-Type: application/json' \ - --header 'Accept: application/json' \ - --data-raw '{ - "documentTemplate": { - "publicKeys": [ - { - "id": "my-auth-key", - "purpose": "authentication" - } - ], - "services": [] - } - }' -``` - -- **Issuer** - Initiate a new issue credential flow - -Replace `{SUBJECT_ID}` with the DID of the holder and `{CONNECTION_ID}` with the connection to the holder. -This assumes that there is a connection already established (see ["connect" documentation](./connect.md)). Also `{ISSUING_DID}` must be specified using the DID created above. - - -```bash -curl -X 'POST' \ - 'http://localhost:8080/prism-agent/issue-credentials/credential-offers' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "schemaId": "schema:1234", - "subjectId": "{SUBJECT_ID}", - "connectionId": "{CONNECTION_ID}", - "issuingDID": "{ISSUING_DID}", - "validityPeriod": 3600, - "automaticIssuance": false, - "claims": { - "firstname": "Alice", - "lastname": "Wonderland", - "birthdate": "01/01/2000" - } - }' | jq -``` - -- **Holder** - Retrieving the list of issue records -```bash -curl -X 'GET' 'http://localhost:8090/prism-agent/issue-credentials/records' | jq -``` - -- **Holder** - Accepting the credential offer - -Replace `{RECORD_ID}` with the UUID of the record from the previous list -```bash -curl -X 'POST' 'http://localhost:8090/prism-agent/issue-credentials/records/{RECORD_ID}/accept-offer' | jq -``` - -- **Issuer** - Retrieving the list of issue records -```bash -curl -X 'GET' 'http://localhost:8080/prism-agent/issue-credentials/records' | jq -``` - -- **Issuer** - Issuing the credential - -Replace `{RECORD_ID}` with the UUID of the record from the previous list -```bash -curl -X 'POST' 'http://localhost:8080/prism-agent/issue-credentials/records/{RECORD_ID}/issue-credential' | jq -``` diff --git a/prism-agent/service/present-proof.md b/prism-agent/service/present-proof.md deleted file mode 100644 index 87ebfed290..0000000000 --- a/prism-agent/service/present-proof.md +++ /dev/null @@ -1,125 +0,0 @@ -## Follow Issue flow as documented below so the the holder has a credential - ---- -## Issue flow -Basic documentation on how to execute the Issue flow from the command line can be found [here](./issue.md). - - -### Running instances of verifier Agent ---- - -#### Starting an instance for `Verifier` on port `8070` -### You can stop the `Issuer` if you are running out of resources locally - -```bash -# From the root directory -PORT=8070 docker-compose -p verifier -f infrastructure/local/docker-compose.yml up -``` - -### Executing the `Verifier` flow ---- -connectionId is the holder (connectionId or did) -Replace `{CONNECTION_ID}` with the DID of the holder displayed at startup in the his Prism Agent console logs - -- **Verifier** - Initiates a Proof Request -`challenge` and `domain` are options which is optional -but reuired to protect against replay attack - -```shell -curl -X 'POST' \ - 'http://localhost:8070/prism-agent/present-proof/presentations' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "connectionId": "{CONNECTION_ID}", "proofs":[],"options": { - "challenge": "11c91493-01b3-4c4d-ac36-b336bab5bddf", - "domain": "https://prism-verifier.com" - } -}' -``` -- **Holder** - Retrieving the list of presentation records - -```shell -curl -X 'GET' 'http://localhost:8090/prism-agent/present-proof/presentations' -H 'accept: application/json' | jq -``` - -- **Holder** - Retrieving the list of credentials records choose the `{RECORD_ID}` for credential with status CredentialRecieved - -```shell -curl -X 'GET' 'http://localhost:8090/prism-agent/issue-credentials/records' -H 'accept: application/json' | jq -``` - -- **Holder** - Accepting the Presentation Request -Replace `{PRESENTATION_ID}` with the UUID of the record from the presentation records list -Replace `{RECORD_ID}` with the UUID of the record from the credential records list - - -```shell -curl -X 'PATCH' \ - 'http://localhost:8090/prism-agent/present-proof/presentations/{PRESENTATION_ID}' \ - -H 'Content-Type: application/json' \ - -d '{ - "action": "request-accept", - "proofId": ["{RECORD_ID}"] -}' -``` - -- **Holder** - Reject the Presentation Request -Replace `{PRESENTATION_ID}` with the UUID of the record from the presentation records list -Replace `{RECORD_ID}` with the UUID of the record from the credential records list - - -```shell -curl -X 'PATCH' \ - 'http://localhost:8090/prism-agent/present-proof/presentations/{PRESENTATION_ID}' \ - -H 'Content-Type: application/json' \ - -d '{ - "action": "request-reject", - "proofId": ["{RECORD_ID}"] -}' -``` - -- **Holder** - check Presentation state PresentationSent -# check PresentationSent ! -```shell -curl -X 'GET' 'http://localhost:8090/prism-agent/present-proof/presentations' -H 'accept: application/json' | jq -``` - -- **Verifier** - check Presentation state PresentationVerified -# check PresentationVerified ! -```shell -curl -X 'GET' 'http://localhost:8070/prism-agent/present-proof/presentations' -H 'accept: application/json' | jq -``` -- **Verifier** - Accept PresentationVerified -Replace `{PRESENTATION_ID}` with the UUID of the record from the presentation records list with state PresentationVerified - -```shell -curl -X 'PATCH' \ - 'http://localhost:8070/prism-agent/present-proof/presentations/{PRESENTATION_ID}' \ - -H 'Content-Type: application/json' \ - -d '{"action": "presentation-accept"}' | jq -``` - -- **Verifier** - Reject Presentation -Replace `{PRESENTATION_ID}` with the UUID of the record from the presentation records list with state PresentationVerified - -```shell -curl -X 'PATCH' \ - 'http://localhost:8070/prism-agent/present-proof/presentations/{PRESENTATION_ID}' \ - -H 'Content-Type: application/json' \ - -d '{"action": "presentation-reject"}' | jq -``` - -- **Verifier** - check Presentation state PresentationVerified -# check PresentationAccepted ! - -```shell -curl -X 'GET' 'http://localhost:8070/prism-agent/present-proof/presentations' -H 'accept: application/json' | jq -``` - -- **Holder / Verifier** - Get a specicic Presentation -Replace `{PRESENTATION_ID}` with the UUID of the record from the presentation list - -```shell -curl -X 'GET' 'http://localhost:8070/prism-agent/present-proof/presentations/{PRESENTATION_ID}' -H 'accept: application/json' | jq -``` \ No newline at end of file diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/http/service/PresentProofApiServiceImpl.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/http/service/PresentProofApiServiceImpl.scala index 417a2aa10e..019425e025 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/http/service/PresentProofApiServiceImpl.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/http/service/PresentProofApiServiceImpl.scala @@ -26,6 +26,7 @@ import io.iohk.atala.pollux.core.model._ import io.iohk.atala.mercury.model.Base64 import cats.instances.option import io.iohk.atala.pollux.core.model.presentation.Options +import io.iohk.atala.agent.openapi.model.PublicKeyJwk class PresentProofApiServiceImpl(presentationService: PresentationService, connectionService: ConnectionService)(using runtime: Runtime[Any] @@ -48,7 +49,7 @@ class PresentProofApiServiceImpl(presentationService: PresentationService, conne .createPresentationRecord( thid = DidCommID(), subjectDid = didId, - connectionId = None, + connectionId = Some(requestPresentationInput.connectionId), proofTypes = requestPresentationInput.proofs.map { e => ProofType( schema = e.schemaId, // TODO rename field to schemaId