Skip to content

Commit f840d36

Browse files
committed
docs: update the connectionless documentation
Signed-off-by: chereseeriepa <[email protected]>
1 parent c4d0fa6 commit f840d36

File tree

1 file changed

+71
-54
lines changed

1 file changed

+71
-54
lines changed

documentation/docs/quick-start.md

+71-54
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ API_KEY_ENABLED disables API Key authentication. This should **not** be used bey
148148
### Agent configuration
149149

150150
#### Creating LongForm PrismDID
151-
1. Run the following API request against your Issuer API to create a PRISM DID:
151+
1. Run the following API request against your Issuer API to create a PRISM DID, this gives you the `longFormDID`:
152152

153153
:::note
154154

@@ -177,16 +177,14 @@ curl --location \
177177
}'
178178
```
179179

180-
2. Publish the DID by replacing `{didRef}` with the `longFormDid` output value from the previous step.
180+
2. Publish the DID by replacing `{longFormDID}` with the output value from the previous step. This returns the DID in its short form, `publishedPrismDID`
181181

182182
```bash
183183
curl --location \
184-
--request POST 'http://localhost:8000/cloud-agent/did-registrar/dids/{didRef}/publications' \
184+
--request POST 'http://localhost:8000/cloud-agent/did-registrar/dids/{longFormDID}/publications' \
185185
--header 'Accept: application/json'
186186
```
187187

188-
3. The short version of the DID is the publishedPrismDID.
189-
190188
:::info
191189

192190
📖Learn more about PRISM DIDs and why it is necessary to publish specific DIDs [here](https://staging-docs.atalaprism.io/tutorials/dids/publish).
@@ -616,26 +614,27 @@ The Issuer can create a credential offer in two ways:
616614
Please replace the following variables in the example request before sending:
617615

618616
- `connectionId`: The ID of the connection previously established between agent and holder. This is part of the response of the POST message from the agent when calling the `cloud-agent/connections` endpoint. It is returned in the `connectionId` attribute. There is a unique connection ID for the relationship between issuer and holder and verifier and holder. In this example, please use the `connectionId` returned when creating the connection between issuer and holder
619-
- `publishedPrismDID`: The short form of the PRISM DID created when setting up the Issuer agent
620-
621-
The `connectionId` is just the ID of the connection we previously established with the issuer.
622-
623-
The Issuing DID is the published PRISM DID in its short version which was also used to create and publish the credential schema.
624-
625-
- ``
617+
- `issuingDID`: The Issuing DID is the `publishedPrismDID` created when [configuring the Issuer](#agent-configuration), which is the `longFormPrismDID` in its short form version.
626618

627619
:::
628620

629621
```bash
630622
curl --location --request POST 'http://localhost:8000/cloud-agent/issue-credentials/credential-offers' \
631623
--header 'Content-Type: application/json' \
632624
--data-raw '{
633-
"claims": {"emailAddress":"sampleEmail", "familyName":"", "dateOfIssuance":"2023-01-01T02:02:02Z", "drivingLicenseID":"", "drivingClass":1},
625+
"claims": {
626+
"emailAddress": "sampleEmail",
627+
"familyName": "",
628+
"dateOfIssuance": "2023-01-01T02:02:02Z",
629+
"drivingLicenseID": "",
630+
"drivingClass": 1
631+
},
634632
"connectionId": [[connectionId]],
635-
"issuingDID": [[publishedPrismDID]],
633+
"issuingDID": [[issuingDID]],
636634
"automaticIssuance": true
637635
}'
638636
```
637+
639638
</TabItem>
640639
<TabItem value="connectionless" label="Connectionless Issuance">
641640
### Create a Credential Offer as Invitation for connectionless issuance **Issuer Agent**
@@ -646,25 +645,27 @@ curl --location --request POST 'http://localhost:8000/cloud-agent/issue-credenti
646645

647646
Please replace the following variables in the example request before sending:
648647

649-
- `goalCode`: OPTIONAL A self-attested code the receiver may want to display to the user or use in automatically deciding what to do with the out-of-band message,
648+
- `goalCode`: OPTIONAL A self-attested string code the receiver may want to display to the user or use in automatically deciding what to do with the out-of-band message,
650649
- `goal`: OPTIONAL. A self-attested string that the receiver may want to display to the user about the context-specific goal of the out-of-band message.
651-
- `publishedPrismDID`: The short form of the PRISM DID created when setting up the Issuer agent
652-
653-
The Issuing DID is the published PRISM DID in its short version which was also used to create and publish the credential schema.
654-
655-
- ``
650+
- `issuingDID`: The Issuing DID is the `publishedPrismDID` created when [configuring the Issuer](#agent-configuration), which is the `longFormPrismDID` in its short form version.
656651

657652
:::
658653

659654
```bash
660655
curl --location --request POST 'http://localhost:8000/cloud-agent/issue-credentials/credential-offers/invitation' \
661656
--header 'Content-Type: application/json' \
662657
--data-raw '{
663-
"claims": {"emailAddress":"sampleEmail", "familyName":"", "dateOfIssuance":"2023-01-01T02:02:02Z", "drivingLicenseID":"", "drivingClass":1},
658+
"claims": {
659+
"emailAddress": "sampleEmail",
660+
"familyName": "",
661+
"dateOfIssuance": "2023-01-01T02:02:02Z",
662+
"drivingLicenseID": "",
663+
"drivingClass": 1
664+
},
664665
"goalCode": [[goalCode]],
665666
"goal": [[goal]],
666667
"credentialFormat": "JWT",
667-
"issuingDID": [[publishedPrismDID]],
668+
"issuingDID": [[issuingDID]],
668669
"automaticIssuance": true
669670
}'
670671
```
@@ -698,7 +699,7 @@ For connectionless issuance, the Holder needs to accept the invitation containin
698699
</TabItem>
699700
</Tabs>
700701

701-
<summary>Code examples</summary>
702+
#### Code examples
702703
<Tabs>
703704
<TabItem value="js" label="Typescript">
704705

@@ -734,7 +735,7 @@ agent.acceptOutOfBandInvitation(invitation)
734735

735736
:::info
736737

737-
automaticIssuance is optional. It can also be manually triggered and confirmed by the Holder.```
738+
`automaticIssuance` is optional. It can also be manually triggered and confirmed by the Holder.
738739

739740
:::
740741

@@ -758,30 +759,37 @@ automaticIssuance is optional. It can also be manually triggered and confirmed b
758759
</Tabs>
759760

760761

761-
<summary>Code examples</summary>
762+
#### Code examples
762763

763-
5. The exchange between CredentialOffer and CredentialRequest is demonstrated through more advanced code samples below, showcasing how different platforms handle it.
764+
5. The exchange between `CredentialOffer` and `CredentialRequest` is demonstrated through more advanced code samples below, showcasing how different platforms handle it.
764765

765766
<Tabs>
766767
<TabItem value="js" label="Typescript">
767768

768769
```typescript
769-
props.agent.addListener(ListenerKey.MESSAGE,async (newMessages:SDK.Domain.Message[]) => {
770-
//newMessages can contain any didcomm message that is received, including
771-
//Credential Offers, Issued credentials and Request Presentation Messages
772-
const credentialOffers = newMessages.filter((message) => message.piuri === "https://didcomm.org/issue-credential/2.0/offer-credential");
773-
774-
if (credentialOffers.length) {
775-
for(const credentialOfferMessage of credentialOffers) {
776-
const credentialOffer = OfferCredential.fromMessage(credentialOfferMessage);
777-
const requestCredential = await props.agent.prepareRequestCredentialWithIssuer(credentialOffer);
778-
try {
779-
await props.agent.sendMessage(requestCredential.makeMessage())
780-
} catch (err) {
781-
console.log("continue after err", err)
782-
}
783-
}
770+
agent.addListener(SDK.ListenerKey.MESSAGE, async (newMessages: SDK.Domain.Message[]) => {
771+
// newMessages can contain any didcomm message that is received, including
772+
// Credential Offers, Issued credentials and Request Presentation Messages
773+
const credentialOffers = newMessages.filter(
774+
(message) => message.piuri === 'https://didcomm.org/issue-credential/3.0/offer-credential'
775+
)
776+
777+
if (credentialOffers.length) {
778+
for (const credentialOfferMessage of credentialOffers) {
779+
try {
780+
// Create credential offer object from the message
781+
const credentialOffer = await SDK.OfferCredential.fromMessage(credentialOfferMessage)
782+
783+
// Prepare the credential request
784+
const requestCredential = await agent.prepareRequestCredentialWithIssuer(credentialOffer)
785+
786+
// Send the credential request
787+
await agent.sendMessage(requestCredential.makeMessage())
788+
} catch (err) {
789+
console.error('Error occurred while sending the credential request:', err)
790+
}
784791
}
792+
}
785793
})
786794
```
787795

@@ -841,32 +849,41 @@ agent.handleReceivedMessagesEvents().collect { list ->
841849
</TabItem>
842850
</Tabs>
843851

844-
### Store the Issued Credential [Holder]
852+
### Store the Issued Credential **Holder**
845853
:::caution
846854

847855
The sample application are using an insecure storage solution which should only be used for testing purposes and not production environments!
848856

849857
:::
850858

851-
<summary>Code examples</summary>
859+
#### Code examples
860+
852861
6. Once the Holder receives a credential from the Cloud Agent, it needs to store the credential somewhere:
853862

854863
<Tabs>
855864
<TabItem value="js" label="Typescript">
856865

857-
858-
859866
```typescript
860-
props.agent.addListener(ListenerKey.MESSAGE,async (newMessages:SDK.Domain.Message[]) => {
861-
//newMessages can contain any didcomm message that is received, including
862-
//Credential Offers, Issued credentials and Request Presentation Messages
863-
const issuedCredentials = newMessages.filter((message) => message.piuri === "https://didcomm.org/issue-credential/2.0/issue-credential");
864-
if (issuedCredentials.length) {
865-
for(const issuedCredential of issuedCredentials) {
866-
const issueCredential = IssueCredential.fromMessage(issuedCredential);
867-
await props.agent.processIssuedCredentialMessage(issueCredential);
868-
}
867+
agent.addListener(SDK.ListenerKey.MESSAGE, async (newMessages: SDK.Domain.Message[]) => {
868+
// newMessages can contain any didcomm message that is received, including
869+
// Credential Offers, Issued credentials and Request Presentation Messages
870+
const issuedCredentials = newMessages.filter(
871+
(message) => message.piuri === 'https://didcomm.org/issue-credential/3.0/issue-credential'
872+
)
873+
874+
if (issuedCredentials.length) {
875+
for (const issuedCredential of issuedCredentials) {
876+
try {
877+
// Create issue credential object from the message
878+
const issueCredential = await SDK.IssueCredential.fromMessage(issuedCredential)
879+
880+
// Store the credential in pluto
881+
await agent.processIssuedCredentialMessage(issueCredential)
882+
} catch (err) {
883+
console.error('Error occurred while storing the credential:', err)
884+
}
869885
}
886+
}
870887
})
871888
```
872889

0 commit comments

Comments
 (0)