diff --git a/src/lib/modules/common/index.ts b/src/lib/modules/common/index.ts new file mode 100644 index 0000000000..135f0bc41a --- /dev/null +++ b/src/lib/modules/common/index.ts @@ -0,0 +1 @@ +export * from './messages/AckMessage'; diff --git a/src/lib/modules/connections/messages/AckMessage.ts b/src/lib/modules/common/messages/AckMessage.ts similarity index 87% rename from src/lib/modules/connections/messages/AckMessage.ts rename to src/lib/modules/common/messages/AckMessage.ts index 6f010e7443..5120615551 100644 --- a/src/lib/modules/connections/messages/AckMessage.ts +++ b/src/lib/modules/common/messages/AckMessage.ts @@ -1,7 +1,7 @@ import { Equals, IsEnum } from 'class-validator'; import { AgentMessage } from '../../../agent/AgentMessage'; -import { ConnectionMessageType } from './ConnectionMessageType'; +import { CommonMessageType } from './CommonMessageType'; /** * Ack message status types @@ -41,7 +41,7 @@ export class AckMessage extends AgentMessage { @Equals(AckMessage.type) public readonly type: string = AckMessage.type; - public static readonly type: string = ConnectionMessageType.Ack; + public static readonly type: string = CommonMessageType.Ack; @IsEnum(AckStatus) public status!: AckStatus; diff --git a/src/lib/modules/common/messages/CommonMessageType.ts b/src/lib/modules/common/messages/CommonMessageType.ts new file mode 100644 index 0000000000..a488938203 --- /dev/null +++ b/src/lib/modules/common/messages/CommonMessageType.ts @@ -0,0 +1,3 @@ +export enum CommonMessageType { + Ack = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/notification/1.0/ack', +} diff --git a/src/lib/modules/connections/__tests__/ConnectionService.test.ts b/src/lib/modules/connections/__tests__/ConnectionService.test.ts index 5a02cdd026..a8b92f2a54 100644 --- a/src/lib/modules/connections/__tests__/ConnectionService.test.ts +++ b/src/lib/modules/connections/__tests__/ConnectionService.test.ts @@ -12,9 +12,8 @@ import { ConnectionRequestMessage, ConnectionResponseMessage, TrustPingMessage, - AckMessage, - AckStatus, } from '../messages'; +import { AckMessage, AckStatus } from '../../common'; import { Repository } from '../../../storage/Repository'; import { signData, unpackAndVerifySignatureDecorator } from '../../../decorators/signature/SignatureDecoratorUtils'; import { InboundMessageContext } from '../../../agent/models/InboundMessageContext'; diff --git a/src/lib/modules/connections/handlers/AckMessageHandler.ts b/src/lib/modules/connections/handlers/AckMessageHandler.ts index f55b1e287e..4267ede53a 100644 --- a/src/lib/modules/connections/handlers/AckMessageHandler.ts +++ b/src/lib/modules/connections/handlers/AckMessageHandler.ts @@ -1,6 +1,6 @@ import { Handler, HandlerInboundMessage } from '../../../agent/Handler'; import { ConnectionService } from '../services/ConnectionService'; -import { AckMessage } from '../messages'; +import { AckMessage } from '../../common'; export class AckMessageHandler implements Handler { private connectionService: ConnectionService; diff --git a/src/lib/modules/connections/messages/ConnectionMessageType.ts b/src/lib/modules/connections/messages/ConnectionMessageType.ts index e59849be4b..414d7f8833 100644 --- a/src/lib/modules/connections/messages/ConnectionMessageType.ts +++ b/src/lib/modules/connections/messages/ConnectionMessageType.ts @@ -2,7 +2,6 @@ export enum ConnectionMessageType { ConnectionInvitation = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation', ConnectionRequest = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/request', ConnectionResponse = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/response', - Ack = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/notification/1.0/ack', TrustPingMessage = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/trust_ping/1.0/ping', TrustPingResponseMessage = 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/trust_ping/1.0/ping_response', } diff --git a/src/lib/modules/connections/messages/index.ts b/src/lib/modules/connections/messages/index.ts index bfe125c467..9e6df92a0e 100644 --- a/src/lib/modules/connections/messages/index.ts +++ b/src/lib/modules/connections/messages/index.ts @@ -1,4 +1,3 @@ -export * from './AckMessage'; export * from './ConnectionInvitationMessage'; export * from './ConnectionMessageType'; export * from './ConnectionRequestMessage'; diff --git a/src/lib/modules/connections/services/ConnectionService.ts b/src/lib/modules/connections/services/ConnectionService.ts index 3d5fc641a6..ace996d645 100644 --- a/src/lib/modules/connections/services/ConnectionService.ts +++ b/src/lib/modules/connections/services/ConnectionService.ts @@ -10,9 +10,9 @@ import { ConnectionInvitationMessage, ConnectionRequestMessage, ConnectionResponseMessage, - AckMessage, TrustPingMessage, } from '../messages'; +import { AckMessage } from '../../common'; import { signData, unpackAndVerifySignatureDecorator } from '../../../decorators/signature/SignatureDecoratorUtils'; import { Connection, diff --git a/src/lib/modules/credentials/__tests__/CredentialService.test.ts b/src/lib/modules/credentials/__tests__/CredentialService.test.ts index d4b5a56120..a279481e5a 100644 --- a/src/lib/modules/credentials/__tests__/CredentialService.test.ts +++ b/src/lib/modules/credentials/__tests__/CredentialService.test.ts @@ -19,13 +19,13 @@ import { INDY_CREDENTIAL_OFFER_ATTACHMENT_ID, INDY_CREDENTIAL_ATTACHMENT_ID, } from '../messages'; +import { AckStatus } from '../../common'; import { JsonEncoder } from '../../../utils/JsonEncoder'; import { credDef, credOffer, credReq } from './fixtures'; import { Attachment, AttachmentData } from '../../../decorators/attachment/Attachment'; import { LedgerService as LedgerServiceImpl } from '../../ledger/services'; import { ConnectionState } from '../../connections'; import { getMockConnection } from '../../connections/__tests__/ConnectionService.test'; -import { AckStatus } from '../../connections'; import { AgentConfig } from '../../../agent/AgentConfig'; jest.mock('./../../../storage/Repository'); diff --git a/src/lib/modules/credentials/messages/CredentialAckMessage.ts b/src/lib/modules/credentials/messages/CredentialAckMessage.ts index 6a68318012..dba40cdced 100644 --- a/src/lib/modules/credentials/messages/CredentialAckMessage.ts +++ b/src/lib/modules/credentials/messages/CredentialAckMessage.ts @@ -1,7 +1,7 @@ import { Equals } from 'class-validator'; import { IssueCredentialMessageType } from './IssueCredentialMessageType'; -import { AckMessage, AckMessageOptions } from '../../../modules/connections'; +import { AckMessage, AckMessageOptions } from '../../../modules/common'; export type CredentialAckMessageOptions = AckMessageOptions; diff --git a/src/lib/modules/credentials/services/CredentialService.ts b/src/lib/modules/credentials/services/CredentialService.ts index dfccb7e94e..9add23e225 100644 --- a/src/lib/modules/credentials/services/CredentialService.ts +++ b/src/lib/modules/credentials/services/CredentialService.ts @@ -6,7 +6,7 @@ import { AgentMessage } from '../../../agent/AgentMessage'; import { LedgerService } from '../../ledger/services/LedgerService'; import { InboundMessageContext } from '../../../agent/models/InboundMessageContext'; import { Attachment, AttachmentData } from '../../../decorators/attachment/Attachment'; -import { ConnectionService, ConnectionRecord, AckStatus } from '../../connections'; +import { ConnectionService, ConnectionRecord } from '../../connections'; import { CredentialRecord } from '../repository/CredentialRecord'; import { Repository } from '../../../storage/Repository'; import { JsonEncoder } from '../../../utils/JsonEncoder'; @@ -28,6 +28,7 @@ import { ProposeCredentialMessage, ProposeCredentialMessageOptions, } from '../messages'; +import { AckStatus } from '../../common'; import { Logger } from '../../../logger'; import { AgentConfig } from '../../../agent/AgentConfig'; diff --git a/src/lib/modules/proofs/messages/PresentationAckMessage.ts b/src/lib/modules/proofs/messages/PresentationAckMessage.ts index c541abf602..b9e325e382 100644 --- a/src/lib/modules/proofs/messages/PresentationAckMessage.ts +++ b/src/lib/modules/proofs/messages/PresentationAckMessage.ts @@ -1,6 +1,6 @@ import { Equals } from 'class-validator'; -import { AckMessage, AckMessageOptions } from '../../../modules/connections'; +import { AckMessage, AckMessageOptions } from '../../../modules/common'; import { PresentProofMessageType } from './PresentProofMessageType'; export type PresentationAckMessageOptions = AckMessageOptions; diff --git a/src/lib/modules/proofs/services/ProofService.ts b/src/lib/modules/proofs/services/ProofService.ts index 16b8da1258..0df0a93b61 100644 --- a/src/lib/modules/proofs/services/ProofService.ts +++ b/src/lib/modules/proofs/services/ProofService.ts @@ -7,7 +7,7 @@ import { AgentMessage } from '../../../agent/AgentMessage'; import { LedgerService } from '../../ledger/services/LedgerService'; import { InboundMessageContext } from '../../../agent/models/InboundMessageContext'; import { Attachment, AttachmentData } from '../../../decorators/attachment/Attachment'; -import { ConnectionRecord, AckStatus } from '../../connections'; +import { ConnectionRecord } from '../../connections'; import { ProofRecord } from '../repository/ProofRecord'; import { Repository } from '../../../storage/Repository'; import { JsonEncoder } from '../../../utils/JsonEncoder'; @@ -26,6 +26,7 @@ import { INDY_PROOF_REQUEST_ATTACHMENT_ID, INDY_PROOF_ATTACHMENT_ID, } from '../messages'; +import { AckStatus } from '../../common'; import { PartialProof, ProofAttributeInfo,