Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix credential formatting in presentationToClaims #16

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

ipbyrne
Copy link
Contributor

@ipbyrne ipbyrne commented Aug 12, 2024

This function was previously setting the wrong value for the enveloped credential.

Below is an example of how the credential looked when decoded:
JWT:

eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdCUzQTgwODA6b3JnYW5pemF0aW9uczpvcmdfYWlyaFhicWFSRVA4d29DZiN6Nk1rbjVzUmFiWTl3ZVF5ckU5UlpibkhYZ0xKc0hza3l3c2NZY0h6MWVDVWFjdWgiLCJhbGciOiJFZERTQSJ9.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiXSwidHlwZSI6WyJWZXJpZmlhYmxlUHJlc2VudGF0aW9uIl0sImhvbGRlciI6eyJpZCI6Imh0dHBzOi8vdW5pdmVyc2l0eS5leGFtcGxlL2lzc3VlcnMvNTY1MDQ5In0sInZlcmlmaWFibGVDcmVkZW50aWFsIjpbeyJAY29udGV4dCI6Imh0dHBzOi8vd3d3LnczLm9yZy9ucy9jcmVkZW50aWFscy92MiIsImlkIjoiZGF0YTphcHBsaWNhdGlvbi92YytsZCtqc29uK2p3dDtoZWFkZXI6XG4gIGtpZDogPi1cbiAgICBkaWQ6d2ViOnRlc3QudHJhbnNtdXRlLmluZHVzdHJpZXM6b3JnYW5pemF0aW9uczpvcmdfN281Q0kwZ2VWbWdYNzNGNiN6NkxTamdnQkVIelZHdmVYdFA2clpFc1JMc3VNdDJqVzdmZlp1ZzlERXZLOWdXRndcbiAgYWxnOiBFZERTQVxucGF5bG9hZDpcbiAgX3NkX2FsZzogc2hhLTI1NlxuICAnQGNvbnRleHQnOlxuICAgIC0gaHR0cHM6Ly93d3cudzMub3JnL25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zxPsAMDd1ydYdYrfr9ycSgzdmij0d6xOsi2jAr1pl2mgjRQTdDA

Decoded:

{
  "@context": [
    "https://www.w3.org/ns/credentials/v2"
  ],
  "type": [
    "VerifiablePresentation"
  ],
  "holder": {
    "id": "https://university.example/issuers/565049"
  },
  "verifiableCredential": [
    {
      "@context": "https://www.w3.org/ns/credentials/v2",
      "id": "data:application/vc+ld+json+jwt;header:\n  kid: >-\n    did:web:test.transmute.industries:organizations:org_7o5CI0geVmgX73F6#z6LSjggBEHzVGveXtP6rZEsRLsuMt2jW7ffZug9DEvK9gWFw\n  alg: EdDSA\npayload:\n  _sd_alg: sha-256\n  '@context':\n    - https://www.w3.org/ns/credentials/v2\n    - https://ref.gs1.org/gs1/vc/license-context\n  type:\n    - VerifiableCredential\n    - GS1PrefixLicenseCredential\n  credentialSchema:\n    id: >-\n      https://platform.transmute.industries/templates/urn:transmute:template:gs1-prefix-license\n    type: JsonSchema\n  id: urn:transmute:credential:217646dc-633d-4b8e-bea1-c7dd2115bf11\n  validFrom: '2024-08-05T14:53:18.701Z'\n  issuer:\n    id: did:web:test.transmute.industries:organizations:org_7o5CI0geVmgX73F6\n    type:\n      - Organization\n    name: GS1 Global Office\n  credentialSubject:\n    organization:\n      gs1:partyGLN: '0614141000005'\n      gs1:organizationName: GS1 US\n    id: did:web:test.transmute.industries:organizations:org_jIU9RTj4xOpFULen\n    licenseValue: '08'\n    alternativeLicenseValue: '8'\n  credentialStatus:\n    id: >-\n      https://test.transmute.industries/credentials/urn:transmute:credential:b0af1483-7c04-4902-a889-96f21c73f68b#27\n    type: BitstringStatusListEntry\n    statusPurpose: suspension\n    statusListIndex: '27'\n    statusListCredential: >-\n      https://test.transmute.industries/credentials/urn:transmute:credential:b0af1483-7c04-4902-a889-96f21c73f68b\n",
      "type": "EnvelopedVerifiableCredential"
    }
  ]
}

This is how it looks after this change:
JWT

eyJraWQiOiJkaWQ6d2ViOmxvY2FsaG9zdCUzQTgwODA6b3JnYW5pemF0aW9uczp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2lZM0psWkdWdWRHbGhiRk4wWVhSMWN5STZleUpwWkNJNkltaDBkSEJ6T2k4dmRHVnpkQzUwY21GdWMyMTFkR1V1YVc1a2RYTjBjbWxsY3k5amNtVmtaVzUwYVdGc2N5OTFjbTQ2ZEhKaGJuTnRkWFJsT21OeVpXUmxiblJwWVd3NllqQmhaakUwT0RNdE4yTXdOQzAwT1RBeUxXRTRPRGt0T1RabU1qRmpOek5tTmpoaUl6STNJaXdpZEhsd1pTSTZJa0pwZEhOMGNtbHVaMU4wWVhSMWMweHBjM1JGYm5SeWVTSXNJbk4wWVhSMWMxQjFjbkJ2YzJVaU9pSnpkWE53Wlc1emFXOXVJaXdpYzNSaGRIVnpUR2x6ZEVsdVpHVjRJam9pTWpjaUxDSnpkR0YwZFhOTWFYTjBRM0psWkdWdWRHbGhiQ0k2SW1oMGRIQnpPaTh2ZEdWemRDNTBjbUZ1YzIxMWRHVXVhVzVrZFhOMGNtbGxjeTlqY21Wa1pXNTBhV0ZzY3k5MWNtNDZkSEpoYm5OdGRYUmxPbU55WldSbGJuUnBZV3c2WWpCaFpqRTBPRE10TjJNd05DMDBPVEF5TFdFNE9Ea3RPVFptTWpGak56Tm1OamhpSW4xOS5rcWNZQ3ZIQzl6WkY3WjBwY3VCWVRTRG93ZmN3aUwyWGd1MUgwWDlpZ3ZhZWMzY1IyTERSdWNXMzEtUFJSMHBOZ01vZm4zRzlpb1BGaXYxYWJad25CQSIsInR5cGUiOiJFbnZlbG9wZWRWZXJpZmlhYmxlQ3JlZGVudGlhbCJ9XX0.Qd1p_EfmEM8bRuBTG7IIOY4nplnbp3GfWeWzOk3LRT9XgvmALQ8fLz0ipiEYHHjY57tP7dZSoV4d-tN38ofVAQ

Decoded:

{
  "@context": [
    "https://www.w3.org/ns/credentials/v2"
  ],
  "type": [
    "VerifiablePresentation"
  ],
  "holder": {
    "id": "https://university.example/issuers/565049"
  },
  "verifiableCredential": [
    {
      "@context": "https://www.w3.org/ns/credentials/v2",
      "id": "data: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pemF0aW9uTmFtZSI6IkdTMSBVUyJ9LCJpZCI6ImRpZDp3ZWI6dGVzdC50cmFuc211dGUuaW5kdXN0cmllczpvcmdhbml6YXRpb25zOm9yZ19qSVU5UlRqNHhPcEZVTGVuIiwibGljZW5zZVZhbHVlIjoiMDgiLCJhbHRlcm5hdGl2ZUxpY2Vuc2VWYWx1ZSI6IjgifSwiY3JlZGVudGlhbFN0YXR1cyI6eyJpZCI6Imh0dHBzOi8vdGVzdC50cmFuc211dGUuaW5kdXN0cmllcy9jcmVkZW50aWFscy91cm46dHJhbnNtdXRlOmNyZWRlbnRpYWw6YjBhZjE0ODMtN2MwNC00OTAyLWE4ODktOTZmMjFjNzNmNjhiIzI3IiwidHlwZSI6IkJpdHN0cmluZ1N0YXR1c0xpc3RFbnRyeSIsInN0YXR1c1B1cnBvc2UiOiJzdXNwZW5zaW9uIiwic3RhdHVzTGlzdEluZGV4IjoiMjciLCJzdGF0dXNMaXN0Q3JlZGVudGlhbCI6Imh0dHBzOi8vdGVzdC50cmFuc211dGUuaW5kdXN0cmllcy9jcmVkZW50aWFscy91cm46dHJhbnNtdXRlOmNyZWRlbnRpYWw6YjBhZjE0ODMtN2MwNC00OTAyLWE4ODktOTZmMjFjNzNmNjhiIn19.kqcYCvHC9zZF7Z0pcuBYTSDowfcwiL2Xgu1H0X9igvaec3cR2LDRucW31-PRR0pNgMofn3G9ioPFiv1abZwnBA",
      "type": "EnvelopedVerifiableCredential"
    }
  ]
}

@ipbyrne ipbyrne marked this pull request as ready for review August 12, 2024 19:35
@OR13 OR13 self-requested a review August 12, 2024 20:46
@OR13 OR13 merged commit 3feff43 into main Aug 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants