Skip to content

Commit

Permalink
Promise.reject(Error('
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Nov 14, 2024
1 parent 2ebed1a commit 4ee2610
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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
4 changes: 2 additions & 2 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

0 comments on commit 4ee2610

Please sign in to comment.