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
  • Loading branch information
sanderPostma committed Nov 14, 2024
2 parents ed74633 + a59450a commit ce6d266
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 @@ -214,7 +214,7 @@ export class AuthorizationResponse {
let nonce: string | undefined = this._payload.nonce
if (this._payload?.vp_token) {
const presentations = this.payload.vp_token ? await extractPresentationsFromVpToken(this.payload.vp_token, opts) : []
const presentationsArray = Array.isArray(presentations) ? presentations : [presentations]
const presentationsArray = presentations ? (Array.isArray(presentations) ? presentations : [presentations]) : []

// We do not verify them, as that is done elsewhere. So we simply can take the first nonce
nonce = presentationsArray
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 @@ -102,7 +102,7 @@ export const verifyPresentations = async (
return null
}

const presentationsArray = Array.isArray(presentations) ? presentations : [presentations]
const presentationsArray = presentations ? (Array.isArray(presentations) ? presentations : [presentations]) : []

const presentationsWithoutMdoc = presentationsArray.filter((p) => p.format !== 'mso_mdoc')
const nonces = new Set(presentationsWithoutMdoc.map(extractNonceFromWrappedVerifiablePresentation))
Expand Down Expand Up @@ -281,7 +281,7 @@ export const assertValidVerifiablePresentations = async (args: {
hasher?: Hasher
}
}) => {
const presentationsArray = Array.isArray(args.presentations) ? args.presentations : [args.presentations]
const presentationsArray = args.presentations ? (Array.isArray(args.presentations) ? args.presentations : [args.presentations]) : []
if (
(!args.presentationDefinitions || args.presentationDefinitions.filter((a) => a.definition).length === 0) &&
(!presentationsArray || (Array.isArray(presentationsArray) && presentationsArray.filter((vp) => vp.presentation).length === 0))
Expand Down

0 comments on commit ce6d266

Please sign in to comment.