Skip to content

Commit

Permalink
fix: add oob state and role check (#777)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored May 23, 2022
1 parent 0c3cc49 commit 1c74618
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/modules/connections/DidExchangeProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { DidKey } from '../dids/methods/key/DidKey'
import { getNumAlgoFromPeerDid, PeerDidNumAlgo } from '../dids/methods/peer/didPeer'
import { didDocumentJsonToNumAlgo1Did } from '../dids/methods/peer/peerDidNumAlgo1'
import { DidRecord, DidRepository } from '../dids/repository'
import { OutOfBandRole } from '../oob/domain/OutOfBandRole'
import { OutOfBandState } from '../oob/domain/OutOfBandState'

import { DidExchangeStateMachine } from './DidExchangeStateMachine'
import { DidExchangeProblemReportError, DidExchangeProblemReportReason } from './errors'
Expand Down Expand Up @@ -131,8 +133,9 @@ export class DidExchangeProtocol {
): Promise<ConnectionRecord> {
this.logger.debug(`Process message ${DidExchangeRequestMessage.type} start`, messageContext)

// TODO check oob role is sender
// TODO check oob state is await-response
outOfBandRecord.assertRole(OutOfBandRole.Sender)
outOfBandRecord.assertState(OutOfBandState.AwaitResponse)

// TODO check there is no connection record for particular oob record

const { did, mediatorId } = routing ? routing : outOfBandRecord
Expand Down

0 comments on commit 1c74618

Please sign in to comment.