Skip to content

Commit

Permalink
chore: reverted unnecessary event changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Sep 25, 2024
1 parent 872893a commit 48418e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 1 addition & 3 deletions packages/siop-oid4vp/lib/op/OP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ export class OP {
const authResponseAsURI = encodeJsonAsURI(payload, { arraysWithIndex: ['presentation_submission'] })
try {
const result = await post(responseUri, authResponseAsURI, { contentType: ContentType.FORM_URL_ENCODED, exceptionOnHttpErrorStatus: true })
const redirectUri = result.successBody?.['redirect_uri'];
await this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_SUCCESS, { correlationId, subject: response, redirectUri: redirectUri })
await this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_SUCCESS, { correlationId, subject: response })
return result.origResponse
} catch (error) {
await this.emitEvent(AuthorizationEvents.ON_AUTH_RESPONSE_SENT_FAILED, { correlationId, subject: response, error: error as Error })
Expand Down Expand Up @@ -259,7 +258,6 @@ export class OP {
payload: {
correlationId: string
subject: AuthorizationRequest | AuthorizationResponse | string | URI
redirectUri?: string
error?: Error
},
): Promise<void> {
Expand Down
8 changes: 1 addition & 7 deletions packages/siop-oid4vp/lib/types/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,21 @@ export enum AuthorizationEvents {

export class AuthorizationEvent<T> {
private readonly _subject: T | undefined
private readonly _redirectUri: string | undefined
private readonly _error?: Error
private readonly _timestamp: number
private readonly _correlationId: string

public constructor(args: { correlationId: string; subject?: T; redirectUri?: string, error?: Error }) {
public constructor(args: { correlationId: string; subject?: T; error?: Error }) {
//fixme: Create correlationId if not provided. Might need to be deferred to registry though
this._correlationId = args.correlationId
this._timestamp = Date.now()
this._subject = args.subject
this._redirectUri = args.redirectUri
this._error = args.error
}

get subject(): T | undefined {
return this._subject
}

get redirectUri(): string | undefined {
return this._redirectUri
}

get timestamp(): number {
return this._timestamp
Expand Down

0 comments on commit 48418e4

Please sign in to comment.