diff --git a/src/controllers/outofband/OutOfBandController.ts b/src/controllers/outofband/OutOfBandController.ts index 63d28b35..4450bd92 100644 --- a/src/controllers/outofband/OutOfBandController.ts +++ b/src/controllers/outofband/OutOfBandController.ts @@ -1,3 +1,4 @@ +import type { RestAgentModules } from '../../cliAgent' import type { OutOfBandInvitationProps, OutOfBandRecordWithInvitationProps } from '../examples' import type { AgentMessageType, RecipientKeyOption, CreateInvitationOptions } from '../types' import type { @@ -12,7 +13,6 @@ import { JsonTransformer, OutOfBandInvitation, Agent, - RecordNotFoundError, Key, KeyType, createPeerDidDocumentFromServices, @@ -20,33 +20,21 @@ import { } from '@credo-ts/core' import { injectable } from 'tsyringe' +import ErrorHandlingService from '../../errorHandlingService' +import { NotFoundError } from '../../errors' import { ConnectionRecordExample, outOfBandInvitationExample, outOfBandRecordExample, RecordId } from '../examples' import { AcceptInvitationConfig, ReceiveInvitationByUrlProps, ReceiveInvitationProps } from '../types' -import { - Body, - Controller, - Delete, - Example, - Get, - Path, - Post, - Query, - Res, - Route, - Tags, - TsoaResponse, - Security, -} from 'tsoa' +import { Body, Controller, Delete, Example, Get, Path, Post, Query, Route, Tags, Security } from 'tsoa' @Tags('Out Of Band') @Security('apiKey') @Route('/oob') @injectable() export class OutOfBandController extends Controller { - private agent: Agent + private agent: Agent - public constructor(agent: Agent) { + public constructor(agent: Agent) { super() this.agent = agent } @@ -59,11 +47,15 @@ export class OutOfBandController extends Controller { @Example([outOfBandRecordExample]) @Get() public async getAllOutOfBandRecords(@Query('invitationId') invitationId?: RecordId) { - let outOfBandRecords = await this.agent.oob.getAll() + try { + let outOfBandRecords = await this.agent.oob.getAll() - if (invitationId) outOfBandRecords = outOfBandRecords.filter((o) => o.outOfBandInvitation.id === invitationId) + if (invitationId) outOfBandRecords = outOfBandRecords.filter((o) => o.outOfBandInvitation.id === invitationId) - return outOfBandRecords.map((c) => c.toJSON()) + return outOfBandRecords.map((c) => c.toJSON()) + } catch (error) { + throw ErrorHandlingService.handle(error) + } } /** @@ -73,16 +65,16 @@ export class OutOfBandController extends Controller { */ @Example(outOfBandRecordExample) @Get('/:outOfBandId') - public async getOutOfBandRecordById( - @Path('outOfBandId') outOfBandId: RecordId, - @Res() notFoundError: TsoaResponse<404, { reason: string }> - ) { - const outOfBandRecord = await this.agent.oob.findById(outOfBandId) + public async getOutOfBandRecordById(@Path('outOfBandId') outOfBandId: RecordId) { + try { + const outOfBandRecord = await this.agent.oob.findById(outOfBandId) - if (!outOfBandRecord) - return notFoundError(404, { reason: `Out of band record with id "${outOfBandId}" not found.` }) + if (!outOfBandRecord) throw new NotFoundError(`Out of band record with id "${outOfBandId}" not found.`) - return outOfBandRecord.toJSON() + return outOfBandRecord.toJSON() + } catch (error) { + throw ErrorHandlingService.handle(error) + } } /** @@ -102,7 +94,6 @@ export class OutOfBandController extends Controller { }) @Post('/create-invitation') public async createInvitation( - @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() config: CreateInvitationOptions & RecipientKeyOption // props removed because of issues with serialization ) { try { @@ -142,7 +133,7 @@ export class OutOfBandController extends Controller { invitationDid: config?.invitationDid ? '' : invitationDid, } } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } @@ -160,7 +151,6 @@ export class OutOfBandController extends Controller { }) @Post('/create-legacy-invitation') public async createLegacyInvitation( - @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() config?: Omit & RecipientKeyOption ) { try { @@ -191,7 +181,7 @@ export class OutOfBandController extends Controller { ...(config?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }), } } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } @@ -215,9 +205,7 @@ export class OutOfBandController extends Controller { recordId: string message: AgentMessageType domain: string - }, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> + } ) { try { const agentMessage = JsonTransformer.fromJSON(config.message, AgentMessage) @@ -227,10 +215,7 @@ export class OutOfBandController extends Controller { message: agentMessage, }) } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { reason: `connection with connection id "${config.recordId}" not found.` }) - } - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } @@ -247,10 +232,7 @@ export class OutOfBandController extends Controller { connectionRecord: ConnectionRecordExample, }) @Post('/receive-invitation') - public async receiveInvitation( - @Body() invitationRequest: ReceiveInvitationProps, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { + public async receiveInvitation(@Body() invitationRequest: ReceiveInvitationProps) { const { invitation, ...config } = invitationRequest try { @@ -262,7 +244,7 @@ export class OutOfBandController extends Controller { connectionRecord: connectionRecord?.toJSON(), } } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } @@ -279,10 +261,7 @@ export class OutOfBandController extends Controller { connectionRecord: ConnectionRecordExample, }) @Post('/receive-invitation-url') - public async receiveInvitationFromUrl( - @Body() invitationRequest: ReceiveInvitationByUrlProps, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { + public async receiveInvitationFromUrl(@Body() invitationRequest: ReceiveInvitationByUrlProps) { const { invitationUrl, ...config } = invitationRequest try { @@ -296,7 +275,7 @@ export class OutOfBandController extends Controller { connectionRecord: connectionRecord?.toJSON(), } } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } @@ -311,9 +290,7 @@ export class OutOfBandController extends Controller { @Post('/:outOfBandId/accept-invitation') public async acceptInvitation( @Path('outOfBandId') outOfBandId: RecordId, - @Body() acceptInvitationConfig: AcceptInvitationConfig, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> + @Body() acceptInvitationConfig: AcceptInvitationConfig ) { try { const { outOfBandRecord, connectionRecord } = await this.agent.oob.acceptInvitation( @@ -326,12 +303,7 @@ export class OutOfBandController extends Controller { connectionRecord: connectionRecord?.toJSON(), } } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { - reason: `mediator with mediatorId ${acceptInvitationConfig?.mediatorId} not found`, - }) - } - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } @@ -341,19 +313,12 @@ export class OutOfBandController extends Controller { * @param outOfBandId Record identifier */ @Delete('/:outOfBandId') - public async deleteOutOfBandRecord( - @Path('outOfBandId') outOfBandId: RecordId, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { + public async deleteOutOfBandRecord(@Path('outOfBandId') outOfBandId: RecordId) { try { this.setStatus(204) await this.agent.oob.deleteById(outOfBandId) } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { reason: `Out of band record with id "${outOfBandId}" not found.` }) - } - return internalServerError(500, { message: `something went wrong: ${error}` }) + throw ErrorHandlingService.handle(error) } } } diff --git a/src/routes/routes.ts b/src/routes/routes.ts index dd4ba3ba..098ab969 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -124,11 +124,6 @@ const models: TsoaRoute.Models = { "additionalProperties": false, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "HandshakeProtocol": { - "dataType": "refEnum", - "enums": ["https://didcomm.org/didexchange/1.x","https://didcomm.org/connections/1.x"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "PlaintextMessage": { "dataType": "refObject", "properties": { @@ -140,6 +135,11 @@ const models: TsoaRoute.Models = { "additionalProperties": {"dataType":"any"}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "HandshakeProtocol": { + "dataType": "refEnum", + "enums": ["https://didcomm.org/didexchange/1.x","https://didcomm.org/connections/1.x"], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "AgentMessage": { "dataType": "refAlias", "type": {"ref":"PlaintextMessage","validators":{}}, @@ -266,7 +266,7 @@ const models: TsoaRoute.Models = { // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Pick_CreateLegacyInvitationConfig.Exclude_keyofCreateLegacyInvitationConfig.routing__": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"dataType":"string"},"alias":{"dataType":"string"},"imageUrl":{"dataType":"string"},"multiUseInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"}},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"alias":{"dataType":"string"},"label":{"dataType":"string"},"imageUrl":{"dataType":"string"},"multiUseInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"}},"validators":{}}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Omit_CreateLegacyInvitationConfig.routing_": { @@ -274,6 +274,11 @@ const models: TsoaRoute.Models = { "type": {"ref":"Pick_CreateLegacyInvitationConfig.Exclude_keyofCreateLegacyInvitationConfig.routing__","validators":{}}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "OutOfBandRecord": { + "dataType": "refAlias", + "type": {"ref":"Record_string.unknown_","validators":{}}, + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "AgentMessageType": { "dataType": "refObject", "properties": { @@ -314,7 +319,7 @@ const models: TsoaRoute.Models = { // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Pick_ReceiveOutOfBandInvitationConfig.Exclude_keyofReceiveOutOfBandInvitationConfig.routing__": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"dataType":"string"},"alias":{"dataType":"string"},"imageUrl":{"dataType":"string"},"autoAcceptConnection":{"dataType":"boolean"},"autoAcceptInvitation":{"dataType":"boolean"},"reuseConnection":{"dataType":"boolean"},"acceptInvitationTimeoutMs":{"dataType":"double"},"ourDid":{"dataType":"string"}},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"alias":{"dataType":"string"},"label":{"dataType":"string"},"imageUrl":{"dataType":"string"},"autoAcceptConnection":{"dataType":"boolean"},"autoAcceptInvitation":{"dataType":"boolean"},"reuseConnection":{"dataType":"boolean"},"acceptInvitationTimeoutMs":{"dataType":"double"},"ourDid":{"dataType":"string"}},"validators":{}}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Omit_ReceiveOutOfBandInvitationConfig.routing_": { @@ -325,8 +330,8 @@ const models: TsoaRoute.Models = { "ReceiveInvitationProps": { "dataType": "refObject", "properties": { - "label": {"dataType":"string"}, "alias": {"dataType":"string"}, + "label": {"dataType":"string"}, "imageUrl": {"dataType":"string"}, "autoAcceptConnection": {"dataType":"boolean"}, "autoAcceptInvitation": {"dataType":"boolean"}, @@ -341,8 +346,8 @@ const models: TsoaRoute.Models = { "ReceiveInvitationByUrlProps": { "dataType": "refObject", "properties": { - "label": {"dataType":"string"}, "alias": {"dataType":"string"}, + "label": {"dataType":"string"}, "imageUrl": {"dataType":"string"}, "autoAcceptConnection": {"dataType":"boolean"}, "autoAcceptInvitation": {"dataType":"boolean"}, @@ -438,7 +443,7 @@ const models: TsoaRoute.Models = { // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing__": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"dataType":"string"},"alias":{"dataType":"string"},"imageUrl":{"dataType":"string"},"multiUseInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"},"goalCode":{"dataType":"string"},"goal":{"dataType":"string"},"handshake":{"dataType":"boolean"},"handshakeProtocols":{"dataType":"array","array":{"dataType":"refEnum","ref":"HandshakeProtocol"}},"messages":{"dataType":"array","array":{"dataType":"refAlias","ref":"AgentMessage"}},"appendedAttachments":{"dataType":"array","array":{"dataType":"refObject","ref":"Attachment"}},"invitationDid":{"dataType":"string"}},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"alias":{"dataType":"string"},"label":{"dataType":"string"},"imageUrl":{"dataType":"string"},"multiUseInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"},"goalCode":{"dataType":"string"},"goal":{"dataType":"string"},"handshake":{"dataType":"boolean"},"handshakeProtocols":{"dataType":"array","array":{"dataType":"refEnum","ref":"HandshakeProtocol"}},"messages":{"dataType":"array","array":{"dataType":"refAlias","ref":"AgentMessage"}},"appendedAttachments":{"dataType":"array","array":{"dataType":"refObject","ref":"Attachment"}},"invitationDid":{"dataType":"string"}},"validators":{}}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Omit_CreateOutOfBandInvitationConfig.routing_": { @@ -448,7 +453,7 @@ const models: TsoaRoute.Models = { // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages__": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"dataType":"string"},"alias":{"dataType":"string"},"imageUrl":{"dataType":"string"},"multiUseInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"},"goalCode":{"dataType":"string"},"goal":{"dataType":"string"},"handshake":{"dataType":"boolean"},"handshakeProtocols":{"dataType":"array","array":{"dataType":"refEnum","ref":"HandshakeProtocol"}},"invitationDid":{"dataType":"string"}},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"alias":{"dataType":"string"},"label":{"dataType":"string"},"imageUrl":{"dataType":"string"},"multiUseInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"},"goalCode":{"dataType":"string"},"goal":{"dataType":"string"},"handshake":{"dataType":"boolean"},"handshakeProtocols":{"dataType":"array","array":{"dataType":"refEnum","ref":"HandshakeProtocol"}},"invitationDid":{"dataType":"string"}},"validators":{}}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_": { @@ -1674,7 +1679,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_getOutOfBandRecordById(request: ExRequest, response: ExResponse, next: any) { const args: Record = { outOfBandId: {"in":"path","name":"outOfBandId","required":true,"ref":"RecordId"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa @@ -1710,7 +1714,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_createInvitation(request: ExRequest, response: ExResponse, next: any) { const args: Record = { - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, config: {"in":"body","name":"config","required":true,"dataType":"intersection","subSchemas":[{"ref":"CreateInvitationOptions"},{"ref":"RecipientKeyOption"}]}, }; @@ -1747,7 +1750,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_createLegacyInvitation(request: ExRequest, response: ExResponse, next: any) { const args: Record = { - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, config: {"in":"body","name":"config","dataType":"intersection","subSchemas":[{"ref":"Omit_CreateLegacyInvitationConfig.routing_"},{"ref":"RecipientKeyOption"}]}, }; @@ -1785,8 +1787,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_createLegacyConnectionlessInvitation(request: ExRequest, response: ExResponse, next: any) { const args: Record = { config: {"in":"body","name":"config","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"domain":{"dataType":"string","required":true},"message":{"ref":"AgentMessageType","required":true},"recordId":{"dataType":"string","required":true}}}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa @@ -1823,7 +1823,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_receiveInvitation(request: ExRequest, response: ExResponse, next: any) { const args: Record = { invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationProps"}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa @@ -1860,7 +1859,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_receiveInvitationFromUrl(request: ExRequest, response: ExResponse, next: any) { const args: Record = { invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationByUrlProps"}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa @@ -1898,8 +1896,6 @@ export function RegisterRoutes(app: Router) { const args: Record = { outOfBandId: {"in":"path","name":"outOfBandId","required":true,"ref":"RecordId"}, acceptInvitationConfig: {"in":"body","name":"acceptInvitationConfig","required":true,"ref":"AcceptInvitationConfig"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa @@ -1936,8 +1932,6 @@ export function RegisterRoutes(app: Router) { async function OutOfBandController_deleteOutOfBandRecord(request: ExRequest, response: ExResponse, next: any) { const args: Record = { outOfBandId: {"in":"path","name":"outOfBandId","required":true,"ref":"RecordId"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa diff --git a/src/routes/swagger.json b/src/routes/swagger.json index 09df30de..7dcdff77 100644 --- a/src/routes/swagger.json +++ b/src/routes/swagger.json @@ -261,14 +261,6 @@ "type": "object", "additionalProperties": false }, - "HandshakeProtocol": { - "description": "Enum values should be sorted based on order of preference. Values will be\nincluded in this order when creating out of band invitations.", - "enum": [ - "https://didcomm.org/didexchange/1.x", - "https://didcomm.org/connections/1.x" - ], - "type": "string" - }, "PlaintextMessage": { "properties": { "@type": { @@ -300,6 +292,14 @@ "type": "object", "additionalProperties": {} }, + "HandshakeProtocol": { + "description": "Enum values should be sorted based on order of preference. Values will be\nincluded in this order when creating out of band invitations.", + "enum": [ + "https://didcomm.org/didexchange/1.x", + "https://didcomm.org/connections/1.x" + ], + "type": "string" + }, "AgentMessage": { "$ref": "#/components/schemas/PlaintextMessage" }, @@ -583,10 +583,10 @@ }, "Pick_CreateLegacyInvitationConfig.Exclude_keyofCreateLegacyInvitationConfig.routing__": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -606,6 +606,9 @@ "$ref": "#/components/schemas/Pick_CreateLegacyInvitationConfig.Exclude_keyofCreateLegacyInvitationConfig.routing__", "description": "Construct a type with the properties of T except for those in type K." }, + "OutOfBandRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, "AgentMessageType": { "properties": { "@id": { @@ -717,10 +720,10 @@ }, "Pick_ReceiveOutOfBandInvitationConfig.Exclude_keyofReceiveOutOfBandInvitationConfig.routing__": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -752,10 +755,10 @@ }, "ReceiveInvitationProps": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -789,10 +792,10 @@ }, "ReceiveInvitationByUrlProps": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -987,10 +990,10 @@ }, "Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing__": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -1043,10 +1046,10 @@ }, "Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages__": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -3731,7 +3734,9 @@ "description": "OutOfBandRecord", "content": { "application/json": { - "schema": {}, + "schema": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, "examples": { "Example 1": { "value": { @@ -3776,24 +3781,6 @@ } } } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } } }, "description": "Retrieve an out of band record by id", @@ -3819,49 +3806,8 @@ "delete": { "operationId": "DeleteOutOfBandRecord", "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } + "204": { + "description": "No content" } }, "description": "Deletes an out of band record from the repository.", @@ -3894,7 +3840,29 @@ "description": "Out of band record", "content": { "application/json": { - "schema": {}, + "schema": { + "properties": { + "invitationDid": { + "type": "string" + }, + "outOfBandRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "invitation": { + "$ref": "#/components/schemas/PlaintextMessage" + }, + "invitationUrl": { + "type": "string" + } + }, + "required": [ + "invitationDid", + "outOfBandRecord", + "invitation", + "invitationUrl" + ], + "type": "object" + }, "examples": { "Example 1": { "value": { @@ -3966,24 +3934,6 @@ } } } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, "description": "Creates an outbound out-of-band record containing out-of-band invitation message defined in\nAries RFC 0434: Out-of-Band Protocol 1.1.", @@ -4025,7 +3975,28 @@ "description": "out-of-band record and invitation", "content": { "application/json": { - "schema": {}, + "schema": { + "properties": { + "outOfBandRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "invitation": { + "$ref": "#/components/schemas/PlaintextMessage" + }, + "invitationUrl": { + "type": "string" + }, + "recipientKey": { + "type": "string" + } + }, + "required": [ + "outOfBandRecord", + "invitation", + "invitationUrl" + ], + "type": "object" + }, "examples": { "Example 1": { "value": { @@ -4096,24 +4067,6 @@ } } } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, "description": "Creates an outbound out-of-band record in the same way how `createInvitation` method does it,\nbut it also converts out-of-band invitation message to an \"legacy\" invitation message defined\nin RFC 0160: Connection Protocol and returns it together with out-of-band record.", @@ -4153,55 +4106,37 @@ "responses": { "200": { "description": "a message and a invitationUrl", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "message": { - "@id": "eac4ff4e-b4fb-4c1d-aef3-b29c89d1cc00", - "@type": "https://didcomm.org/connections/1.0/invitation" - }, - "invitationUrl": "http://example.com/invitation_url" - } - } - } - } - } - }, - "404": { - "description": "", "content": { "application/json": { "schema": { "properties": { - "reason": { + "outOfBandRecord": { + "$ref": "#/components/schemas/OutOfBandRecord" + }, + "invitationUrl": { "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { + }, "message": { - "type": "string" + "$ref": "#/components/schemas/AgentMessage" } }, "required": [ + "outOfBandRecord", + "invitationUrl", "message" ], "type": "object" + }, + "examples": { + "Example 1": { + "value": { + "message": { + "@id": "eac4ff4e-b4fb-4c1d-aef3-b29c89d1cc00", + "@type": "https://didcomm.org/connections/1.0/invitation" + }, + "invitationUrl": "http://example.com/invitation_url" + } + } } } } @@ -4255,7 +4190,21 @@ "description": "out-of-band record and connection record if one has been created.", "content": { "application/json": { - "schema": {}, + "schema": { + "properties": { + "connectionRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "outOfBandRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + } + }, + "required": [ + "connectionRecord", + "outOfBandRecord" + ], + "type": "object" + }, "examples": { "Example 1": { "value": { @@ -4317,24 +4266,6 @@ } } } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, "description": "Creates inbound out-of-band record and assigns out-of-band invitation message to it if the\nmessage is valid.", @@ -4367,7 +4298,21 @@ "description": "out-of-band record and connection record if one has been created.", "content": { "application/json": { - "schema": {}, + "schema": { + "properties": { + "connectionRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "outOfBandRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + } + }, + "required": [ + "connectionRecord", + "outOfBandRecord" + ], + "type": "object" + }, "examples": { "Example 1": { "value": { @@ -4429,24 +4374,6 @@ } } } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, "description": "Creates inbound out-of-band record and assigns out-of-band invitation message to it if the\nmessage is valid.", @@ -4479,7 +4406,21 @@ "description": "Ok", "content": { "application/json": { - "schema": {}, + "schema": { + "properties": { + "connectionRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "outOfBandRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + } + }, + "required": [ + "connectionRecord", + "outOfBandRecord" + ], + "type": "object" + }, "examples": { "Example 1": { "value": { @@ -4541,42 +4482,6 @@ } } } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, "description": "Accept a connection invitation as invitee (by sending a connection request message) for the connection with the specified connection id.\nThis is not needed when auto accepting of connections is enabled.",