Skip to content

Commit

Permalink
refactor(did-comm): fix param type for getDIDCommMessageMediaType
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Jun 26, 2021
1 parent 46aa1eb commit 122834e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/shared/documentationExamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/IResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface IResolver extends IPluginMethodMap {
resolveDid(args: ResolveDidArgs): Promise<DIDResolutionResult>

/**
* 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
Expand Down
15 changes: 9 additions & 6 deletions packages/did-comm/plugin.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -58,7 +54,10 @@
"to": {
"type": "string"
},
"thread_id": {
"thid": {
"type": "string"
},
"pthid": {
"type": "string"
},
"id": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/did-comm/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export class DIDComm implements IAgentPlugin {
}

/** {@inheritdoc IDIDComm.getDIDCommMessageMediaType} */
async getDidCommMessageMediaType({ message }: { message: string }): Promise<DIDCommMessageMediaType> {
async getDidCommMessageMediaType({ message }: IPackedDIDCommMessage): Promise<DIDCommMessageMediaType> {
try {
const { mediaType } = this.decodeMessageAndMediaType(message)
return mediaType
Expand Down
2 changes: 1 addition & 1 deletion packages/did-comm/src/types/IDIDComm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface IDIDComm extends IPluginMethodMap {
*
* @beta
*/
getDIDCommMessageMediaType(args: IUnpackDIDCommMessageArgs): Promise<DIDCommMessageMediaType>
getDIDCommMessageMediaType(args: IPackedDIDCommMessage): Promise<DIDCommMessageMediaType>

/**
* Packs a {@link IDIDCommMessage} using one of the {@link DIDCommMessagePacking} options.
Expand Down

0 comments on commit 122834e

Please sign in to comment.