Skip to content

Commit

Permalink
docs(sdk): Add documentation for set interaction detail feature (#820)
Browse files Browse the repository at this point in the history
docs(sdk): Add documentation for set interaction detail feature

Signed-off-by: Talwinder Kaur <[email protected]>
  • Loading branch information
talwinder50 authored Oct 22, 2024
1 parent 61237fb commit b35f4b7
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions cmd/wallet-sdk-gomobile/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,14 @@ val ackTkn = interaction.acknowledgment().serialize()

val ack = Acknowledgment(ackTkn)

// Additional Interactions are recorded as part of the wallet’s activity history which are OPTIONAL.
// Upon the conclusion of issuance or presentation flows, the wallet will send a modified acknowledgment request to the downstream project.

ack.setInteractionDetails({"userID": "123456"}) //SetInteractionDetails extends acknowledgment request to record additional interactions as part of the wallet’s activity history. (Optional)

ack.success() // user accepts the credential
ack.reject() // user rejects the credential

// Consider checking the activity log at some point after the interaction
```

#### Swift (iOS) - Issuer-Initiated - Pre-Authorized Code Flow
Expand Down Expand Up @@ -840,7 +844,7 @@ interaction.requireAcknowledgment() // returns true, if the issuer requires ackn
let ackTkn = interaction.Acknowledgment().Serialize()

let ack = Openid4ciNewAcknowledgment(ackTkn)

try ack.setInteractionDetails("""{"user": "123456"}""") //SetInteractionDetails extends acknowledgment request to record additional interactions as part of the wallet’s activity history. (Optional)
try ack.success() // user accepts the credential
try ack.reject() // user rejects the credential

Expand Down Expand Up @@ -1580,6 +1584,9 @@ selectedVCs.add(requirementDesc.matchedVCs.atIndex(0)) // Users should select on
interaction.presentCredential(selectedVCs)
// Consider checking the activity log at some point after the interaction

interaction.presentCredentialOpts(selectedCredentials, PresentCredentialOpts().setInteractionDetails( """{"user": "123456"}"""))


// To force a specific credential to be presented, even if it doesn't match all
// requirements, use this instead of presentCredential:
val preferredVC = savedCredentials.atIndex(0)
Expand All @@ -1593,8 +1600,9 @@ val ackTkn = interaction.acknowledgment().serialize()

val ack = Acknowledgment(ackTkn)

ack.noConsent()() // user declines the share request
ack.noMatchingCredential()() // no matching credentials found
ack.SetInteractionDetails({"userID": "123456"}) // SetInteractionDetails extends acknowledgment request to record additional interactions as part of the wallet’s activity history. (Optional)
ack.noConsent() // user declines the share request
ack.noMatchingCredential() // no matching credentials found
```

###### Read scope and add custom scope claims
Expand All @@ -1603,12 +1611,11 @@ ack.noMatchingCredential()() // no matching credentials found

val scope = interaction.customScope()

interaction.PresentCredentialOpts(PresentCredentialOpts().addScopeClaim(
scope.atIndex(0), """{"email":"[email protected]"}"""), selectedCredentials)
interaction.presentCredentialOpts(selectedCredentials, PresentCredentialOpts().addScopeClaim(
scope.atIndex(0), """{"email":"[email protected]"}"""),)

```


#### Swift (iOS)

```swift
Expand Down Expand Up @@ -1652,6 +1659,11 @@ selectedVCs.add(requirementDesc.matchedVCs.atIndex(0)) // Users should select on
let credentials = interaction.presentCredential(selectedVCs)
// Consider checking the activity log at some point after the interaction

try interaction.presentCredentialOpts(
selectedVCs,
opts: Openid4vpNewPresentCredentialOpts()?.setInteractionDetails({"userId": "123456"}))
)

// To force a specific credential to be presented, even if it doesn't match all
// requirements, use this instead of presentCredential:
let preferredVC = savedCredentials.atIndex(0)
Expand All @@ -1665,8 +1677,9 @@ let ackTkn = interaction.Acknowledgment().Serialize()

let ack = Acknowledgment(ackTkn)

try ack.noConsent()() // user declines the share request
try ack.noMatchingCredential()() // no matching credentials found
try ack.SetInteractionDetails({"userID":"123456"}) //SetInteractionDetails extends acknowledgment request to record additional interactions as part of the wallet’s activity history. (Optional)
try ack.noConsent() // user declines the share request
try ack.noMatchingCredential() // no matching credentials found
```

##### SubmissionRequirements complex cases
Expand Down Expand Up @@ -1861,10 +1874,8 @@ try interaction.presentCredentialOpts(
selectedCreds,
opts: Openid4vpNewPresentCredentialOpts()?.addScopeClaim(scope.atIndex(0), claimJSON:#"{"email":"[email protected]"}"#)
)

```


### Error Codes & Troubleshooting Tips

| Error | Possible Reasons |
Expand Down

0 comments on commit b35f4b7

Please sign in to comment.