From 1c7461836578a62ec545de3a0c8fcdc7de2f4d8f Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Mon, 23 May 2022 11:07:01 +0200 Subject: [PATCH] fix: add oob state and role check (#777) Signed-off-by: Timo Glastra --- .../core/src/modules/connections/DidExchangeProtocol.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/modules/connections/DidExchangeProtocol.ts b/packages/core/src/modules/connections/DidExchangeProtocol.ts index 4f04301b67..917b5bda8b 100644 --- a/packages/core/src/modules/connections/DidExchangeProtocol.ts +++ b/packages/core/src/modules/connections/DidExchangeProtocol.ts @@ -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' @@ -131,8 +133,9 @@ export class DidExchangeProtocol { ): Promise { 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