Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

PEX & DWN helper methods #128

@bnonni

Description

@bnonni

Summary

Presentation Exchange (PEX) requires constructing multiple objects that conform to specific object patterns on both sides of the exchange. The DcxIssuer and DcxApplicant classes need additional PEX helper methods that abstract the complexity of the PEX process. Both classes have helpers for interacting with the DWN. Need to rework these completely.

Applicant

  • PEX Methods
    • Create presentation submission (embedded into credential application)
    • Create credential application (embedded into verifiable presentation)
  • DWN Methods
    • Read application responses from applicant remote dwn
    • Create applications in issuer dwn

Issuer

  • PEX Methods
    • Create presentation definition (embedded into credential manifest)
    • Create credential manifest (embedded into verifiable presentation)
    • Create fulfillment and denial (embedded into credential response)
    • Create credential response (embedded into verifiable presentation)
  • DWN Methods
    • Read applications from issuer remote dwn
    • Read and create manifests from issuer remote dwn
    • Create application responses in applicant dwn
    • Create invoices in applicant dwn

Common

  • PEX Methods
    • Create verifiable credential (embedded into verifiable presentation)
    • Create verifiable presentation (creates VP structure using dcx application/manifest/response record schemas)
    • Verify presentation (checks VP structure against dcx application/manifest/response record schemas)
    • Submit verifiable presentation
  • PEX Types
    • Verifiable Presentation Credential Manifest
      • Credential Manifest
      • Presentation Definition
    • Verifiable Presentation Credential Application
      • Credential Application
      • Presentation Submission
    • Verifiable Presentation Credential Response
      • Credential Response
      • Fulfillment
      • Denial

Basic PEX Steps

  1. Create Unsigned Verifiable Credential
{
    "@context": [
      "https: //www.w3.org/2018/credentials/v1",
      "https: //w3id.org/vc/status-list/2021/v1"
    ],
    "type": [
      "VerifiableCredential",
      "SomeCustomCredential"
    ],
    "id": "urn:uuid:d79e8c94-eb48-4700-9a6c-845ddf1e566d",
    "issuer": "did:dht:applicant",
    "issuanceDate": "2024-08-29T23: 41: 00Z",
    "credentialSubject": {
      "id": "did:dht:applicant",
      "holderClaim1": "claim1",
      "holderClaim2": "claim2",
    }
}
  1. Create Self-Signed Verifiable Credential JWT
eyJhbGciOiJF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YWaWC1R6FOE_OrdBdMxpCepKXj7zyRRBQ8Cg
  1. Create Presentation Submission
{
  "id": "c185cfb9-7362-4849-8c6a-cc681df6a3ce",
  "definition_id": "presentation-definition-id-from-matching-manifest",
  "descriptor_map": [
    {
      "id": "presentation-definition-input-descriptor-0-id-from-matching-manifest",
      "format": "jwt",
      "path": "$.verifiableCredential[0]"
    }
  ]
}
  1. Create Credential Application
{
  "id": "11d9cbdf-dd3b-416d-9cde-babbe6486676",
  "spec_version": "https://identity.foundation/credential-manifest/#versioning",
  "applicant": "did:dht:applicant",
  "manifest_id": "id-from-matching-manifest",
  "format": {
    "jwt": {
      "alg": [
        "EdDSA"
      ]
    }
  },
  "presentation_submission": {
    "id": "c185cfb9-7362-4849-8c6a-cc681df6a3ce",
    "definition_id": "presentation-definition-id-from-matching-manifest",
    "descriptor_map": [
      {
        "id": "presentation-definition-input-descriptor-0-id-from-matching-manifest",
        "format": "jwt",
        "path": "$.verifiableCredential[0]"
      }
    ]
  }
}
  1. Create Verifiable Presentation (Credential Application)
{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://identity.foundation/credential-manifest/application/v1"
  ],
  "type": [
    "VerifiablePresentation",
    "CredentialApplication"
  ],
  "credential_application": {
    "id": "11d9cbdf-dd3b-416d-9cde-babbe6486676",
    "spec_version": "https://identity.foundation/credential-manifest/#versioning",
    "applicant": "did:dht:applicant",
    "manifest_id": "id-from-matching-manifest",
    "format": {
      "jwt": {
        "alg": [
          "EdDSA"
        ]
      }
    },
    "presentation_submission": {
      "id": "c185cfb9-7362-4849-8c6a-cc681df6a3ce",
      "definition_id": "presentation-definition-id-from-matching-manifest",
      "descriptor_map": [
        {
          "id": "presentation-definition-input-descriptor-0-id-from-matching-manifest",
          "format": "jwt",
          "path": "$.verifiableCredential[0]"
        }
      ]
    }
  },
  "verifiableCredential": [
    "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpkaHQ6enczNndxY204OXl1ZG02aDc1M2h4YWZydHVnOHV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 0, urgent and important, do nowenhancementNew feature or requestpackage: applicantDirectly impacts the applicant packagepackage: issuerDirectly impacts the issuer package

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions