Skip to content

Commit

Permalink
fix: registered connection problem report message handler (#1462)
Browse files Browse the repository at this point in the history
Signed-off-by: Dheeraj Budhiraja <[email protected]>
  • Loading branch information
dheerajbudhiraja authored May 24, 2023
1 parent 11366e5 commit d2d8ee0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/modules/connections/ConnectionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
DidExchangeResponseHandler,
TrustPingMessageHandler,
TrustPingResponseMessageHandler,
ConnectionProblemReportHandler,
} from './handlers'
import { HandshakeProtocol } from './models'
import { ConnectionService } from './services/ConnectionService'
Expand Down Expand Up @@ -421,6 +422,7 @@ export class ConnectionsApi {
new ConnectionResponseHandler(this.connectionService, this.outOfBandService, this.didResolverService, this.config)
)
messageHandlerRegistry.registerMessageHandler(new AckMessageHandler(this.connectionService))
messageHandlerRegistry.registerMessageHandler(new ConnectionProblemReportHandler(this.connectionService))
messageHandlerRegistry.registerMessageHandler(
new TrustPingMessageHandler(this.trustPingService, this.connectionService)
)
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/modules/connections/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './TrustPingResponseMessageHandler'
export * from './DidExchangeRequestHandler'
export * from './DidExchangeResponseHandler'
export * from './DidExchangeCompleteHandler'
export * from './ConnectionProblemReportHandler'
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ export class ConnectionService {

connectionRecord.errorMessage = `${connectionProblemReportMessage.description.code} : ${connectionProblemReportMessage.description.en}`
await this.update(messageContext.agentContext, connectionRecord)

// Marking connection as abandoned in case of problem report from issuer agent
// TODO: Can be conditionally abandoned - Like if another user is scanning already used connection invite where issuer will send invite-already-used problem code.
await this.updateState(messageContext.agentContext, connectionRecord, DidExchangeState.Abandoned)

return connectionRecord
}

Expand Down

0 comments on commit d2d8ee0

Please sign in to comment.