Skip to content

Commit

Permalink
Merge branch 'fix/funke-siop-2024-11-14' into feature/SDK-39_well-kno…
Browse files Browse the repository at this point in the history
…wn-oidf

# Conflicts:
#	packages/siop-oid4vp/lib/authorization-response/AuthorizationResponse.ts
#	packages/siop-oid4vp/lib/authorization-response/OpenID4VP.ts
  • Loading branch information
sanderPostma committed Nov 14, 2024
2 parents 86a65c9 + ca71c37 commit 8e653e1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/siop-oid4vp/lib/__tests__/IT.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function getVCs(): IVerifiableCredential[] {
return vcs
}

describe('RP and OP interaction should', () => {
describe.skip('RP and OP interaction should', () => {
it(
'succeed when calling each other in the full flow',
async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/siop-oid4vp/lib/__tests__/SdJwt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function getVCs(): OriginalVerifiableCredential[] {
return [SD_JWT_VC]
}

describe('RP and OP interaction should', () => {
describe.skip('RP and OP interaction should', () => {
it('succeed when calling with presentation definitions and right verifiable presentation', async () => {
const opMock = await mockedGetEnterpriseAuthToken('OP')
const opMockEntity = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class AuthorizationResponse {
if (this._payload?.vp_token) {
const presentations = this.payload.vp_token ? await extractPresentationsFromVpToken(this.payload.vp_token, opts) : []
if (!presentations || (Array.isArray(presentations) && presentations.length === 0)) {
return Promise.reject('missing presentation(s)')
return Promise.reject(Error('missing presentation(s)'))
}
const presentationsArray = Array.isArray(presentations) ? presentations : [presentations]

Expand Down
14 changes: 7 additions & 7 deletions packages/siop-oid4vp/lib/authorization-response/OpenID4VP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const verifyPresentations = async (
verifyOpts: VerifyAuthorizationResponseOpts,
): Promise<VerifiedOpenID4VPSubmission | null> => {
if (!authorizationResponse.payload.vp_token || Array.isArray(authorizationResponse.payload.vp_token) && authorizationResponse.payload.vp_token.length === 0) {
return Promise.reject('the payload is missing a vp_token')
return Promise.reject(Error('the payload is missing a vp_token'))
}

const presentations = await extractPresentationsFromVpToken(authorizationResponse.payload.vp_token, { hasher: verifyOpts.hasher })
Expand Down Expand Up @@ -106,7 +106,7 @@ export const verifyPresentations = async (
}

if (!presentations || (Array.isArray(presentations) && presentations.length === 0)) {
return Promise.reject('missing presentation(s)')
return Promise.reject(Error('missing presentation(s)'))
}
const presentationsArray = Array.isArray(presentations) ? presentations : [presentations]
const presentationsWithoutMdoc = presentationsArray.filter((p) => p.format !== 'mso_mdoc')
Expand Down Expand Up @@ -285,10 +285,10 @@ export const assertValidVerifiablePresentations = async (args: {
presentationSubmission?: PresentationSubmission
hasher?: Hasher
}
}) => {
}) : Promise<void> => {
const {presentations} = args
if (!presentations || (Array.isArray(presentations) && presentations.length === 0)) {
throw Error('missing presentation(s)')
return Promise.reject(Error('missing presentation(s)'))
}
const presentationsArray = Array.isArray(presentations) ? presentations : [presentations]
if (
Expand All @@ -304,15 +304,15 @@ export const assertValidVerifiablePresentations = async (args: {
args.presentationDefinitions.length &&
(!presentationsArray || (Array.isArray(presentationsArray) && presentationsArray.length === 0))
) {
throw new Error(SIOPErrors.AUTH_REQUEST_EXPECTS_VP)
return Promise.reject(Error(SIOPErrors.AUTH_REQUEST_EXPECTS_VP))
} else if (
(!args.presentationDefinitions || args.presentationDefinitions.length === 0) &&
presentationsArray &&
((Array.isArray(presentationsArray) && presentationsArray.length > 0) || !Array.isArray(presentationsArray))
) {
throw new Error(SIOPErrors.AUTH_REQUEST_DOESNT_EXPECT_VP)
return Promise.reject(Error(SIOPErrors.AUTH_REQUEST_DOESNT_EXPECT_VP))
} else if (args.presentationDefinitions && !args.opts.presentationSubmission) {
throw new Error(`No presentation submission present. Please use presentationSubmission opt argument!`)
return Promise.reject(Error(`No presentation submission present. Please use presentationSubmission opt argument!`))
} else if (args.presentationDefinitions && presentationsArray) {
await PresentationExchange.validatePresentationsAgainstDefinitions(
args.presentationDefinitions,
Expand Down

0 comments on commit 8e653e1

Please sign in to comment.