Skip to content

Commit

Permalink
chore: DCQL lib update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Jan 14, 2025
1 parent 3f5d895 commit 6202193
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
presentationSignCallback?: PresentationSignCallback,
customApprovals?: Record<string, (verifiedAuthorizationRequest: VerifiedAuthorizationRequest, sessionId: string) => Promise<void>>,
options?: DidAuthSiopOpAuthenticatorOptions,
hasher?: Hasher,
hasher?: Hasher, // FIXME BEFORE PR move into DidAuthSiopOpAuthenticatorOptions (move everything into options like we do with the rest of the agent plugins)
) {
const { onContactIdentityCreated, onIdentifierCreated } = options ?? {}
this.onContactIdentityCreated = onContactIdentityCreated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ export const siopSendAuthorizationResponse = async (
const allMatches = Array.isArray(value) ? value : [value]
allMatches.forEach((match) => {
if (match.success) {
const originalCredential = getOriginalVerifiableCredential(vcs[match.credential_index])
const originalCredential = getOriginalVerifiableCredential(vcs[match.input_credential_index])
if (!originalCredential) {
throw new Error(`Index ${match.credential_index} out of range in credentials array`)
throw new Error(`Index ${match.input_credential_index} out of range in credentials array`)
}
presentation[key] =
(originalCredential as any)['compactSdJwtVc'] !== undefined ? (originalCredential as any).compactSdJwtVc : originalCredential
Expand Down
4 changes: 3 additions & 1 deletion packages/siopv2-oid4vp-op-auth/src/utils/dcql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ export function convertToDcqlCredentials(credential: UniqueDigitalCredential | O
}

if ('vct' in payload!) {
return { vct: payload.vct, claims: payload } satisfies DcqlSdJwtVcCredential
return { vct: payload.vct, claims: payload, credential_format: 'vc+sd-jwt' } satisfies DcqlSdJwtVcCredential // TODO dc+sd-jwt support?
} else if ('docType' in payload! && 'namespaces' in payload) {
// mdoc
return { docType: payload.docType, namespaces: payload.namespaces, claims: payload }
} else {
return {
claims: payload,
credential_format: 'jwt_vc_json', // TODO jwt_vc_json-ld support
} as DcqlW3cVcCredential
}
}

0 comments on commit 6202193

Please sign in to comment.