Skip to content

Commit

Permalink
fix: change credential decoding in handleAuthorizationRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
martines3000 committed Nov 5, 2024
1 parent 1e8c6a9 commit cdaa99e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-cherries-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blockchain-lab-um/masca": minor
---

Fixes credential decoding in handleAuthorizationRequest
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"./files/circuits/credentialAtomicQuerySigV2/circuit_final.zkey",
"./files/circuits/credentialAtomicQuerySigV2/verification_key.json"
],
"shasum": "nb6d1TmK0UaDb4uoutgzRlNYcftbFe/mdawtXk4UeLM="
"shasum": "8z+x2k7IWORaxqEwcU2DDZZDy0IhYelIz+P/nqeRBso="
},
"initialPermissions": {
"endowment:ethereum-provider": {},
Expand Down
27 changes: 7 additions & 20 deletions packages/snap/src/veramo/Veramo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,24 +842,13 @@ class VeramoService {
throw new Error(selectCredentialsResult.error);
}

// return {
// isUserInteractionRequired: true,
// credentials: selectCredentialsResult.data,
// presentationDefinition: authorizationRequest.presentation_definition,
// }
// }

// const selectCredentialsResult = await agent.selectCredentials({
// credentials: credentials as any,
// });

// if (isError(selectCredentialsResult)) {
// throw new Error(selectCredentialsResult.error);
// }
const decodedCredentials = selectCredentialsResult.data.map(
(credential) => decodeCredentialToObject(credential)
);

const createPresentationSubmissionResult =
await VeramoService.instance.createPresentationSubmission({
credentials: selectCredentialsResult.data,
credentials: decodedCredentials as any,
});

if (isError(createPresentationSubmissionResult)) {
Expand All @@ -868,15 +857,13 @@ class VeramoService {

const presentationSubmission = createPresentationSubmissionResult.data;

const decodedCredentials = selectCredentialsResult.data.map(
(credential) => decodeCredentialToObject(credential).proof.jwt
);

const veramoPresentation =
await VeramoService.instance.createVerifiablePresentation({
presentation: {
holder: did,
verifiableCredential: decodedCredentials,
verifiableCredential: decodedCredentials.map(
(credential) => credential.proof.jwt
),
},
proofFormat: 'jwt',
});
Expand Down

0 comments on commit cdaa99e

Please sign in to comment.