Skip to content

Commit

Permalink
docs: update SDK verification examples (#189)
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian G <cristian.castro@iohk.io>
  • Loading branch information
cristianIOHK authored Aug 22, 2024
1 parent 52c3895 commit 1ea8a90
Showing 1 changed file with 47 additions and 12 deletions.
59 changes: 47 additions & 12 deletions edge-agent-sdk/docs/examples/SDKVerification.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Cross-Platform Edge SDK Verification
## 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]
2. A holder who already has a JWT or Anoncred Credential issued by a known issuer (prism:did) [Holder A]
3. A holder who does not have credentials but aims to start the Verification [Holder B (verifier)]
4. Holder A shares its peerDID with holder B.
5. Holder B will initiate a presentation request
Expand All @@ -15,7 +15,7 @@
> NOTE:
> It follows the [Identity Foundation Presentation-exchange V2 protocol](https://identity.foundation/presentation-exchange/spec/v2.0.0/#input-descriptor)
>
> Claims can be
> Claims can be for JWT:
> ```kotlin
> data class InputFieldFilter(
> val type: String,
Expand All @@ -24,17 +24,25 @@
> val const: List<Any>? = null,
> val value: Any? = null)
> ```
>
> Claims can be for Anoncreds:
> ```kotlin
> data class AnoncredsPresentationClaims(
> val predicates: Map<String, AnoncredsInputFieldFilter>,
> val attributes: Map<String, RequestedAttributes>)
> ```
## Flow
1. Holder B Initiates the Presentation Request: creating a PresentationDefinitionRequest with specified requirements.
2. Holder A, will then create a Presentation Submission which contains the requested credential together with a randomised challenge.
3. Holder B, will receive the Presentation Submission and verify the following
* Holder A signed the JWT presentation with the correct signatures.
* Holder A signed the random challenge that required them to have the correct keys.
* Holder A includes a credential of its owns and not somebody else's.
* Holder A includes a credential with valid signatures, matching the issuer through the specified DID.
* (optional) Holder A has included a credential that the requested issuer has issued.
* (optional) Holder A has included a credential that satisfies the requested claims.
2. Holder A, will then create a Presentation which meets the criteria received as part of the request.
3. Holder B, will receive the Presentation and verify the following
* [JWT] Holder A signed the JWT presentation with the correct signatures.
* [JWT] Holder A signed the random challenge that required them to have the correct keys.
* [JWT] Holder A includes a credential of its owns and not somebody else's.
* [JWT] Holder A includes a credential with valid signatures, matching the issuer through the specified DID.
* [JWT] (optional) Holder A has included a credential that the requested issuer has issued.
* [JWT] (optional) Holder A has included a credential that satisfies the requested claims.
* [Anoncreds] Holder A presentation meets the attributes and predicates requested.
4. Holder B can then verify at any point in time that presentation request and show feedback in UI.
## Code Reference
Expand All @@ -43,9 +51,9 @@
* The Edge Agent Verifier (SDK) will then send the Presentation Request to the desired holder
Example
Example for JWT
```kotlin
val claims = PresentationClaims(
val claims = JWTPresentationClaims(
claims = mapOf(
"email" to InputFieldFilter(
type = "string",
Expand All @@ -63,6 +71,33 @@ agent.initiatePresentationRequest(
)
```
Example for Anoncreds
```kotlin
val claims = AnoncredsPresentationClaims(
predicates = mapOf(
"0_age" to AnoncredsInputFieldFilter(
type = "string",
name = "age",
gte = 18
)
),
attributes = mapOf(
"0_name" to RequestedAttributes(
"name",
setOf("name"),
emptyMap(),
null
)
)
)
agent.initiatePresentationRequest(
type = CredentialType.ANONCREDS_PROOF_REQUEST,
toDID = toDID,
presentationClaims = claims
)
```
* The Edge Agent Holder will be asked to choose what credential wants to be used for that Presentation Request
Example
Expand Down

0 comments on commit 1ea8a90

Please sign in to comment.