diff --git a/packages/core/src/agent.ts b/packages/core/src/agent.ts index 9e30eec66..5ed042471 100644 --- a/packages/core/src/agent.ts +++ b/packages/core/src/agent.ts @@ -173,7 +173,7 @@ export class Agent implements IAgent { * @public */ async execute

(method: string, args: P): Promise { - Debug('veramo:agent:' + method)('%o', args) + Debug('veramo:agent:' + method)('%s %o', 'arg', args) if (!this.methods[method]) throw Error('Method not available: ' + method) const _args = args || {} if (this.schemaValidation && this.schema.components.methods[method]) { @@ -183,7 +183,7 @@ export class Agent implements IAgent { if (this.schemaValidation && this.schema.components.methods[method]) { validateReturnType(method, result, this.schema) } - Debug('veramo:agent:' + method + ':result')('%o', result) + Debug('veramo:agent:' + method)('%s %o', 'res', result) return result } diff --git a/packages/did-comm/src/protocols/coordinate-mediation-message-handler.ts b/packages/did-comm/src/protocols/coordinate-mediation-message-handler.ts index 7c93bf117..e903bb392 100644 --- a/packages/did-comm/src/protocols/coordinate-mediation-message-handler.ts +++ b/packages/did-comm/src/protocols/coordinate-mediation-message-handler.ts @@ -9,10 +9,34 @@ const debug = Debug('veramo:did-comm:coordinate-mediation-message-handler') type IContext = IAgentContext +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ export const MEDIATE_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/coordinate-mediation/2.0/mediate-request' + +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ export const MEDIATE_GRANT_MESSAGE_TYPE = 'https://didcomm.org/coordinate-mediation/2.0/mediate-grant' + +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ export const MEDIATE_DENY_MESSAGE_TYPE = 'https://didcomm.org/coordinate-mediation/2.0/mediate-deny' +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ +export const STATUS_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/status-request' + +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ +export const DELIVERY_REQUEST_MESSAGE_TYPE = 'https://didcomm.org/messagepickup/3.0/delivery-request' + +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ export function createMediateRequestMessage( recipientDidUrl: string, mediatorDidUrl: string, @@ -28,6 +52,9 @@ export function createMediateRequestMessage( } } +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ export function createMediateGrantMessage( recipientDidUrl: string, mediatorDidUrl: string, @@ -46,6 +73,40 @@ export function createMediateGrantMessage( } } +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ +export function createStatusRequestMessage( + recipientDidUrl: string, + mediatorDidUrl: string, +): IDIDCommMessage { + return { + id: v4(), + type: STATUS_REQUEST_MESSAGE_TYPE, + to: mediatorDidUrl, + from: recipientDidUrl, + return_route: 'all', + body: {}, + } +} + +/** + * @beta This API may change without a BREAKING CHANGE notice. + */ +export function createDeliveryRequestMessage( + recipientDidUrl: string, + mediatorDidUrl: string, +): IDIDCommMessage { + return { + id: v4(), + type: DELIVERY_REQUEST_MESSAGE_TYPE, + to: mediatorDidUrl, + from: recipientDidUrl, + return_route: 'all', + body: { limit: 2 }, + } +} + /** * A plugin for the {@link @veramo/message-handler#MessageHandler} that handles Mediator Coordinator messages for the mediator role. * @beta This API may change without a BREAKING CHANGE notice. diff --git a/packages/did-comm/src/protocols/index.ts b/packages/did-comm/src/protocols/index.ts index a0a7f8303..f88bae505 100644 --- a/packages/did-comm/src/protocols/index.ts +++ b/packages/did-comm/src/protocols/index.ts @@ -1,4 +1,4 @@ export { TrustPingMessageHandler } from './trust-ping-message-handler.js' -export { CoordinateMediationMediatorMessageHandler, CoordinateMediationRecipientMessageHandler } from "./coordinate-mediation-message-handler.js" +export * from "./coordinate-mediation-message-handler.js" export { RoutingMessageHandler } from "./routing-message-handler.js" export { PickupMediatorMessageHandler, PickupRecipientMessageHandler } from "./messagepickup-message-handler.js" \ No newline at end of file