Skip to content

Commit

Permalink
chore: fixed emitEvent's
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Oct 9, 2024
1 parent 3c63a27 commit bb1002c
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions packages/siop-oid4vp/lib/op/OP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,22 +238,25 @@ export class OP {
clientMetadata
})

return jarmAuthResponseSend({
authRequestParams: {
response_uri: responseUri,
response_mode: responseMode,
response_type: responseType,
},
authResponse: response,
})
.then((result) => {
void this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_SUCCESS, { correlationId, subject: response })
return result
try {
const jarmResponse = await jarmAuthResponseSend({
authRequestParams: {
response_uri: responseUri,
response_mode: responseMode,
response_type: responseType
},
authResponse: response
})
.catch((error: Error) => {
void this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_FAILED, { correlationId, subject: response, error })
throw error
void this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_SUCCESS, { correlationId, subject: response })
return jarmResponse
} catch (error) {
void this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_FAILED, {
correlationId,
subject: response,
error
})
throw error
}
}

const authResponseAsURI = encodeJsonAsURI(payload, { arraysWithIndex: ['presentation_submission'] })
Expand Down

0 comments on commit bb1002c

Please sign in to comment.