From 122834e69bf6f6c463ee455ce8ef93387b039824 Mon Sep 17 00:00:00 2001 From: Mircea Nistor Date: Sat, 26 Jun 2021 07:57:22 +0300 Subject: [PATCH] refactor(did-comm): fix param type for `getDIDCommMessageMediaType` --- __tests__/shared/documentationExamples.ts | 2 +- packages/core/src/types/IResolver.ts | 2 +- packages/did-comm/plugin.schema.json | 15 +++++++++------ packages/did-comm/src/action-handler.ts | 2 +- packages/did-comm/src/types/IDIDComm.ts | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/__tests__/shared/documentationExamples.ts b/__tests__/shared/documentationExamples.ts index f5ecf58b6..b4715826d 100644 --- a/__tests__/shared/documentationExamples.ts +++ b/__tests__/shared/documentationExamples.ts @@ -28,7 +28,7 @@ export default (testContext: { const didFragment = `${did}#controller` const fragment = await agent.getDIDComponentById({ didDocument: (await agent.resolveDid({ didUrl: did }))?.didDocument, - didURI: didFragment, + didUrl: didFragment, section: 'authentication', }) expect(fragment).toEqual({ diff --git a/packages/core/src/types/IResolver.ts b/packages/core/src/types/IResolver.ts index d6546fe4d..9282523ef 100644 --- a/packages/core/src/types/IResolver.ts +++ b/packages/core/src/types/IResolver.ts @@ -67,7 +67,7 @@ export interface IResolver extends IPluginMethodMap { resolveDid(args: ResolveDidArgs): Promise /** - * Dereferences a DID URI fragment and return the corresponding DID document entry. + * Dereferences a DID URL fragment and returns the corresponding DID document entry. * * @example * ```typescript diff --git a/packages/did-comm/plugin.schema.json b/packages/did-comm/plugin.schema.json index 46a5a8c9d..d7381d793 100644 --- a/packages/did-comm/plugin.schema.json +++ b/packages/did-comm/plugin.schema.json @@ -2,10 +2,6 @@ "IDIDComm": { "components": { "schemas": { - "IUnpackDIDCommMessageArgs": { - "$ref": "#/components/schemas/IPackedDIDCommMessage", - "description": "The input to the {@link DIDComm.unpackDIDCommMessage } method." - }, "IPackedDIDCommMessage": { "type": "object", "properties": { @@ -58,7 +54,10 @@ "to": { "type": "string" }, - "thread_id": { + "thid": { + "type": "string" + }, + "pthid": { "type": "string" }, "id": { @@ -436,6 +435,10 @@ ], "description": "Verifiable Presentation {@link https://github.com/decentralized-identifier/did-jwt-vc }" }, + "IUnpackDIDCommMessageArgs": { + "$ref": "#/components/schemas/IPackedDIDCommMessage", + "description": "The input to the {@link DIDComm.unpackDIDCommMessage } method." + }, "IUnpackedDIDCommMessage": { "type": "object", "properties": { @@ -469,7 +472,7 @@ "getDIDCommMessageMediaType": { "description": "Partially decodes a possible DIDComm message string to determine the ", "arguments": { - "$ref": "#/components/schemas/IUnpackDIDCommMessageArgs" + "$ref": "#/components/schemas/IPackedDIDCommMessage" }, "returnType": { "$ref": "#/components/schemas/DIDCommMessageMediaType" diff --git a/packages/did-comm/src/action-handler.ts b/packages/did-comm/src/action-handler.ts index 24dc767c5..0730b2c37 100644 --- a/packages/did-comm/src/action-handler.ts +++ b/packages/did-comm/src/action-handler.ts @@ -307,7 +307,7 @@ export class DIDComm implements IAgentPlugin { } /** {@inheritdoc IDIDComm.getDIDCommMessageMediaType} */ - async getDidCommMessageMediaType({ message }: { message: string }): Promise { + async getDidCommMessageMediaType({ message }: IPackedDIDCommMessage): Promise { try { const { mediaType } = this.decodeMessageAndMediaType(message) return mediaType diff --git a/packages/did-comm/src/types/IDIDComm.ts b/packages/did-comm/src/types/IDIDComm.ts index 6136fd64c..cbd475a34 100644 --- a/packages/did-comm/src/types/IDIDComm.ts +++ b/packages/did-comm/src/types/IDIDComm.ts @@ -30,7 +30,7 @@ export interface IDIDComm extends IPluginMethodMap { * * @beta */ - getDIDCommMessageMediaType(args: IUnpackDIDCommMessageArgs): Promise + getDIDCommMessageMediaType(args: IPackedDIDCommMessage): Promise /** * Packs a {@link IDIDCommMessage} using one of the {@link DIDCommMessagePacking} options.