@credo-ts/didcomm 0.7.2 → 0.7.3-alpha-20261006101201

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"DidCommMessageSender.d.mts","names":[],"sources":["../src/DidCommMessageSender.ts"],"mappings":";;;;;;;;;;;;iBAgCiB;EACf;EACA;;qBAIW;UACH;UACA;UACA;UACA;UACA;EAGN,YAAA,iBAAiB,wBACjB,kBAAkB,yBAClB,qBAAqB,qBACrB,wBAAwB,wBACxB,cAAc;EASH,YACX,cAAc,gBAEZ,MACA,SACA;IAEA,MAAM;IACN,SAAS;IACT;MAED,QAAQ;UAUG;EAcD,YACX,cAAc,gBAEZ,YACA,kBACA,cACA;IAEA,YAAY;IACZ;IACA,kBAAkB;IAClB;MAAY,oBAAoB;;MACjC;EAmFU,YACX,wBAAwB,+BACxB;IACE,oBAAoB;MACrB;UA2LW;UAwCA;UA2DN;UAmBM;UAuEN"}
1
+ {"version":3,"file":"DidCommMessageSender.d.mts","names":[],"sources":["../src/DidCommMessageSender.ts"],"mappings":";;;;;;;;;;;;iBAgCiB;EACf;EACA;;qBAIW;UACH;UACA;UACA;UACA;UACA;EAGN,YAAA,iBAAiB,wBACjB,kBAAkB,yBAClB,qBAAqB,qBACrB,wBAAwB,wBACxB,cAAc;EASH,YACX,cAAc,gBAEZ,MACA,SACA;IAEA,MAAM;IACN,SAAS;IACT;MAED,QAAQ;UAUG;EAcD,YACX,cAAc,gBAEZ,YACA,kBACA,cACA;IAEA,YAAY;IACZ;IACA,kBAAkB;IAClB;MAAY,oBAAoB;;MACjC;EAmFU,YACX,wBAAwB,+BACxB;IACE,oBAAoB;MACrB;UAoLW;UAwCA;UA2DN;UAmBM;UAuEN"}
@@ -114,7 +114,6 @@ let DidCommMessageSender = class DidCommMessageSender {
114
114
  try {
115
115
  ({services, queueService} = await this.retrieveServicesByConnection(agentContext, connection, options?.transportPriority, outOfBand));
116
116
  } catch (error) {
117
- agentContext.config.logger.error(`Unable to retrieve services for connection '${connection.id}. ${error.message}`);
118
117
  this.emitMessageSentEvent(outboundMessageContext, "Undeliverable");
119
118
  throw new MessageSendingError(`Unable to retrieve services for connection '${connection.id}`, {
120
119
  outboundMessageContext,
@@ -127,7 +126,6 @@ let DidCommMessageSender = class DidCommMessageSender {
127
126
  throw new MessageSendingError(`Unable to send message using connection '${connection.id}' that doesn't have a did`, { outboundMessageContext });
128
127
  }
129
128
  const { didDocument, keys } = await agentContext.resolve(DidsApi).resolveCreatedDidDocumentWithKeys(connection.did).catch((error) => {
130
- agentContext.config.logger.error(`Unable to send message using connection '${connection.id}', unable to resolve did`, { error });
131
129
  this.emitMessageSentEvent(outboundMessageContext, "Undeliverable");
132
130
  throw new MessageSendingError(`Unable to send message using connection '${connection.id}'. Unble to resolve did`, {
133
131
  outboundMessageContext,
@@ -1 +1 @@
1
- {"version":3,"file":"DidCommMessageSender.mjs","names":[],"sources":["../src/DidCommMessageSender.ts"],"sourcesContent":["import {\n AgentContext,\n CredoError,\n DidKey,\n DidsApi,\n didKeyToEd25519PublicJwk,\n EventEmitter,\n getPublicJwkFromVerificationMethod,\n injectable,\n Kms,\n MessageValidator,\n type ResolvedDidCommService,\n utils,\n verkeyToDidKey,\n} from '@credo-ts/core'\nimport { DID_COMM_TRANSPORT_QUEUE } from './constants'\nimport type { EnvelopeKeys } from './DidCommEnvelopeService'\nimport { DidCommEnvelopeService } from './DidCommEnvelopeService'\nimport type { DidCommMessageSentEvent } from './DidCommEvents'\nimport { DidCommEventTypes } from './DidCommEvents'\nimport type { DidCommMessage } from './DidCommMessage'\nimport { DidCommModuleConfig } from './DidCommModuleConfig'\nimport type { DidCommTransportSession } from './DidCommTransportService'\nimport { DidCommTransportService } from './DidCommTransportService'\nimport { ReturnRouteTypes } from './decorators/transport/TransportDecorator'\nimport { MessageSendingError } from './errors'\nimport { DidCommOutboundMessageContext, OutboundMessageSendStatus } from './models'\nimport type { DidCommConnectionRecord } from './modules/connections/repository'\nimport type { DidCommOutOfBandRecord } from './modules/oob/repository'\nimport { DidCommDocumentService } from './services/DidCommDocumentService'\nimport type { DidCommEncryptedMessage, DidCommOutboundPackage } from './types'\n\nexport interface TransportPriorityOptions {\n schemes: string[]\n restrictive?: boolean\n}\n\n@injectable()\nexport class DidCommMessageSender {\n private envelopeService: DidCommEnvelopeService\n private transportService: DidCommTransportService\n private didCommModuleConfig: DidCommModuleConfig\n private didCommDocumentService: DidCommDocumentService\n private eventEmitter: EventEmitter\n\n public constructor(\n envelopeService: DidCommEnvelopeService,\n transportService: DidCommTransportService,\n didCommModuleConfig: DidCommModuleConfig,\n didCommDocumentService: DidCommDocumentService,\n eventEmitter: EventEmitter\n ) {\n this.envelopeService = envelopeService\n this.transportService = transportService\n this.didCommModuleConfig = didCommModuleConfig\n this.didCommDocumentService = didCommDocumentService\n this.eventEmitter = eventEmitter\n }\n\n public async packMessage(\n agentContext: AgentContext,\n {\n keys,\n message,\n endpoint,\n }: {\n keys: EnvelopeKeys\n message: DidCommMessage\n endpoint: string\n }\n ): Promise<DidCommOutboundPackage> {\n const encryptedMessage = await this.envelopeService.packMessage(agentContext, message, keys)\n\n return {\n payload: encryptedMessage,\n responseRequested: message.hasAnyReturnRoute(),\n endpoint,\n }\n }\n\n private async sendMessageToSession(\n agentContext: AgentContext,\n session: DidCommTransportSession,\n message: DidCommMessage\n ) {\n agentContext.config.logger.debug(`Packing message and sending it via existing session ${session.type}...`)\n if (!session.keys) {\n throw new CredoError(`There are no keys for the given ${session.type} transport session.`)\n }\n const encryptedMessage = await this.envelopeService.packMessage(agentContext, message, session.keys)\n agentContext.config.logger.debug('Sending message')\n await session.send(agentContext, encryptedMessage)\n }\n\n public async sendPackage(\n agentContext: AgentContext,\n {\n connection,\n encryptedMessage,\n recipientKey,\n options,\n }: {\n connection: DidCommConnectionRecord\n recipientKey: string\n encryptedMessage: DidCommEncryptedMessage\n options?: { transportPriority?: TransportPriorityOptions }\n }\n ) {\n const errors: Error[] = []\n\n // Try to send to already open session\n const session = this.transportService.findSessionByConnectionId(connection.id)\n if (session?.inboundMessage?.hasReturnRouting()) {\n try {\n await session.send(agentContext, encryptedMessage)\n return\n } catch (error) {\n errors.push(error)\n agentContext.config.logger.debug(\n `Sending packed message via session failed with error: ${error.message}.`,\n error\n )\n }\n }\n\n // Retrieve DIDComm services\n const { services, queueService } = await this.retrieveServicesByConnection(\n agentContext,\n connection,\n options?.transportPriority\n )\n\n if (this.didCommModuleConfig.outboundTransports.length === 0 && !queueService) {\n throw new CredoError('Agent has no outbound transport!')\n }\n\n // Loop trough all available services and try to send the message\n for (const service of services) {\n agentContext.config.logger.debug('Sending outbound message to service:', { service })\n try {\n const protocolScheme = utils.getProtocolScheme(service.serviceEndpoint)\n for (const transport of this.didCommModuleConfig.outboundTransports) {\n if (transport.supportedSchemes.includes(protocolScheme)) {\n await transport.sendMessage({\n payload: encryptedMessage,\n endpoint: service.serviceEndpoint,\n connectionId: connection.id,\n })\n break\n }\n }\n return\n } catch (error) {\n agentContext.config.logger.debug(\n `Sending outbound message to service with id ${service.id} failed with the following error:`,\n {\n message: error.message,\n error: error,\n }\n )\n }\n }\n\n // We didn't succeed to send the message over open session, or directly to serviceEndpoint\n // If the other party shared a queue service endpoint in their did doc we queue the message\n if (queueService) {\n agentContext.config.logger.debug(\n `Queue packed message for connection ${connection.id} (${connection.theirLabel})`\n )\n await this.didCommModuleConfig.queueTransportRepository.addMessage(agentContext, {\n connectionId: connection.id,\n recipientDids: [verkeyToDidKey(recipientKey)],\n payload: encryptedMessage,\n })\n return\n }\n\n // Message is undeliverable\n agentContext.config.logger.error(\n `Message is undeliverable to connection ${connection.id} (${connection.theirLabel})`,\n {\n message: encryptedMessage,\n errors,\n connection,\n }\n )\n throw new CredoError(`Message is undeliverable to connection ${connection.id} (${connection.theirLabel})`)\n }\n\n public async sendMessage(\n outboundMessageContext: DidCommOutboundMessageContext,\n options?: {\n transportPriority?: TransportPriorityOptions\n }\n ) {\n const { agentContext, connection, outOfBand, message } = outboundMessageContext\n const errors: Error[] = []\n\n if (outboundMessageContext.isOutboundServiceMessage()) {\n return this.sendMessageToService(outboundMessageContext)\n }\n\n if (!connection) {\n agentContext.config.logger.error('Outbound message has no associated connection')\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError('Outbound message has no associated connection', {\n outboundMessageContext,\n })\n }\n\n agentContext.config.logger.debug('Send outbound message', {\n message,\n connectionId: connection.id,\n })\n\n const session = this.findSessionForOutboundContext(outboundMessageContext)\n\n if (session) {\n agentContext.config.logger.debug(\n `Found session with return routing for message '${message.id}' (connection '${connection.id}'`\n )\n\n try {\n await this.sendMessageToSession(agentContext, session, message)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToSession)\n return\n } catch (error) {\n errors.push(error)\n agentContext.config.logger.debug(\n `Sending an outbound message via session failed with error: ${error.message}.`,\n error\n )\n }\n }\n\n // Retrieve DIDComm services\n let services: ResolvedDidCommService[] = []\n let queueService: ResolvedDidCommService | undefined\n\n try {\n ;({ services, queueService } = await this.retrieveServicesByConnection(\n agentContext,\n connection,\n options?.transportPriority,\n outOfBand\n ))\n } catch (error) {\n agentContext.config.logger.error(`Unable to retrieve services for connection '${connection.id}. ${error.message}`)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError(`Unable to retrieve services for connection '${connection.id}`, {\n outboundMessageContext,\n cause: error,\n })\n }\n\n if (!connection.did) {\n agentContext.config.logger.error(\n `Unable to send message using connection '${connection.id}' that doesn't have a did`\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError(\n `Unable to send message using connection '${connection.id}' that doesn't have a did`,\n { outboundMessageContext }\n )\n }\n\n const dids = agentContext.resolve(DidsApi)\n const { didDocument, keys } = await dids.resolveCreatedDidDocumentWithKeys(connection.did).catch((error) => {\n agentContext.config.logger.error(\n `Unable to send message using connection '${connection.id}', unable to resolve did`,\n {\n error,\n }\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError(\n `Unable to send message using connection '${connection.id}'. Unble to resolve did`,\n { outboundMessageContext, cause: error }\n )\n })\n\n const authentication = didDocument\n .findVerificationMethodsByPurpose(['authentication'])\n .map((verificationMethod) => {\n const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod)\n const kmsKeyId = keys?.find((key) => verificationMethod.id.endsWith(key.didDocumentRelativeKeyId))?.kmsKeyId\n\n // Set stored key id, or fallback to legacy key id\n publicJwk.keyId = kmsKeyId ?? publicJwk.legacyKeyId\n\n return { verificationMethod, publicJwk, kmsKeyId }\n })\n .filter((v): v is typeof v & { publicJwk: Kms.PublicJwk<Kms.Ed25519PublicJwk> } =>\n v.publicJwk.is(Kms.Ed25519PublicJwk)\n )\n\n // We take the first one with a kms key id. Otherwise we pick the first\n const senderVerificationMethod = authentication?.find((a) => a.kmsKeyId !== undefined) ?? authentication?.[0]\n if (!senderVerificationMethod) {\n throw new MessageSendingError(\n `Unable to determine sender key for did ${connection.did}, no available Ed25519 keys`,\n {\n outboundMessageContext,\n }\n )\n }\n\n // If the returnRoute is already set we won't override it. This allows to set the returnRoute manually if this is desired.\n const shouldAddReturnRoute =\n message.transport?.returnRoute === undefined && !this.transportService.hasInboundEndpoint(didDocument)\n\n // Loop trough all available services and try to send the message\n for (const service of services) {\n try {\n // Enable return routing if the our did document does not have any inbound endpoint for given sender key\n await this.sendToService(\n new DidCommOutboundMessageContext(message, {\n agentContext,\n serviceParams: {\n service,\n senderKey: senderVerificationMethod.publicJwk,\n returnRoute: shouldAddReturnRoute,\n },\n connection,\n })\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToTransport)\n return\n } catch (error) {\n errors.push(error)\n agentContext.config.logger.debug(\n `Sending outbound message to service with id ${service.id} failed with the following error:`,\n {\n message: error.message,\n error: error,\n }\n )\n }\n }\n\n // We didn't succeed to send the message over open session, or directly to serviceEndpoint\n // If the other party shared a queue service endpoint in their did doc we queue the message\n if (queueService && message.allowQueueTransport) {\n agentContext.config.logger.debug(`Queue message for connection ${connection.id} (${connection.theirLabel})`)\n\n const keys = {\n recipientKeys: queueService.recipientKeys,\n routingKeys: queueService.routingKeys,\n senderKey: senderVerificationMethod.publicJwk,\n }\n\n const encryptedMessage = await this.envelopeService.packMessage(agentContext, message, keys)\n await this.didCommModuleConfig.queueTransportRepository.addMessage(agentContext, {\n connectionId: connection.id,\n recipientDids: keys.recipientKeys.map((item) => new DidKey(item).did),\n payload: encryptedMessage,\n })\n\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.QueuedForPickup)\n\n return\n }\n\n // Message is undeliverable\n agentContext.config.logger.error(\n `Message is undeliverable to connection ${connection.id} (${connection.theirLabel})`,\n {\n message,\n errors,\n connection,\n }\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n\n throw new MessageSendingError(\n `Message is undeliverable to connection ${connection.id} (${connection.theirLabel}). \\n\\nReasons:\\n\\t- ${errors.map((e) => e.message).join('\\n\\t-')}`,\n { outboundMessageContext }\n )\n }\n\n private async sendMessageToService(outboundMessageContext: DidCommOutboundMessageContext) {\n const session = this.findSessionForOutboundContext(outboundMessageContext)\n\n if (session) {\n outboundMessageContext.agentContext.config.logger.debug(\n `Found session with return routing for message '${outboundMessageContext.message.id}'`\n )\n try {\n await this.sendMessageToSession(outboundMessageContext.agentContext, session, outboundMessageContext.message)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToSession)\n return\n } catch (error) {\n outboundMessageContext.agentContext.config.logger.debug(\n `Sending an outbound message via session failed with error: ${error.message}.`,\n error\n )\n }\n }\n\n // If there is no session try sending to service instead\n try {\n await this.sendToService(outboundMessageContext)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToTransport)\n } catch (error) {\n outboundMessageContext.agentContext.config.logger.error(\n `Message is undeliverable to service with id ${outboundMessageContext.serviceParams?.service.id}: ${error.message}`,\n {\n message: outboundMessageContext.message,\n error,\n }\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n\n throw new MessageSendingError(\n `Message is undeliverable to service with id ${outboundMessageContext.serviceParams?.service.id}: ${error.message}`,\n { outboundMessageContext }\n )\n }\n }\n\n private async sendToService(outboundMessageContext: DidCommOutboundMessageContext) {\n const { agentContext, message, serviceParams, connection } = outboundMessageContext\n\n if (!serviceParams) {\n throw new CredoError('No service parameters found in outbound message context')\n }\n const { service, senderKey, returnRoute } = serviceParams\n\n if (this.didCommModuleConfig.outboundTransports.length === 0) {\n throw new CredoError('Agent has no outbound transport!')\n }\n\n agentContext.config.logger.debug('Sending outbound message to service:', {\n messageId: message.id,\n service: { ...service, recipientKeys: 'omitted...', routingKeys: 'omitted...' },\n })\n\n const keys = {\n recipientKeys: service.recipientKeys,\n routingKeys: service.routingKeys,\n senderKey,\n }\n\n // Set return routing for message if requested\n if (returnRoute) {\n message.setReturnRouting(ReturnRouteTypes.all)\n }\n\n try {\n MessageValidator.validateSync(message)\n } catch (error) {\n agentContext.config.logger.error(\n `Aborting sending outbound message ${message.type} to ${service.serviceEndpoint}. Message validation failed`,\n {\n errors: error,\n message: message.toJSON(),\n }\n )\n\n throw error\n }\n\n const outboundPackage = await this.packMessage(agentContext, { message, keys, endpoint: service.serviceEndpoint })\n outboundPackage.endpoint = service.serviceEndpoint\n outboundPackage.connectionId = connection?.id\n for (const transport of this.didCommModuleConfig.outboundTransports) {\n const protocolScheme = utils.getProtocolScheme(service.serviceEndpoint)\n if (!protocolScheme) {\n agentContext.config.logger.warn('Service does not have a protocol scheme.')\n } else if (transport.supportedSchemes.includes(protocolScheme)) {\n await transport.sendMessage(outboundPackage)\n return\n }\n }\n throw new MessageSendingError(`Unable to send message to service: ${service.serviceEndpoint}`, {\n outboundMessageContext,\n })\n }\n\n private findSessionForOutboundContext(outboundContext: DidCommOutboundMessageContext) {\n let session: DidCommTransportSession | undefined\n\n // Use session id from outbound context if present, or use the session from the inbound message context\n const sessionId = outboundContext.sessionId ?? outboundContext.inboundMessageContext?.sessionId\n\n // Try to find session by id\n if (sessionId) {\n session = this.transportService.findSessionById(sessionId)\n }\n\n // Try to find session by connection id\n if (!session && outboundContext.connection?.id) {\n session = this.transportService.findSessionByConnectionId(outboundContext.connection.id)\n }\n\n return session?.inboundMessage?.hasAnyReturnRoute() ? session : null\n }\n\n private async retrieveServicesByConnection(\n agentContext: AgentContext,\n connection: DidCommConnectionRecord,\n transportPriority?: TransportPriorityOptions,\n outOfBand?: DidCommOutOfBandRecord\n ) {\n agentContext.config.logger.debug(\n `Retrieving services for connection '${connection.id}' (${connection.theirLabel})`,\n {\n transportPriority,\n connection,\n }\n )\n\n let didCommServices: ResolvedDidCommService[] = []\n\n if (connection.theirDid) {\n agentContext.config.logger.debug(`Resolving services for connection theirDid ${connection.theirDid}.`)\n didCommServices = await this.didCommDocumentService.resolveServicesFromDid(agentContext, connection.theirDid)\n } else if (outOfBand) {\n agentContext.config.logger.debug(`Resolving services from out-of-band record ${outOfBand.id}.`)\n if (connection.isRequester) {\n for (const service of outOfBand.outOfBandInvitation.getServices()) {\n // Resolve dids to DIDDocs to retrieve services\n if (typeof service === 'string') {\n agentContext.config.logger.debug(`Resolving services for did ${service}.`)\n didCommServices.push(...(await this.didCommDocumentService.resolveServicesFromDid(agentContext, service)))\n } else {\n // Out of band inline service contains keys encoded as did:key references\n didCommServices.push({\n id: service.id,\n recipientKeys: service.recipientKeys.map(didKeyToEd25519PublicJwk),\n routingKeys: service.routingKeys?.map(didKeyToEd25519PublicJwk) || [],\n serviceEndpoint: service.serviceEndpoint,\n })\n }\n }\n }\n }\n\n // Separate queue service out\n let services = didCommServices.filter((s) => !isDidCommTransportQueue(s.serviceEndpoint))\n const queueService = didCommServices.find((s) => isDidCommTransportQueue(s.serviceEndpoint))\n\n // If restrictive will remove services not listed in schemes list\n if (transportPriority?.restrictive) {\n services = services.filter((service) => {\n const serviceSchema = utils.getProtocolScheme(service.serviceEndpoint)\n return transportPriority.schemes.includes(serviceSchema)\n })\n }\n\n // If transport priority is set we will sort services by our priority.\n // Services whose scheme is not listed in the priority list are kept but\n // sorted after any prioritized ones (indexOf returns -1 for them, which\n // would otherwise incorrectly rank them first).\n if (transportPriority?.schemes) {\n const schemePriority = (endpoint: string) => {\n const index = transportPriority.schemes.indexOf(utils.getProtocolScheme(endpoint))\n return index === -1 ? Number.MAX_SAFE_INTEGER : index\n }\n services = services.sort((a, b) => schemePriority(a.serviceEndpoint) - schemePriority(b.serviceEndpoint))\n }\n\n agentContext.config.logger.debug(\n `Retrieved ${services.length} services for message to connection '${connection.id}'(${connection.theirLabel})'`,\n { hasQueueService: queueService !== undefined, transportPriority }\n )\n return { services, queueService }\n }\n\n private emitMessageSentEvent(\n outboundMessageContext: DidCommOutboundMessageContext,\n status: OutboundMessageSendStatus\n ) {\n const { agentContext } = outboundMessageContext\n this.eventEmitter.emit<DidCommMessageSentEvent>(agentContext, {\n type: DidCommEventTypes.DidCommMessageSent,\n payload: {\n message: outboundMessageContext,\n status,\n },\n })\n }\n}\n\nexport function isDidCommTransportQueue(serviceEndpoint: string): serviceEndpoint is typeof DID_COMM_TRANSPORT_QUEUE {\n return serviceEndpoint === DID_COMM_TRANSPORT_QUEUE\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCO,IAAM,uBAAN,MAAM,qBAAqB;CAOhC,YACE,iBACA,kBACA,qBACA,wBACA,cACA;EACA,KAAK,kBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,sBAAsB;EAC3B,KAAK,yBAAyB;EAC9B,KAAK,eAAe;CACtB;CAEA,MAAa,YACX,cACA,EACE,MACA,SACA,YAM+B;EAGjC,OAAO;GACL,SAAS,MAHoB,KAAK,gBAAgB,YAAY,cAAc,SAAS,IAAI;GAIzF,mBAAmB,QAAQ,kBAAkB;GAC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AE;GAAU;EAAa;CAClC;CAEA,qBACE,wBACA,QACA;EACA,MAAM,EAAE,iBAAiB;EACzB,KAAK,aAAa,KAA8B,cAAc;GAC5D,MAAA;GACA,SAAS;IACP,SAAS;IACT;GACF;EACF,CAAC;CACH;AACF;AAjiBC,uBAAA,WAAA,CAAA,WAAW,GAAA,mBAAA,qBAAA;;;;;;;AAmiBZ,SAAgB,wBAAwB,iBAA6E;CACnH,OAAO,oBAAoB;AAC7B"}
1
+ {"version":3,"file":"DidCommMessageSender.mjs","names":[],"sources":["../src/DidCommMessageSender.ts"],"sourcesContent":["import {\n AgentContext,\n CredoError,\n DidKey,\n DidsApi,\n didKeyToEd25519PublicJwk,\n EventEmitter,\n getPublicJwkFromVerificationMethod,\n injectable,\n Kms,\n MessageValidator,\n type ResolvedDidCommService,\n utils,\n verkeyToDidKey,\n} from '@credo-ts/core'\nimport { DID_COMM_TRANSPORT_QUEUE } from './constants'\nimport type { EnvelopeKeys } from './DidCommEnvelopeService'\nimport { DidCommEnvelopeService } from './DidCommEnvelopeService'\nimport type { DidCommMessageSentEvent } from './DidCommEvents'\nimport { DidCommEventTypes } from './DidCommEvents'\nimport type { DidCommMessage } from './DidCommMessage'\nimport { DidCommModuleConfig } from './DidCommModuleConfig'\nimport type { DidCommTransportSession } from './DidCommTransportService'\nimport { DidCommTransportService } from './DidCommTransportService'\nimport { ReturnRouteTypes } from './decorators/transport/TransportDecorator'\nimport { MessageSendingError } from './errors'\nimport { DidCommOutboundMessageContext, OutboundMessageSendStatus } from './models'\nimport type { DidCommConnectionRecord } from './modules/connections/repository'\nimport type { DidCommOutOfBandRecord } from './modules/oob/repository'\nimport { DidCommDocumentService } from './services/DidCommDocumentService'\nimport type { DidCommEncryptedMessage, DidCommOutboundPackage } from './types'\n\nexport interface TransportPriorityOptions {\n schemes: string[]\n restrictive?: boolean\n}\n\n@injectable()\nexport class DidCommMessageSender {\n private envelopeService: DidCommEnvelopeService\n private transportService: DidCommTransportService\n private didCommModuleConfig: DidCommModuleConfig\n private didCommDocumentService: DidCommDocumentService\n private eventEmitter: EventEmitter\n\n public constructor(\n envelopeService: DidCommEnvelopeService,\n transportService: DidCommTransportService,\n didCommModuleConfig: DidCommModuleConfig,\n didCommDocumentService: DidCommDocumentService,\n eventEmitter: EventEmitter\n ) {\n this.envelopeService = envelopeService\n this.transportService = transportService\n this.didCommModuleConfig = didCommModuleConfig\n this.didCommDocumentService = didCommDocumentService\n this.eventEmitter = eventEmitter\n }\n\n public async packMessage(\n agentContext: AgentContext,\n {\n keys,\n message,\n endpoint,\n }: {\n keys: EnvelopeKeys\n message: DidCommMessage\n endpoint: string\n }\n ): Promise<DidCommOutboundPackage> {\n const encryptedMessage = await this.envelopeService.packMessage(agentContext, message, keys)\n\n return {\n payload: encryptedMessage,\n responseRequested: message.hasAnyReturnRoute(),\n endpoint,\n }\n }\n\n private async sendMessageToSession(\n agentContext: AgentContext,\n session: DidCommTransportSession,\n message: DidCommMessage\n ) {\n agentContext.config.logger.debug(`Packing message and sending it via existing session ${session.type}...`)\n if (!session.keys) {\n throw new CredoError(`There are no keys for the given ${session.type} transport session.`)\n }\n const encryptedMessage = await this.envelopeService.packMessage(agentContext, message, session.keys)\n agentContext.config.logger.debug('Sending message')\n await session.send(agentContext, encryptedMessage)\n }\n\n public async sendPackage(\n agentContext: AgentContext,\n {\n connection,\n encryptedMessage,\n recipientKey,\n options,\n }: {\n connection: DidCommConnectionRecord\n recipientKey: string\n encryptedMessage: DidCommEncryptedMessage\n options?: { transportPriority?: TransportPriorityOptions }\n }\n ) {\n const errors: Error[] = []\n\n // Try to send to already open session\n const session = this.transportService.findSessionByConnectionId(connection.id)\n if (session?.inboundMessage?.hasReturnRouting()) {\n try {\n await session.send(agentContext, encryptedMessage)\n return\n } catch (error) {\n errors.push(error)\n agentContext.config.logger.debug(\n `Sending packed message via session failed with error: ${error.message}.`,\n error\n )\n }\n }\n\n // Retrieve DIDComm services\n const { services, queueService } = await this.retrieveServicesByConnection(\n agentContext,\n connection,\n options?.transportPriority\n )\n\n if (this.didCommModuleConfig.outboundTransports.length === 0 && !queueService) {\n throw new CredoError('Agent has no outbound transport!')\n }\n\n // Loop trough all available services and try to send the message\n for (const service of services) {\n agentContext.config.logger.debug('Sending outbound message to service:', { service })\n try {\n const protocolScheme = utils.getProtocolScheme(service.serviceEndpoint)\n for (const transport of this.didCommModuleConfig.outboundTransports) {\n if (transport.supportedSchemes.includes(protocolScheme)) {\n await transport.sendMessage({\n payload: encryptedMessage,\n endpoint: service.serviceEndpoint,\n connectionId: connection.id,\n })\n break\n }\n }\n return\n } catch (error) {\n agentContext.config.logger.debug(\n `Sending outbound message to service with id ${service.id} failed with the following error:`,\n {\n message: error.message,\n error: error,\n }\n )\n }\n }\n\n // We didn't succeed to send the message over open session, or directly to serviceEndpoint\n // If the other party shared a queue service endpoint in their did doc we queue the message\n if (queueService) {\n agentContext.config.logger.debug(\n `Queue packed message for connection ${connection.id} (${connection.theirLabel})`\n )\n await this.didCommModuleConfig.queueTransportRepository.addMessage(agentContext, {\n connectionId: connection.id,\n recipientDids: [verkeyToDidKey(recipientKey)],\n payload: encryptedMessage,\n })\n return\n }\n\n // Message is undeliverable\n agentContext.config.logger.error(\n `Message is undeliverable to connection ${connection.id} (${connection.theirLabel})`,\n {\n message: encryptedMessage,\n errors,\n connection,\n }\n )\n throw new CredoError(`Message is undeliverable to connection ${connection.id} (${connection.theirLabel})`)\n }\n\n public async sendMessage(\n outboundMessageContext: DidCommOutboundMessageContext,\n options?: {\n transportPriority?: TransportPriorityOptions\n }\n ) {\n const { agentContext, connection, outOfBand, message } = outboundMessageContext\n const errors: Error[] = []\n\n if (outboundMessageContext.isOutboundServiceMessage()) {\n return this.sendMessageToService(outboundMessageContext)\n }\n\n if (!connection) {\n agentContext.config.logger.error('Outbound message has no associated connection')\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError('Outbound message has no associated connection', {\n outboundMessageContext,\n })\n }\n\n agentContext.config.logger.debug('Send outbound message', {\n message,\n connectionId: connection.id,\n })\n\n const session = this.findSessionForOutboundContext(outboundMessageContext)\n\n if (session) {\n agentContext.config.logger.debug(\n `Found session with return routing for message '${message.id}' (connection '${connection.id}'`\n )\n\n try {\n await this.sendMessageToSession(agentContext, session, message)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToSession)\n return\n } catch (error) {\n errors.push(error)\n agentContext.config.logger.debug(\n `Sending an outbound message via session failed with error: ${error.message}.`,\n error\n )\n }\n }\n\n // Retrieve DIDComm services\n let services: ResolvedDidCommService[] = []\n let queueService: ResolvedDidCommService | undefined\n\n try {\n ;({ services, queueService } = await this.retrieveServicesByConnection(\n agentContext,\n connection,\n options?.transportPriority,\n outOfBand\n ))\n } catch (error) {\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError(`Unable to retrieve services for connection '${connection.id}`, {\n outboundMessageContext,\n cause: error,\n })\n }\n\n if (!connection.did) {\n agentContext.config.logger.error(\n `Unable to send message using connection '${connection.id}' that doesn't have a did`\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError(\n `Unable to send message using connection '${connection.id}' that doesn't have a did`,\n { outboundMessageContext }\n )\n }\n\n const dids = agentContext.resolve(DidsApi)\n const { didDocument, keys } = await dids.resolveCreatedDidDocumentWithKeys(connection.did).catch((error) => {\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n throw new MessageSendingError(\n `Unable to send message using connection '${connection.id}'. Unble to resolve did`,\n { outboundMessageContext, cause: error }\n )\n })\n\n const authentication = didDocument\n .findVerificationMethodsByPurpose(['authentication'])\n .map((verificationMethod) => {\n const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod)\n const kmsKeyId = keys?.find((key) => verificationMethod.id.endsWith(key.didDocumentRelativeKeyId))?.kmsKeyId\n\n // Set stored key id, or fallback to legacy key id\n publicJwk.keyId = kmsKeyId ?? publicJwk.legacyKeyId\n\n return { verificationMethod, publicJwk, kmsKeyId }\n })\n .filter((v): v is typeof v & { publicJwk: Kms.PublicJwk<Kms.Ed25519PublicJwk> } =>\n v.publicJwk.is(Kms.Ed25519PublicJwk)\n )\n\n // We take the first one with a kms key id. Otherwise we pick the first\n const senderVerificationMethod = authentication?.find((a) => a.kmsKeyId !== undefined) ?? authentication?.[0]\n if (!senderVerificationMethod) {\n throw new MessageSendingError(\n `Unable to determine sender key for did ${connection.did}, no available Ed25519 keys`,\n {\n outboundMessageContext,\n }\n )\n }\n\n // If the returnRoute is already set we won't override it. This allows to set the returnRoute manually if this is desired.\n const shouldAddReturnRoute =\n message.transport?.returnRoute === undefined && !this.transportService.hasInboundEndpoint(didDocument)\n\n // Loop trough all available services and try to send the message\n for (const service of services) {\n try {\n // Enable return routing if the our did document does not have any inbound endpoint for given sender key\n await this.sendToService(\n new DidCommOutboundMessageContext(message, {\n agentContext,\n serviceParams: {\n service,\n senderKey: senderVerificationMethod.publicJwk,\n returnRoute: shouldAddReturnRoute,\n },\n connection,\n })\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToTransport)\n return\n } catch (error) {\n errors.push(error)\n agentContext.config.logger.debug(\n `Sending outbound message to service with id ${service.id} failed with the following error:`,\n {\n message: error.message,\n error: error,\n }\n )\n }\n }\n\n // We didn't succeed to send the message over open session, or directly to serviceEndpoint\n // If the other party shared a queue service endpoint in their did doc we queue the message\n if (queueService && message.allowQueueTransport) {\n agentContext.config.logger.debug(`Queue message for connection ${connection.id} (${connection.theirLabel})`)\n\n const keys = {\n recipientKeys: queueService.recipientKeys,\n routingKeys: queueService.routingKeys,\n senderKey: senderVerificationMethod.publicJwk,\n }\n\n const encryptedMessage = await this.envelopeService.packMessage(agentContext, message, keys)\n await this.didCommModuleConfig.queueTransportRepository.addMessage(agentContext, {\n connectionId: connection.id,\n recipientDids: keys.recipientKeys.map((item) => new DidKey(item).did),\n payload: encryptedMessage,\n })\n\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.QueuedForPickup)\n\n return\n }\n\n // Message is undeliverable\n agentContext.config.logger.error(\n `Message is undeliverable to connection ${connection.id} (${connection.theirLabel})`,\n {\n message,\n errors,\n connection,\n }\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n\n throw new MessageSendingError(\n `Message is undeliverable to connection ${connection.id} (${connection.theirLabel}). \\n\\nReasons:\\n\\t- ${errors.map((e) => e.message).join('\\n\\t-')}`,\n { outboundMessageContext }\n )\n }\n\n private async sendMessageToService(outboundMessageContext: DidCommOutboundMessageContext) {\n const session = this.findSessionForOutboundContext(outboundMessageContext)\n\n if (session) {\n outboundMessageContext.agentContext.config.logger.debug(\n `Found session with return routing for message '${outboundMessageContext.message.id}'`\n )\n try {\n await this.sendMessageToSession(outboundMessageContext.agentContext, session, outboundMessageContext.message)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToSession)\n return\n } catch (error) {\n outboundMessageContext.agentContext.config.logger.debug(\n `Sending an outbound message via session failed with error: ${error.message}.`,\n error\n )\n }\n }\n\n // If there is no session try sending to service instead\n try {\n await this.sendToService(outboundMessageContext)\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.SentToTransport)\n } catch (error) {\n outboundMessageContext.agentContext.config.logger.error(\n `Message is undeliverable to service with id ${outboundMessageContext.serviceParams?.service.id}: ${error.message}`,\n {\n message: outboundMessageContext.message,\n error,\n }\n )\n this.emitMessageSentEvent(outboundMessageContext, OutboundMessageSendStatus.Undeliverable)\n\n throw new MessageSendingError(\n `Message is undeliverable to service with id ${outboundMessageContext.serviceParams?.service.id}: ${error.message}`,\n { outboundMessageContext }\n )\n }\n }\n\n private async sendToService(outboundMessageContext: DidCommOutboundMessageContext) {\n const { agentContext, message, serviceParams, connection } = outboundMessageContext\n\n if (!serviceParams) {\n throw new CredoError('No service parameters found in outbound message context')\n }\n const { service, senderKey, returnRoute } = serviceParams\n\n if (this.didCommModuleConfig.outboundTransports.length === 0) {\n throw new CredoError('Agent has no outbound transport!')\n }\n\n agentContext.config.logger.debug('Sending outbound message to service:', {\n messageId: message.id,\n service: { ...service, recipientKeys: 'omitted...', routingKeys: 'omitted...' },\n })\n\n const keys = {\n recipientKeys: service.recipientKeys,\n routingKeys: service.routingKeys,\n senderKey,\n }\n\n // Set return routing for message if requested\n if (returnRoute) {\n message.setReturnRouting(ReturnRouteTypes.all)\n }\n\n try {\n MessageValidator.validateSync(message)\n } catch (error) {\n agentContext.config.logger.error(\n `Aborting sending outbound message ${message.type} to ${service.serviceEndpoint}. Message validation failed`,\n {\n errors: error,\n message: message.toJSON(),\n }\n )\n\n throw error\n }\n\n const outboundPackage = await this.packMessage(agentContext, { message, keys, endpoint: service.serviceEndpoint })\n outboundPackage.endpoint = service.serviceEndpoint\n outboundPackage.connectionId = connection?.id\n for (const transport of this.didCommModuleConfig.outboundTransports) {\n const protocolScheme = utils.getProtocolScheme(service.serviceEndpoint)\n if (!protocolScheme) {\n agentContext.config.logger.warn('Service does not have a protocol scheme.')\n } else if (transport.supportedSchemes.includes(protocolScheme)) {\n await transport.sendMessage(outboundPackage)\n return\n }\n }\n throw new MessageSendingError(`Unable to send message to service: ${service.serviceEndpoint}`, {\n outboundMessageContext,\n })\n }\n\n private findSessionForOutboundContext(outboundContext: DidCommOutboundMessageContext) {\n let session: DidCommTransportSession | undefined\n\n // Use session id from outbound context if present, or use the session from the inbound message context\n const sessionId = outboundContext.sessionId ?? outboundContext.inboundMessageContext?.sessionId\n\n // Try to find session by id\n if (sessionId) {\n session = this.transportService.findSessionById(sessionId)\n }\n\n // Try to find session by connection id\n if (!session && outboundContext.connection?.id) {\n session = this.transportService.findSessionByConnectionId(outboundContext.connection.id)\n }\n\n return session?.inboundMessage?.hasAnyReturnRoute() ? session : null\n }\n\n private async retrieveServicesByConnection(\n agentContext: AgentContext,\n connection: DidCommConnectionRecord,\n transportPriority?: TransportPriorityOptions,\n outOfBand?: DidCommOutOfBandRecord\n ) {\n agentContext.config.logger.debug(\n `Retrieving services for connection '${connection.id}' (${connection.theirLabel})`,\n {\n transportPriority,\n connection,\n }\n )\n\n let didCommServices: ResolvedDidCommService[] = []\n\n if (connection.theirDid) {\n agentContext.config.logger.debug(`Resolving services for connection theirDid ${connection.theirDid}.`)\n didCommServices = await this.didCommDocumentService.resolveServicesFromDid(agentContext, connection.theirDid)\n } else if (outOfBand) {\n agentContext.config.logger.debug(`Resolving services from out-of-band record ${outOfBand.id}.`)\n if (connection.isRequester) {\n for (const service of outOfBand.outOfBandInvitation.getServices()) {\n // Resolve dids to DIDDocs to retrieve services\n if (typeof service === 'string') {\n agentContext.config.logger.debug(`Resolving services for did ${service}.`)\n didCommServices.push(...(await this.didCommDocumentService.resolveServicesFromDid(agentContext, service)))\n } else {\n // Out of band inline service contains keys encoded as did:key references\n didCommServices.push({\n id: service.id,\n recipientKeys: service.recipientKeys.map(didKeyToEd25519PublicJwk),\n routingKeys: service.routingKeys?.map(didKeyToEd25519PublicJwk) || [],\n serviceEndpoint: service.serviceEndpoint,\n })\n }\n }\n }\n }\n\n // Separate queue service out\n let services = didCommServices.filter((s) => !isDidCommTransportQueue(s.serviceEndpoint))\n const queueService = didCommServices.find((s) => isDidCommTransportQueue(s.serviceEndpoint))\n\n // If restrictive will remove services not listed in schemes list\n if (transportPriority?.restrictive) {\n services = services.filter((service) => {\n const serviceSchema = utils.getProtocolScheme(service.serviceEndpoint)\n return transportPriority.schemes.includes(serviceSchema)\n })\n }\n\n // If transport priority is set we will sort services by our priority.\n // Services whose scheme is not listed in the priority list are kept but\n // sorted after any prioritized ones (indexOf returns -1 for them, which\n // would otherwise incorrectly rank them first).\n if (transportPriority?.schemes) {\n const schemePriority = (endpoint: string) => {\n const index = transportPriority.schemes.indexOf(utils.getProtocolScheme(endpoint))\n return index === -1 ? Number.MAX_SAFE_INTEGER : index\n }\n services = services.sort((a, b) => schemePriority(a.serviceEndpoint) - schemePriority(b.serviceEndpoint))\n }\n\n agentContext.config.logger.debug(\n `Retrieved ${services.length} services for message to connection '${connection.id}'(${connection.theirLabel})'`,\n { hasQueueService: queueService !== undefined, transportPriority }\n )\n return { services, queueService }\n }\n\n private emitMessageSentEvent(\n outboundMessageContext: DidCommOutboundMessageContext,\n status: OutboundMessageSendStatus\n ) {\n const { agentContext } = outboundMessageContext\n this.eventEmitter.emit<DidCommMessageSentEvent>(agentContext, {\n type: DidCommEventTypes.DidCommMessageSent,\n payload: {\n message: outboundMessageContext,\n status,\n },\n })\n }\n}\n\nexport function isDidCommTransportQueue(serviceEndpoint: string): serviceEndpoint is typeof DID_COMM_TRANSPORT_QUEUE {\n return serviceEndpoint === DID_COMM_TRANSPORT_QUEUE\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCO,IAAM,uBAAN,MAAM,qBAAqB;CAOhC,YACE,iBACA,kBACA,qBACA,wBACA,cACA;EACA,KAAK,kBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,sBAAsB;EAC3B,KAAK,yBAAyB;EAC9B,KAAK,eAAe;CACtB;CAEA,MAAa,YACX,cACA,EACE,MACA,SACA,YAM+B;EAGjC,OAAO;GACL,SAAS,MAHoB,KAAK,gBAAgB,YAAY,cAAc,SAAS,IAAI;GAIzF,mBAAmB,QAAQ,kBAAkB;GAC7C;EACF;CACF;CAEA,MAAc,qBACZ,cACA,SACA,SACA;EACA,aAAa,OAAO,OAAO,MAAM,uDAAuD,QAAQ,KAAK,IAAI;EACzG,IAAI,CAAC,QAAQ,MACX,MAAM,IAAI,WAAW,mCAAmC,QAAQ,KAAK,oBAAoB;EAE3F,MAAM,mBAAmB,MAAM,KAAK,gBAAgB,YAAY,cAAc,SAAS,QAAQ,IAAI;EACnG,aAAa,OAAO,OAAO,MAAM,iBAAiB;EAClD,MAAM,QAAQ,KAAK,cAAc,gBAAgB;CACnD;CAEA,MAAa,YACX,cACA,EACE,YACA,kBACA,cACA,WAOF;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GA,IAAI,WAAW,gBAAgB,QAAQ,MAAM,CAAC,wBAAwB,EAAE,eAAe,CAAC;EACxF,MAAM,eAAe,gBAAgB,MAAM,MAAM,wBAAwB,EAAE,eAAe,CAAC;EAG3F,IAAI,mBAAmB,aACrB,WAAW,SAAS,QAAQ,YAAY;GACtC,MAAM,gBAAgB,MAAM,kBAAkB,QAAQ,eAAe;GACrE,OAAO,kBAAkB,QAAQ,SAAS,aAAa;EACzD,CAAC;EAOH,IAAI,mBAAmB,SAAS;GAC9B,MAAM,kBAAkB,aAAqB;IAC3C,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ,MAAM,kBAAkB,QAAQ,CAAC;IACjF,OAAO,UAAU,KAAK,OAAO,mBAAmB;GAClD;GACA,WAAW,SAAS,MAAM,GAAG,MAAM,eAAe,EAAE,eAAe,IAAI,eAAe,EAAE,eAAe,CAAC;EAC1G;EAEA,aAAa,OAAO,OAAO,MACzB,aAAa,SAAS,OAAO,uCAAuC,WAAW,GAAG,IAAI,WAAW,WAAW,KAC5G;GAAE,iBAAiB,iBAAiB,KAAA;GAAW;EAAkB,CACnE;EACA,OAAO;GAAE;GAAU;EAAa;CAClC;CAEA,qBACE,wBACA,QACA;EACA,MAAM,EAAE,iBAAiB;EACzB,KAAK,aAAa,KAA8B,cAAc;GAC5D,MAAA;GACA,SAAS;IACP,SAAS;IACT;GACF;EACF,CAAC;CACH;AACF;AA1hBC,uBAAA,WAAA,CAAA,WAAW,GAAA,mBAAA,qBAAA;;;;;;;AA4hBZ,SAAgB,wBAAwB,iBAA6E;CACnH,OAAO,oBAAoB;AAC7B"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./build/index.mjs",
5
5
  "./package.json": "./package.json"
6
6
  },
7
- "version": "0.7.2",
7
+ "version": "0.7.3-alpha-20261006101201",
8
8
  "files": [
9
9
  "build"
10
10
  ],
@@ -24,7 +24,7 @@
24
24
  "luxon": "^3.7.2",
25
25
  "query-string": "^9.3.1",
26
26
  "rxjs": "^7.8.2",
27
- "@credo-ts/core": "0.7.2"
27
+ "@credo-ts/core": "0.7.3-alpha-20261006101201"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@animo-id/pex": "^6.1.1",