diff --git a/samples/cliConfig.json b/samples/cliConfig.json index 2e5ef5f6..13733d39 100644 --- a/samples/cliConfig.json +++ b/samples/cliConfig.json @@ -1,6 +1,6 @@ { - "label": "AFJ Rest Agent 1", - "walletId": "sample", + "label": "Credo Rest Agent", + "walletId": "sharedAgent", "walletKey": "sample", "walletType": "postgres", "walletUrl": "localhost:5432", @@ -43,5 +43,6 @@ "schemaManagerContractAddress": "0x552992e9f14b15bBd76488cD4c38c89B80259f37", "rpcUrl": "https://polygon-mumbai.infura.io/v3/0579d305568d404e996e49695e9272a3", "fileServerUrl": "https://schema.credebl.id/", - "fileServerToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6ImNhZDI3ZjhjLTMyNWYtNDRmZC04ZmZkLWExNGNhZTY3NTMyMSJ9.I3IR7abjWbfStnxzn1BhxhV0OEzt1x3mULjDdUcgWHk" + "fileServerToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6ImNhZDI3ZjhjLTMyNWYtNDRmZC04ZmZkLWExNGNhZTY3NTMyMSJ9.I3IR7abjWbfStnxzn1BhxhV0OEzt1x3mULjDdUcgWHk", + "api-key": "supersecret" } diff --git a/src/authentication.ts b/src/authentication.ts index 30cf4bf6..68963ea4 100644 --- a/src/authentication.ts +++ b/src/authentication.ts @@ -1,33 +1,165 @@ -import type * as express from 'express' +import type { RestAgentModules, RestMultiTenantAgentModules } from './cliAgent' +import type { TenantAgent } from '@aries-framework/tenants/build/TenantAgent' +import type { Request } from 'express' -import { LogLevel } from '@aries-framework/core' +import { Agent, LogLevel } from '@aries-framework/core' +import jwt, { decode } from 'jsonwebtoken' +import { container } from 'tsyringe' +import { AgentRole, ErrorMessages } from './enums/enum' +import { StatusException } from './error' import { TsLogger } from './utils/logger' +// export type AgentType = Agent | Agent | TenantAgent + let dynamicApiKey: string = 'api_key' // Initialize with a default value -export async function expressAuthentication( - request: express.Request, - securityName: string, - secMethod?: { [key: string]: any }, - scopes?: string -) { +export async function expressAuthentication(request: Request, securityName: string, scopes?: string[]) { const logger = new TsLogger(LogLevel.info) + const agent = container.resolve(Agent) + + logger.info(`securityName::: ${securityName}`) + logger.info(`scopes::: ${scopes}`) - logger.info(`secMethod::: ${JSON.stringify(secMethod)}`) - logger.info(`scopes::: ${JSON.stringify(scopes)}`) + if (scopes && scopes?.includes('skip')) { + // Skip authentication for this route or controller + request['agent'] = agent + return true + } const apiKeyHeader = request.headers['authorization'] + if (!apiKeyHeader) { + // return false + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + } + if (securityName === 'apiKey') { + // Auth: For BW/Dedicated agent to GET their token if (apiKeyHeader) { const providedApiKey = apiKeyHeader as string - if (providedApiKey === dynamicApiKey) { - return 'success' + request['agent'] = agent + return true } } } + + if (securityName === 'jwt') { + const tenancy = agent!.modules.tenants ? true : false + const tokenWithHeader = apiKeyHeader + const token = tokenWithHeader!.replace('Bearer ', '') + const reqPath = request.path + const decodedToken: jwt.JwtPayload = decode(token) as jwt.JwtPayload + const role: AgentRole = decodedToken.role + + if (tenancy) { + // it should be a shared agent + if (role !== AgentRole.RestRootAgentWithTenants && role !== AgentRole.RestTenantAgent) { + // return false //'The agent is a multi-tenant agent' + logger.debug('Unknown role. The agent is a multi-tenant agent') + return Promise.reject(new StatusException('Unknown role', 401)) + } + if (role === AgentRole.RestTenantAgent) { + // Logic if the token is of tenant agent + if (reqPath.includes('/multi-tenancy/')) { + // Note: Include the below logic for path detection instead of url + // if (scopes && scopes?.includes('multi-tenant')) { + logger.debug('Tenants cannot manage tenants') + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + } else { + // Auth: tenant agent + const tenantId: string = decodedToken.tenantId + if (!tenantId) { + // return false + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + } + const tenantAgent = await agent.modules.tenants.getTenantAgent({ tenantId }) + if (!tenantAgent) { + // return false + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + } + + const verified = await verifyToken(tenantAgent, token) + // Note: logic to store generate token for tenant using BW's secertKey + // const verified = await verifyToken(agent, token) + + // Failed to verify token + if (!verified) { + // return false + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + } + + // Only need to registerInstance for TenantAgent. + // return tenantAgent + request['agent'] = tenantAgent + return true + } + } else if (role === AgentRole.RestRootAgentWithTenants) { + // Auth: base wallet + const verified = await verifyToken(agent!, token) + + // Base wallet cant access any endpoints apart from multi-tenant endpoint + // if (!reqPath.includes('/multi-tenancy/')) { + // logger.error('Basewallet can only manage tenants and can`t perform other operations') + // return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + // } + + // Note: Implement the authorization part using scopes(below), instead of url(above) + // if (!scopes?.includes('multi-tenant')) { + // logger.error('Basewallet can only manage tenants') + // return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + // } + + if (!verified) return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + + request['agent'] = agent + return true + } else { + // return false //'Invalid Token' + logger.debug('Invalid Token') + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + } + } else { + if (role !== AgentRole.RestRootAgent) { + logger.debug('This is a dedicated agent') + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + // return false //'This is a dedicated agent' + } else { + // Auth: dedicated agent + + if (reqPath.includes('/multi-tenancy/')) + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + + const verified = await verifyToken(agent!, token) + if (!verified) return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) + //return false + + request['agent'] = agent + return true + } + } + } + // return false + return Promise.reject(new StatusException(ErrorMessages.Unauthorized, 401)) +} + +async function verifyToken(agent: Agent | TenantAgent, token: string): Promise { + const secretKey = await getSecretKey(agent) + const verified = jwt.verify(token, secretKey) + + return verified ? true : false +} + +// Common function to pass agent object and get secretKey +async function getSecretKey( + agent: Agent | TenantAgent +): Promise { + const genericRecord = await agent.genericRecords.getAll() + const recordWithToken = genericRecord.find((record) => record?.content?.secretKey !== undefined) + const secretKey = recordWithToken?.content.secretKey as string + + return secretKey } export function setDynamicApiKey(newApiKey: string) { diff --git a/src/cli.ts b/src/cli.ts index 4f57ea24..c5f8c0ca 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -129,6 +129,9 @@ const parsed = yargs boolean: true, default: false, }) + .option('apiKey', { + string: true, + }) // .option('storage-config', { // array: true, // default: [], @@ -198,5 +201,6 @@ export async function runCliServer() { rpcUrl: parsed['rpcUrl'], fileServerUrl: parsed['fileServerUrl'], fileServerToken: parsed['fileServerToken'], + apiKey: parsed['apiKey'], } as unknown as AriesRestConfig) } diff --git a/src/cliAgent.ts b/src/cliAgent.ts index 0281332c..0f7495ef 100644 --- a/src/cliAgent.ts +++ b/src/cliAgent.ts @@ -49,11 +49,11 @@ import { anoncreds } from '@hyperledger/anoncreds-nodejs' import { ariesAskar } from '@hyperledger/aries-askar-nodejs' import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import axios from 'axios' -import { randomBytes } from 'crypto' import { readFile } from 'fs/promises' -import jwt from 'jsonwebtoken' +// eslint-disable-next-line import/no-cycle import { setupServer } from './server' +import { generateSecretKey } from './utils/common.service' import { TsLogger } from './utils/logger' import { BCOVRIN_TEST_GENESIS } from './utils/util' @@ -100,6 +100,7 @@ export interface AriesRestConfig { rpcUrl: string fileServerUrl: string fileServerToken: string + apiKey: string } export async function readRestConfig(path: string) { @@ -202,23 +203,24 @@ const getWithTenantModules = (networkConfig: [IndyVdrPoolConfig, ...IndyVdrPoolC } } -async function generateSecretKey(length: number = 32): Promise { - // Asynchronously generate a buffer containing random values - const buffer: Buffer = await new Promise((resolve, reject) => { - randomBytes(length, (error, buf) => { - if (error) { - reject(error) - } else { - resolve(buf) - } - }) - }) - - // Convert the buffer to a hexadecimal string - const secretKey: string = buffer.toString('hex') - - return secretKey -} +// Add this function in common service +// async function generateSecretKey(length: number = 32): Promise { +// // Asynchronously generate a buffer containing random values +// const buffer: Buffer = await new Promise((resolve, reject) => { +// randomBytes(length, (error, buf) => { +// if (error) { +// reject(error) +// } else { +// resolve(buf) +// } +// }) +// }) + +// // Convert the buffer to a hexadecimal string +// const secretKey: string = buffer.toString('hex') + +// return secretKey +// } export async function runRestAgent(restConfig: AriesRestConfig) { const { @@ -228,6 +230,7 @@ export async function runRestAgent(restConfig: AriesRestConfig) { webhookUrl, adminPort, walletConfig, + apiKey, ...afjConfig } = restConfig @@ -327,36 +330,18 @@ export async function runRestAgent(restConfig: AriesRestConfig) { await agent.initialize() - let token: string = '' const genericRecord = await agent.genericRecords.getAll() + const recordsWithSecretKey = genericRecord.some((record) => record?.content?.secretKey) - const recordsWithToken = genericRecord.some((record) => record?.content?.token) - if (!genericRecord.length || !recordsWithToken) { - // Call the async function - const secretKeyInfo: string = await generateSecretKey() - // Check if the secretKey already exist in the genericRecords - - // if already exist - then don't generate the secret key again - // Check if the JWT token already available in genericRecords - if yes, and also don't generate the JWT token - // instead use the existin JWT token - // if JWT token is not found, create/generate a new token and save in genericRecords - // next time, the same token should be used - instead of creating a new token on every restart event of the agent - - // if already exist - then don't generate the secret key again - // Check if the JWT token already available in genericRecords - if yes, and also don't generate the JWT token - // instead use the existin JWT token - // if JWT token is not found, create/generate a new token and save in genericRecords - // next time, the same token should be used - instead of creating a new token on every restart event of the agent - token = jwt.sign({ agentInfo: 'agentInfo' }, secretKeyInfo) + if (!genericRecord.length || !recordsWithSecretKey) { + // If secretKey doesn't exist in genericRecord: i.e. Agent initialized for the first time or secretKey not found + // Generate and store secret key for agent while initialization + const secretKeyInfo = await generateSecretKey() await agent.genericRecords.save({ content: { secretKey: secretKeyInfo, - token, }, }) - } else { - const recordWithToken = genericRecord.find((record) => record?.content?.token !== undefined) - token = recordWithToken?.content.token as string } const app = await setupServer( @@ -365,10 +350,10 @@ export async function runRestAgent(restConfig: AriesRestConfig) { webhookUrl, port: adminPort, }, - token + apiKey ) - logger.info(`*** API Token: ${token}`) + logger.info(`*** API Key: ${apiKey}`) app.listen(adminPort, () => { logger.info(`Successfully started server on port ${adminPort}`) diff --git a/src/controllers/agent/AgentController.ts b/src/controllers/agent/AgentController.ts index e7ccc708..70fe4fd6 100644 --- a/src/controllers/agent/AgentController.ts +++ b/src/controllers/agent/AgentController.ts @@ -1,41 +1,70 @@ -import type { AgentInfo } from '../types' +import type { AgentInfo, AgentToken } from '../types' -import { Agent } from '@aries-framework/core' +import { Request as Req } from 'express' +import jwt from 'jsonwebtoken' import { injectable } from 'tsyringe' -import { Controller, Delete, Get, Route, Tags, Security } from 'tsoa' +import { AgentRole } from '../../enums/enum' + +// import { generateSecretKey } from 'src/utils/common.service' +import { Controller, Delete, Get, Post, Route, Tags, Security, Request } from 'tsoa' @Tags('Agent') @Route('/agent') @injectable() +// @Security('jwt') export class AgentController extends Controller { - private agent: Agent + // private agent: Agent - public constructor(agent: Agent) { - super() - this.agent = agent - } + // public constructor(agent: Agent) { + // super() + // this.agent = agent + // } /** * Retrieve basic agent information */ - @Get('/') - public async getAgentInfo(): Promise { + @Security('jwt') + @Get('/info') + public async getAgentInfo(@Request() request: Req): Promise { return { - label: this.agent.config.label, - endpoints: this.agent.config.endpoints, - isInitialized: this.agent.isInitialized, + label: request.agent.config.label, + endpoints: request.agent.config.endpoints, + isInitialized: request.agent.isInitialized, publicDid: undefined, } } /** - * Delete wallet + * Retrieve agent token */ + @Post('/token') @Security('apiKey') + public async getAgentToken(@Request() request: Req): Promise { + let token + const genericRecords = await request.agent.genericRecords.getAll() + const secretKeyInfo = genericRecords.find((record) => record?.content?.secretKey !== undefined) + if (!secretKeyInfo) { + throw new Error('secretKeyInfo not found') + } + const secretKey = secretKeyInfo.content.secretKey as string + if (!('tenants' in request.agent.modules)) { + token = jwt.sign({ role: AgentRole.RestRootAgent }, secretKey) + } else { + token = jwt.sign({ role: AgentRole.RestRootAgentWithTenants }, secretKey) + } + return { + token: token, + } + } + + /** + * Delete wallet + */ @Delete('/wallet') - public async deleteWallet() { - const deleteWallet = await this.agent.wallet.delete() + @Security('jwt') + public async deleteWallet(@Request() request: Req) { + const deleteWallet = await request.agent.wallet.delete() return deleteWallet } } diff --git a/src/controllers/basic-messages/BasicMessageController.ts b/src/controllers/basic-messages/BasicMessageController.ts index 78c0d595..63df3f59 100644 --- a/src/controllers/basic-messages/BasicMessageController.ts +++ b/src/controllers/basic-messages/BasicMessageController.ts @@ -1,24 +1,20 @@ import type { BasicMessageRecord, BasicMessageStorageProps } from '@aries-framework/core' -import { Agent, RecordNotFoundError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { RecordNotFoundError } from '@aries-framework/core' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { BasicMessageRecordExample, RecordId } from '../examples' -import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security, Request } from 'tsoa' @Tags('Basic Messages') @Route('/basic-messages') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class BasicMessageController extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Retrieve basic messages by connection id * @@ -27,8 +23,11 @@ export class BasicMessageController extends Controller { */ @Example([BasicMessageRecordExample]) @Get('/:connectionId') - public async getBasicMessages(@Path('connectionId') connectionId: RecordId): Promise { - return await this.agent.basicMessages.findAllByQuery({ connectionId }) + public async getBasicMessages( + @Path('connectionId') connectionId: RecordId, + @Request() request: Req + ): Promise { + return await request.agent.basicMessages.findAllByQuery({ connectionId }) } /** @@ -40,13 +39,14 @@ export class BasicMessageController extends Controller { @Post('/:connectionId') public async sendMessage( @Path('connectionId') connectionId: RecordId, - @Body() request: Record<'content', string>, + @Body() requestBody: Record<'content', string>, + @Request() request: Req, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { this.setStatus(204) - await this.agent.basicMessages.sendMessage(connectionId, request.content) + await request.agent.basicMessages.sendMessage(connectionId, requestBody.content) } catch (error) { if (error instanceof RecordNotFoundError) { return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) diff --git a/src/controllers/connections/ConnectionController.ts b/src/controllers/connections/ConnectionController.ts index ba093db9..fadad179 100644 --- a/src/controllers/connections/ConnectionController.ts +++ b/src/controllers/connections/ConnectionController.ts @@ -1,29 +1,33 @@ import type { ConnectionRecordProps } from '@aries-framework/core' -import { - ConnectionRepository, - DidExchangeState, - Agent, - AriesFrameworkError, - RecordNotFoundError, -} from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { ConnectionRepository, DidExchangeState, AriesFrameworkError, RecordNotFoundError } from '@aries-framework/core' +import { Request as Req } from 'express' +// eslint-disable-next-line import/no-extraneous-dependencies import { injectable } from 'tsyringe' import { ConnectionRecordExample, RecordId } from '../examples' -import { Controller, Delete, Example, Get, Path, Post, Query, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { + Controller, + Delete, + Example, + Get, + Path, + Post, + Query, + Res, + Route, + Tags, + TsoaResponse, + Security, + Request, +} from 'tsoa' @Tags('Connections') @Route() @injectable() export class ConnectionController extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Retrieve all connections records * @param alias Alias @@ -34,9 +38,11 @@ export class ConnectionController extends Controller { * @returns ConnectionRecord[] */ @Example([ConnectionRecordExample]) - @Security('apiKey') + // @Security('apiKey') + @Security('jwt') @Get('/connections') public async getAllConnections( + @Request() request: Req, @Query('outOfBandId') outOfBandId?: string, @Query('alias') alias?: string, @Query('state') state?: DidExchangeState, @@ -47,11 +53,11 @@ export class ConnectionController extends Controller { let connections if (outOfBandId) { - connections = await this.agent.connections.findAllByOutOfBandId(outOfBandId) + connections = await request.agent.connections.findAllByOutOfBandId(outOfBandId) } else { - const connectionRepository = this.agent.dependencyManager.resolve(ConnectionRepository) + const connectionRepository = request.agent.dependencyManager.resolve(ConnectionRepository) - const connections = await connectionRepository.findByQuery(this.agent.context, { + const connections = await connectionRepository.findByQuery(request.agent.context, { alias, myDid, theirDid, @@ -77,13 +83,15 @@ export class ConnectionController extends Controller { * @returns ConnectionRecord */ @Example(ConnectionRecordExample) - @Security('apiKey') + // @Security('apiKey') + @Security('jwt') @Get('/connections/:connectionId') public async getConnectionById( + @Request() request: Req, @Path('connectionId') connectionId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }> ) { - const connection = await this.agent.connections.findById(connectionId) + const connection = await request.agent.connections.findById(connectionId) if (!connection) return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) @@ -96,15 +104,17 @@ export class ConnectionController extends Controller { * @param connectionId Connection identifier */ @Delete('/connections/:connectionId') - @Security('apiKey') + // @Security('apiKey') + @Security('jwt') public async deleteConnection( + @Request() request: Req, @Path('connectionId') connectionId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { this.setStatus(204) - await this.agent.connections.deleteById(connectionId) + await request.agent.connections.deleteById(connectionId) } catch (error) { if (error instanceof RecordNotFoundError) { return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) @@ -123,15 +133,17 @@ export class ConnectionController extends Controller { * @returns ConnectionRecord */ @Example(ConnectionRecordExample) - @Security('apiKey') + // @Security('apiKey') + @Security('jwt') @Post('/connections/:connectionId/accept-request') public async acceptRequest( + @Request() request: Req, @Path('connectionId') connectionId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const connection = await this.agent.connections.acceptRequest(connectionId) + const connection = await request.agent.connections.acceptRequest(connectionId) return connection.toJSON() } catch (error) { if (error instanceof AriesFrameworkError) { @@ -151,15 +163,17 @@ export class ConnectionController extends Controller { * @returns ConnectionRecord */ @Example(ConnectionRecordExample) - @Security('apiKey') + // @Security('apiKey') + @Security('jwt') @Post('/connections/:connectionId/accept-response') public async acceptResponse( + @Request() request: Req, @Path('connectionId') connectionId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const connection = await this.agent.connections.acceptResponse(connectionId) + const connection = await request.agent.connections.acceptResponse(connectionId) return connection.toJSON() } catch (error) { if (error instanceof RecordNotFoundError) { @@ -169,14 +183,16 @@ export class ConnectionController extends Controller { } } + @Security('jwt', ['skip']) @Get('/url/:invitationId') public async getInvitation( + @Request() request: Req, @Path('invitationId') invitationId: string, @Res() notFoundError: TsoaResponse<404, { reason: string }>, // eslint-disable-next-line @typescript-eslint/no-unused-vars @Res() internalServerError: TsoaResponse<500, { message: string }> ) { - const outOfBandRecord = await this.agent.oob.findByCreatedInvitationId(invitationId) + const outOfBandRecord = await request.agent.oob.findByCreatedInvitationId(invitationId) if (!outOfBandRecord || outOfBandRecord.state !== 'await-response') return notFoundError(404, { reason: `connection with invitationId "${invitationId}" not found.` }) diff --git a/src/controllers/credentials/CredentialController.ts b/src/controllers/credentials/CredentialController.ts index e1ae9af7..edc1b97f 100644 --- a/src/controllers/credentials/CredentialController.ts +++ b/src/controllers/credentials/CredentialController.ts @@ -1,17 +1,18 @@ -import type { RestAgentModules } from '../../cliAgent' import type { CredentialExchangeRecordProps, CredentialProtocolVersionType, Routing } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies import { LegacyIndyCredentialFormatService, V1CredentialProtocol } from '@aries-framework/anoncreds' +// eslint-disable-next-line import/no-extraneous-dependencies import { CredentialRepository, CredentialState, - Agent, RecordNotFoundError, HandshakeProtocol, W3cCredentialService, Key, KeyType, } from '@aries-framework/core' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { CredentialExchangeRecordExample, RecordId } from '../examples' @@ -26,23 +27,33 @@ import { CreateOfferOobOptions, } from '../types' -import { Body, Controller, Get, Path, Post, Res, Route, Tags, TsoaResponse, Example, Query, Security } from 'tsoa' +import { + Body, + Controller, + Get, + Path, + Post, + Res, + Route, + Tags, + TsoaResponse, + Example, + Query, + Security, + Request, +} from 'tsoa' @Tags('Credentials') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @Route('/credentials') @injectable() export class CredentialController extends Controller { - private agent: Agent private outOfBandController: OutOfBandController - // private v1CredentialProtocol: V1CredentialProtocol - - public constructor(agent: Agent, outOfBandController: OutOfBandController) { + public constructor(outOfBandController: OutOfBandController) { super() - this.agent = agent this.outOfBandController = outOfBandController - // this.v1CredentialProtocol = v1CredentialProtocol } /** @@ -53,13 +64,14 @@ export class CredentialController extends Controller { @Example([CredentialExchangeRecordExample]) @Get('/') public async getAllCredentials( + @Request() request: Req, @Query('threadId') threadId?: string, @Query('connectionId') connectionId?: string, @Query('state') state?: CredentialState ) { - const credentialRepository = this.agent.dependencyManager.resolve(CredentialRepository) + const credentialRepository = request.agent.dependencyManager.resolve(CredentialRepository) - const credentials = await credentialRepository.findByQuery(this.agent.context, { + const credentials = await credentialRepository.findByQuery(request.agent.context, { connectionId, threadId, state, @@ -69,15 +81,15 @@ export class CredentialController extends Controller { } @Get('/w3c') - public async getAllW3c() { - const w3cCredentialService = await this.agent.dependencyManager.resolve(W3cCredentialService) - return await w3cCredentialService.getAllCredentialRecords(this.agent.context) + public async getAllW3c(@Request() request: Req) { + const w3cCredentialService = await request.agent.dependencyManager.resolve(W3cCredentialService) + return await w3cCredentialService.getAllCredentialRecords(request.agent.context) } @Get('/w3c/:id') - public async getW3cById(@Path('id') id: string) { - const w3cCredentialService = await this.agent.dependencyManager.resolve(W3cCredentialService) - return await w3cCredentialService.getCredentialRecordById(this.agent.context, id) + public async getW3cById(@Path('id') id: string, @Request() request: Req) { + const w3cCredentialService = await request.agent.dependencyManager.resolve(W3cCredentialService) + return await w3cCredentialService.getCredentialRecordById(request.agent.context, id) } /** @@ -89,12 +101,13 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Get('/:credentialRecordId') public async getCredentialById( + @Request() request: Req, @Path('credentialRecordId') credentialRecordId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const credential = await this.agent.credentials.getById(credentialRecordId) + const credential = await request.agent.credentials.getById(credentialRecordId) return credential.toJSON() } catch (error) { if (error instanceof RecordNotFoundError) { @@ -116,12 +129,13 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Post('/propose-credential') public async proposeCredential( + @Request() request: Req, @Body() proposeCredentialOptions: ProposeCredentialOptions, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const credential = await this.agent.credentials.proposeCredential({ + const credential = await request.agent.credentials.proposeCredential({ connectionId: proposeCredentialOptions.connectionId, protocolVersion: 'v1' as CredentialProtocolVersionType<[]>, credentialFormats: proposeCredentialOptions.credentialFormats, @@ -150,13 +164,14 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Post('/accept-proposal') public async acceptProposal( + @Request() request: Req, // @Path('credentialRecordId') credentialRecordId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() acceptCredentialProposal: AcceptCredentialProposalOptions ) { try { - const credential = await this.agent.credentials.acceptProposal({ + const credential = await request.agent.credentials.acceptProposal({ credentialRecordId: acceptCredentialProposal.credentialRecordId, credentialFormats: acceptCredentialProposal.credentialFormats, autoAcceptCredential: acceptCredentialProposal.autoAcceptCredential, @@ -184,11 +199,12 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Post('/create-offer') public async createOffer( + @Request() request: Req, @Body() createOfferOptions: CreateOfferOptions, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const offer = await this.agent.credentials.offerCredential({ + const offer = await request.agent.credentials.offerCredential({ connectionId: createOfferOptions.connectionId, protocolVersion: createOfferOptions.protocolVersion as CredentialProtocolVersionType<[]>, credentialFormats: createOfferOptions.credentialFormats, @@ -202,26 +218,27 @@ export class CredentialController extends Controller { @Post('/create-offer-oob') public async createOfferOob( + @Request() request: Req, @Body() outOfBandOption: CreateOfferOobOptions, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { let routing: Routing - const linkSecretIds = await this.agent.modules.anoncreds.getLinkSecretIds() + const linkSecretIds = await request.agent.modules.anoncreds.getLinkSecretIds() if (linkSecretIds.length === 0) { - await this.agent.modules.anoncreds.createLinkSecret() + await request.agent.modules.anoncreds.createLinkSecret() } if (outOfBandOption?.recipientKey) { routing = { - endpoints: this.agent.config.endpoints, + endpoints: request.agent.config.endpoints, routingKeys: [], recipientKey: Key.fromPublicKeyBase58(outOfBandOption.recipientKey, KeyType.Ed25519), mediatorId: undefined, } } else { - routing = await this.agent.mediationRecipient.getRouting({}) + routing = await request.agent.mediationRecipient.getRouting({}) } - const offerOob = await this.agent.credentials.createOffer({ + const offerOob = await request.agent.credentials.createOffer({ protocolVersion: outOfBandOption.protocolVersion as CredentialProtocolVersionType<[]>, credentialFormats: outOfBandOption.credentialFormats, autoAcceptCredential: outOfBandOption.autoAcceptCredential, @@ -229,7 +246,7 @@ export class CredentialController extends Controller { }) const credentialMessage = offerOob.message - const outOfBandRecord = await this.agent.oob.createInvitation({ + const outOfBandRecord = await request.agent.oob.createInvitation({ label: outOfBandOption.label, handshakeProtocols: [HandshakeProtocol.Connections], messages: [credentialMessage], @@ -239,10 +256,10 @@ export class CredentialController extends Controller { }) return { invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ - domain: this.agent.config.endpoints[0], + domain: request.agent.config.endpoints[0], }), invitation: outOfBandRecord.outOfBandInvitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + useDidSovPrefixWhereAllowed: request.agent.config.useDidSovPrefixWhereAllowed, }), outOfBandRecord: outOfBandRecord.toJSON(), recipientKey: outOfBandOption?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }, @@ -263,16 +280,17 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Post('/accept-offer') public async acceptOffer( + @Request() request: Req, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() acceptCredentialOfferOptions: CredentialOfferOptions ) { try { - const linkSecretIds = await this.agent.modules.anoncreds.getLinkSecretIds() + const linkSecretIds = await request.agent.modules.anoncreds.getLinkSecretIds() if (linkSecretIds.length === 0) { - await this.agent.modules.anoncreds.createLinkSecret() + await request.agent.modules.anoncreds.createLinkSecret() } - const acceptOffer = await this.agent.credentials.acceptOffer({ + const acceptOffer = await request.agent.credentials.acceptOffer({ credentialRecordId: acceptCredentialOfferOptions.credentialRecordId, credentialFormats: acceptCredentialOfferOptions.credentialFormats, autoAcceptCredential: acceptCredentialOfferOptions.autoAcceptCredential, @@ -300,6 +318,7 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Post('/accept-request') public async acceptRequest( + @Request() request: Req, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() acceptCredentialRequestOptions: AcceptCredentialRequestOptions @@ -308,7 +327,7 @@ export class CredentialController extends Controller { const indyCredentialFormat = new LegacyIndyCredentialFormatService() const v1CredentialProtocol = new V1CredentialProtocol({ indyCredentialFormat }) - const credential = await v1CredentialProtocol.acceptRequest(this.agent.context, acceptCredentialRequestOptions) + const credential = await v1CredentialProtocol.acceptRequest(request.agent.context, acceptCredentialRequestOptions) return credential } catch (error) { if (error instanceof RecordNotFoundError) { @@ -330,6 +349,7 @@ export class CredentialController extends Controller { @Example(CredentialExchangeRecordExample) @Post('/accept-credential') public async acceptCredential( + @Request() request: Req, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() acceptCredential: AcceptCredential @@ -338,7 +358,7 @@ export class CredentialController extends Controller { const indyCredentialFormat = new LegacyIndyCredentialFormatService() const v1CredentialProtocol = new V1CredentialProtocol({ indyCredentialFormat }) - const credential = await v1CredentialProtocol.acceptCredential(this.agent.context, acceptCredential) + const credential = await v1CredentialProtocol.acceptCredential(request.agent.context, acceptCredential) return credential } catch (error) { if (error instanceof RecordNotFoundError) { diff --git a/src/controllers/credentials/CredentialDefinitionController.ts b/src/controllers/credentials/CredentialDefinitionController.ts index 582cb41b..8b99941a 100644 --- a/src/controllers/credentials/CredentialDefinitionController.ts +++ b/src/controllers/credentials/CredentialDefinitionController.ts @@ -1,29 +1,27 @@ import type { SchemaId } from '../examples' +// eslint-disable-next-line import/no-extraneous-dependencies import { AnonCredsError, getUnqualifiedCredentialDefinitionId, parseIndyCredentialDefinitionId, } from '@aries-framework/anoncreds' -import { Agent, AriesFrameworkError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { AriesFrameworkError } from '@aries-framework/core' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { CredentialEnum } from '../../enums/enum' import { CredentialDefinitionExample, CredentialDefinitionId } from '../examples' -import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security, Request } from 'tsoa' @Tags('Credential Definitions') @Route('/credential-definitions') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class CredentialDefinitionController extends Controller { - private agent: Agent - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Retrieve credential definition by credential definition id * @@ -33,13 +31,14 @@ export class CredentialDefinitionController extends Controller { @Example(CredentialDefinitionExample) @Get('/:credentialDefinitionId') public async getCredentialDefinitionById( + @Request() request: Req, @Path('credentialDefinitionId') credentialDefinitionId: CredentialDefinitionId, @Res() badRequestError: TsoaResponse<400, { reason: string }>, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - return await this.agent.modules.anoncreds.getCredentialDefinition(credentialDefinitionId) + return await request.agent.modules.anoncreds.getCredentialDefinition(credentialDefinitionId) } catch (error) { if (error instanceof AriesFrameworkError && error.message === 'IndyError(LedgerNotFound): LedgerNotFound') { return notFoundError(404, { @@ -65,6 +64,7 @@ export class CredentialDefinitionController extends Controller { @Example(CredentialDefinitionExample) @Post('/') public async createCredentialDefinition( + @Request() request: Req, @Body() credentialDefinitionRequest: { issuerId: string @@ -85,11 +85,15 @@ export class CredentialDefinitionController extends Controller { type: 'CL', } if (!endorse) { - const { credentialDefinitionState } = await this.agent.modules.anoncreds.registerCredentialDefinition({ + const { credentialDefinitionState } = await request.agent.modules.anoncreds.registerCredentialDefinition({ credentialDefinition: credentialDefinitionPyload, options: {}, }) + if (!credentialDefinitionState?.credentialDefinitionId) { + throw new Error('Credential Definition Id not found') + } + const indyCredDefId = parseIndyCredentialDefinitionId(credentialDefinitionState.credentialDefinitionId) const getCredentialDefinitionId = await getUnqualifiedCredentialDefinitionId( indyCredDefId.namespaceIdentifier, @@ -106,7 +110,7 @@ export class CredentialDefinitionController extends Controller { throw new Error('Please provide the endorser DID') } - const createCredDefTxResult = await this.agent.modules.anoncreds.registerCredentialDefinition({ + const createCredDefTxResult = await request.agent.modules.anoncreds.registerCredentialDefinition({ credentialDefinition: credentialDefinitionPyload, options: { endorserMode: 'external', diff --git a/src/controllers/credentials/SchemaController.ts b/src/controllers/credentials/SchemaController.ts index aea82383..708c76ba 100644 --- a/src/controllers/credentials/SchemaController.ts +++ b/src/controllers/credentials/SchemaController.ts @@ -1,27 +1,23 @@ import type { Version } from '../examples' +// eslint-disable-next-line import/no-extraneous-dependencies import { AnonCredsError, getUnqualifiedSchemaId, parseIndySchemaId } from '@aries-framework/anoncreds' -import { Agent, AriesFrameworkError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { AriesFrameworkError } from '@aries-framework/core' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { CredentialEnum } from '../../enums/enum' import { SchemaId, SchemaExample } from '../examples' -import { Body, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { Body, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security, Request } from 'tsoa' @Tags('Schemas') @Route('/schemas') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class SchemaController { - private agent: Agent - // private anonCredsSchema: AnonCredsApi - - public constructor(agent: Agent) { - this.agent = agent - // this.anonCredsSchema = anonCredsSchema - } - /** * Retrieve schema by schema id * @@ -31,6 +27,7 @@ export class SchemaController { @Example(SchemaExample) @Get('/:schemaId') public async getSchemaById( + @Request() request: Req, @Path('schemaId') schemaId: SchemaId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() forbiddenError: TsoaResponse<403, { reason: string }>, @@ -38,7 +35,7 @@ export class SchemaController { @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - return await this.agent.modules.anoncreds.getSchema(schemaId) + return await request.agent.modules.anoncreds.getSchema(schemaId) } catch (errorMessage) { if ( errorMessage instanceof AnonCredsError && @@ -73,6 +70,7 @@ export class SchemaController { @Example(SchemaExample) @Post('/') public async createSchema( + @Request() request: Req, @Body() schema: { issuerId: string @@ -96,7 +94,7 @@ export class SchemaController { } if (!schema.endorse) { - const { schemaState } = await this.agent.modules.anoncreds.registerSchema({ + const { schemaState } = await request.agent.modules.anoncreds.registerSchema({ schema: schemaPayload, options: { endorserMode: 'internal', @@ -104,6 +102,10 @@ export class SchemaController { }, }) + if (!schemaState.schemaId) { + throw Error('SchemaId not found') + } + const indySchemaId = parseIndySchemaId(schemaState.schemaId) const getSchemaUnqualifiedId = await getUnqualifiedSchemaId( indySchemaId.namespaceIdentifier, @@ -119,7 +121,7 @@ export class SchemaController { throw new Error('Please provide the endorser DID') } - const createSchemaTxResult = await this.agent.modules.anoncreds.registerSchema({ + const createSchemaTxResult = await request.agent.modules.anoncreds.registerSchema({ options: { endorserMode: 'external', endorserDid: schema.endorserDid ? schema.endorserDid : '', diff --git a/src/controllers/did/DidController.ts b/src/controllers/did/DidController.ts index 140dd3c7..5cfb2d38 100644 --- a/src/controllers/did/DidController.ts +++ b/src/controllers/did/DidController.ts @@ -1,16 +1,19 @@ +import type { AgentType } from '../../types/request' import type { DidResolutionResultProps } from '../types' import type { KeyDidCreateOptions } from '@aries-framework/core' +// eslint-disable-next-line import/order import type { PolygonDidCreateOptions } from '@ayanworks/credo-polygon-w3c-module/build/dids' +// eslint-disable-next-line import/no-extraneous-dependencies import { KeyType, TypedArrayEncoder, DidDocumentBuilder, getEd25519VerificationKey2018, - Agent, getBls12381G2Key2020, } from '@aries-framework/core' import axios from 'axios' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { DidMethod, Network, Role } from '../../enums/enum' @@ -18,20 +21,14 @@ import { BCOVRIN_REGISTER_URL, INDICIO_NYM_URL } from '../../utils/util' import { Did, DidRecordExample } from '../examples' import { DidCreate } from '../types' -import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { Body, Controller, Example, Get, Path, Post, Res, Route, Tags, TsoaResponse, Security, Request } from 'tsoa' @Tags('Dids') @Route('/dids') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class DidController extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Resolves did and returns did resolution result * @param did Decentralized Identifier @@ -39,9 +36,9 @@ export class DidController extends Controller { */ @Example(DidRecordExample) @Get('/:did') - public async getDidRecordByDid(@Path('did') did: Did) { - const resolveResult = await this.agent.dids.resolve(did) - const importDid = await this.agent.dids.import({ + public async getDidRecordByDid(@Request() request: Req, @Path('did') did: Did) { + const resolveResult = await request.agent.dids.resolve(did) + const importDid = await request.agent.dids.import({ did, overwrite: true, }) @@ -62,6 +59,7 @@ export class DidController extends Controller { @Post('/write') public async writeDid( + @Request() request: Req, @Body() createDidOptions: DidCreate, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { @@ -75,19 +73,19 @@ export class DidController extends Controller { let result switch (createDidOptions.method) { case DidMethod.Indy: - result = await this.handleIndy(createDidOptions) + result = await this.handleIndy(createDidOptions, request.agent) break case DidMethod.Key: - result = await this.handleKey(createDidOptions) + result = await this.handleKey(createDidOptions, request.agent) break case DidMethod.Web: - result = await this.handleWeb(createDidOptions) + result = await this.handleWeb(createDidOptions, request.agent) break case DidMethod.Polygon: - result = await this.handlePolygon(createDidOptions) + result = await this.handlePolygon(createDidOptions, request.agent) break default: @@ -102,7 +100,7 @@ export class DidController extends Controller { } } - private async handleIndy(createDidOptions: DidCreate) { + private async handleIndy(createDidOptions: DidCreate, agent: AgentType) { let result if (!createDidOptions.keyType) { throw Error('keyType is required') @@ -124,7 +122,8 @@ export class DidController extends Controller { case Network.Bcovrin_Testnet: result = await this.handleBcovrin( createDidOptions, - `did:${createDidOptions.method}:${createDidOptions.network}` + `did:${createDidOptions.method}:${createDidOptions.network}`, + agent ) break @@ -132,7 +131,8 @@ export class DidController extends Controller { case Network.Indicio_Testnet: result = await this.handleIndicio( createDidOptions, - `did:${createDidOptions.method}:${createDidOptions.network}` + `did:${createDidOptions.method}:${createDidOptions.network}`, + agent ) break @@ -142,15 +142,15 @@ export class DidController extends Controller { return result } - private async handleBcovrin(createDidOptions: DidCreate, didMethod: string) { + private async handleBcovrin(createDidOptions: DidCreate, didMethod: string, agent: AgentType) { let didDocument if (!createDidOptions.seed) { throw Error('Seed is required') } if (createDidOptions?.role?.toLowerCase() === Role.Endorser) { if (createDidOptions.did) { - await this.importDid(didMethod, createDidOptions.did, createDidOptions.seed) - const getDid = await this.agent.dids.getCreatedDids({ + await this.importDid(didMethod, createDidOptions.did, createDidOptions.seed, agent) + const getDid = await agent.dids.getCreatedDids({ method: createDidOptions.method, did: `did:${createDidOptions.method}:${createDidOptions.network}:${createDidOptions.did}`, }) @@ -169,8 +169,8 @@ export class DidController extends Controller { seed: createDidOptions.seed, }) const { did } = res?.data || {} - await this.importDid(didMethod, did, createDidOptions.seed) - const didRecord = await this.agent.dids.getCreatedDids({ + await this.importDid(didMethod, did, createDidOptions.seed, agent) + const didRecord = await agent.dids.getCreatedDids({ method: DidMethod.Indy, did: `did:${DidMethod.Indy}:${Network.Bcovrin_Testnet}:${res.data.did}`, }) @@ -188,20 +188,20 @@ export class DidController extends Controller { if (!createDidOptions.endorserDid) { throw new Error('Please provide the endorser DID or role') } - const didCreateTxResult = await this.createEndorserDid(createDidOptions.endorserDid) + const didCreateTxResult = await this.createEndorserDid(createDidOptions.endorserDid, agent) return { did: didCreateTxResult.didState.did, didDocument: didCreateTxResult.didState.didDocument } } } - private async handleIndicio(createDidOptions: DidCreate, didMethod: string) { + private async handleIndicio(createDidOptions: DidCreate, didMethod: string, agent: AgentType) { let didDocument if (!createDidOptions.seed) { throw Error('Seed is required') } if (createDidOptions?.role?.toLowerCase() === Role.Endorser) { if (createDidOptions.did) { - await this.importDid(didMethod, createDidOptions.did, createDidOptions.seed) - const didRecord = await this.agent.dids.getCreatedDids({ + await this.importDid(didMethod, createDidOptions.did, createDidOptions.seed, agent) + const didRecord = await agent.dids.getCreatedDids({ method: createDidOptions.method, did: `did:${createDidOptions.method}:${createDidOptions.network}:${createDidOptions.did}`, }) @@ -215,11 +215,11 @@ export class DidController extends Controller { didDocument: didDocument, } } else { - const key = await this.createIndicioKey(createDidOptions) + const key = await this.createIndicioKey(createDidOptions, agent) const res = await axios.post(INDICIO_NYM_URL, key) if (res.data.statusCode === 200) { - await this.importDid(didMethod, key.did, createDidOptions.seed) - const didRecord = await this.agent.dids.getCreatedDids({ + await this.importDid(didMethod, key.did, createDidOptions.seed, agent) + const didRecord = await agent.dids.getCreatedDids({ method: DidMethod.Indy, did: `${didMethod}:${key.did}`, }) @@ -238,13 +238,13 @@ export class DidController extends Controller { if (!createDidOptions.endorserDid) { throw new Error('Please provide the endorser DID or role') } - const didCreateTxResult = await this.createEndorserDid(createDidOptions.endorserDid) + const didCreateTxResult = await this.createEndorserDid(createDidOptions.endorserDid, agent) return didCreateTxResult } } - private async createEndorserDid(endorserDid: string) { - return this.agent.dids.create({ + private async createEndorserDid(endorserDid: string, agent: AgentType) { + return agent.dids.create({ method: 'indy', options: { endorserMode: 'external', @@ -253,11 +253,11 @@ export class DidController extends Controller { }) } - private async createIndicioKey(createDidOptions: DidCreate) { + private async createIndicioKey(createDidOptions: DidCreate, agent: AgentType) { if (!createDidOptions.seed) { throw Error('Seed is required') } - const key = await this.agent.wallet.createKey({ + const key = await agent.wallet.createKey({ privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), keyType: KeyType.Ed25519, }) @@ -284,8 +284,8 @@ export class DidController extends Controller { return body } - private async importDid(didMethod: string, did: string, seed: string) { - await this.agent.dids.import({ + private async importDid(didMethod: string, did: string, seed: string, agent: AgentType) { + await agent.dids.import({ did: `${didMethod}:${did}`, overwrite: true, privateKeys: [ @@ -297,7 +297,7 @@ export class DidController extends Controller { }) } - public async handleKey(didOptions: DidCreate) { + public async handleKey(didOptions: DidCreate, agent: AgentType) { let did let didResponse let didDocument @@ -313,12 +313,12 @@ export class DidController extends Controller { } if (!didOptions.did) { - await this.agent.wallet.createKey({ + await agent.wallet.createKey({ keyType: didOptions.keyType, seed: TypedArrayEncoder.fromString(didOptions.seed), }) - didResponse = await this.agent.dids.create({ + didResponse = await agent.dids.create({ method: DidMethod.Key, options: { keyType: KeyType.Ed25519, @@ -331,14 +331,14 @@ export class DidController extends Controller { didDocument = didResponse.didState.didDocument } else { did = didOptions.did - const createdDid = await this.agent.dids.getCreatedDids({ + const createdDid = await agent.dids.getCreatedDids({ method: DidMethod.Key, did: didOptions.did, }) didDocument = createdDid[0]?.didDocument } - await this.agent.dids.import({ + await agent.dids.import({ did, overwrite: true, didDocument, @@ -346,7 +346,7 @@ export class DidController extends Controller { return { did: did, didDocument: didDocument } } - public async handleWeb(didOptions: DidCreate) { + public async handleWeb(didOptions: DidCreate, agent: AgentType) { let didDocument: any if (!didOptions.domain) { throw Error('domain is required') @@ -368,7 +368,7 @@ export class DidController extends Controller { const did = `did:${didOptions.method}:${domain}` const keyId = `${did}#key-1` - const key = await this.agent.wallet.createKey({ + const key = await agent.wallet.createKey({ keyType: KeyType.Ed25519, privateKey: TypedArrayEncoder.fromString(didOptions.seed), }) @@ -388,7 +388,7 @@ export class DidController extends Controller { .build() } - await this.agent.dids.import({ + await agent.dids.import({ did, overwrite: true, didDocument, @@ -396,7 +396,7 @@ export class DidController extends Controller { return { did, didDocument } } - public async handlePolygon(createDidOptions: DidCreate) { + public async handlePolygon(createDidOptions: DidCreate, agent: AgentType) { // need to discuss try catch logic const { endpoint, network, privatekey } = createDidOptions if (network !== 'mainnet' && network !== 'testnet') { @@ -406,7 +406,7 @@ export class DidController extends Controller { throw Error('Invalid private key or not supported') } - return this.agent.dids.create({ + return agent.dids.create({ method: 'polygon', options: { network, @@ -419,9 +419,9 @@ export class DidController extends Controller { } @Get('/') - public async getDids(@Res() internalServerError: TsoaResponse<500, { message: string }>) { + public async getDids(@Request() request: Req, @Res() internalServerError: TsoaResponse<500, { message: string }>) { try { - const createdDids = await this.agent.dids.getCreatedDids() + const createdDids = await request.agent.dids.getCreatedDids() return createdDids } catch (error) { return internalServerError(500, { message: `something went wrong: ${error}` }) diff --git a/src/controllers/endorser-transaction/EndorserTransactionController.ts b/src/controllers/endorser-transaction/EndorserTransactionController.ts index aa7a2ebb..c43a287a 100644 --- a/src/controllers/endorser-transaction/EndorserTransactionController.ts +++ b/src/controllers/endorser-transaction/EndorserTransactionController.ts @@ -1,40 +1,40 @@ +import type { AgentType } from '../../types/request' import type { Version } from '../examples' +// eslint-disable-next-line import/order import type { IndyVdrDidCreateOptions } from '@aries-framework/indy-vdr' +// eslint-disable-next-line import/no-extraneous-dependencies import { getUnqualifiedCredentialDefinitionId, getUnqualifiedSchemaId, parseIndyCredentialDefinitionId, parseIndySchemaId, } from '@aries-framework/anoncreds' -import { Agent, AriesFrameworkError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { AriesFrameworkError } from '@aries-framework/core' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { CredentialEnum } from '../../enums/enum' import { DidNymTransaction, EndorserTransaction, WriteTransaction } from '../types' -import { Body, Controller, Post, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { Body, Controller, Post, Res, Route, Tags, TsoaResponse, Security, Request } from 'tsoa' @Tags('EndorserTransaction') @Route('/transactions') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class EndorserTransactionController extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - @Post('/endorse') public async endorserTransaction( + @Request() request: Req, @Body() endorserTransaction: EndorserTransaction, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Res() forbiddenError: TsoaResponse<400, { reason: string }> ) { try { - const signedTransaction = await this.agent.modules.indyVdr.endorseTransaction( + const signedTransaction = await request.agent.modules.indyVdr.endorseTransaction( endorserTransaction.transaction, endorserTransaction.endorserDid ) @@ -54,11 +54,12 @@ export class EndorserTransactionController extends Controller { @Post('/set-endorser-role') public async didNymTransaction( + @Request() request: Req, @Body() didNymTransaction: DidNymTransaction, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const didCreateSubmitResult = await this.agent.dids.create({ + const didCreateSubmitResult = await request.agent.dids.create({ did: didNymTransaction.did, options: { endorserMode: 'external', @@ -76,6 +77,7 @@ export class EndorserTransactionController extends Controller { @Post('/write') public async writeSchemaAndCredDefOnLedger( + @Request() request: Req, @Res() forbiddenError: TsoaResponse<400, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() @@ -85,12 +87,14 @@ export class EndorserTransactionController extends Controller { if (writeTransaction.schema) { const writeSchema = await this.submitSchemaOnLedger( writeTransaction.schema, + request.agent, writeTransaction.endorsedTransaction ) return writeSchema } else if (writeTransaction.credentialDefinition) { const writeCredDef = await this.submitCredDefOnLedger( writeTransaction.credentialDefinition, + request.agent, writeTransaction.endorsedTransaction ) return writeCredDef @@ -116,11 +120,12 @@ export class EndorserTransactionController extends Controller { version: Version attributes: string[] }, + agent: AgentType, endorsedTransaction?: string ) { try { const { issuerId, name, version, attributes } = schema - const { schemaState } = await this.agent.modules.anoncreds.registerSchema({ + const { schemaState } = await agent.modules.anoncreds.registerSchema({ options: { endorserMode: 'external', endorsedTransaction, @@ -133,6 +138,10 @@ export class EndorserTransactionController extends Controller { }, }) + if (!schemaState.schemaId) { + throw Error('SchemaId not found') + } + const indySchemaId = parseIndySchemaId(schemaState.schemaId) const getSchemaUnqualifiedId = await getUnqualifiedSchemaId( indySchemaId.namespaceIdentifier, @@ -156,10 +165,11 @@ export class EndorserTransactionController extends Controller { value: unknown type: string }, + agent: AgentType, endorsedTransaction?: string ) { try { - const { credentialDefinitionState } = await this.agent.modules.anoncreds.registerCredentialDefinition({ + const { credentialDefinitionState } = await agent.modules.anoncreds.registerCredentialDefinition({ credentialDefinition, options: { endorserMode: 'external', @@ -167,6 +177,10 @@ export class EndorserTransactionController extends Controller { }, }) + if (!credentialDefinitionState.credentialDefinitionId) { + throw Error('Credential Definition Id not found') + } + const indyCredDefId = parseIndyCredentialDefinitionId(credentialDefinitionState.credentialDefinitionId) const getCredentialDefinitionId = await getUnqualifiedCredentialDefinitionId( indyCredDefId.namespaceIdentifier, diff --git a/src/controllers/multi-tenancy/MultiTenancyController.ts b/src/controllers/multi-tenancy/MultiTenancyController.ts index 1bf05991..ba51dbd7 100644 --- a/src/controllers/multi-tenancy/MultiTenancyController.ts +++ b/src/controllers/multi-tenancy/MultiTenancyController.ts @@ -1,109 +1,41 @@ -import type { RestAgentModules, RestMultiTenantAgentModules } from '../../cliAgent' -import type { Version } from '../examples' -import type { RecipientKeyOption } from '../types' -import type { - AcceptProofRequestOptions, - ConnectionRecordProps, - CreateOutOfBandInvitationConfig, - CredentialProtocolVersionType, - KeyDidCreateOptions, - OutOfBandRecord, - ProofExchangeRecordProps, - ProofsProtocolVersionType, - Routing, -} from '@aries-framework/core' -import type { IndyVdrDidCreateOptions, IndyVdrDidCreateResult } from '@aries-framework/indy-vdr' -import type { QuestionAnswerRecord, ValidResponse } from '@aries-framework/question-answer' +import type { RestMultiTenantAgentModules } from '../../cliAgent' +import type { Agent } from '@aries-framework/core' import type { TenantRecord } from '@aries-framework/tenants' -import type { TenantAgent } from '@aries-framework/tenants/build/TenantAgent' -import type { PolygonDidCreateOptions } from '@ayanworks/credo-polygon-w3c-module/build/dids' - -import { - getUnqualifiedSchemaId, - getUnqualifiedCredentialDefinitionId, - parseIndyCredentialDefinitionId, - parseIndySchemaId, - AnonCredsError, -} from '@aries-framework/anoncreds' -import { - AcceptCredentialOfferOptions, - Agent, - AriesFrameworkError, - ConnectionRepository, - CredentialRepository, - CredentialState, - DidDocumentBuilder, - DidExchangeState, - HandshakeProtocol, - JsonTransformer, - Key, - KeyType, - OutOfBandInvitation, - RecordNotFoundError, - TypedArrayEncoder, - getBls12381G2Key2020, - getEd25519VerificationKey2018, - injectable, -} from '@aries-framework/core' -import { QuestionAnswerRole, QuestionAnswerState } from '@aries-framework/question-answer' -import axios from 'axios' - -import { CredentialEnum, DidMethod, Network, Role } from '../../enums/enum' -import { BCOVRIN_REGISTER_URL, INDICIO_NYM_URL } from '../../utils/util' -import { SchemaId, CredentialDefinitionId, RecordId, ProofRecordExample, ConnectionRecordExample } from '../examples' -import { - RequestProofOptions, - CreateOfferOptions, - CreateTenantOptions, - DidCreate, - DidNymTransaction, - EndorserTransaction, - ReceiveInvitationByUrlProps, - ReceiveInvitationProps, - WriteTransaction, - CreateProofRequestOobOptions, - CreateOfferOobOptions, -} from '../types' - -import { - Body, - Controller, - Delete, - Get, - Post, - Query, - Res, - Route, - Tags, - TsoaResponse, - Path, - Example, - Security, -} from 'tsoa' + +// eslint-disable-next-line import/no-extraneous-dependencies +import { JsonTransformer, RecordNotFoundError, injectable } from '@aries-framework/core' +import { Request as Req } from 'express' +import jwt from 'jsonwebtoken' + +import { AgentRole } from '../../enums/enum' +import { generateSecretKey } from '../../utils/common.service' +import { CreateTenantOptions } from '../types' + +import { Body, Controller, Delete, Post, Res, Route, Tags, TsoaResponse, Path, Security, Request, Get } from 'tsoa' @Tags('MultiTenancy') @Route('/multi-tenancy') @injectable() export class MultiTenancyController extends Controller { - private readonly agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - //create wallet - @Security('apiKey') + // @Security('apiKey') + @Security('jwt', ['multi-tenant']) @Post('/create-tenant') public async createTenant( + @Request() request: Req, @Body() createTenantOptions: CreateTenantOptions, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { const { config } = createTenantOptions try { - const tenantRecord: TenantRecord = await this.agent.modules.tenants.createTenant({ config }) - return tenantRecord + const agent = request.agent as Agent + const tenantRecord: TenantRecord = await agent.modules.tenants.createTenant({ config }) + // Note: logic to store generate token for tenant using BW's secertKey + // Here no need to change the logic, here only change the logic in 'createToken' + const token = await this.createToken(agent, tenantRecord.id) + const withToken = { token, ...tenantRecord } + return withToken } catch (error) { if (error instanceof RecordNotFoundError) { return notFoundError(404, { @@ -115,1561 +47,1628 @@ export class MultiTenancyController extends Controller { } } - @Security('apiKey') - @Post('/create-did/:tenantId') - public async createDid( - @Body() createDidOptions: DidCreate, + // @Security('apiKey') + @Security('jwt', ['multi-tenant']) + @Get(':tenantId') + public async getTenantById( + @Request() request: Req, @Path('tenantId') tenantId: string, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { - let didRes - try { - if (!createDidOptions.method) { - throw Error('Method is required') - } - - let result - switch (createDidOptions.method) { - case DidMethod.Indy: - result = await this.handleIndy(createDidOptions, tenantId) - break - - case DidMethod.Key: - result = await this.handleKey(createDidOptions, tenantId) - break - - case DidMethod.Web: - result = await this.handleWeb(createDidOptions, tenantId) - break - - case DidMethod.Polygon: - result = await this.handlePolygon(createDidOptions, tenantId) - break - - default: - return internalServerError(500, { message: `Invalid method: ${createDidOptions.method}` }) - } - - didRes = { ...result } - - return didRes + const agent = request.agent as Agent + const getTenant = await agent.modules.tenants.getTenantById(tenantId) + return JsonTransformer.toJSON(getTenant) } catch (error) { if (error instanceof RecordNotFoundError) { return notFoundError(404, { - reason: `Did not created`, + reason: `Tenant with id: ${tenantId} not found.`, }) } - return internalServerError(500, { message: `Something went wrong: ${error}` }) } } - private async handleIndy(createDidOptions: DidCreate, tenantId: string) { - let result - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (!createDidOptions.keyType) { - throw Error('keyType is required') - } - - if (!createDidOptions.seed) { - throw Error('Seed is required') - } - - if (!createDidOptions.network) { - throw Error('For indy method network is required') - } - - if (createDidOptions.keyType !== KeyType.Ed25519) { - throw Error('Only ed25519 key type supported') - } - - if (!Network.Bcovrin_Testnet && !Network.Indicio_Demonet && !Network.Indicio_Testnet) { - throw Error(`Invalid network for 'indy' method: ${createDidOptions.network}`) - } - switch (createDidOptions?.network?.toLowerCase()) { - case Network.Bcovrin_Testnet: - result = await this.handleBcovrin( - createDidOptions, - tenantAgent, - `did:${createDidOptions.method}:${createDidOptions.network}` - ) - break - - case Network.Indicio_Demonet: - case Network.Indicio_Testnet: - result = await this.handleIndicio( - createDidOptions, - tenantAgent, - `did:${createDidOptions.method}:${createDidOptions.network}` - ) - break - - default: - throw new Error(`Invalid network for 'indy' method: ${createDidOptions.network}`) - } - }) - return result - } - - private async handleBcovrin( - createDidOptions: DidCreate, - tenantAgent: TenantAgent, - didMethod: string - ) { - let didDocument - if (!createDidOptions.seed) { - throw Error('Seed is required') - } - if (createDidOptions.did) { - await this.importDid(didMethod, createDidOptions.did, createDidOptions.seed, tenantAgent) - const getDid = await tenantAgent.dids.getCreatedDids({ - method: createDidOptions.method, - did: `did:${createDidOptions.method}:${createDidOptions.network}:${createDidOptions.did}`, - }) - if (getDid.length > 0) { - didDocument = getDid[0].didDocument - } - return { - did: `${didMethod}:${createDidOptions.did}`, - didDocument: didDocument, - } - } else { - if (createDidOptions?.role?.toLowerCase() === Role.Endorser) { - await tenantAgent.wallet.createKey({ - privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), - keyType: KeyType.Ed25519, - }) - - const body = { - role: 'ENDORSER', - alias: 'Alias', - seed: createDidOptions.seed, - } - - const res = await axios.post(BCOVRIN_REGISTER_URL, body) - if (res) { - const { did } = res?.data || {} - await this.importDid(didMethod, did, createDidOptions.seed, tenantAgent) - const didRecord = await tenantAgent.dids.getCreatedDids({ - method: DidMethod.Indy, - did: `did:${DidMethod.Indy}:${Network.Bcovrin_Testnet}:${res.data.did}`, - }) - - if (didRecord.length > 0) { - didDocument = didRecord[0].didDocument - } - - return { - did: `${didMethod}:${res.data.did}`, - didDocument: didDocument, - } - } - } else { - if (!createDidOptions.endorserDid) { - throw Error('endorserDid or role is required') - } - - const didCreateTxResult = (await this.agent.dids.create({ - method: DidMethod.Indy, - options: { - endorserMode: 'external', - endorserDid: createDidOptions.endorserDid ? createDidOptions.endorserDid : '', - }, - })) as IndyVdrDidCreateResult - return { did: didCreateTxResult.didState.did, didDocument: didCreateTxResult.didState.didDocument } - } - } - } - - private async handleIndicio( - createDidOptions: DidCreate, - tenantAgent: TenantAgent, - didMethod: string - ) { - let didDocument - if (!createDidOptions.seed) { - throw Error('Seed is required') - } - - if (createDidOptions.did) { - await this.importDid(didMethod, createDidOptions?.did, createDidOptions.seed, tenantAgent) - const getDid = await tenantAgent.dids.getCreatedDids({ - method: createDidOptions.method, - did: `did:${createDidOptions.method}:${createDidOptions.network}:${createDidOptions.did}`, - }) - if (getDid.length > 0) { - didDocument = getDid[0].didDocument - } - - return { - did: `${didMethod}:${createDidOptions.did}`, - didDocument: didDocument, - } - } else { - if (createDidOptions?.role?.toLowerCase() === Role.Endorser) { - return await this.handleEndorserCreation(createDidOptions, tenantAgent, didMethod) - } else { - return await this.handleIndyDidCreation(createDidOptions, tenantAgent) - } - } - } - - private async handleEndorserCreation( - createDidOptions: DidCreate, - tenantAgent: TenantAgent, - didMethod: string - ) { - let didDocument - if (!createDidOptions.seed) { - throw Error('Seed is required') - } - const key = await tenantAgent.wallet.createKey({ - privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), - keyType: KeyType.Ed25519, - }) - const buffer = TypedArrayEncoder.fromBase58(key.publicKeyBase58) - - const did = TypedArrayEncoder.toBase58(buffer.slice(0, 16)) - - let body - if (createDidOptions.network === Network.Indicio_Testnet) { - body = { - network: 'testnet', - did, - verkey: TypedArrayEncoder.toBase58(buffer), - } - } else if (createDidOptions.network === Network.Indicio_Demonet) { - body = { - network: 'demonet', - did, - verkey: TypedArrayEncoder.toBase58(buffer), - } - } - const res = await axios.post(INDICIO_NYM_URL, body) - if (res.data.statusCode === 200) { - await this.importDid(didMethod, did, createDidOptions.seed, tenantAgent) - const didRecord = await tenantAgent.dids.getCreatedDids({ - method: DidMethod.Indy, - did: `${didMethod}:${body?.did}`, - }) - if (didRecord.length > 0) { - didDocument = didRecord[0].didDocument - } - - return { - did: `${didMethod}:${body?.did}`, - didDocument: didDocument, - } - } - } - - private async handleIndyDidCreation(createDidOptions: DidCreate, tenantAgent: TenantAgent) { - if (!createDidOptions.endorserDid) { - throw Error('endorserDid or role is required') - } - - const didCreateTxResult = await tenantAgent.dids.create({ - method: DidMethod.Indy, - options: { - endorserMode: 'external', - endorserDid: createDidOptions.endorserDid ? createDidOptions.endorserDid : '', - }, - }) - return { didTx: didCreateTxResult.didState.did } - } - - private async handleKey(createDidOptions: DidCreate, tenantId: string) { - let didResponse - let did: string - let didDocument: any - - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (!createDidOptions.seed) { - throw Error('Seed is required') - } - if (!createDidOptions.keyType) { - throw Error('keyType is required') - } - - if (createDidOptions.keyType !== KeyType.Ed25519 && createDidOptions.keyType !== KeyType.Bls12381g2) { - throw Error('Only ed25519 and bls12381g2 key type supported') - } - - if (!createDidOptions.did) { - await tenantAgent.wallet.createKey({ - keyType: createDidOptions.keyType, - seed: TypedArrayEncoder.fromString(createDidOptions.seed), - }) - const didKeyResponse = await tenantAgent.dids.create({ - method: DidMethod.Key, - options: { - keyType: KeyType.Ed25519, - }, - secret: { - privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), - }, - }) - did = `${didKeyResponse.didState.did}` - didDocument = didKeyResponse.didState.didDocument - } else { - did = createDidOptions.did - const createdDid = await tenantAgent.dids.getCreatedDids({ - did: createDidOptions.did, - method: DidMethod.Key, - }) - didDocument = createdDid[0]?.didDocument - } - - await tenantAgent.dids.import({ - did, - overwrite: true, - didDocument, - }) - - didResponse = { - did, - didDocument, - } - }) - return didResponse - } - - private async handleWeb(createDidOptions: DidCreate, tenantId: string) { - let did - let didDocument: any - - if (!createDidOptions.domain) { - throw Error('For web method domain is required') - } - - if (!createDidOptions.keyType) { - throw Error('keyType is required') - } - - if (createDidOptions.keyType !== KeyType.Ed25519 && createDidOptions.keyType !== KeyType.Bls12381g2) { - throw Error('Only ed25519 and bls12381g2 key type supported') - } - - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (!createDidOptions.seed) { - throw Error('Seed is required') - } - - did = `did:${createDidOptions.method}:${createDidOptions.domain}` - const keyId = `${did}#key-1` - const key = await tenantAgent.wallet.createKey({ - keyType: createDidOptions.keyType, - seed: TypedArrayEncoder.fromString(createDidOptions.seed), - }) - if (createDidOptions.keyType === KeyType.Ed25519) { - didDocument = new DidDocumentBuilder(did) - .addContext('https://w3id.org/security/suites/ed25519-2018/v1') - .addVerificationMethod(getEd25519VerificationKey2018({ key, id: keyId, controller: did })) - .addAuthentication(keyId) - .build() - } - if (createDidOptions.keyType === KeyType.Bls12381g2) { - didDocument = new DidDocumentBuilder(did) - .addContext('https://w3id.org/security/bbs/v1') - .addVerificationMethod(getBls12381G2Key2020({ key, id: keyId, controller: did })) - .addAuthentication(keyId) - .build() - } - - await tenantAgent.dids.import({ - did, - overwrite: true, - didDocument, - }) - }) - return { did, didDocument } - } - - public async handlePolygon(createDidOptions: DidCreate, tenantId: string) { - let createDidResponse - let didResponse - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - // need to discuss try catch logic - - const networkDetails = createDidOptions.network - const networkName = networkDetails?.split(':')[1] - - const { endpoint, privatekey } = createDidOptions - if (networkName !== 'mainnet' && networkName !== 'testnet') { - throw Error('Invalid network type') - } - if (!privatekey || typeof privatekey !== 'string' || !privatekey.trim() || privatekey.length !== 64) { - throw Error('Invalid private key or not supported') - } - - createDidResponse = await tenantAgent.dids.create({ - method: DidMethod.Polygon, - options: { - network: networkName, - endpoint, - }, - secret: { - privateKey: TypedArrayEncoder.fromHex(`${privatekey}`), - }, - }) - didResponse = { - did: createDidResponse?.didState?.did, - didDoc: createDidResponse?.didState?.didDocument, - } - }) - return didResponse - } - - private async importDid(didMethod: string, did: string, seed: string, tenantAgent: TenantAgent) { - await tenantAgent.dids.import({ - did: `${didMethod}:${did}`, - overwrite: true, - privateKeys: [ - { - keyType: KeyType.Ed25519, - privateKey: TypedArrayEncoder.fromString(seed), - }, - ], - }) - } - - @Security('apiKey') - @Get('/dids/:tenantId') - public async getDids( - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - try { - let getDids - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - getDids = await tenantAgent.dids.getCreatedDids() - }) - return getDids - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/transactions/set-endorser-role/:tenantId') - public async didNymTransaction( - @Path('tenantId') tenantId: string, - @Body() didNymTransaction: DidNymTransaction, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let didCreateSubmitResult - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - didCreateSubmitResult = await tenantAgent.dids.create({ - did: didNymTransaction.did, - options: { - endorserMode: 'external', - endorsedTransaction: { - nymRequest: didNymTransaction.nymRequest, - }, - }, - }) - await tenantAgent.dids.import({ - did: didNymTransaction.did, - overwrite: true, - }) - }) - - return didCreateSubmitResult - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/transactions/endorse/:tenantId') - public async endorserTransaction( - @Path('tenantId') tenantId: string, - @Body() endorserTransaction: EndorserTransaction, - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Res() forbiddenError: TsoaResponse<400, { reason: string }> - ) { - let signedTransaction - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - signedTransaction = await tenantAgent.modules.indyVdr.endorseTransaction( - endorserTransaction.transaction, - endorserTransaction.endorserDid - ) - }) - - return { signedTransaction } - } catch (error) { - if (error instanceof AriesFrameworkError) { - if (error.message.includes('UnauthorizedClientRequest')) { - return forbiddenError(400, { - reason: 'this action is not allowed.', - }) - } - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Example(ConnectionRecordExample) - @Security('apiKey') - @Get('/connections/:connectionId/:tenantId') - public async getConnectionById( - @Path('tenantId') tenantId: string, - @Path('connectionId') connectionId: RecordId, - @Res() notFoundError: TsoaResponse<404, { reason: string }> - ) { - let connectionRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const connection = await tenantAgent.connections.findById(connectionId) - - if (!connection) - return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) - connectionRecord = connection.toJSON() - }) - - return connectionRecord - } - - @Security('apiKey') - @Post('/create-invitation/:tenantId') - public async createInvitation( - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Path('tenantId') tenantId: string, - @Body() config?: Omit // props removed because of issues with serialization - ) { - let outOfBandRecord: OutOfBandRecord | undefined - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - outOfBandRecord = await tenantAgent.oob.createInvitation(config) - }) - - return { - invitationUrl: outOfBandRecord?.outOfBandInvitation.toUrl({ - domain: this.agent.config.endpoints[0], - }), - invitation: outOfBandRecord?.outOfBandInvitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, - }), - outOfBandRecord: outOfBandRecord?.toJSON(), - } - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/create-legacy-invitation/:tenantId') - public async createLegacyInvitation( - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Path('tenantId') tenantId: string, - @Body() - config?: Omit & RecipientKeyOption // props removed because of issues with serialization - ) { - let getInvitation - try { - let routing: Routing - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (config?.recipientKey) { - routing = { - endpoints: tenantAgent.config.endpoints, - routingKeys: [], - recipientKey: Key.fromPublicKeyBase58(config.recipientKey, KeyType.Ed25519), - mediatorId: undefined, - } - } else { - routing = await tenantAgent.mediationRecipient.getRouting({}) - } - const { outOfBandRecord, invitation } = await tenantAgent.oob.createLegacyInvitation({ ...config, routing }) - getInvitation = { - invitationUrl: invitation.toUrl({ - domain: this.agent.config.endpoints[0], - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, - }), - invitation: invitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, - }), - outOfBandRecord: outOfBandRecord.toJSON(), - ...(config?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }), - } - }) - - return getInvitation - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/receive-invitation/:tenantId') - public async receiveInvitation( - @Body() invitationRequest: ReceiveInvitationProps, - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let receiveInvitationRes - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const { invitation, ...config } = invitationRequest - const invite = new OutOfBandInvitation({ ...invitation, handshakeProtocols: invitation.handshake_protocols }) - const { outOfBandRecord, connectionRecord } = await tenantAgent.oob.receiveInvitation(invite, config) - receiveInvitationRes = { - outOfBandRecord: outOfBandRecord.toJSON(), - connectionRecord: connectionRecord?.toJSON(), - } - }) - - return receiveInvitationRes - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/receive-invitation-url/:tenantId') - public async receiveInvitationFromUrl( - @Body() invitationRequest: ReceiveInvitationByUrlProps, - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let receiveInvitationUrl - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const { invitationUrl, ...config } = invitationRequest - const { outOfBandRecord, connectionRecord } = await tenantAgent.oob.receiveInvitationFromUrl( - invitationUrl, - config - ) - receiveInvitationUrl = { - outOfBandRecord: outOfBandRecord.toJSON(), - connectionRecord: connectionRecord?.toJSON(), - } - }) - - return receiveInvitationUrl - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('/oob/:invitationId/:tenantId') - public async getAllOutOfBandRecords( - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Path('invitationId') invitationId?: string - ) { - let outOfBandRecordsRes - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - let outOfBandRecords - outOfBandRecords = await tenantAgent.oob.getAll() - - if (invitationId) - outOfBandRecords = outOfBandRecords.filter((o: any) => o.outOfBandInvitation.id === invitationId) - outOfBandRecordsRes = outOfBandRecords.map((c: any) => c.toJSON()) - }) - - return outOfBandRecordsRes - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('/connections/:tenantId') - public async getAllConnections( - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Query('outOfBandId') outOfBandId?: string, - @Query('alias') alias?: string, - @Query('state') state?: DidExchangeState, - @Query('myDid') myDid?: string, - @Query('theirDid') theirDid?: string, - @Query('theirLabel') theirLabel?: string - ) { - let connectionRecord - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (outOfBandId) { - connectionRecord = await tenantAgent.connections.findAllByOutOfBandId(outOfBandId) - } else { - const connectionRepository = tenantAgent.dependencyManager.resolve(ConnectionRepository) - - const connections = await connectionRepository.findByQuery(tenantAgent.context, { - alias, - myDid, - theirDid, - theirLabel, - state, - }) - - connectionRecord = connections.map((c: any) => c.toJSON()) - } - }) - return connectionRecord - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Get('/url/:tenantId/:invitationId') - public async getInvitation( - @Path('invitationId') invitationId: string, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }> - ) { - let invitationJson - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const outOfBandRecord = await tenantAgent.oob.findByCreatedInvitationId(invitationId) - - if (!outOfBandRecord || outOfBandRecord.state !== 'await-response') - return notFoundError(404, { reason: `connection with invitationId "${invitationId}" not found.` }) - - invitationJson = outOfBandRecord.outOfBandInvitation.toJSON({ useDidSovPrefixWhereAllowed: true }) - }) - return invitationJson - } - - @Security('apiKey') - @Post('/schema/:tenantId') - public async createSchema( - @Body() - schema: { - issuerId: string - name: string - version: Version - attributes: string[] - endorse?: boolean - endorserDid?: string - }, - @Path('tenantId') tenantId: string, - @Res() forbiddenError: TsoaResponse<400, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let schemaRecord - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (!schema.endorse) { - const { schemaState } = await tenantAgent.modules.anoncreds.registerSchema({ - schema: { - issuerId: schema.issuerId, - name: schema.name, - version: schema.version, - attrNames: schema.attributes, - }, - options: { - endorserMode: 'internal', - endorserDid: schema.issuerId, - }, - }) - - if (!schemaState.schemaId) { - throw Error('SchemaId not found') - } - - const indySchemaId = parseIndySchemaId(schemaState.schemaId) - const getSchemaId = await getUnqualifiedSchemaId( - indySchemaId.namespaceIdentifier, - indySchemaId.schemaName, - indySchemaId.schemaVersion - ) - if (schemaState.state === CredentialEnum.Finished) { - schemaState.schemaId = getSchemaId - } - - schemaRecord = schemaState - } else { - if (!schema.endorserDid) { - throw new Error('Please provide the endorser DID') - } - - const createSchemaTxResult = await tenantAgent.modules.anoncreds.registerSchema({ - options: { - endorserMode: 'external', - endorserDid: schema.endorserDid ? schema.endorserDid : '', - }, - schema: { - attrNames: schema.attributes, - issuerId: schema.issuerId, - name: schema.name, - version: schema.version, - }, - }) - - schemaRecord = createSchemaTxResult - } - }) - - return schemaRecord - } catch (error) { - if (error instanceof AriesFrameworkError) { - if (error.message.includes('UnauthorizedClientRequest')) { - return forbiddenError(400, { - reason: 'this action is not allowed.', - }) - } - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/polygon-wc3/schema/:tenantId') - public async createPolygonW3CSchema( - @Body() - createSchemaRequest: { - did: string - schemaName: string - schema: object - }, - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ): Promise { - try { - let schemaResponse - const { did, schemaName, schema } = createSchemaRequest - if (!did || !schemaName || !schema) { - throw Error('One or more parameters are empty or undefined.') - } - - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - //need to add the return type after adding the scham URL - schemaResponse = await tenantAgent.modules.polygon.createSchema({ - did, - schemaName, - schema, - }) - }) - return schemaResponse - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('polygon-wc3/schema/:did/:schemaId/:tenantId') - public async getPolygonW3CSchemaById( - @Path('tenantId') tenantId: string, - @Path('did') did: string, - @Path('schemaId') schemaId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Res() badRequestError: TsoaResponse<400, { reason: string }>, - @Res() forbiddenError: TsoaResponse<401, { reason: string }> - ): Promise { - if (!tenantId || !did || !schemaId) { - return badRequestError(400, { reason: 'Missing or invalid parameters.' }) - } - - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - return tenantAgent.modules.polygon.getSchemaById(did, schemaId) - }) - } catch (error) { - if (error instanceof AriesFrameworkError) { - if (error.message.includes('UnauthorizedClientRequest')) { - return forbiddenError(401, { - reason: 'this action is not allowed.', - }) - } - } - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/transactions/write/:tenantId') - public async writeSchemaAndCredDefOnLedger( + // @Security('apiKey') + @Security('jwt', ['multi-tenant']) + @Post('/get-token/:tenantId') + public async getTenantToken( + @Request() request: Req, @Path('tenantId') tenantId: string, - @Res() forbiddenError: TsoaResponse<400, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Body() - writeTransaction: WriteTransaction - ) { - try { - if (writeTransaction.schema) { - const writeSchema = await this.submitSchemaOnLedger( - writeTransaction.schema, - writeTransaction.endorsedTransaction, - tenantId - ) - return writeSchema - } else if (writeTransaction.credentialDefinition) { - const writeCredDef = await this.submitCredDefOnLedger( - writeTransaction.credentialDefinition, - writeTransaction.endorsedTransaction, - tenantId - ) - return writeCredDef - } else { - throw new Error('Please provide valid schema or credential-def!') - } - } catch (error) { - if (error instanceof AriesFrameworkError) { - if (error.message.includes('UnauthorizedClientRequest')) { - return forbiddenError(400, { - reason: 'this action is not allowed.', - }) - } - } - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - public async submitSchemaOnLedger( - schema: { - issuerId: string - name: string - version: Version - attributes: string[] - }, - endorsedTransaction: string, - tenantId: string - ) { - let schemaRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const { issuerId, name, version, attributes } = schema - const { schemaState } = await tenantAgent.modules.anoncreds.registerSchema({ - options: { - endorserMode: 'external', - endorsedTransaction, - }, - schema: { - attrNames: attributes, - issuerId: issuerId, - name: name, - version: version, - }, - }) - - if (!schemaState.schemaId) { - throw Error('SchemaId not found') - } - - const indySchemaId = parseIndySchemaId(schemaState.schemaId) - const getSchemaUnqualifiedId = await getUnqualifiedSchemaId( - indySchemaId.namespaceIdentifier, - indySchemaId.schemaName, - indySchemaId.schemaVersion - ) - if (schemaState.state === CredentialEnum.Finished || schemaState.state === CredentialEnum.Action) { - schemaState.schemaId = getSchemaUnqualifiedId - } - schemaRecord = schemaState - }) - return schemaRecord - } - - public async submitCredDefOnLedger( - credentialDefinition: { - schemaId: string - issuerId: string - tag: string - value: unknown - type: string - }, - endorsedTransaction: string, - tenantId: string - ) { - let credentialDefinitionRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const { credentialDefinitionState } = await tenantAgent.modules.anoncreds.registerCredentialDefinition({ - credentialDefinition, - options: { - endorserMode: 'external', - endorsedTransaction: endorsedTransaction, - }, - }) - - if (!credentialDefinitionState.credentialDefinitionId) { - throw Error('Credential Definition Id not found') - } - - const indyCredDefId = parseIndyCredentialDefinitionId(credentialDefinitionState.credentialDefinitionId) - const getCredentialDefinitionId = await getUnqualifiedCredentialDefinitionId( - indyCredDefId.namespaceIdentifier, - indyCredDefId.schemaSeqNo, - indyCredDefId.tag - ) - if ( - credentialDefinitionState.state === CredentialEnum.Finished || - credentialDefinitionState.state === CredentialEnum.Action - ) { - credentialDefinitionState.credentialDefinitionId = getCredentialDefinitionId - } - - credentialDefinitionRecord = credentialDefinitionState - }) - return credentialDefinitionRecord - } - - @Security('apiKey') - @Get('/schema/:schemaId/:tenantId') - public async getSchemaById( - @Path('schemaId') schemaId: SchemaId, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() forbiddenError: TsoaResponse<403, { reason: string }>, - @Res() badRequestError: TsoaResponse<400, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let getSchema - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - getSchema = await tenantAgent.modules.anoncreds.getSchema(schemaId) - }) - - return getSchema - } catch (error) { - if (error instanceof AnonCredsError && error.message === 'IndyError(LedgerNotFound): LedgerNotFound') { - return notFoundError(404, { - reason: `schema definition with schemaId "${schemaId}" not found.`, - }) - } else if (error instanceof AnonCredsError && error.cause instanceof AnonCredsError) { - if ((error.cause.cause, 'LedgerInvalidTransaction')) { - return forbiddenError(403, { - reason: `schema definition with schemaId "${schemaId}" can not be returned.`, - }) - } - if ((error.cause.cause, 'CommonInvalidStructure')) { - return badRequestError(400, { - reason: `schemaId "${schemaId}" has invalid structure.`, - }) - } - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/credential-definition/:tenantId') - public async createCredentialDefinition( - @Body() - credentialDefinitionRequest: { - issuerId: string - schemaId: string - tag: string - endorse?: boolean - endorserDid?: string - }, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let credentialDefinitionRecord - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - credentialDefinitionRequest.endorse = credentialDefinitionRequest.endorse - ? credentialDefinitionRequest.endorse - : false - - if (!credentialDefinitionRequest.endorse) { - const { credentialDefinitionState } = await tenantAgent.modules.anoncreds.registerCredentialDefinition({ - credentialDefinition: { - issuerId: credentialDefinitionRequest.issuerId, - schemaId: credentialDefinitionRequest.schemaId, - tag: credentialDefinitionRequest.tag, - }, - options: {}, - }) - - if (!credentialDefinitionState?.credentialDefinitionId) { - throw new Error('Credential Definition Id not found') - } - const indyCredDefId = parseIndyCredentialDefinitionId(credentialDefinitionState.credentialDefinitionId) - const getCredentialDefinitionId = await getUnqualifiedCredentialDefinitionId( - indyCredDefId.namespaceIdentifier, - indyCredDefId.schemaSeqNo, - indyCredDefId.tag - ) - if (credentialDefinitionState.state === CredentialEnum.Finished) { - credentialDefinitionState.credentialDefinitionId = getCredentialDefinitionId - } - - credentialDefinitionRecord = credentialDefinitionState - } else { - const createCredDefTxResult = await tenantAgent.modules.anoncreds.registerCredentialDefinition({ - credentialDefinition: { - issuerId: credentialDefinitionRequest.issuerId, - tag: credentialDefinitionRequest.tag, - schemaId: credentialDefinitionRequest.schemaId, - type: 'CL', - }, - options: { - endorserMode: 'external', - endorserDid: credentialDefinitionRequest.endorserDid ? credentialDefinitionRequest.endorserDid : '', - }, - }) - - credentialDefinitionRecord = createCredDefTxResult - } - }) - - return credentialDefinitionRecord - } catch (error) { - if (error instanceof notFoundError) { - return notFoundError(404, { - reason: `schema with schemaId "${credentialDefinitionRequest.schemaId}" not found.`, - }) - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('/credential-definition/:credentialDefinitionId/:tenantId') - public async getCredentialDefinitionById( - @Path('credentialDefinitionId') credentialDefinitionId: CredentialDefinitionId, - @Path('tenantId') tenantId: string, - @Res() badRequestError: TsoaResponse<400, { reason: string }>, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { - let getCredDef - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - getCredDef = await tenantAgent.modules.anoncreds.getCredentialDefinition(credentialDefinitionId) - }) - - return getCredDef - } catch (error) { - if (error instanceof AriesFrameworkError && error.message === 'IndyError(LedgerNotFound): LedgerNotFound') { - return notFoundError(404, { - reason: `credential definition with credentialDefinitionId "${credentialDefinitionId}" not found.`, - }) - } else if (error instanceof AnonCredsError && error.cause instanceof AriesFrameworkError) { - if ((error.cause.cause, 'CommonInvalidStructure')) { - return badRequestError(400, { - reason: `credentialDefinitionId "${credentialDefinitionId}" has invalid structure.`, - }) - } - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/credentials/create-offer/:tenantId') - public async createOffer( - @Body() createOfferOptions: CreateOfferOptions, - @Path('tenantId') tenantId: string, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let offer - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - offer = await tenantAgent.credentials.offerCredential({ - connectionId: createOfferOptions.connectionId, - protocolVersion: createOfferOptions.protocolVersion as CredentialProtocolVersionType<[]>, - credentialFormats: createOfferOptions.credentialFormats, - autoAcceptCredential: createOfferOptions.autoAcceptCredential, - }) - }) - - return offer - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/credentials/create-offer-oob/:tenantId') - public async createOfferOob( - @Path('tenantId') tenantId: string, - @Body() createOfferOptions: CreateOfferOobOptions, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let createOfferOobRecord - - try { - let routing: Routing - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const linkSecretIds = await tenantAgent.modules.anoncreds.getLinkSecretIds() - if (linkSecretIds.length === 0) { - await tenantAgent.modules.anoncreds.createLinkSecret() - } - - if (createOfferOptions?.recipientKey) { - routing = { - endpoints: tenantAgent.config.endpoints, - routingKeys: [], - recipientKey: Key.fromPublicKeyBase58(createOfferOptions.recipientKey, KeyType.Ed25519), - mediatorId: undefined, - } - } else { - routing = await tenantAgent.mediationRecipient.getRouting({}) - } - - const offerOob = await tenantAgent.credentials.createOffer({ - protocolVersion: createOfferOptions.protocolVersion as CredentialProtocolVersionType<[]>, - credentialFormats: createOfferOptions.credentialFormats, - autoAcceptCredential: createOfferOptions.autoAcceptCredential, - comment: createOfferOptions.comment, - }) - - const credentialMessage = offerOob.message - const outOfBandRecord = await tenantAgent.oob.createInvitation({ - label: createOfferOptions.label, - handshakeProtocols: [HandshakeProtocol.Connections], - messages: [credentialMessage], - autoAcceptConnection: true, - imageUrl: createOfferOptions?.imageUrl, - goalCode: createOfferOptions?.goalCode, - routing, - }) - - createOfferOobRecord = { - invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ - domain: this.agent.config.endpoints[0], - }), - invitation: outOfBandRecord.outOfBandInvitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, - }), - outOfBandRecord: outOfBandRecord.toJSON(), - outOfBandRecordId: outOfBandRecord.id, - recipientKey: createOfferOptions?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }, - } - }) - return createOfferOobRecord - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/credentials/accept-offer/:tenantId') - public async acceptOffer( - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }>, - @Path('tenantId') tenantId: string, - @Body() acceptCredentialOfferOptions: AcceptCredentialOfferOptions - ) { - let acceptOffer try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const linkSecretIds = await tenantAgent.modules.anoncreds.getLinkSecretIds() - if (linkSecretIds.length === 0) { - await tenantAgent.modules.anoncreds.createLinkSecret() - } - acceptOffer = await tenantAgent.credentials.acceptOffer({ - credentialRecordId: acceptCredentialOfferOptions.credentialRecordId, - credentialFormats: acceptCredentialOfferOptions.credentialFormats, - autoAcceptCredential: acceptCredentialOfferOptions.autoAcceptCredential, - comment: acceptCredentialOfferOptions.comment, - }) + const agent = request.agent as unknown as Agent + let secretKey + await agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + const genericRecord = await tenantAgent.genericRecords.getAll() + const records = genericRecord.find((record) => record?.content?.secretKey !== undefined) + secretKey = records?.content.secretKey as string }) - return acceptOffer - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { - reason: `credential with credential record id "${acceptCredentialOfferOptions.credentialRecordId}" not found.`, - }) - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('/credentials/:credentialRecordId/:tenantId') - public async getCredentialById( - @Path('credentialRecordId') credentialRecordId: RecordId, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let credentialRecord - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const credential = await tenantAgent.credentials.getById(credentialRecordId) - credentialRecord = credential.toJSON() - }) + // Note: logic to store generate token for tenant using BW's secertKey + // const genericRecord = await agent.genericRecords.getAll() + // const records = genericRecord.find((record) => record?.content?.secretKey !== undefined) + // const secretKey = records?.content.secretKey as string - return credentialRecord - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { - reason: `credential with credential record id "${credentialRecordId}" not found.`, - }) + if (!secretKey) { + throw new Error('secretKey does not exist in wallet') } - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('/credentials/:tenantId') - public async getAllCredentials( - @Path('tenantId') tenantId: string, - @Query('threadId') threadId?: string, - @Query('connectionId') connectionId?: string, - @Query('state') state?: CredentialState - ) { - let credentialRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const credentialRepository = tenantAgent.dependencyManager.resolve(CredentialRepository) - const credentials = await credentialRepository.findByQuery(tenantAgent.context, { - connectionId, - threadId, - state, - }) - credentialRecord = credentials.map((c: any) => c.toJSON()) - }) - return credentialRecord - } - - @Security('apiKey') - @Get('/proofs/:tenantId') - public async getAllProofs(@Path('tenantId') tenantId: string, @Query('threadId') threadId?: string) { - let proofRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - let proofs = await tenantAgent.proofs.getAll() - if (threadId) proofs = proofs.filter((p: any) => p.threadId === threadId) - proofRecord = proofs.map((proof: any) => proof.toJSON()) - }) - return proofRecord - } + const token = await this.createToken(agent, tenantId, secretKey) - @Security('apiKey') - @Get('/form-data/:tenantId/:proofRecordId') - @Example(ProofRecordExample) - public async proofFormData( - @Path('proofRecordId') proofRecordId: string, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let proof - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - proof = await tenantAgent.proofs.getFormatData(proofRecordId) - }) - return proof + return { token: token } } catch (error) { if (error instanceof RecordNotFoundError) { return notFoundError(404, { - reason: `proof with proofRecordId "${proofRecordId}" not found.`, + reason: `SecretKey not found`, }) } - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/proofs/request-proof/:tenantId') - @Example(ProofRecordExample) - public async requestProof( - @Body() requestProofOptions: RequestProofOptions, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let proof - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const requestProofPayload = { - connectionId: requestProofOptions.connectionId, - protocolVersion: requestProofOptions.protocolVersion as ProofsProtocolVersionType<[]>, - comment: requestProofOptions.comment, - proofFormats: requestProofOptions.proofFormats, - autoAcceptProof: requestProofOptions.autoAcceptProof, - goalCode: requestProofOptions.goalCode, - parentThreadId: requestProofOptions.parentThreadId, - willConfirm: requestProofOptions.willConfirm, - } - proof = await tenantAgent.proofs.requestProof(requestProofPayload) - }) - - return proof - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/proofs/create-request-oob/:tenantId') - public async createRequest( - @Path('tenantId') tenantId: string, - @Body() createRequestOptions: CreateProofRequestOobOptions, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let oobProofRecord - try { - let routing: Routing - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (createRequestOptions?.recipientKey) { - routing = { - endpoints: tenantAgent.config.endpoints, - routingKeys: [], - recipientKey: Key.fromPublicKeyBase58(createRequestOptions.recipientKey, KeyType.Ed25519), - mediatorId: undefined, - } - } else { - routing = await tenantAgent.mediationRecipient.getRouting({}) - } - const proof = await tenantAgent.proofs.createRequest({ - protocolVersion: createRequestOptions.protocolVersion as ProofsProtocolVersionType<[]>, - proofFormats: createRequestOptions.proofFormats, - goalCode: createRequestOptions.goalCode, - willConfirm: createRequestOptions.willConfirm, - parentThreadId: createRequestOptions.parentThreadId, - autoAcceptProof: createRequestOptions.autoAcceptProof, - comment: createRequestOptions.comment, - }) - - const proofMessage = proof.message - const outOfBandRecord = await tenantAgent.oob.createInvitation({ - label: createRequestOptions.label, - handshakeProtocols: [HandshakeProtocol.Connections], - messages: [proofMessage], - autoAcceptConnection: true, - imageUrl: createRequestOptions?.imageUrl, - routing, - goalCode: createRequestOptions?.goalCode, - }) - - oobProofRecord = { - invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ - domain: this.agent.config.endpoints[0], - }), - invitation: outOfBandRecord.outOfBandInvitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, - }), - outOfBandRecord: outOfBandRecord.toJSON(), - proofRecordThId: proof.proofRecord.threadId, - proofMessageId: proof.message.thread?.threadId - ? proof.message.thread?.threadId - : proof.message.threadId - ? proof.message.thread - : proof.message.id, - recipientKey: createRequestOptions?.recipientKey - ? {} - : { recipientKey: routing.recipientKey.publicKeyBase58 }, - } - }) - - return oobProofRecord - } catch (error) { - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/proofs/:proofRecordId/accept-request/:tenantId') - @Example(ProofRecordExample) - public async acceptRequest( - @Path('tenantId') tenantId: string, - @Path('proofRecordId') proofRecordId: string, - @Body() - request: { - filterByPresentationPreview?: boolean - filterByNonRevocationRequirements?: boolean - comment?: string - }, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let proofRecord - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const requestedCredentials = await tenantAgent.proofs.selectCredentialsForRequest({ - proofRecordId, - }) - - const acceptProofRequest: AcceptProofRequestOptions = { - proofRecordId, - comment: request.comment, - proofFormats: requestedCredentials.proofFormats, - } - - const proof = await tenantAgent.proofs.acceptRequest(acceptProofRequest) - - proofRecord = proof.toJSON() - }) - return proofRecord - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { - reason: `proof with proofRecordId "${proofRecordId}" not found.`, - }) - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Post('/proofs/:proofRecordId/accept-presentation/:tenantId') - @Example(ProofRecordExample) - public async acceptPresentation( - @Path('tenantId') tenantId: string, - @Path('proofRecordId') proofRecordId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let proof - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - proof = await tenantAgent.proofs.acceptPresentation({ proofRecordId }) - }) - - return proof - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { - reason: `proof with proofRecordId "${proofRecordId}" not found.`, - }) - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - @Security('apiKey') - @Get('/proofs/:proofRecordId/:tenantId') - @Example(ProofRecordExample) - public async getProofById( - @Path('tenantId') tenantId: string, - @Path('proofRecordId') proofRecordId: RecordId, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - let proofRecord - try { - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const proof = await tenantAgent.proofs.getById(proofRecordId) - proofRecord = proof.toJSON() - }) - return proofRecord - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { - reason: `proof with proofRecordId "${proofRecordId}" not found.`, - }) - } - - return internalServerError(500, { message: `something went wrong: ${error}` }) + return internalServerError(500, { message: `Something went wrong: ${error}` }) } } - @Security('apiKey') + // @Security('apiKey') + // @Post('/create-did/:tenantId') + // public async createDid( + // @Body() createDidOptions: DidCreate, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let didRes + + // try { + // if (!createDidOptions.method) { + // throw Error('Method is required') + // } + + // let result + // switch (createDidOptions.method) { + // case DidMethod.Indy: + // result = await this.handleIndy(createDidOptions, tenantId) + // break + + // case DidMethod.Key: + // result = await this.handleKey(createDidOptions, tenantId) + // break + + // case DidMethod.Web: + // result = await this.handleWeb(createDidOptions, tenantId) + // break + + // case DidMethod.Polygon: + // result = await this.handlePolygon(createDidOptions, tenantId) + // break + + // default: + // return internalServerError(500, { message: `Invalid method: ${createDidOptions.method}` }) + // } + + // didRes = { ...result } + + // return didRes + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `Did not created`, + // }) + // } + + // return internalServerError(500, { message: `Something went wrong: ${error}` }) + // } + // } + + // private async handleIndy(createDidOptions: DidCreate, tenantId: string) { + // let result + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (!createDidOptions.keyType) { + // throw Error('keyType is required') + // } + + // if (!createDidOptions.seed) { + // throw Error('Seed is required') + // } + + // if (!createDidOptions.network) { + // throw Error('For indy method network is required') + // } + + // if (createDidOptions.keyType !== KeyType.Ed25519) { + // throw Error('Only ed25519 key type supported') + // } + + // if (!Network.Bcovrin_Testnet && !Network.Indicio_Demonet && !Network.Indicio_Testnet) { + // throw Error(`Invalid network for 'indy' method: ${createDidOptions.network}`) + // } + // switch (createDidOptions?.network?.toLowerCase()) { + // case Network.Bcovrin_Testnet: + // result = await this.handleBcovrin( + // createDidOptions, + // tenantAgent, + // `did:${createDidOptions.method}:${createDidOptions.network}` + // ) + // break + + // case Network.Indicio_Demonet: + // case Network.Indicio_Testnet: + // result = await this.handleIndicio( + // createDidOptions, + // tenantAgent, + // `did:${createDidOptions.method}:${createDidOptions.network}` + // ) + // break + + // default: + // throw new Error(`Invalid network for 'indy' method: ${createDidOptions.network}`) + // } + // }) + // return result + // } + + // private async handleBcovrin( + // createDidOptions: DidCreate, + // tenantAgent: TenantAgent, + // didMethod: string + // ) { + // let didDocument + // if (!createDidOptions.seed) { + // throw Error('Seed is required') + // } + // if (createDidOptions.did) { + // await this.importDid(didMethod, createDidOptions.did, createDidOptions.seed, tenantAgent) + // const getDid = await tenantAgent.dids.getCreatedDids({ + // method: createDidOptions.method, + // did: `did:${createDidOptions.method}:${createDidOptions.network}:${createDidOptions.did}`, + // }) + // if (getDid.length > 0) { + // didDocument = getDid[0].didDocument + // } + // return { + // did: `${didMethod}:${createDidOptions.did}`, + // didDocument: didDocument, + // } + // } else { + // if (createDidOptions?.role?.toLowerCase() === Role.Endorser) { + // await tenantAgent.wallet.createKey({ + // privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), + // keyType: KeyType.Ed25519, + // }) + + // const body = { + // role: 'ENDORSER', + // alias: 'Alias', + // seed: createDidOptions.seed, + // } + + // const res = await axios.post(BCOVRIN_REGISTER_URL, body) + // if (res) { + // const { did } = res?.data || {} + // await this.importDid(didMethod, did, createDidOptions.seed, tenantAgent) + // const didRecord = await tenantAgent.dids.getCreatedDids({ + // method: DidMethod.Indy, + // did: `did:${DidMethod.Indy}:${Network.Bcovrin_Testnet}:${res.data.did}`, + // }) + + // if (didRecord.length > 0) { + // didDocument = didRecord[0].didDocument + // } + + // return { + // did: `${didMethod}:${res.data.did}`, + // didDocument: didDocument, + // } + // } + // } else { + // if (!createDidOptions.endorserDid) { + // throw Error('endorserDid or role is required') + // } + + // const didCreateTxResult = (await this.agent.dids.create({ + // method: DidMethod.Indy, + // options: { + // endorserMode: 'external', + // endorserDid: createDidOptions.endorserDid ? createDidOptions.endorserDid : '', + // }, + // })) as IndyVdrDidCreateResult + // return { did: didCreateTxResult.didState.did, didDocument: didCreateTxResult.didState.didDocument } + // } + // } + // } + + // private async handleIndicio( + // createDidOptions: DidCreate, + // tenantAgent: TenantAgent, + // didMethod: string + // ) { + // let didDocument + // if (!createDidOptions.seed) { + // throw Error('Seed is required') + // } + + // if (createDidOptions.did) { + // await this.importDid(didMethod, createDidOptions?.did, createDidOptions.seed, tenantAgent) + // const getDid = await tenantAgent.dids.getCreatedDids({ + // method: createDidOptions.method, + // did: `did:${createDidOptions.method}:${createDidOptions.network}:${createDidOptions.did}`, + // }) + // if (getDid.length > 0) { + // didDocument = getDid[0].didDocument + // } + + // return { + // did: `${didMethod}:${createDidOptions.did}`, + // didDocument: didDocument, + // } + // } else { + // if (createDidOptions?.role?.toLowerCase() === Role.Endorser) { + // return await this.handleEndorserCreation(createDidOptions, tenantAgent, didMethod) + // } else { + // return await this.handleIndyDidCreation(createDidOptions, tenantAgent) + // } + // } + // } + + // private async handleEndorserCreation( + // createDidOptions: DidCreate, + // tenantAgent: TenantAgent, + // didMethod: string + // ) { + // let didDocument + // if (!createDidOptions.seed) { + // throw Error('Seed is required') + // } + // const key = await tenantAgent.wallet.createKey({ + // privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), + // keyType: KeyType.Ed25519, + // }) + // const buffer = TypedArrayEncoder.fromBase58(key.publicKeyBase58) + + // const did = TypedArrayEncoder.toBase58(buffer.slice(0, 16)) + + // let body + // if (createDidOptions.network === Network.Indicio_Testnet) { + // body = { + // network: 'testnet', + // did, + // verkey: TypedArrayEncoder.toBase58(buffer), + // } + // } else if (createDidOptions.network === Network.Indicio_Demonet) { + // body = { + // network: 'demonet', + // did, + // verkey: TypedArrayEncoder.toBase58(buffer), + // } + // } + // const res = await axios.post(INDICIO_NYM_URL, body) + // if (res.data.statusCode === 200) { + // await this.importDid(didMethod, did, createDidOptions.seed, tenantAgent) + // const didRecord = await tenantAgent.dids.getCreatedDids({ + // method: DidMethod.Indy, + // did: `${didMethod}:${body?.did}`, + // }) + // if (didRecord.length > 0) { + // didDocument = didRecord[0].didDocument + // } + + // return { + // did: `${didMethod}:${body?.did}`, + // didDocument: didDocument, + // } + // } + // } + + // private async handleIndyDidCreation(createDidOptions: DidCreate, tenantAgent: TenantAgent) { + // if (!createDidOptions.endorserDid) { + // throw Error('endorserDid or role is required') + // } + + // const didCreateTxResult = await tenantAgent.dids.create({ + // method: DidMethod.Indy, + // options: { + // endorserMode: 'external', + // endorserDid: createDidOptions.endorserDid ? createDidOptions.endorserDid : '', + // }, + // }) + // return { didTx: didCreateTxResult.didState.did } + // } + + // private async handleKey(createDidOptions: DidCreate, tenantId: string) { + // let didResponse + // let did: string + // let didDocument: any + + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (!createDidOptions.seed) { + // throw Error('Seed is required') + // } + // if (!createDidOptions.keyType) { + // throw Error('keyType is required') + // } + + // if (createDidOptions.keyType !== KeyType.Ed25519 && createDidOptions.keyType !== KeyType.Bls12381g2) { + // throw Error('Only ed25519 and bls12381g2 key type supported') + // } + + // if (!createDidOptions.did) { + // await tenantAgent.wallet.createKey({ + // keyType: createDidOptions.keyType, + // seed: TypedArrayEncoder.fromString(createDidOptions.seed), + // }) + // const didKeyResponse = await tenantAgent.dids.create({ + // method: DidMethod.Key, + // options: { + // keyType: KeyType.Ed25519, + // }, + // secret: { + // privateKey: TypedArrayEncoder.fromString(createDidOptions.seed), + // }, + // }) + // did = `${didKeyResponse.didState.did}` + // didDocument = didKeyResponse.didState.didDocument + // } else { + // did = createDidOptions.did + // const createdDid = await tenantAgent.dids.getCreatedDids({ + // did: createDidOptions.did, + // method: DidMethod.Key, + // }) + // didDocument = createdDid[0]?.didDocument + // } + + // await tenantAgent.dids.import({ + // did, + // overwrite: true, + // didDocument, + // }) + + // didResponse = { + // did, + // didDocument, + // } + // }) + // return didResponse + // } + + // private async handleWeb(createDidOptions: DidCreate, tenantId: string) { + // let did + // let didDocument: any + + // if (!createDidOptions.domain) { + // throw Error('For web method domain is required') + // } + + // if (!createDidOptions.keyType) { + // throw Error('keyType is required') + // } + + // if (createDidOptions.keyType !== KeyType.Ed25519 && createDidOptions.keyType !== KeyType.Bls12381g2) { + // throw Error('Only ed25519 and bls12381g2 key type supported') + // } + + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (!createDidOptions.seed) { + // throw Error('Seed is required') + // } + + // did = `did:${createDidOptions.method}:${createDidOptions.domain}` + // const keyId = `${did}#key-1` + // const key = await tenantAgent.wallet.createKey({ + // keyType: createDidOptions.keyType, + // seed: TypedArrayEncoder.fromString(createDidOptions.seed), + // }) + // if (createDidOptions.keyType === KeyType.Ed25519) { + // didDocument = new DidDocumentBuilder(did) + // .addContext('https://w3id.org/security/suites/ed25519-2018/v1') + // .addVerificationMethod(getEd25519VerificationKey2018({ key, id: keyId, controller: did })) + // .addAuthentication(keyId) + // .build() + // } + // if (createDidOptions.keyType === KeyType.Bls12381g2) { + // didDocument = new DidDocumentBuilder(did) + // .addContext('https://w3id.org/security/bbs/v1') + // .addVerificationMethod(getBls12381G2Key2020({ key, id: keyId, controller: did })) + // .addAuthentication(keyId) + // .build() + // } + + // await tenantAgent.dids.import({ + // did, + // overwrite: true, + // didDocument, + // }) + // }) + // return { did, didDocument } + // } + + // public async handlePolygon(createDidOptions: DidCreate, tenantId: string) { + // let createDidResponse + // let didResponse + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // // need to discuss try catch logic + + // const networkDetails = createDidOptions.network + // const networkName = networkDetails?.split(':')[1] + + // const { endpoint, privatekey } = createDidOptions + // if (networkName !== 'mainnet' && networkName !== 'testnet') { + // throw Error('Invalid network type') + // } + // if (!privatekey || typeof privatekey !== 'string' || !privatekey.trim() || privatekey.length !== 64) { + // throw Error('Invalid private key or not supported') + // } + + // createDidResponse = await tenantAgent.dids.create({ + // method: DidMethod.Polygon, + // options: { + // network: networkName, + // endpoint, + // }, + // secret: { + // privateKey: TypedArrayEncoder.fromHex(`${privatekey}`), + // }, + // }) + // didResponse = { + // did: createDidResponse?.didState?.did, + // didDoc: createDidResponse?.didState?.didDocument, + // } + // }) + // return didResponse + // } + + // private async importDid(didMethod: string, did: string, seed: string, tenantAgent: TenantAgent) { + // await tenantAgent.dids.import({ + // did: `${didMethod}:${did}`, + // overwrite: true, + // privateKeys: [ + // { + // keyType: KeyType.Ed25519, + // privateKey: TypedArrayEncoder.fromString(seed), + // }, + // ], + // }) + // } + + // @Security('apiKey') + // @Get('/dids/:tenantId') + // public async getDids( + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // try { + // let getDids + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // getDids = await tenantAgent.dids.getCreatedDids() + // }) + // return getDids + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/transactions/set-endorser-role/:tenantId') + // public async didNymTransaction( + // @Path('tenantId') tenantId: string, + // @Body() didNymTransaction: DidNymTransaction, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let didCreateSubmitResult + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // didCreateSubmitResult = await tenantAgent.dids.create({ + // did: didNymTransaction.did, + // options: { + // endorserMode: 'external', + // endorsedTransaction: { + // nymRequest: didNymTransaction.nymRequest, + // }, + // }, + // }) + // await tenantAgent.dids.import({ + // did: didNymTransaction.did, + // overwrite: true, + // }) + // }) + + // return didCreateSubmitResult + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/transactions/endorse/:tenantId') + // public async endorserTransaction( + // @Path('tenantId') tenantId: string, + // @Body() endorserTransaction: EndorserTransaction, + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Res() forbiddenError: TsoaResponse<400, { reason: string }> + // ) { + // let signedTransaction + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // signedTransaction = await tenantAgent.modules.indyVdr.endorseTransaction( + // endorserTransaction.transaction, + // endorserTransaction.endorserDid + // ) + // }) + + // return { signedTransaction } + // } catch (error) { + // if (error instanceof AriesFrameworkError) { + // if (error.message.includes('UnauthorizedClientRequest')) { + // return forbiddenError(400, { + // reason: 'this action is not allowed.', + // }) + // } + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Example(ConnectionRecordExample) + // @Security('apiKey') + // @Get('/connections/:connectionId/:tenantId') + // public async getConnectionById( + // @Path('tenantId') tenantId: string, + // @Path('connectionId') connectionId: RecordId, + // @Res() notFoundError: TsoaResponse<404, { reason: string }> + // ) { + // let connectionRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const connection = await tenantAgent.connections.findById(connectionId) + + // if (!connection) + // return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) + // connectionRecord = connection.toJSON() + // }) + + // return connectionRecord + // } + + // @Security('apiKey') + // @Post('/create-invitation/:tenantId') + // public async createInvitation( + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Path('tenantId') tenantId: string, + // @Body() config?: Omit // props removed because of issues with serialization + // ) { + // let outOfBandRecord: OutOfBandRecord | undefined + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // outOfBandRecord = await tenantAgent.oob.createInvitation(config) + // }) + + // return { + // invitationUrl: outOfBandRecord?.outOfBandInvitation.toUrl({ + // domain: this.agent.config.endpoints[0], + // }), + // invitation: outOfBandRecord?.outOfBandInvitation.toJSON({ + // useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + // }), + // outOfBandRecord: outOfBandRecord?.toJSON(), + // } + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/create-legacy-invitation/:tenantId') + // public async createLegacyInvitation( + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Path('tenantId') tenantId: string, + // @Body() + // config?: Omit & RecipientKeyOption // props removed because of issues with serialization + // ) { + // let getInvitation + // try { + // let routing: Routing + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (config?.recipientKey) { + // routing = { + // endpoints: tenantAgent.config.endpoints, + // routingKeys: [], + // recipientKey: Key.fromPublicKeyBase58(config.recipientKey, KeyType.Ed25519), + // mediatorId: undefined, + // } + // } else { + // routing = await tenantAgent.mediationRecipient.getRouting({}) + // } + // const { outOfBandRecord, invitation } = await tenantAgent.oob.createLegacyInvitation({ ...config, routing }) + // getInvitation = { + // invitationUrl: invitation.toUrl({ + // domain: this.agent.config.endpoints[0], + // useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + // }), + // invitation: invitation.toJSON({ + // useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + // }), + // outOfBandRecord: outOfBandRecord.toJSON(), + // ...(config?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }), + // } + // }) + + // return getInvitation + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/receive-invitation/:tenantId') + // public async receiveInvitation( + // @Body() invitationRequest: ReceiveInvitationProps, + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let receiveInvitationRes + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const { invitation, ...config } = invitationRequest + // const invite = new OutOfBandInvitation({ ...invitation, handshakeProtocols: invitation.handshake_protocols }) + // const { outOfBandRecord, connectionRecord } = await tenantAgent.oob.receiveInvitation(invite, config) + // receiveInvitationRes = { + // outOfBandRecord: outOfBandRecord.toJSON(), + // connectionRecord: connectionRecord?.toJSON(), + // } + // }) + + // return receiveInvitationRes + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/receive-invitation-url/:tenantId') + // public async receiveInvitationFromUrl( + // @Body() invitationRequest: ReceiveInvitationByUrlProps, + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let receiveInvitationUrl + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const { invitationUrl, ...config } = invitationRequest + // const { outOfBandRecord, connectionRecord } = await tenantAgent.oob.receiveInvitationFromUrl( + // invitationUrl, + // config + // ) + // receiveInvitationUrl = { + // outOfBandRecord: outOfBandRecord.toJSON(), + // connectionRecord: connectionRecord?.toJSON(), + // } + // }) + + // return receiveInvitationUrl + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('/oob/:invitationId/:tenantId') + // public async getAllOutOfBandRecords( + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Path('invitationId') invitationId?: string + // ) { + // let outOfBandRecordsRes + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // let outOfBandRecords + // outOfBandRecords = await tenantAgent.oob.getAll() + + // if (invitationId) + // outOfBandRecords = outOfBandRecords.filter((o: any) => o.outOfBandInvitation.id === invitationId) + // outOfBandRecordsRes = outOfBandRecords.map((c: any) => c.toJSON()) + // }) + + // return outOfBandRecordsRes + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('/connections/:tenantId') + // public async getAllConnections( + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Query('outOfBandId') outOfBandId?: string, + // @Query('alias') alias?: string, + // @Query('state') state?: DidExchangeState, + // @Query('myDid') myDid?: string, + // @Query('theirDid') theirDid?: string, + // @Query('theirLabel') theirLabel?: string + // ) { + // let connectionRecord + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (outOfBandId) { + // connectionRecord = await tenantAgent.connections.findAllByOutOfBandId(outOfBandId) + // } else { + // const connectionRepository = tenantAgent.dependencyManager.resolve(ConnectionRepository) + + // const connections = await connectionRepository.findByQuery(tenantAgent.context, { + // alias, + // myDid, + // theirDid, + // theirLabel, + // state, + // }) + + // connectionRecord = connections.map((c: any) => c.toJSON()) + // } + // }) + // return connectionRecord + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Get('/url/:tenantId/:invitationId') + // public async getInvitation( + // @Path('invitationId') invitationId: string, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }> + // ) { + // let invitationJson + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const outOfBandRecord = await tenantAgent.oob.findByCreatedInvitationId(invitationId) + + // if (!outOfBandRecord || outOfBandRecord.state !== 'await-response') + // return notFoundError(404, { reason: `connection with invitationId "${invitationId}" not found.` }) + + // invitationJson = outOfBandRecord.outOfBandInvitation.toJSON({ useDidSovPrefixWhereAllowed: true }) + // }) + // return invitationJson + // } + + // @Security('apiKey') + // @Post('/schema/:tenantId') + // public async createSchema( + // @Body() + // schema: { + // issuerId: string + // name: string + // version: Version + // attributes: string[] + // endorse?: boolean + // endorserDid?: string + // }, + // @Path('tenantId') tenantId: string, + // @Res() forbiddenError: TsoaResponse<400, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let schemaRecord + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (!schema.endorse) { + // const { schemaState } = await tenantAgent.modules.anoncreds.registerSchema({ + // schema: { + // issuerId: schema.issuerId, + // name: schema.name, + // version: schema.version, + // attrNames: schema.attributes, + // }, + // options: { + // endorserMode: 'internal', + // endorserDid: schema.issuerId, + // }, + // }) + + // if (!schemaState.schemaId) { + // throw Error('SchemaId not found') + // } + + // const indySchemaId = parseIndySchemaId(schemaState.schemaId) + // const getSchemaId = await getUnqualifiedSchemaId( + // indySchemaId.namespaceIdentifier, + // indySchemaId.schemaName, + // indySchemaId.schemaVersion + // ) + // if (schemaState.state === CredentialEnum.Finished) { + // schemaState.schemaId = getSchemaId + // } + + // schemaRecord = schemaState + // } else { + // if (!schema.endorserDid) { + // throw new Error('Please provide the endorser DID') + // } + + // const createSchemaTxResult = await tenantAgent.modules.anoncreds.registerSchema({ + // options: { + // endorserMode: 'external', + // endorserDid: schema.endorserDid ? schema.endorserDid : '', + // }, + // schema: { + // attrNames: schema.attributes, + // issuerId: schema.issuerId, + // name: schema.name, + // version: schema.version, + // }, + // }) + + // schemaRecord = createSchemaTxResult + // } + // }) + + // return schemaRecord + // } catch (error) { + // if (error instanceof AriesFrameworkError) { + // if (error.message.includes('UnauthorizedClientRequest')) { + // return forbiddenError(400, { + // reason: 'this action is not allowed.', + // }) + // } + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/polygon-wc3/schema/:tenantId') + // public async createPolygonW3CSchema( + // @Body() + // createSchemaRequest: { + // did: string + // schemaName: string + // schema: object + // }, + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ): Promise { + // try { + // let schemaResponse + // const { did, schemaName, schema } = createSchemaRequest + // if (!did || !schemaName || !schema) { + // throw Error('One or more parameters are empty or undefined.') + // } + + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // //need to add the return type after adding the scham URL + // schemaResponse = await tenantAgent.modules.polygon.createSchema({ + // did, + // schemaName, + // schema, + // }) + // }) + // return schemaResponse + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('polygon-wc3/schema/:did/:schemaId/:tenantId') + // public async getPolygonW3CSchemaById( + // @Path('tenantId') tenantId: string, + // @Path('did') did: string, + // @Path('schemaId') schemaId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Res() badRequestError: TsoaResponse<400, { reason: string }>, + // @Res() forbiddenError: TsoaResponse<401, { reason: string }> + // ): Promise { + // if (!tenantId || !did || !schemaId) { + // return badRequestError(400, { reason: 'Missing or invalid parameters.' }) + // } + + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // return tenantAgent.modules.polygon.getSchemaById(did, schemaId) + // }) + // } catch (error) { + // if (error instanceof AriesFrameworkError) { + // if (error.message.includes('UnauthorizedClientRequest')) { + // return forbiddenError(401, { + // reason: 'this action is not allowed.', + // }) + // } + // } + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/transactions/write/:tenantId') + // public async writeSchemaAndCredDefOnLedger( + // @Path('tenantId') tenantId: string, + // @Res() forbiddenError: TsoaResponse<400, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Body() + // writeTransaction: WriteTransaction + // ) { + // try { + // if (writeTransaction.schema) { + // const writeSchema = await this.submitSchemaOnLedger( + // writeTransaction.schema, + // writeTransaction.endorsedTransaction, + // tenantId + // ) + // return writeSchema + // } else if (writeTransaction.credentialDefinition) { + // const writeCredDef = await this.submitCredDefOnLedger( + // writeTransaction.credentialDefinition, + // writeTransaction.endorsedTransaction, + // tenantId + // ) + // return writeCredDef + // } else { + // throw new Error('Please provide valid schema or credential-def!') + // } + // } catch (error) { + // if (error instanceof AriesFrameworkError) { + // if (error.message.includes('UnauthorizedClientRequest')) { + // return forbiddenError(400, { + // reason: 'this action is not allowed.', + // }) + // } + // } + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // public async submitSchemaOnLedger( + // schema: { + // issuerId: string + // name: string + // version: Version + // attributes: string[] + // }, + // endorsedTransaction: string, + // tenantId: string + // ) { + // let schemaRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const { issuerId, name, version, attributes } = schema + // const { schemaState } = await tenantAgent.modules.anoncreds.registerSchema({ + // options: { + // endorserMode: 'external', + // endorsedTransaction, + // }, + // schema: { + // attrNames: attributes, + // issuerId: issuerId, + // name: name, + // version: version, + // }, + // }) + + // if (!schemaState.schemaId) { + // throw Error('SchemaId not found') + // } + + // const indySchemaId = parseIndySchemaId(schemaState.schemaId) + // const getSchemaUnqualifiedId = await getUnqualifiedSchemaId( + // indySchemaId.namespaceIdentifier, + // indySchemaId.schemaName, + // indySchemaId.schemaVersion + // ) + // if (schemaState.state === CredentialEnum.Finished || schemaState.state === CredentialEnum.Action) { + // schemaState.schemaId = getSchemaUnqualifiedId + // } + // schemaRecord = schemaState + // }) + // return schemaRecord + // } + + // public async submitCredDefOnLedger( + // credentialDefinition: { + // schemaId: string + // issuerId: string + // tag: string + // value: unknown + // type: string + // }, + // endorsedTransaction: string, + // tenantId: string + // ) { + // let credentialDefinitionRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const { credentialDefinitionState } = await tenantAgent.modules.anoncreds.registerCredentialDefinition({ + // credentialDefinition, + // options: { + // endorserMode: 'external', + // endorsedTransaction: endorsedTransaction, + // }, + // }) + + // if (!credentialDefinitionState.credentialDefinitionId) { + // throw Error('Credential Definition Id not found') + // } + + // const indyCredDefId = parseIndyCredentialDefinitionId(credentialDefinitionState.credentialDefinitionId) + // const getCredentialDefinitionId = await getUnqualifiedCredentialDefinitionId( + // indyCredDefId.namespaceIdentifier, + // indyCredDefId.schemaSeqNo, + // indyCredDefId.tag + // ) + // if ( + // credentialDefinitionState.state === CredentialEnum.Finished || + // credentialDefinitionState.state === CredentialEnum.Action + // ) { + // credentialDefinitionState.credentialDefinitionId = getCredentialDefinitionId + // } + + // credentialDefinitionRecord = credentialDefinitionState + // }) + // return credentialDefinitionRecord + // } + + // @Security('apiKey') + // @Get('/schema/:schemaId/:tenantId') + // public async getSchemaById( + // @Path('schemaId') schemaId: SchemaId, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() forbiddenError: TsoaResponse<403, { reason: string }>, + // @Res() badRequestError: TsoaResponse<400, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let getSchema + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // getSchema = await tenantAgent.modules.anoncreds.getSchema(schemaId) + // }) + + // return getSchema + // } catch (error) { + // if (error instanceof AnonCredsError && error.message === 'IndyError(LedgerNotFound): LedgerNotFound') { + // return notFoundError(404, { + // reason: `schema definition with schemaId "${schemaId}" not found.`, + // }) + // } else if (error instanceof AnonCredsError && error.cause instanceof AnonCredsError) { + // if ((error.cause.cause, 'LedgerInvalidTransaction')) { + // return forbiddenError(403, { + // reason: `schema definition with schemaId "${schemaId}" can not be returned.`, + // }) + // } + // if ((error.cause.cause, 'CommonInvalidStructure')) { + // return badRequestError(400, { + // reason: `schemaId "${schemaId}" has invalid structure.`, + // }) + // } + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/credential-definition/:tenantId') + // public async createCredentialDefinition( + // @Body() + // credentialDefinitionRequest: { + // issuerId: string + // schemaId: string + // tag: string + // endorse?: boolean + // endorserDid?: string + // }, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let credentialDefinitionRecord + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // credentialDefinitionRequest.endorse = credentialDefinitionRequest.endorse + // ? credentialDefinitionRequest.endorse + // : false + + // if (!credentialDefinitionRequest.endorse) { + // const { credentialDefinitionState } = await tenantAgent.modules.anoncreds.registerCredentialDefinition({ + // credentialDefinition: { + // issuerId: credentialDefinitionRequest.issuerId, + // schemaId: credentialDefinitionRequest.schemaId, + // tag: credentialDefinitionRequest.tag, + // }, + // options: {}, + // }) + + // if (!credentialDefinitionState?.credentialDefinitionId) { + // throw new Error('Credential Definition Id not found') + // } + // const indyCredDefId = parseIndyCredentialDefinitionId(credentialDefinitionState.credentialDefinitionId) + // const getCredentialDefinitionId = await getUnqualifiedCredentialDefinitionId( + // indyCredDefId.namespaceIdentifier, + // indyCredDefId.schemaSeqNo, + // indyCredDefId.tag + // ) + // if (credentialDefinitionState.state === CredentialEnum.Finished) { + // credentialDefinitionState.credentialDefinitionId = getCredentialDefinitionId + // } + + // credentialDefinitionRecord = credentialDefinitionState + // } else { + // const createCredDefTxResult = await tenantAgent.modules.anoncreds.registerCredentialDefinition({ + // credentialDefinition: { + // issuerId: credentialDefinitionRequest.issuerId, + // tag: credentialDefinitionRequest.tag, + // schemaId: credentialDefinitionRequest.schemaId, + // type: 'CL', + // }, + // options: { + // endorserMode: 'external', + // endorserDid: credentialDefinitionRequest.endorserDid ? credentialDefinitionRequest.endorserDid : '', + // }, + // }) + + // credentialDefinitionRecord = createCredDefTxResult + // } + // }) + + // return credentialDefinitionRecord + // } catch (error) { + // if (error instanceof notFoundError) { + // return notFoundError(404, { + // reason: `schema with schemaId "${credentialDefinitionRequest.schemaId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('/credential-definition/:credentialDefinitionId/:tenantId') + // public async getCredentialDefinitionById( + // @Path('credentialDefinitionId') credentialDefinitionId: CredentialDefinitionId, + // @Path('tenantId') tenantId: string, + // @Res() badRequestError: TsoaResponse<400, { reason: string }>, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let getCredDef + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // getCredDef = await tenantAgent.modules.anoncreds.getCredentialDefinition(credentialDefinitionId) + // }) + + // return getCredDef + // } catch (error) { + // if (error instanceof AriesFrameworkError && error.message === 'IndyError(LedgerNotFound): LedgerNotFound') { + // return notFoundError(404, { + // reason: `credential definition with credentialDefinitionId "${credentialDefinitionId}" not found.`, + // }) + // } else if (error instanceof AnonCredsError && error.cause instanceof AriesFrameworkError) { + // if ((error.cause.cause, 'CommonInvalidStructure')) { + // return badRequestError(400, { + // reason: `credentialDefinitionId "${credentialDefinitionId}" has invalid structure.`, + // }) + // } + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/credentials/create-offer/:tenantId') + // public async createOffer( + // @Body() createOfferOptions: CreateOfferOptions, + // @Path('tenantId') tenantId: string, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let offer + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // offer = await tenantAgent.credentials.offerCredential({ + // connectionId: createOfferOptions.connectionId, + // protocolVersion: createOfferOptions.protocolVersion as CredentialProtocolVersionType<[]>, + // credentialFormats: createOfferOptions.credentialFormats, + // autoAcceptCredential: createOfferOptions.autoAcceptCredential, + // }) + // }) + + // return offer + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/credentials/create-offer-oob/:tenantId') + // public async createOfferOob( + // @Path('tenantId') tenantId: string, + // @Body() createOfferOptions: CreateOfferOobOptions, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let createOfferOobRecord + + // try { + // let routing: Routing + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const linkSecretIds = await tenantAgent.modules.anoncreds.getLinkSecretIds() + // if (linkSecretIds.length === 0) { + // await tenantAgent.modules.anoncreds.createLinkSecret() + // } + + // if (createOfferOptions?.recipientKey) { + // routing = { + // endpoints: tenantAgent.config.endpoints, + // routingKeys: [], + // recipientKey: Key.fromPublicKeyBase58(createOfferOptions.recipientKey, KeyType.Ed25519), + // mediatorId: undefined, + // } + // } else { + // routing = await tenantAgent.mediationRecipient.getRouting({}) + // } + + // const offerOob = await tenantAgent.credentials.createOffer({ + // protocolVersion: createOfferOptions.protocolVersion as CredentialProtocolVersionType<[]>, + // credentialFormats: createOfferOptions.credentialFormats, + // autoAcceptCredential: createOfferOptions.autoAcceptCredential, + // comment: createOfferOptions.comment, + // }) + + // const credentialMessage = offerOob.message + // const outOfBandRecord = await tenantAgent.oob.createInvitation({ + // label: createOfferOptions.label, + // handshakeProtocols: [HandshakeProtocol.Connections], + // messages: [credentialMessage], + // autoAcceptConnection: true, + // imageUrl: createOfferOptions?.imageUrl, + // goalCode: createOfferOptions?.goalCode, + // routing, + // }) + + // createOfferOobRecord = { + // invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ + // domain: this.agent.config.endpoints[0], + // }), + // invitation: outOfBandRecord.outOfBandInvitation.toJSON({ + // useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + // }), + // outOfBandRecord: outOfBandRecord.toJSON(), + // outOfBandRecordId: outOfBandRecord.id, + // recipientKey: createOfferOptions?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }, + // } + // }) + // return createOfferOobRecord + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/credentials/accept-offer/:tenantId') + // public async acceptOffer( + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }>, + // @Path('tenantId') tenantId: string, + // @Body() acceptCredentialOfferOptions: AcceptCredentialOfferOptions + // ) { + // let acceptOffer + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const linkSecretIds = await tenantAgent.modules.anoncreds.getLinkSecretIds() + // if (linkSecretIds.length === 0) { + // await tenantAgent.modules.anoncreds.createLinkSecret() + // } + // acceptOffer = await tenantAgent.credentials.acceptOffer({ + // credentialRecordId: acceptCredentialOfferOptions.credentialRecordId, + // credentialFormats: acceptCredentialOfferOptions.credentialFormats, + // autoAcceptCredential: acceptCredentialOfferOptions.autoAcceptCredential, + // comment: acceptCredentialOfferOptions.comment, + // }) + // }) + + // return acceptOffer + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `credential with credential record id "${acceptCredentialOfferOptions.credentialRecordId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('/credentials/:credentialRecordId/:tenantId') + // public async getCredentialById( + // @Path('credentialRecordId') credentialRecordId: RecordId, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let credentialRecord + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const credential = await tenantAgent.credentials.getById(credentialRecordId) + // credentialRecord = credential.toJSON() + // }) + + // return credentialRecord + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `credential with credential record id "${credentialRecordId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('/credentials/:tenantId') + // public async getAllCredentials( + // @Path('tenantId') tenantId: string, + // @Query('threadId') threadId?: string, + // @Query('connectionId') connectionId?: string, + // @Query('state') state?: CredentialState + // ) { + // let credentialRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const credentialRepository = tenantAgent.dependencyManager.resolve(CredentialRepository) + // const credentials = await credentialRepository.findByQuery(tenantAgent.context, { + // connectionId, + // threadId, + // state, + // }) + // credentialRecord = credentials.map((c: any) => c.toJSON()) + // }) + // return credentialRecord + // } + + // @Security('apiKey') + // @Get('/proofs/:tenantId') + // public async getAllProofs(@Path('tenantId') tenantId: string, @Query('threadId') threadId?: string) { + // let proofRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // let proofs = await tenantAgent.proofs.getAll() + // if (threadId) proofs = proofs.filter((p: any) => p.threadId === threadId) + // proofRecord = proofs.map((proof: any) => proof.toJSON()) + // }) + // return proofRecord + // } + + // @Security('apiKey') + // @Get('/form-data/:tenantId/:proofRecordId') + // @Example(ProofRecordExample) + // public async proofFormData( + // @Path('proofRecordId') proofRecordId: string, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let proof + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // proof = await tenantAgent.proofs.getFormatData(proofRecordId) + // }) + // return proof + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `proof with proofRecordId "${proofRecordId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/proofs/request-proof/:tenantId') + // @Example(ProofRecordExample) + // public async requestProof( + // @Body() requestProofOptions: RequestProofOptions, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let proof + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const requestProofPayload = { + // connectionId: requestProofOptions.connectionId, + // protocolVersion: requestProofOptions.protocolVersion as ProofsProtocolVersionType<[]>, + // comment: requestProofOptions.comment, + // proofFormats: requestProofOptions.proofFormats, + // autoAcceptProof: requestProofOptions.autoAcceptProof, + // goalCode: requestProofOptions.goalCode, + // parentThreadId: requestProofOptions.parentThreadId, + // willConfirm: requestProofOptions.willConfirm, + // } + // proof = await tenantAgent.proofs.requestProof(requestProofPayload) + // }) + + // return proof + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/proofs/create-request-oob/:tenantId') + // public async createRequest( + // @Path('tenantId') tenantId: string, + // @Body() createRequestOptions: CreateProofRequestOobOptions, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let oobProofRecord + // try { + // let routing: Routing + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (createRequestOptions?.recipientKey) { + // routing = { + // endpoints: tenantAgent.config.endpoints, + // routingKeys: [], + // recipientKey: Key.fromPublicKeyBase58(createRequestOptions.recipientKey, KeyType.Ed25519), + // mediatorId: undefined, + // } + // } else { + // routing = await tenantAgent.mediationRecipient.getRouting({}) + // } + // const proof = await tenantAgent.proofs.createRequest({ + // protocolVersion: createRequestOptions.protocolVersion as ProofsProtocolVersionType<[]>, + // proofFormats: createRequestOptions.proofFormats, + // goalCode: createRequestOptions.goalCode, + // willConfirm: createRequestOptions.willConfirm, + // parentThreadId: createRequestOptions.parentThreadId, + // autoAcceptProof: createRequestOptions.autoAcceptProof, + // comment: createRequestOptions.comment, + // }) + + // const proofMessage = proof.message + // const outOfBandRecord = await tenantAgent.oob.createInvitation({ + // label: createRequestOptions.label, + // handshakeProtocols: [HandshakeProtocol.Connections], + // messages: [proofMessage], + // autoAcceptConnection: true, + // imageUrl: createRequestOptions?.imageUrl, + // routing, + // goalCode: createRequestOptions?.goalCode, + // }) + + // oobProofRecord = { + // invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ + // domain: this.agent.config.endpoints[0], + // }), + // invitation: outOfBandRecord.outOfBandInvitation.toJSON({ + // useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + // }), + // outOfBandRecord: outOfBandRecord.toJSON(), + // proofRecordThId: proof.proofRecord.threadId, + // proofMessageId: proof.message.thread?.threadId + // ? proof.message.thread?.threadId + // : proof.message.threadId + // ? proof.message.thread + // : proof.message.id, + // recipientKey: createRequestOptions?.recipientKey + // ? {} + // : { recipientKey: routing.recipientKey.publicKeyBase58 }, + // } + // }) + + // return oobProofRecord + // } catch (error) { + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/proofs/:proofRecordId/accept-request/:tenantId') + // @Example(ProofRecordExample) + // public async acceptRequest( + // @Path('tenantId') tenantId: string, + // @Path('proofRecordId') proofRecordId: string, + // @Body() + // request: { + // filterByPresentationPreview?: boolean + // filterByNonRevocationRequirements?: boolean + // comment?: string + // }, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let proofRecord + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const requestedCredentials = await tenantAgent.proofs.selectCredentialsForRequest({ + // proofRecordId, + // }) + + // const acceptProofRequest: AcceptProofRequestOptions = { + // proofRecordId, + // comment: request.comment, + // proofFormats: requestedCredentials.proofFormats, + // } + + // const proof = await tenantAgent.proofs.acceptRequest(acceptProofRequest) + + // proofRecord = proof.toJSON() + // }) + // return proofRecord + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `proof with proofRecordId "${proofRecordId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Post('/proofs/:proofRecordId/accept-presentation/:tenantId') + // @Example(ProofRecordExample) + // public async acceptPresentation( + // @Path('tenantId') tenantId: string, + // @Path('proofRecordId') proofRecordId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let proof + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // proof = await tenantAgent.proofs.acceptPresentation({ proofRecordId }) + // }) + + // return proof + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `proof with proofRecordId "${proofRecordId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + // @Get('/proofs/:proofRecordId/:tenantId') + // @Example(ProofRecordExample) + // public async getProofById( + // @Path('tenantId') tenantId: string, + // @Path('proofRecordId') proofRecordId: RecordId, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // let proofRecord + // try { + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const proof = await tenantAgent.proofs.getById(proofRecordId) + // proofRecord = proof.toJSON() + // }) + // return proofRecord + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { + // reason: `proof with proofRecordId "${proofRecordId}" not found.`, + // }) + // } + + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // @Security('apiKey') + @Security('jwt', ['multi-tenant']) @Delete(':tenantId') public async deleteTenantById( + @Request() request: Req, @Path('tenantId') tenantId: string, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const deleteTenant = await this.agent.modules.tenants.deleteTenantById(tenantId) + const agent = request.agent as Agent + const deleteTenant = await agent.modules.tenants.deleteTenantById(tenantId) return JsonTransformer.toJSON(deleteTenant) } catch (error) { if (error instanceof RecordNotFoundError) { @@ -1681,221 +1680,248 @@ export class MultiTenancyController extends Controller { } } - @Security('apiKey') - @Post('/did/web/:tenantId') - public async createDidWeb( - @Path('tenantId') tenantId: string, - @Body() didOptions: DidCreate, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - try { - let didDoc - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (!didOptions.seed) { - throw Error('Seed is required') - } - if (!didOptions.keyType) { - throw Error('keyType is required') - } - if (didOptions.keyType !== KeyType.Ed25519 && didOptions.keyType !== KeyType.Bls12381g2) { - throw Error('Only ed25519 and bls12381g2 key type supported') - } - const did = `did:${didOptions.method}:${didOptions.domain}` - let didDocument: any - const keyId = `${did}#key-1` - const key = await tenantAgent.wallet.createKey({ - keyType: didOptions.keyType, - seed: TypedArrayEncoder.fromString(didOptions.seed), - }) - if (didOptions.keyType === 'ed25519') { - didDocument = new DidDocumentBuilder(did) - .addContext('https://w3id.org/security/suites/ed25519-2018/v1') - .addVerificationMethod(getEd25519VerificationKey2018({ key, id: keyId, controller: did })) - .addAuthentication(keyId) - .build() - } - if (didOptions.keyType === 'bls12381g2') { - didDocument = new DidDocumentBuilder(did) - .addContext('https://w3id.org/security/bbs/v1') - .addVerificationMethod(getBls12381G2Key2020({ key, id: keyId, controller: did })) - .addAuthentication(keyId) - .build() - } - - didDoc = { - did, - didDocument: didDocument.toJSON(), - } - }) - return didDoc - } catch (error) { - return internalServerError(500, { - message: `something went wrong: ${error}`, - }) - } - } - - @Security('apiKey') - @Post('/did/key:tenantId') - public async createDidKey( - @Path('tenantId') tenantId: string, - @Body() didOptions: DidCreate, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - try { - let didCreateResponse - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - if (!didOptions.seed) { - throw Error('Seed is required') - } - didCreateResponse = await tenantAgent.dids.create({ - method: 'key', - options: { - keyType: KeyType.Ed25519, - }, - secret: { - privateKey: TypedArrayEncoder.fromString(didOptions.seed), + // @Security('apiKey') + // @Post('/did/web/:tenantId') + // public async createDidWeb( + // @Path('tenantId') tenantId: string, + // @Body() didOptions: DidCreate, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // try { + // let didDoc + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (!didOptions.seed) { + // throw Error('Seed is required') + // } + // if (!didOptions.keyType) { + // throw Error('keyType is required') + // } + // if (didOptions.keyType !== KeyType.Ed25519 && didOptions.keyType !== KeyType.Bls12381g2) { + // throw Error('Only ed25519 and bls12381g2 key type supported') + // } + // const did = `did:${didOptions.method}:${didOptions.domain}` + // let didDocument: any + // const keyId = `${did}#key-1` + // const key = await tenantAgent.wallet.createKey({ + // keyType: didOptions.keyType, + // seed: TypedArrayEncoder.fromString(didOptions.seed), + // }) + // if (didOptions.keyType === 'ed25519') { + // didDocument = new DidDocumentBuilder(did) + // .addContext('https://w3id.org/security/suites/ed25519-2018/v1') + // .addVerificationMethod(getEd25519VerificationKey2018({ key, id: keyId, controller: did })) + // .addAuthentication(keyId) + // .build() + // } + // if (didOptions.keyType === 'bls12381g2') { + // didDocument = new DidDocumentBuilder(did) + // .addContext('https://w3id.org/security/bbs/v1') + // .addVerificationMethod(getBls12381G2Key2020({ key, id: keyId, controller: did })) + // .addAuthentication(keyId) + // .build() + // } + + // didDoc = { + // did, + // didDocument: didDocument.toJSON(), + // } + // }) + // return didDoc + // } catch (error) { + // return internalServerError(500, { + // message: `something went wrong: ${error}`, + // }) + // } + // } + + // @Security('apiKey') + // @Post('/did/key:tenantId') + // public async createDidKey( + // @Path('tenantId') tenantId: string, + // @Body() didOptions: DidCreate, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // try { + // let didCreateResponse + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // if (!didOptions.seed) { + // throw Error('Seed is required') + // } + // didCreateResponse = await tenantAgent.dids.create({ + // method: 'key', + // options: { + // keyType: KeyType.Ed25519, + // }, + // secret: { + // privateKey: TypedArrayEncoder.fromString(didOptions.seed), + // }, + // }) + // }) + // return didCreateResponse + // } catch (error) { + // return internalServerError(500, { + // message: `something went wrong: ${error}`, + // }) + // } + // } + + // /** + // * Retrieve question and answer records by query + // * + // * @param tenantId Tenant identifier + // * @param connectionId Connection identifier + // * @param role Role of the question + // * @param state State of the question + // * @param threadId Thread identifier + // * @returns QuestionAnswerRecord[] + // */ + // @Security('apiKey') + // @Get('/question-answer/:tenantId') + // public async getQuestionAnswerRecords( + // @Path('tenantId') tenantId: string, + // @Query('connectionId') connectionId?: string, + // @Query('role') role?: QuestionAnswerRole, + // @Query('state') state?: QuestionAnswerState, + // @Query('threadId') threadId?: string + // ) { + // let questionAnswerRecords: QuestionAnswerRecord[] = [] + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // questionAnswerRecords = await tenantAgent.modules.questionAnswer.findAllByQuery({ + // connectionId, + // role, + // state, + // threadId, + // }) + // }) + // return questionAnswerRecords.map((record) => record.toJSON()) + // } + + // /** + // * Send a question to a connection + // * + // * @param tenantId Tenant identifier + // * @param connectionId Connection identifier + // * @param content The content of the message + // */ + // @Security('apiKey') + // @Post('/question-answer/question/:connectionId/:tenantId') + // public async sendQuestion( + // @Path('connectionId') connectionId: RecordId, + // @Path('tenantId') tenantId: string, + // @Body() + // config: { + // question: string + // validResponses: ValidResponse[] + // detail?: string + // }, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // try { + // const { question, validResponses, detail } = config + // let questionAnswerRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // questionAnswerRecord = await tenantAgent.modules.questionAnswer.sendQuestion(connectionId, { + // question, + // validResponses, + // detail, + // }) + // questionAnswerRecord = questionAnswerRecord?.toJSON() + // }) + + // return questionAnswerRecord + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) + // } + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // /** + // * Send a answer to question + // * + // * @param tenantId Tenant identifier + // * @param id Question Answer Record identifier + // * @param response The response of the question + // */ + // @Security('apiKey') + // @Post('/question-answer/answer/:id/:tenantId') + // public async sendAnswer( + // @Path('id') id: RecordId, + // @Path('tenantId') tenantId: string, + // @Body() request: Record<'response', string>, + // @Res() notFoundError: TsoaResponse<404, { reason: string }>, + // @Res() internalServerError: TsoaResponse<500, { message: string }> + // ) { + // try { + // let questionAnswerRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const record = await tenantAgent.modules.questionAnswer.sendAnswer(id, request.response) + // questionAnswerRecord = record.toJSON() + // }) + // return questionAnswerRecord + // } catch (error) { + // if (error instanceof RecordNotFoundError) { + // return notFoundError(404, { reason: `record with connection id "${id}" not found.` }) + // } + // return internalServerError(500, { message: `something went wrong: ${error}` }) + // } + // } + + // /** + // * Retrieve question answer record by id + // * + // * @param id Question Answer Record identifier + // * @param tenantId Tenant identifier + // * @returns ConnectionRecord + // */ + // @Security('apiKey') + // @Get('/question-answer/:id/:tenantId') + // public async getQuestionAnswerRecordById( + // @Path('id') id: RecordId, + // @Path('tenantId') tenantId: string, + // @Res() notFoundError: TsoaResponse<404, { reason: string }> + // ) { + // let questionAnswerRecord + // await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + // const record = await tenantAgent.modules.questionAnswer.findById(id) + // questionAnswerRecord = record + // }) + + // if (!questionAnswerRecord) { + // return notFoundError(404, { + // reason: `Question Answer Record with id "${id}" not found.`, + // }) + // } + + // return questionAnswerRecord + // } + + private async createToken(agent: Agent, tenantId: string, secretKey?: string) { + let key: string + if (!secretKey) { + key = await generateSecretKey() + await agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + tenantAgent.genericRecords.save({ + content: { + secretKey: key, }, }) }) - return didCreateResponse - } catch (error) { - return internalServerError(500, { - message: `something went wrong: ${error}`, - }) - } - } - /** - * Retrieve question and answer records by query - * - * @param tenantId Tenant identifier - * @param connectionId Connection identifier - * @param role Role of the question - * @param state State of the question - * @param threadId Thread identifier - * @returns QuestionAnswerRecord[] - */ - @Security('apiKey') - @Get('/question-answer/:tenantId') - public async getQuestionAnswerRecords( - @Path('tenantId') tenantId: string, - @Query('connectionId') connectionId?: string, - @Query('role') role?: QuestionAnswerRole, - @Query('state') state?: QuestionAnswerState, - @Query('threadId') threadId?: string - ) { - let questionAnswerRecords: QuestionAnswerRecord[] = [] - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - questionAnswerRecords = await tenantAgent.modules.questionAnswer.findAllByQuery({ - connectionId, - role, - state, - threadId, - }) - }) - return questionAnswerRecords.map((record) => record.toJSON()) - } - - /** - * Send a question to a connection - * - * @param tenantId Tenant identifier - * @param connectionId Connection identifier - * @param content The content of the message - */ - @Security('apiKey') - @Post('/question-answer/question/:connectionId/:tenantId') - public async sendQuestion( - @Path('connectionId') connectionId: RecordId, - @Path('tenantId') tenantId: string, - @Body() - config: { - question: string - validResponses: ValidResponse[] - detail?: string - }, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - try { - const { question, validResponses, detail } = config - let questionAnswerRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - questionAnswerRecord = await tenantAgent.modules.questionAnswer.sendQuestion(connectionId, { - question, - validResponses, - detail, - }) - questionAnswerRecord = questionAnswerRecord?.toJSON() - }) + // Note: logic to store generate token for tenant using BW's secertKey + // const genericRecord = await agent.genericRecords.getAll() + // const recordWithToken = genericRecord.find((record) => record?.content?.secretKey !== undefined) + // const key = recordWithToken?.content.secretKey as string - return questionAnswerRecord - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { reason: `connection with connection id "${connectionId}" not found.` }) + if (!key) { + throw new Error('SecretKey does not exist for basewallet') } - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - /** - * Send a answer to question - * - * @param tenantId Tenant identifier - * @param id Question Answer Record identifier - * @param response The response of the question - */ - @Security('apiKey') - @Post('/question-answer/answer/:id/:tenantId') - public async sendAnswer( - @Path('id') id: RecordId, - @Path('tenantId') tenantId: string, - @Body() request: Record<'response', string>, - @Res() notFoundError: TsoaResponse<404, { reason: string }>, - @Res() internalServerError: TsoaResponse<500, { message: string }> - ) { - try { - let questionAnswerRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const record = await tenantAgent.modules.questionAnswer.sendAnswer(id, request.response) - questionAnswerRecord = record.toJSON() - }) - return questionAnswerRecord - } catch (error) { - if (error instanceof RecordNotFoundError) { - return notFoundError(404, { reason: `record with connection id "${id}" not found.` }) - } - return internalServerError(500, { message: `something went wrong: ${error}` }) - } - } - - /** - * Retrieve question answer record by id - * - * @param id Question Answer Record identifier - * @param tenantId Tenant identifier - * @returns ConnectionRecord - */ - @Security('apiKey') - @Get('/question-answer/:id/:tenantId') - public async getQuestionAnswerRecordById( - @Path('id') id: RecordId, - @Path('tenantId') tenantId: string, - @Res() notFoundError: TsoaResponse<404, { reason: string }> - ) { - let questionAnswerRecord - await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { - const record = await tenantAgent.modules.questionAnswer.findById(id) - questionAnswerRecord = record - }) - - if (!questionAnswerRecord) { - return notFoundError(404, { - reason: `Question Answer Record with id "${id}" not found.`, - }) + } else { + key = secretKey } - - return questionAnswerRecord + const token = jwt.sign({ role: AgentRole.RestTenantAgent, tenantId }, key) + return token } } diff --git a/src/controllers/outofband/OutOfBandController.ts b/src/controllers/outofband/OutOfBandController.ts index 9dabc5c4..4cde3a9e 100644 --- a/src/controllers/outofband/OutOfBandController.ts +++ b/src/controllers/outofband/OutOfBandController.ts @@ -2,15 +2,16 @@ import type { OutOfBandInvitationProps, OutOfBandRecordWithInvitationProps } fro import type { AgentMessageType, RecipientKeyOption } from '../types' import type { ConnectionRecordProps, CreateLegacyInvitationConfig, Routing } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies import { AgentMessage, JsonTransformer, OutOfBandInvitation, - Agent, RecordNotFoundError, Key, KeyType, } from '@aries-framework/core' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { ConnectionRecordExample, outOfBandInvitationExample, outOfBandRecordExample, RecordId } from '../examples' @@ -30,25 +31,20 @@ import { Path, Post, Query, - Res, + Request, Route, Tags, TsoaResponse, Security, + Res, } from 'tsoa' @Tags('Out Of Band') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @Route('/oob') @injectable() export class OutOfBandController extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Retrieve all out of band records * @param invitationId invitation identifier @@ -56,8 +52,8 @@ export class OutOfBandController extends Controller { */ @Example([outOfBandRecordExample]) @Get() - public async getAllOutOfBandRecords(@Query('invitationId') invitationId?: RecordId) { - let outOfBandRecords = await this.agent.oob.getAll() + public async getAllOutOfBandRecords(@Request() request: Req, @Query('invitationId') invitationId?: RecordId) { + let outOfBandRecords = await request.agent.oob.getAll() if (invitationId) outOfBandRecords = outOfBandRecords.filter((o) => o.outOfBandInvitation.id === invitationId) @@ -72,10 +68,11 @@ export class OutOfBandController extends Controller { @Example(outOfBandRecordExample) @Get('/:outOfBandId') public async getOutOfBandRecordById( + @Request() request: Req, @Path('outOfBandId') outOfBandId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }> ) { - const outOfBandRecord = await this.agent.oob.findById(outOfBandId) + const outOfBandRecord = await request.agent.oob.findById(outOfBandId) if (!outOfBandRecord) return notFoundError(404, { reason: `Out of band record with id "${outOfBandId}" not found.` }) @@ -100,17 +97,18 @@ export class OutOfBandController extends Controller { }) @Post('/create-invitation') public async createInvitation( + @Request() request: Req, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() config: CreateInvitationOptions // props removed because of issues with serialization ) { try { - const outOfBandRecord = await this.agent.oob.createInvitation(config) + const outOfBandRecord = await request.agent.oob.createInvitation(config) return { invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ - domain: this.agent.config.endpoints[0], + domain: request.agent.config.endpoints[0], }), invitation: outOfBandRecord.outOfBandInvitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + useDidSovPrefixWhereAllowed: request.agent.config.useDidSovPrefixWhereAllowed, }), outOfBandRecord: outOfBandRecord.toJSON(), } @@ -133,6 +131,7 @@ export class OutOfBandController extends Controller { }) @Post('/create-legacy-invitation') public async createLegacyInvitation( + @Request() request: Req, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Body() config?: Omit & RecipientKeyOption ) { @@ -140,25 +139,25 @@ export class OutOfBandController extends Controller { let routing: Routing if (config?.recipientKey) { routing = { - endpoints: this.agent.config.endpoints, + endpoints: request.agent.config.endpoints, routingKeys: [], recipientKey: Key.fromPublicKeyBase58(config.recipientKey, KeyType.Ed25519), mediatorId: undefined, } } else { - routing = await this.agent.mediationRecipient.getRouting({}) + routing = await request.agent.mediationRecipient.getRouting({}) } - const { outOfBandRecord, invitation } = await this.agent.oob.createLegacyInvitation({ + const { outOfBandRecord, invitation } = await request.agent.oob.createLegacyInvitation({ ...config, routing, }) return { invitationUrl: invitation.toUrl({ - domain: this.agent.config.endpoints[0], - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + domain: request.agent.config.endpoints[0], + useDidSovPrefixWhereAllowed: request.agent.config.useDidSovPrefixWhereAllowed, }), invitation: invitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + useDidSovPrefixWhereAllowed: request.agent.config.useDidSovPrefixWhereAllowed, }), outOfBandRecord: outOfBandRecord.toJSON(), ...(config?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }), @@ -183,6 +182,7 @@ export class OutOfBandController extends Controller { }) @Post('/create-legacy-connectionless-invitation') public async createLegacyConnectionlessInvitation( + @Request() request: Req, @Body() config: { recordId: string @@ -195,7 +195,7 @@ export class OutOfBandController extends Controller { try { const agentMessage = JsonTransformer.fromJSON(config.message, AgentMessage) - return await this.agent.oob.createLegacyConnectionlessInvitation({ + return await request.agent.oob.createLegacyConnectionlessInvitation({ ...config, message: agentMessage, }) @@ -221,6 +221,7 @@ export class OutOfBandController extends Controller { }) @Post('/receive-invitation') public async receiveInvitation( + @Request() request: Req, @Body() invitationRequest: ReceiveInvitationProps, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { @@ -228,7 +229,7 @@ export class OutOfBandController extends Controller { try { const invite = new OutOfBandInvitation({ ...invitation, handshakeProtocols: invitation.handshake_protocols }) - const { outOfBandRecord, connectionRecord } = await this.agent.oob.receiveInvitation(invite, config) + const { outOfBandRecord, connectionRecord } = await request.agent.oob.receiveInvitation(invite, config) return { outOfBandRecord: outOfBandRecord.toJSON(), @@ -253,17 +254,21 @@ export class OutOfBandController extends Controller { }) @Post('/receive-invitation-url') public async receiveInvitationFromUrl( + @Request() request: Req, @Body() invitationRequest: ReceiveInvitationByUrlProps, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { const { invitationUrl, ...config } = invitationRequest try { - const linkSecretIds = await this.agent.modules.anoncreds.getLinkSecretIds() + const linkSecretIds = await request.agent.modules.anoncreds.getLinkSecretIds() if (linkSecretIds.length === 0) { - await this.agent.modules.anoncreds.createLinkSecret() + await request.agent.modules.anoncreds.createLinkSecret() } - const { outOfBandRecord, connectionRecord } = await this.agent.oob.receiveInvitationFromUrl(invitationUrl, config) + const { outOfBandRecord, connectionRecord } = await request.agent.oob.receiveInvitationFromUrl( + invitationUrl, + config + ) return { outOfBandRecord: outOfBandRecord.toJSON(), connectionRecord: connectionRecord?.toJSON(), @@ -283,13 +288,14 @@ export class OutOfBandController extends Controller { }) @Post('/:outOfBandId/accept-invitation') public async acceptInvitation( + @Request() request: Req, @Path('outOfBandId') outOfBandId: RecordId, @Body() acceptInvitationConfig: AcceptInvitationConfig, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const { outOfBandRecord, connectionRecord } = await this.agent.oob.acceptInvitation( + const { outOfBandRecord, connectionRecord } = await request.agent.oob.acceptInvitation( outOfBandId, acceptInvitationConfig ) @@ -315,13 +321,14 @@ export class OutOfBandController extends Controller { */ @Delete('/:outOfBandId') public async deleteOutOfBandRecord( + @Request() request: Req, @Path('outOfBandId') outOfBandId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { this.setStatus(204) - await this.agent.oob.deleteById(outOfBandId) + await request.agent.oob.deleteById(outOfBandId) } catch (error) { if (error instanceof RecordNotFoundError) { return notFoundError(404, { reason: `Out of band record with id "${outOfBandId}" not found.` }) diff --git a/src/controllers/polygon/PolygonController.ts b/src/controllers/polygon/PolygonController.ts index c65074f1..e91186d6 100644 --- a/src/controllers/polygon/PolygonController.ts +++ b/src/controllers/polygon/PolygonController.ts @@ -1,24 +1,18 @@ -import type { RestAgentModules } from '../../cliAgent' - -import { Agent, AriesFrameworkError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { AriesFrameworkError } from '@aries-framework/core' import { generateSecp256k1KeyPair } from '@ayanworks/credo-polygon-w3c-module' import { DidOperation } from '@ayanworks/credo-polygon-w3c-module/build/ledger' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' -import { Route, Tags, Security, Controller, Post, TsoaResponse, Res, Body, Get, Path } from 'tsoa' +import { Route, Tags, Security, Controller, Post, TsoaResponse, Res, Body, Get, Path, Request } from 'tsoa' @Tags('Polygon') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @Route('/polygon') @injectable() export class Polygon extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Create Secp256k1 key pair for polygon DID * @@ -45,6 +39,7 @@ export class Polygon extends Controller { */ @Post('create-schema') public async createSchema( + @Request() request: Req, @Body() createSchemaRequest: { did: string @@ -62,7 +57,7 @@ export class Polygon extends Controller { }) } - return this.agent.modules.polygon.createSchema({ + return request.agent.modules.polygon.createSchema({ did, schemaName, schema, @@ -79,6 +74,7 @@ export class Polygon extends Controller { */ @Post('estimate-transaction') public async estimateTransaction( + @Request() request: Req, @Body() estimateTransactionRequest: { operation: any @@ -96,9 +92,9 @@ export class Polygon extends Controller { }) } if (operation === DidOperation.Create) { - return this.agent.modules.polygon.estimateFeeForDidOperation({ operation }) + return request.agent.modules.polygon.estimateFeeForDidOperation({ operation }) } else if (operation === DidOperation.Update) { - return this.agent.modules.polygon.estimateFeeForDidOperation({ operation }) + return request.agent.modules.polygon.estimateFeeForDidOperation({ operation }) } } catch (error) { return internalServerError(500, { message: `something went wrong: ${error}` }) @@ -112,13 +108,14 @@ export class Polygon extends Controller { */ @Get(':did/:schemaId') public async getSchemaById( + @Request() request: Req, @Path('did') did: string, @Path('schemaId') schemaId: string, @Res() internalServerError: TsoaResponse<500, { message: string }>, @Res() forbiddenError: TsoaResponse<401, { reason: string }> ): Promise { try { - return this.agent.modules.polygon.getSchemaById(did, schemaId) + return request.agent.modules.polygon.getSchemaById(did, schemaId) } catch (error) { if (error instanceof AriesFrameworkError) { if (error.message.includes('UnauthorizedClientRequest')) { diff --git a/src/controllers/proofs/ProofController.ts b/src/controllers/proofs/ProofController.ts index 5f9bed8c..5ae8fc99 100644 --- a/src/controllers/proofs/ProofController.ts +++ b/src/controllers/proofs/ProofController.ts @@ -5,7 +5,10 @@ import type { Routing, } from '@aries-framework/core' -import { Agent, HandshakeProtocol, Key, KeyType, RecordNotFoundError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { HandshakeProtocol, Key, KeyType, RecordNotFoundError } from '@aries-framework/core' +import { Request as Req } from 'express' +// eslint-disable-next-line import/no-extraneous-dependencies import { injectable } from 'tsyringe' import { ProofRecordExample, RecordId } from '../examples' @@ -16,19 +19,28 @@ import { RequestProofProposalOptions, } from '../types' -import { Body, Controller, Example, Get, Path, Post, Query, Res, Route, Tags, TsoaResponse, Security } from 'tsoa' +import { + Body, + Controller, + Example, + Get, + Path, + Post, + Query, + Res, + Route, + Tags, + TsoaResponse, + Security, + Request, +} from 'tsoa' @Tags('Proofs') @Route('/proofs') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class ProofController extends Controller { - private agent: Agent - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Retrieve all proof records * @@ -37,8 +49,8 @@ export class ProofController extends Controller { */ @Example([ProofRecordExample]) @Get('/') - public async getAllProofs(@Query('threadId') threadId?: string) { - let proofs = await this.agent.proofs.getAll() + public async getAllProofs(@Request() request: Req, @Query('threadId') threadId?: string) { + let proofs = await request.agent.proofs.getAll() if (threadId) proofs = proofs.filter((p) => p.threadId === threadId) @@ -54,12 +66,13 @@ export class ProofController extends Controller { @Get('/:proofRecordId') @Example(ProofRecordExample) public async getProofById( + @Request() request: Req, @Path('proofRecordId') proofRecordId: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const proof = await this.agent.proofs.getById(proofRecordId) + const proof = await request.agent.proofs.getById(proofRecordId) return proof.toJSON() } catch (error) { @@ -82,12 +95,13 @@ export class ProofController extends Controller { @Post('/propose-proof') @Example(ProofRecordExample) public async proposeProof( + @Request() request: Req, @Body() requestProofProposalOptions: RequestProofProposalOptions, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const proof = await this.agent.proofs.proposeProof({ + const proof = await request.agent.proofs.proposeProof({ connectionId: requestProofProposalOptions.connectionId, protocolVersion: 'v1' as ProofsProtocolVersionType<[]>, proofFormats: requestProofProposalOptions.proofFormats, @@ -119,12 +133,13 @@ export class ProofController extends Controller { @Post('/:proofRecordId/accept-proposal') @Example(ProofRecordExample) public async acceptProposal( + @Request() request: Req, @Body() acceptProposal: AcceptProofProposal, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const proof = await this.agent.proofs.acceptProposal(acceptProposal) + const proof = await request.agent.proofs.acceptProposal(acceptProposal) return proof } catch (error) { @@ -140,6 +155,7 @@ export class ProofController extends Controller { @Post('/request-proof') @Example(ProofRecordExample) public async requestProof( + @Request() request: Req, @Body() requestProofOptions: RequestProofOptions, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> @@ -155,7 +171,7 @@ export class ProofController extends Controller { parentThreadId: requestProofOptions.parentThreadId, willConfirm: requestProofOptions.willConfirm, } - const proof = await this.agent.proofs.requestProof(requestProofPayload) + const proof = await request.agent.proofs.requestProof(requestProofPayload) return proof } catch (error) { @@ -165,6 +181,7 @@ export class ProofController extends Controller { @Post('create-request-oob') public async createRequest( + @Request() request: Req, @Body() createRequestOptions: CreateProofRequestOobOptions, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { @@ -172,15 +189,15 @@ export class ProofController extends Controller { let routing: Routing if (createRequestOptions?.recipientKey) { routing = { - endpoints: this.agent.config.endpoints, + endpoints: request.agent.config.endpoints, routingKeys: [], recipientKey: Key.fromPublicKeyBase58(createRequestOptions.recipientKey, KeyType.Ed25519), mediatorId: undefined, } } else { - routing = await this.agent.mediationRecipient.getRouting({}) + routing = await request.agent.mediationRecipient.getRouting({}) } - const proof = await this.agent.proofs.createRequest({ + const proof = await request.agent.proofs.createRequest({ protocolVersion: createRequestOptions.protocolVersion as ProofsProtocolVersionType<[]>, proofFormats: createRequestOptions.proofFormats, goalCode: createRequestOptions.goalCode, @@ -190,7 +207,7 @@ export class ProofController extends Controller { comment: createRequestOptions.comment, }) const proofMessage = proof.message - const outOfBandRecord = await this.agent.oob.createInvitation({ + const outOfBandRecord = await request.agent.oob.createInvitation({ label: createRequestOptions.label, handshakeProtocols: [HandshakeProtocol.Connections], messages: [proofMessage], @@ -201,10 +218,10 @@ export class ProofController extends Controller { return { invitationUrl: outOfBandRecord.outOfBandInvitation.toUrl({ - domain: this.agent.config.endpoints[0], + domain: request.agent.config.endpoints[0], }), invitation: outOfBandRecord.outOfBandInvitation.toJSON({ - useDidSovPrefixWhereAllowed: this.agent.config.useDidSovPrefixWhereAllowed, + useDidSovPrefixWhereAllowed: request.agent.config.useDidSovPrefixWhereAllowed, }), outOfBandRecord: outOfBandRecord.toJSON(), recipientKey: createRequestOptions?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 }, @@ -225,9 +242,10 @@ export class ProofController extends Controller { @Post('/:proofRecordId/accept-request') @Example(ProofRecordExample) public async acceptRequest( + @Request() request: Req, @Path('proofRecordId') proofRecordId: string, @Body() - request: { + requestBody: { filterByPresentationPreview?: boolean filterByNonRevocationRequirements?: boolean comment?: string @@ -236,17 +254,17 @@ export class ProofController extends Controller { @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const requestedCredentials = await this.agent.proofs.selectCredentialsForRequest({ + const requestedCredentials = await request.agent.proofs.selectCredentialsForRequest({ proofRecordId, }) const acceptProofRequest: AcceptProofRequestOptions = { proofRecordId, - comment: request.comment, + comment: requestBody.comment, proofFormats: requestedCredentials.proofFormats, } - const proof = await this.agent.proofs.acceptRequest(acceptProofRequest) + const proof = await request.agent.proofs.acceptRequest(acceptProofRequest) return proof.toJSON() } catch (error) { @@ -269,12 +287,13 @@ export class ProofController extends Controller { @Post('/:proofRecordId/accept-presentation') @Example(ProofRecordExample) public async acceptPresentation( + @Request() request: Req, @Path('proofRecordId') proofRecordId: string, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const proof = await this.agent.proofs.acceptPresentation({ proofRecordId }) + const proof = await request.agent.proofs.acceptPresentation({ proofRecordId }) return proof } catch (error) { if (error instanceof RecordNotFoundError) { @@ -289,12 +308,13 @@ export class ProofController extends Controller { @Get('/:proofRecordId/form-data') @Example(ProofRecordExample) public async proofFormData( + @Request() request: Req, @Path('proofRecordId') proofRecordId: string, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const proof = await this.agent.proofs.getFormatData(proofRecordId) + const proof = await request.agent.proofs.getFormatData(proofRecordId) return proof } catch (error) { if (error instanceof RecordNotFoundError) { diff --git a/src/controllers/question-answer/QuestionAnswerController.ts b/src/controllers/question-answer/QuestionAnswerController.ts index ac84d1e8..88788316 100644 --- a/src/controllers/question-answer/QuestionAnswerController.ts +++ b/src/controllers/question-answer/QuestionAnswerController.ts @@ -1,26 +1,22 @@ -import type { RestAgentModules } from '../../cliAgent' import type { ValidResponse } from '@aries-framework/question-answer' -import { Agent, RecordNotFoundError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies +import { RecordNotFoundError } from '@aries-framework/core' +// eslint-disable-next-line import/no-extraneous-dependencies import { QuestionAnswerRole, QuestionAnswerState } from '@aries-framework/question-answer' +import { Request as Req } from 'express' import { injectable } from 'tsyringe' import { RecordId } from '../examples' -import { Body, Controller, Get, Path, Post, Res, Route, Tags, TsoaResponse, Query, Security } from 'tsoa' +import { Body, Controller, Get, Path, Post, Res, Route, Tags, TsoaResponse, Query, Security, Request } from 'tsoa' @Tags('Question Answer') @Route('/question-answer') -@Security('apiKey') +// @Security('apiKey') +@Security('jwt') @injectable() export class QuestionAnswerController extends Controller { - private agent: Agent - - public constructor(agent: Agent) { - super() - this.agent = agent - } - /** * Retrieve question and answer records by query * @@ -32,12 +28,13 @@ export class QuestionAnswerController extends Controller { */ @Get('/') public async getQuestionAnswerRecords( + @Request() request: Req, @Query('connectionId') connectionId?: string, @Query('role') role?: QuestionAnswerRole, @Query('state') state?: QuestionAnswerState, @Query('threadId') threadId?: string ) { - const questionAnswerRecords = await this.agent.modules.questionAnswer.findAllByQuery({ + const questionAnswerRecords = await request.agent.modules.questionAnswer.findAllByQuery({ connectionId, role, state, @@ -54,6 +51,7 @@ export class QuestionAnswerController extends Controller { */ @Post('question/:connectionId') public async sendQuestion( + @Request() request: Req, @Path('connectionId') connectionId: RecordId, @Body() config: { @@ -67,7 +65,7 @@ export class QuestionAnswerController extends Controller { try { const { question, validResponses, detail } = config - const record = await this.agent.modules.questionAnswer.sendQuestion(connectionId, { + const record = await request.agent.modules.questionAnswer.sendQuestion(connectionId, { question, validResponses, detail, @@ -90,13 +88,14 @@ export class QuestionAnswerController extends Controller { */ @Post('answer/:id') public async sendAnswer( + @Request() request: Req, @Path('id') id: RecordId, - @Body() request: Record<'response', string>, + @Body() requestBody: Record<'response', string>, @Res() notFoundError: TsoaResponse<404, { reason: string }>, @Res() internalServerError: TsoaResponse<500, { message: string }> ) { try { - const record = await this.agent.modules.questionAnswer.sendAnswer(id, request.response) + const record = await request.agent.modules.questionAnswer.sendAnswer(id, requestBody.response) return record.toJSON() } catch (error) { if (error instanceof RecordNotFoundError) { @@ -113,10 +112,11 @@ export class QuestionAnswerController extends Controller { */ @Get('/:id') public async getQuestionAnswerRecordById( + @Request() request: Req, @Path('id') id: RecordId, @Res() notFoundError: TsoaResponse<404, { reason: string }> ) { - const record = await this.agent.modules.questionAnswer.findById(id) + const record = await request.agent.modules.questionAnswer.findById(id) if (!record) return notFoundError(404, { diff --git a/src/controllers/types.ts b/src/controllers/types.ts index 1c45ea6c..dbabd23e 100644 --- a/src/controllers/types.ts +++ b/src/controllers/types.ts @@ -1,5 +1,6 @@ import type { Version } from './examples' import type { AnonCredsCredentialFormat, LegacyIndyCredentialFormat } from '@aries-framework/anoncreds' +// eslint-disable-next-line import/order import type { AutoAcceptCredential, AutoAcceptProof, @@ -11,7 +12,6 @@ import type { DidResolutionMetadata, DidDocumentMetadata, ProofExchangeRecord, - ProofFormat, DidRegistrationExtraOptions, DidDocument, DidRegistrationSecretOptions, @@ -27,8 +27,13 @@ import type { KeyType, JsonLdCredentialFormat, } from '@aries-framework/core' + +// import type { GenericRecordsApi } from '@aries-framework/core/build/modules/generic-records' +// import type { GenericRecord } from '@aries-framework/core/build/modules/generic-records/repository/GenericRecord' import type { DIDDocument } from 'did-resolver' +// import type { GenericRecord } from '@aries-framework/core/build/modules/generic-records/repository/GenericRecord' + export type TenantConfig = Pick & { walletConfig: Pick } @@ -44,6 +49,10 @@ export interface AgentInfo { // } } +export interface AgentToken { + token: string +} + export interface AgentMessageType { '@id': string '@type': string @@ -257,10 +266,7 @@ export interface RequestProofOptions { // TODO: added type in protocolVersion export interface RequestProofProposalOptions { connectionId: string - proofFormats: { - formats: ProofFormat[] - action: 'createProposal' - } + proofFormats: any goalCode?: string parentThreadId?: string autoAcceptProof?: AutoAcceptProof @@ -269,10 +275,7 @@ export interface RequestProofProposalOptions { export interface AcceptProofProposal { proofRecordId: string - proofFormats: { - formats: ProofFormat[] - action: 'acceptProposal' - } + proofFormats: any comment?: string autoAcceptProof?: AutoAcceptProof goalCode?: string diff --git a/src/enums/enum.ts b/src/enums/enum.ts index 3b355229..9ca19fdc 100644 --- a/src/enums/enum.ts +++ b/src/enums/enum.ts @@ -21,3 +21,13 @@ export enum Network { Indicio_Demonet = 'indicio:demonet', Indicio_Mainnet = 'indicio:mainnet', } + +export enum AgentRole { + RestRootAgentWithTenants = 'RestRootAgentWithTenants', + RestRootAgent = 'RestRootAgent', + RestTenantAgent = 'RestTenantAgent', +} + +export enum ErrorMessages { + Unauthorized = 'Unauthorized', +} diff --git a/src/error/ApiError.ts b/src/error/ApiError.ts new file mode 100644 index 00000000..fb733e1e --- /dev/null +++ b/src/error/ApiError.ts @@ -0,0 +1,4 @@ +export interface ApiError { + message: string + details?: unknown +} diff --git a/src/error/StatusException.ts b/src/error/StatusException.ts new file mode 100644 index 00000000..c41dced6 --- /dev/null +++ b/src/error/StatusException.ts @@ -0,0 +1,8 @@ +export class StatusException extends Error { + public status: number + + public constructor(message: string, status: number) { + super(message) + this.status = status + } +} diff --git a/src/error/index.ts b/src/error/index.ts new file mode 100644 index 00000000..1a8ad899 --- /dev/null +++ b/src/error/index.ts @@ -0,0 +1,2 @@ +export * from './ApiError' +export * from './StatusException' diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 4d348d79..e503c38e 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -3,31 +3,31 @@ // 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 import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, HttpStatusCodeLiteral, TsoaResponse, fetchMiddlewares } from '@tsoa/runtime'; // 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 +import { QuestionAnswerController } from './../controllers/question-answer/QuestionAnswerController'; +// 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 +import { ProofController } from './../controllers/proofs/ProofController'; +// 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 +import { Polygon } from './../controllers/polygon/PolygonController'; +// 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 +import { OutOfBandController } from './../controllers/outofband/OutOfBandController'; +// 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 import { AgentController } from './../controllers/agent/AgentController'; // 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 import { BasicMessageController } from './../controllers/basic-messages/BasicMessageController'; // 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 import { ConnectionController } from './../controllers/connections/ConnectionController'; // 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 -import { OutOfBandController } from './../controllers/outofband/OutOfBandController'; -// 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 import { CredentialDefinitionController } from './../controllers/credentials/CredentialDefinitionController'; // 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 import { SchemaController } from './../controllers/credentials/SchemaController'; // 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 import { DidController } from './../controllers/did/DidController'; // 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 -import { MultiTenancyController } from './../controllers/multi-tenancy/MultiTenancyController'; -// 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 -import { ProofController } from './../controllers/proofs/ProofController'; -// 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 import { EndorserTransactionController } from './../controllers/endorser-transaction/EndorserTransactionController'; // 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 import { CredentialController } from './../controllers/credentials/CredentialController'; // 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 -import { Polygon } from './../controllers/polygon/PolygonController'; -// 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 -import { QuestionAnswerController } from './../controllers/question-answer/QuestionAnswerController'; +import { MultiTenancyController } from './../controllers/multi-tenancy/MultiTenancyController'; import { expressAuthentication } from './../authentication'; // @ts-ignore - no great way to install types from subpackage import { iocContainer } from './../utils/tsyringeTsoaIocContainer'; @@ -37,25 +37,19 @@ import type { RequestHandler, Router } from 'express'; // 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 const models: TsoaRoute.Models = { - "AgentInfo": { - "dataType": "refObject", - "properties": { - "label": {"dataType":"string","required":true}, - "endpoints": {"dataType":"array","array":{"dataType":"string"},"required":true}, - "isInitialized": {"dataType":"boolean","required":true}, - "publicDid": {"dataType":"void","required":true}, - }, - "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 "Record_string.unknown_": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"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 - "BasicMessageRecord": { - "dataType": "refAlias", - "type": {"ref":"Record_string.unknown_","validators":{}}, + "QuestionAnswerRole": { + "dataType": "refEnum", + "enums": ["questioner","responder"], + }, + // 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 + "QuestionAnswerState": { + "dataType": "refEnum", + "enums": ["question-sent","question-received","answer-received","answer-sent"], }, // 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 "RecordId": { @@ -63,14 +57,80 @@ const models: TsoaRoute.Models = { "type": {"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 - "Record_content.string_": { + "ValidResponse": { + "dataType": "refObject", + "properties": { + "text": {"dataType":"string","required":true}, + }, + "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 + "Record_response.string_": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"content":{"dataType":"string","required":true}},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"response":{"dataType":"string","required":true}},"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 - "DidExchangeState": { + "AutoAcceptProof": { "dataType": "refEnum", - "enums": ["start","invitation-sent","invitation-received","request-sent","request-received","response-sent","response-received","abandoned","completed"], + "enums": ["always","contentApproved","never"], + }, + // 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 + "RequestProofProposalOptions": { + "dataType": "refObject", + "properties": { + "connectionId": {"dataType":"string","required":true}, + "proofFormats": {"dataType":"any","required":true}, + "goalCode": {"dataType":"string"}, + "parentThreadId": {"dataType":"string"}, + "autoAcceptProof": {"ref":"AutoAcceptProof"}, + "comment": {"dataType":"string"}, + }, + "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 + "AcceptProofProposal": { + "dataType": "refObject", + "properties": { + "proofRecordId": {"dataType":"string","required":true}, + "proofFormats": {"dataType":"any","required":true}, + "comment": {"dataType":"string"}, + "autoAcceptProof": {"ref":"AutoAcceptProof"}, + "goalCode": {"dataType":"string"}, + "willConfirm": {"dataType":"boolean"}, + }, + "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 + "RequestProofOptions": { + "dataType": "refObject", + "properties": { + "connectionId": {"dataType":"string","required":true}, + "protocolVersion": {"dataType":"string","required":true}, + "proofFormats": {"dataType":"any","required":true}, + "comment": {"dataType":"string","required":true}, + "autoAcceptProof": {"ref":"AutoAcceptProof","required":true}, + "goalCode": {"dataType":"string"}, + "parentThreadId": {"dataType":"string"}, + "willConfirm": {"dataType":"boolean"}, + }, + "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 + "CreateProofRequestOobOptions": { + "dataType": "refObject", + "properties": { + "protocolVersion": {"dataType":"string","required":true}, + "proofFormats": {"dataType":"any","required":true}, + "goalCode": {"dataType":"string"}, + "parentThreadId": {"dataType":"string"}, + "willConfirm": {"dataType":"boolean"}, + "autoAcceptProof": {"ref":"AutoAcceptProof"}, + "comment": {"dataType":"string"}, + "label": {"dataType":"string"}, + "imageUrl": {"dataType":"string"}, + "recipientKey": {"dataType":"string"}, + }, + "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": { @@ -206,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_": { @@ -262,7 +322,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"}},"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"}},"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_": { @@ -273,8 +333,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"}, @@ -288,8 +348,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"}, @@ -313,6 +373,40 @@ 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 + "AgentInfo": { + "dataType": "refObject", + "properties": { + "label": {"dataType":"string","required":true}, + "endpoints": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "isInitialized": {"dataType":"boolean","required":true}, + "publicDid": {"dataType":"void","required":true}, + }, + "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 + "AgentToken": { + "dataType": "refObject", + "properties": { + "token": {"dataType":"string","required":true}, + }, + "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 + "BasicMessageRecord": { + "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 + "Record_content.string_": { + "dataType": "refAlias", + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"content":{"dataType":"string","required":true}},"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 + "DidExchangeState": { + "dataType": "refEnum", + "enums": ["start","invitation-sent","invitation-received","request-sent","request-received","response-sent","response-received","abandoned","completed"], + }, + // 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 "CredentialDefinitionId": { "dataType": "refAlias", "type": {"dataType":"string","validators":{}}, @@ -386,25 +480,11 @@ 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 - "Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"dataType":"string","required":true},"connectionImageUrl":{"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_TenantConfig.walletConfig_": { - "dataType": "refAlias", - "type": {"ref":"Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__","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 - "CreateTenantOptions": { + "EndorserTransaction": { "dataType": "refObject", "properties": { - "config": {"ref":"Omit_TenantConfig.walletConfig_","required":true}, - "seed": {"dataType":"string"}, - "method": {"dataType":"string"}, - "role": {"dataType":"string"}, - "endorserDid": {"dataType":"string"}, - "did": {"dataType":"string"}, + "transaction": {"dataType":"union","subSchemas":[{"dataType":"string"},{"ref":"Record_string.unknown_"}],"required":true}, + "endorserDid": {"dataType":"string","required":true}, }, "additionalProperties": false, }, @@ -418,39 +498,63 @@ 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 - "EndorserTransaction": { + "WriteTransaction": { "dataType": "refObject", "properties": { - "transaction": {"dataType":"union","subSchemas":[{"dataType":"string"},{"ref":"Record_string.unknown_"}],"required":true}, - "endorserDid": {"dataType":"string","required":true}, + "endorsedTransaction": {"dataType":"string","required":true}, + "endorserDid": {"dataType":"string"}, + "schema": {"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"string"},"required":true},"version":{"ref":"Version","required":true},"name":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true}}}, + "credentialDefinition": {"dataType":"nestedObjectLiteral","nestedProperties":{"type":{"dataType":"string","required":true},"value":{"dataType":"any","required":true},"tag":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true}}}, }, "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 - "Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages__": { + "CredentialState": { + "dataType": "refEnum", + "enums": ["proposal-sent","proposal-received","offer-sent","offer-received","declined","request-sent","request-received","credential-issued","credential-received","done","abandoned"], + }, + // 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 + "W3cCredentialRecord": { "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"}}},"validators":{}}, + "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 - "Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_": { + "ConnectionRecord": { "dataType": "refAlias", - "type": {"ref":"Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages__","validators":{}}, + "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 - "WriteTransaction": { + "AutoAcceptCredential": { + "dataType": "refEnum", + "enums": ["always","contentApproved","never"], + }, + // 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 + "ProposeCredentialOptions": { "dataType": "refObject", "properties": { - "endorsedTransaction": {"dataType":"string","required":true}, - "endorserDid": {"dataType":"string"}, - "schema": {"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"string"},"required":true},"version":{"ref":"Version","required":true},"name":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true}}}, - "credentialDefinition": {"dataType":"nestedObjectLiteral","nestedProperties":{"type":{"dataType":"string","required":true},"value":{"dataType":"any","required":true},"tag":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true}}}, + "connectionRecord": {"ref":"ConnectionRecord","required":true}, + "credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"issuerDid":{"dataType":"string","required":true},"credentialDefinitionId":{"dataType":"string","required":true},"schemaVersion":{"dataType":"string","required":true},"schemaName":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true},"schemaIssuerDid":{"dataType":"string","required":true}},"required":true}},"required":true}, + "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, + "comment": {"dataType":"string"}, + "connectionId": {"dataType":"string","required":true}, }, "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 - "AutoAcceptCredential": { - "dataType": "refEnum", - "enums": ["always","contentApproved","never"], + "CredentialFormatPayload_CredentialFormats.acceptProposal_": { + "dataType": "refAlias", + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"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 + "AcceptCredentialProposalOptions": { + "dataType": "refObject", + "properties": { + "credentialRecordId": {"dataType":"string","required":true}, + "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormats.acceptProposal_"}, + "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, + "comment": {"dataType":"string"}, + }, + "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 "CreateOfferOptions": { @@ -552,202 +656,70 @@ 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 - "CredentialFormatPayload_CredentialFormatsFromProtocols_CredentialProtocol-Array_.acceptOffer_": { + "CredentialFormatPayload_CredentialFormats.acceptOffer_": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"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 - "AcceptCredentialOfferOptions": { + "CredentialOfferOptions": { "dataType": "refObject", "properties": { + "credentialRecordId": {"dataType":"string","required":true}, + "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormats.acceptOffer_"}, "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, "comment": {"dataType":"string"}, - "credentialRecordId": {"dataType":"string","required":true}, - "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormatsFromProtocols_CredentialProtocol-Array_.acceptOffer_"}, }, "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 - "CredentialState": { - "dataType": "refEnum", - "enums": ["proposal-sent","proposal-received","offer-sent","offer-received","declined","request-sent","request-received","credential-issued","credential-received","done","abandoned"], + "CredentialExchangeRecord": { + "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 - "AutoAcceptProof": { - "dataType": "refEnum", - "enums": ["always","contentApproved","never"], + "CredentialFormatPayload_CredentialFormats.acceptRequest_": { + "dataType": "refAlias", + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"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 - "RequestProofOptions": { + "AcceptCredentialRequestOptions": { "dataType": "refObject", "properties": { - "connectionId": {"dataType":"string","required":true}, - "protocolVersion": {"dataType":"string","required":true}, - "proofFormats": {"dataType":"any","required":true}, - "comment": {"dataType":"string","required":true}, - "autoAcceptProof": {"ref":"AutoAcceptProof","required":true}, - "goalCode": {"dataType":"string"}, - "parentThreadId": {"dataType":"string"}, - "willConfirm": {"dataType":"boolean"}, + "credentialRecord": {"ref":"CredentialExchangeRecord","required":true}, + "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormats.acceptRequest_"}, + "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, + "comment": {"dataType":"string"}, }, "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 - "CreateProofRequestOobOptions": { - "dataType": "refObject", - "properties": { - "protocolVersion": {"dataType":"string","required":true}, - "proofFormats": {"dataType":"any","required":true}, - "goalCode": {"dataType":"string"}, - "parentThreadId": {"dataType":"string"}, - "willConfirm": {"dataType":"boolean"}, - "autoAcceptProof": {"ref":"AutoAcceptProof"}, - "comment": {"dataType":"string"}, - "label": {"dataType":"string"}, - "imageUrl": {"dataType":"string"}, - "recipientKey": {"dataType":"string"}, - }, - "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 - "QuestionAnswerRole": { - "dataType": "refEnum", - "enums": ["questioner","responder"], - }, - // 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 - "QuestionAnswerState": { - "dataType": "refEnum", - "enums": ["question-sent","question-received","answer-received","answer-sent"], - }, - // 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 - "ValidResponse": { - "dataType": "refObject", - "properties": { - "text": {"dataType":"string","required":true}, - }, - "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 - "Record_response.string_": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"response":{"dataType":"string","required":true}},"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 - "ProofFormat": { - "dataType": "refObject", - "properties": { - "formatKey": {"dataType":"string","required":true}, - "proofFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"selectCredentialsForRequest":{"dataType":"nestedObjectLiteral","nestedProperties":{"output":{"dataType":"any","required":true},"input":{"dataType":"any","required":true}},"required":true},"getCredentialsForRequest":{"dataType":"nestedObjectLiteral","nestedProperties":{"output":{"dataType":"any","required":true},"input":{"dataType":"any","required":true}},"required":true},"acceptRequest":{"dataType":"any","required":true},"createRequest":{"dataType":"any","required":true},"acceptProposal":{"dataType":"any","required":true},"createProposal":{"dataType":"any","required":true}},"required":true}, - "formatData": {"dataType":"nestedObjectLiteral","nestedProperties":{"presentation":{"dataType":"any","required":true},"request":{"dataType":"any","required":true},"proposal":{"dataType":"any","required":true}},"required":true}, - }, - "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 - "RequestProofProposalOptions": { - "dataType": "refObject", - "properties": { - "connectionId": {"dataType":"string","required":true}, - "proofFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"action":{"dataType":"enum","enums":["createProposal"],"required":true},"formats":{"dataType":"array","array":{"dataType":"refObject","ref":"ProofFormat"},"required":true}},"required":true}, - "goalCode": {"dataType":"string"}, - "parentThreadId": {"dataType":"string"}, - "autoAcceptProof": {"ref":"AutoAcceptProof"}, - "comment": {"dataType":"string"}, - }, - "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 - "AcceptProofProposal": { - "dataType": "refObject", - "properties": { - "proofRecordId": {"dataType":"string","required":true}, - "proofFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"action":{"dataType":"enum","enums":["acceptProposal"],"required":true},"formats":{"dataType":"array","array":{"dataType":"refObject","ref":"ProofFormat"},"required":true}},"required":true}, - "comment": {"dataType":"string"}, - "autoAcceptProof": {"ref":"AutoAcceptProof"}, - "goalCode": {"dataType":"string"}, - "willConfirm": {"dataType":"boolean"}, - }, - "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 - "W3cCredentialRecord": { - "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 - "ConnectionRecord": { - "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 - "ProposeCredentialOptions": { - "dataType": "refObject", - "properties": { - "connectionRecord": {"ref":"ConnectionRecord","required":true}, - "credentialFormats": {"dataType":"nestedObjectLiteral","nestedProperties":{"indy":{"dataType":"nestedObjectLiteral","nestedProperties":{"attributes":{"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"value":{"dataType":"string","required":true},"name":{"dataType":"string","required":true}}},"required":true},"issuerDid":{"dataType":"string","required":true},"credentialDefinitionId":{"dataType":"string","required":true},"schemaVersion":{"dataType":"string","required":true},"schemaName":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true},"schemaIssuerDid":{"dataType":"string","required":true}},"required":true}},"required":true}, - "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, - "comment": {"dataType":"string"}, - "connectionId": {"dataType":"string","required":true}, - }, - "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 - "CredentialFormatPayload_CredentialFormats.acceptProposal_": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"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 - "AcceptCredentialProposalOptions": { - "dataType": "refObject", - "properties": { - "credentialRecordId": {"dataType":"string","required":true}, - "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormats.acceptProposal_"}, - "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, - "comment": {"dataType":"string"}, - }, - "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 - "CredentialFormatPayload_CredentialFormats.acceptOffer_": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"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 - "CredentialOfferOptions": { + "AcceptCredential": { "dataType": "refObject", "properties": { - "credentialRecordId": {"dataType":"string","required":true}, - "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormats.acceptOffer_"}, - "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, - "comment": {"dataType":"string"}, + "credentialRecord": {"ref":"CredentialExchangeRecord","required":true}, }, "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 - "CredentialExchangeRecord": { + "Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__": { "dataType": "refAlias", - "type": {"ref":"Record_string.unknown_","validators":{}}, + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"dataType":"string","required":true},"connectionImageUrl":{"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 - "CredentialFormatPayload_CredentialFormats.acceptRequest_": { + "Omit_TenantConfig.walletConfig_": { "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"dataType":"any"},"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 - "AcceptCredentialRequestOptions": { - "dataType": "refObject", - "properties": { - "credentialRecord": {"ref":"CredentialExchangeRecord","required":true}, - "credentialFormats": {"ref":"CredentialFormatPayload_CredentialFormats.acceptRequest_"}, - "autoAcceptCredential": {"ref":"AutoAcceptCredential"}, - "comment": {"dataType":"string"}, - }, - "additionalProperties": false, + "type": {"ref":"Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__","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 - "AcceptCredential": { + "CreateTenantOptions": { "dataType": "refObject", "properties": { - "credentialRecord": {"ref":"CredentialExchangeRecord","required":true}, + "config": {"ref":"Omit_TenantConfig.walletConfig_","required":true}, + "seed": {"dataType":"string"}, + "method": {"dataType":"string"}, + "role": {"dataType":"string"}, + "endorserDid": {"dataType":"string"}, + "did": {"dataType":"string"}, }, "additionalProperties": false, }, @@ -762,12 +734,18 @@ export function RegisterRoutes(app: Router) { // NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look // Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa // ########################################################################################################### - app.get('/agent', - ...(fetchMiddlewares(AgentController)), - ...(fetchMiddlewares(AgentController.prototype.getAgentInfo)), + app.get('/question-answer', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(QuestionAnswerController)), + ...(fetchMiddlewares(QuestionAnswerController.prototype.getQuestionAnswerRecords)), - async function AgentController_getAgentInfo(request: any, response: any, next: any) { + async function QuestionAnswerController_getQuestionAnswerRecords(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + connectionId: {"in":"query","name":"connectionId","dataType":"string"}, + role: {"in":"query","name":"role","ref":"QuestionAnswerRole"}, + state: {"in":"query","name":"state","ref":"QuestionAnswerState"}, + threadId: {"in":"query","name":"threadId","dataType":"string"}, }; // 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 @@ -778,26 +756,31 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(AgentController); + const controller: any = await container.get(QuestionAnswerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAgentInfo.apply(controller, validatedArgs as any); + const promise = controller.getQuestionAnswerRecords.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.delete('/agent/wallet', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(AgentController)), - ...(fetchMiddlewares(AgentController.prototype.deleteWallet)), + app.post('/question-answer/question/:connectionId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(QuestionAnswerController)), + ...(fetchMiddlewares(QuestionAnswerController.prototype.sendQuestion)), - async function AgentController_deleteWallet(request: any, response: any, next: any) { + async function QuestionAnswerController_sendQuestion(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, + config: {"in":"body","name":"config","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"detail":{"dataType":"string"},"validResponses":{"dataType":"array","array":{"dataType":"refObject","ref":"ValidResponse"},"required":true},"question":{"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 @@ -808,27 +791,31 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(AgentController); + const controller: any = await container.get(QuestionAnswerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.deleteWallet.apply(controller, validatedArgs as any); + const promise = controller.sendQuestion.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/basic-messages/:connectionId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(BasicMessageController)), - ...(fetchMiddlewares(BasicMessageController.prototype.getBasicMessages)), + app.post('/question-answer/answer/:id', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(QuestionAnswerController)), + ...(fetchMiddlewares(QuestionAnswerController.prototype.sendAnswer)), - async function BasicMessageController_getBasicMessages(request: any, response: any, next: any) { + async function QuestionAnswerController_sendAnswer(request: any, response: any, next: any) { const args = { - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, + requestBody: {"in":"body","name":"requestBody","required":true,"ref":"Record_response.string_"}, + 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 @@ -839,30 +826,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(BasicMessageController); + const controller: any = await container.get(QuestionAnswerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getBasicMessages.apply(controller, validatedArgs as any); + const promise = controller.sendAnswer.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/basic-messages/:connectionId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(BasicMessageController)), - ...(fetchMiddlewares(BasicMessageController.prototype.sendMessage)), + app.get('/question-answer/:id', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(QuestionAnswerController)), + ...(fetchMiddlewares(QuestionAnswerController.prototype.getQuestionAnswerRecordById)), - async function BasicMessageController_sendMessage(request: any, response: any, next: any) { + async function QuestionAnswerController_getQuestionAnswerRecordById(request: any, response: any, next: any) { const args = { - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - request: {"in":"body","name":"request","required":true,"ref":"Record_content.string_"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + id: {"in":"path","name":"id","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 @@ -873,32 +859,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(BasicMessageController); + const controller: any = await container.get(QuestionAnswerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.sendMessage.apply(controller, validatedArgs as any); + const promise = controller.getQuestionAnswerRecordById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/connections', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.getAllConnections)), + app.get('/proofs', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.getAllProofs)), - async function ConnectionController_getAllConnections(request: any, response: any, next: any) { + async function ProofController_getAllProofs(request: any, response: any, next: any) { const args = { - outOfBandId: {"in":"query","name":"outOfBandId","dataType":"string"}, - alias: {"in":"query","name":"alias","dataType":"string"}, - state: {"in":"query","name":"state","ref":"DidExchangeState"}, - myDid: {"in":"query","name":"myDid","dataType":"string"}, - theirDid: {"in":"query","name":"theirDid","dataType":"string"}, - theirLabel: {"in":"query","name":"theirLabel","dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + threadId: {"in":"query","name":"threadId","dataType":"string"}, }; // 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 @@ -909,1009 +891,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ConnectionController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAllConnections.apply(controller, validatedArgs as any); + const promise = controller.getAllProofs.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/connections/:connectionId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.getConnectionById)), - - async function ConnectionController_getConnectionById(request: any, response: any, next: any) { - const args = { - connectionId: {"in":"path","name":"connectionId","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + app.get('/proofs/:proofRecordId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.getProofById)), - const controller: any = await container.get(ConnectionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getConnectionById.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.delete('/connections/:connectionId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.deleteConnection)), - - async function ConnectionController_deleteConnection(request: any, response: any, next: any) { - const args = { - connectionId: {"in":"path","name":"connectionId","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(ConnectionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.deleteConnection.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/connections/:connectionId/accept-request', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.acceptRequest)), - - async function ConnectionController_acceptRequest(request: any, response: any, next: any) { - const args = { - connectionId: {"in":"path","name":"connectionId","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(ConnectionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.acceptRequest.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/connections/:connectionId/accept-response', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.acceptResponse)), - - async function ConnectionController_acceptResponse(request: any, response: any, next: any) { - const args = { - connectionId: {"in":"path","name":"connectionId","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(ConnectionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.acceptResponse.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/url/:invitationId', - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.getInvitation)), - - async function ConnectionController_getInvitation(request: any, response: any, next: any) { - const args = { - invitationId: {"in":"path","name":"invitationId","required":true,"dataType":"string"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(ConnectionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/oob', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.getAllOutOfBandRecords)), - - async function OutOfBandController_getAllOutOfBandRecords(request: any, response: any, next: any) { - const args = { - invitationId: {"in":"query","name":"invitationId","ref":"RecordId"}, - }; - - // 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getAllOutOfBandRecords.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/oob/:outOfBandId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.getOutOfBandRecordById)), - - async function OutOfBandController_getOutOfBandRecordById(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getOutOfBandRecordById.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/oob/create-invitation', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.createInvitation)), - - async function OutOfBandController_createInvitation(request: any, response: any, next: any) { - const args = { - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - config: {"in":"body","name":"config","required":true,"ref":"CreateInvitationOptions"}, - }; - - // 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/oob/create-legacy-invitation', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.createLegacyInvitation)), - - async function OutOfBandController_createLegacyInvitation(request: any, response: any, next: any) { - const args = { - 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"}]}, - }; - - // 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createLegacyInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/oob/create-legacy-connectionless-invitation', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.createLegacyConnectionlessInvitation)), - - async function OutOfBandController_createLegacyConnectionlessInvitation(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createLegacyConnectionlessInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/oob/receive-invitation', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.receiveInvitation)), - - async function OutOfBandController_receiveInvitation(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.receiveInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/oob/receive-invitation-url', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.receiveInvitationFromUrl)), - - async function OutOfBandController_receiveInvitationFromUrl(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.receiveInvitationFromUrl.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/oob/:outOfBandId/accept-invitation', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.acceptInvitation)), - - async function OutOfBandController_acceptInvitation(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.acceptInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.delete('/oob/:outOfBandId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.deleteOutOfBandRecord)), - - async function OutOfBandController_deleteOutOfBandRecord(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(OutOfBandController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.deleteOutOfBandRecord.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/credential-definitions/:credentialDefinitionId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(CredentialDefinitionController)), - ...(fetchMiddlewares(CredentialDefinitionController.prototype.getCredentialDefinitionById)), - - async function CredentialDefinitionController_getCredentialDefinitionById(request: any, response: any, next: any) { - const args = { - credentialDefinitionId: {"in":"path","name":"credentialDefinitionId","required":true,"ref":"CredentialDefinitionId"}, - badRequestError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(CredentialDefinitionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getCredentialDefinitionById.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/credential-definitions', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(CredentialDefinitionController)), - ...(fetchMiddlewares(CredentialDefinitionController.prototype.createCredentialDefinition)), - - async function CredentialDefinitionController_createCredentialDefinition(request: any, response: any, next: any) { - const args = { - credentialDefinitionRequest: {"in":"body","name":"credentialDefinitionRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"endorserDid":{"dataType":"string"},"endorse":{"dataType":"boolean"},"tag":{"dataType":"string","required":true},"schemaId":{"ref":"SchemaId","required":true},"issuerId":{"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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(CredentialDefinitionController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createCredentialDefinition.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/schemas/:schemaId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(SchemaController)), - ...(fetchMiddlewares(SchemaController.prototype.getSchemaById)), - - async function SchemaController_getSchemaById(request: any, response: any, next: any) { - const args = { - schemaId: {"in":"path","name":"schemaId","required":true,"ref":"SchemaId"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - forbiddenError: {"in":"res","name":"403","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - badRequestError: {"in":"res","name":"400","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(SchemaController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getSchemaById.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/schemas', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(SchemaController)), - ...(fetchMiddlewares(SchemaController.prototype.createSchema)), - - async function SchemaController_createSchema(request: any, response: any, next: any) { - const args = { - schema: {"in":"body","name":"schema","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"endorserDid":{"dataType":"string"},"endorse":{"dataType":"boolean"},"attributes":{"dataType":"array","array":{"dataType":"string"},"required":true},"version":{"ref":"Version","required":true},"name":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true}}}, - forbiddenError: {"in":"res","name":"400","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(SchemaController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createSchema.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/dids/:did', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(DidController)), - ...(fetchMiddlewares(DidController.prototype.getDidRecordByDid)), - - async function DidController_getDidRecordByDid(request: any, response: any, next: any) { - const args = { - did: {"in":"path","name":"did","required":true,"ref":"Did"}, - }; - - // 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(DidController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getDidRecordByDid.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/dids/write', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(DidController)), - ...(fetchMiddlewares(DidController.prototype.writeDid)), - - async function DidController_writeDid(request: any, response: any, next: any) { - const args = { - createDidOptions: {"in":"body","name":"createDidOptions","required":true,"ref":"DidCreate"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(DidController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.writeDid.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/dids', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(DidController)), - ...(fetchMiddlewares(DidController.prototype.getDids)), - - async function DidController_getDids(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(DidController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getDids.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/create-tenant', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createTenant)), - - async function MultiTenancyController_createTenant(request: any, response: any, next: any) { - const args = { - createTenantOptions: {"in":"body","name":"createTenantOptions","required":true,"ref":"CreateTenantOptions"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createTenant.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/create-did/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createDid)), - - async function MultiTenancyController_createDid(request: any, response: any, next: any) { - const args = { - createDidOptions: {"in":"body","name":"createDidOptions","required":true,"ref":"DidCreate"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createDid.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/multi-tenancy/dids/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getDids)), - - async function MultiTenancyController_getDids(request: any, response: any, next: any) { - const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getDids.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/transactions/set-endorser-role/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.didNymTransaction)), - - async function MultiTenancyController_didNymTransaction(request: any, response: any, next: any) { - const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - didNymTransaction: {"in":"body","name":"didNymTransaction","required":true,"ref":"DidNymTransaction"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.didNymTransaction.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/transactions/endorse/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.endorserTransaction)), - - async function MultiTenancyController_endorserTransaction(request: any, response: any, next: any) { - const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - endorserTransaction: {"in":"body","name":"endorserTransaction","required":true,"ref":"EndorserTransaction"}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - forbiddenError: {"in":"res","name":"400","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.endorserTransaction.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/multi-tenancy/connections/:connectionId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getConnectionById)), - - async function MultiTenancyController_getConnectionById(request: any, response: any, next: any) { - const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - connectionId: {"in":"path","name":"connectionId","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getConnectionById.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/create-invitation/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createInvitation)), - - async function MultiTenancyController_createInvitation(request: any, response: any, next: any) { - const args = { - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - config: {"in":"body","name":"config","ref":"Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_"}, - }; - - // 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/create-legacy-invitation/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createLegacyInvitation)), - - async function MultiTenancyController_createLegacyInvitation(request: any, response: any, next: any) { - const args = { - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - config: {"in":"body","name":"config","dataType":"intersection","subSchemas":[{"ref":"Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_"},{"ref":"RecipientKeyOption"}]}, - }; - - // 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createLegacyInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/receive-invitation/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.receiveInvitation)), - - async function MultiTenancyController_receiveInvitation(request: any, response: any, next: any) { - const args = { - invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationProps"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(MultiTenancyController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.receiveInvitation.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/multi-tenancy/receive-invitation-url/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.receiveInvitationFromUrl)), - - async function MultiTenancyController_receiveInvitationFromUrl(request: any, response: any, next: any) { + async function ProofController_getProofById(request: any, response: any, next: any) { const args = { - invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationByUrlProps"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + proofRecordId: {"in":"path","name":"proofRecordId","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}}}, }; @@ -1923,29 +925,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.receiveInvitationFromUrl.apply(controller, validatedArgs as any); + const promise = controller.getProofById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/oob/:invitationId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getAllOutOfBandRecords)), + app.post('/proofs/propose-proof', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.proposeProof)), - async function MultiTenancyController_getAllOutOfBandRecords(request: any, response: any, next: any) { + async function ProofController_proposeProof(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + requestProofProposalOptions: {"in":"body","name":"requestProofProposalOptions","required":true,"ref":"RequestProofProposalOptions"}, + 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}}}, - invitationId: {"in":"path","name":"invitationId","required":true,"dataType":"string"}, }; // 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 @@ -1956,34 +959,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAllOutOfBandRecords.apply(controller, validatedArgs as any); + const promise = controller.proposeProof.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/connections/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getAllConnections)), + app.post('/proofs/:proofRecordId/accept-proposal', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.acceptProposal)), - async function MultiTenancyController_getAllConnections(request: any, response: any, next: any) { + async function ProofController_acceptProposal(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + acceptProposal: {"in":"body","name":"acceptProposal","required":true,"ref":"AcceptProofProposal"}, + 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}}}, - outOfBandId: {"in":"query","name":"outOfBandId","dataType":"string"}, - alias: {"in":"query","name":"alias","dataType":"string"}, - state: {"in":"query","name":"state","ref":"DidExchangeState"}, - myDid: {"in":"query","name":"myDid","dataType":"string"}, - theirDid: {"in":"query","name":"theirDid","dataType":"string"}, - theirLabel: {"in":"query","name":"theirLabel","dataType":"string"}, }; // 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 @@ -1994,28 +993,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAllConnections.apply(controller, validatedArgs as any); + const promise = controller.acceptProposal.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/url/:tenantId/:invitationId', - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getInvitation)), + app.post('/proofs/request-proof', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.requestProof)), - async function MultiTenancyController_getInvitation(request: any, response: any, next: any) { + async function ProofController_requestProof(request: any, response: any, next: any) { const args = { - invitationId: {"in":"path","name":"invitationId","required":true,"dataType":"string"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + requestProofOptions: {"in":"body","name":"requestProofOptions","required":true,"ref":"RequestProofOptions"}, 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 @@ -2026,29 +1027,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getInvitation.apply(controller, validatedArgs as any); + const promise = controller.requestProof.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/schema/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createSchema)), + app.post('/proofs/create-request-oob', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.createRequest)), - async function MultiTenancyController_createSchema(request: any, response: any, next: any) { + async function ProofController_createRequest(request: any, response: any, next: any) { const args = { - schema: {"in":"body","name":"schema","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"endorserDid":{"dataType":"string"},"endorse":{"dataType":"boolean"},"attributes":{"dataType":"array","array":{"dataType":"string"},"required":true},"version":{"ref":"Version","required":true},"name":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true}}}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - forbiddenError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createRequestOptions: {"in":"body","name":"createRequestOptions","required":true,"ref":"CreateProofRequestOobOptions"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -2060,28 +1060,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createSchema.apply(controller, validatedArgs as any); + const promise = controller.createRequest.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/polygon-wc3/schema/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createPolygonW3CSchema)), + app.post('/proofs/:proofRecordId/accept-request', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.acceptRequest)), - async function MultiTenancyController_createPolygonW3CSchema(request: any, response: any, next: any) { + async function ProofController_acceptRequest(request: any, response: any, next: any) { const args = { - createSchemaRequest: {"in":"body","name":"createSchemaRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"schema":{"dataType":"object","required":true},"schemaName":{"dataType":"string","required":true},"did":{"dataType":"string","required":true}}}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, + requestBody: {"in":"body","name":"requestBody","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"comment":{"dataType":"string"},"filterByNonRevocationRequirements":{"dataType":"boolean"},"filterByPresentationPreview":{"dataType":"boolean"}}}, + 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}}}, }; @@ -2093,32 +1095,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createPolygonW3CSchema.apply(controller, validatedArgs as any); + const promise = controller.acceptRequest.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/polygon-wc3/schema/:did/:schemaId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getPolygonW3CSchemaById)), + app.post('/proofs/:proofRecordId/accept-presentation', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.acceptPresentation)), - async function MultiTenancyController_getPolygonW3CSchemaById(request: any, response: any, next: any) { + async function ProofController_acceptPresentation(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - did: {"in":"path","name":"did","required":true,"dataType":"string"}, - schemaId: {"in":"path","name":"schemaId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, + 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}}}, - badRequestError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - forbiddenError: {"in":"res","name":"401","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 @@ -2129,30 +1129,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getPolygonW3CSchemaById.apply(controller, validatedArgs as any); + const promise = controller.acceptPresentation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/transactions/write/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.writeSchemaAndCredDefOnLedger)), + app.get('/proofs/:proofRecordId/form-data', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ProofController)), + ...(fetchMiddlewares(ProofController.prototype.proofFormData)), - async function MultiTenancyController_writeSchemaAndCredDefOnLedger(request: any, response: any, next: any) { + async function ProofController_proofFormData(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - forbiddenError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, + 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}}}, - writeTransaction: {"in":"body","name":"writeTransaction","required":true,"ref":"WriteTransaction"}, }; // 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 @@ -2163,31 +1163,26 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ProofController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.writeSchemaAndCredDefOnLedger.apply(controller, validatedArgs as any); + const promise = controller.proofFormData.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/schema/:schemaId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getSchemaById)), + app.post('/polygon/create-keys', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(Polygon)), + ...(fetchMiddlewares(Polygon.prototype.createKeyPair)), - async function MultiTenancyController_getSchemaById(request: any, response: any, next: any) { + async function Polygon_createKeyPair(request: any, response: any, next: any) { const args = { - schemaId: {"in":"path","name":"schemaId","required":true,"ref":"SchemaId"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - forbiddenError: {"in":"res","name":"403","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - badRequestError: {"in":"res","name":"400","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}}}, }; @@ -2199,30 +1194,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(Polygon); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getSchemaById.apply(controller, validatedArgs as any); + const promise = controller.createKeyPair.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/credential-definition/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createCredentialDefinition)), + app.post('/polygon/create-schema', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(Polygon)), + ...(fetchMiddlewares(Polygon.prototype.createSchema)), - async function MultiTenancyController_createCredentialDefinition(request: any, response: any, next: any) { + async function Polygon_createSchema(request: any, response: any, next: any) { const args = { - credentialDefinitionRequest: {"in":"body","name":"credentialDefinitionRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"endorserDid":{"dataType":"string"},"endorse":{"dataType":"boolean"},"tag":{"dataType":"string","required":true},"schemaId":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true}}}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createSchemaRequest: {"in":"body","name":"createSchemaRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"schema":{"dataType":"object","required":true},"schemaName":{"dataType":"string","required":true},"did":{"dataType":"string","required":true}}}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, + badRequestError: {"in":"res","name":"400","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 @@ -2233,31 +1228,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(Polygon); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createCredentialDefinition.apply(controller, validatedArgs as any); + const promise = controller.createSchema.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/credential-definition/:credentialDefinitionId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getCredentialDefinitionById)), + app.post('/polygon/estimate-transaction', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(Polygon)), + ...(fetchMiddlewares(Polygon.prototype.estimateTransaction)), - async function MultiTenancyController_getCredentialDefinitionById(request: any, response: any, next: any) { + async function Polygon_estimateTransaction(request: any, response: any, next: any) { const args = { - credentialDefinitionId: {"in":"path","name":"credentialDefinitionId","required":true,"ref":"CredentialDefinitionId"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - badRequestError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + estimateTransactionRequest: {"in":"body","name":"estimateTransactionRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"transaction":{"dataType":"any","required":true},"operation":{"dataType":"any","required":true}}}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, + badRequestError: {"in":"res","name":"400","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 @@ -2268,29 +1262,31 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(Polygon); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getCredentialDefinitionById.apply(controller, validatedArgs as any); + const promise = controller.estimateTransaction.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/credentials/create-offer/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createOffer)), + app.get('/polygon/:did/:schemaId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(Polygon)), + ...(fetchMiddlewares(Polygon.prototype.getSchemaById)), - async function MultiTenancyController_createOffer(request: any, response: any, next: any) { + async function Polygon_getSchemaById(request: any, response: any, next: any) { const args = { - createOfferOptions: {"in":"body","name":"createOfferOptions","required":true,"ref":"CreateOfferOptions"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + did: {"in":"path","name":"did","required":true,"dataType":"string"}, + schemaId: {"in":"path","name":"schemaId","required":true,"dataType":"string"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, + forbiddenError: {"in":"res","name":"401","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 @@ -2301,29 +1297,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(Polygon); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createOffer.apply(controller, validatedArgs as any); + const promise = controller.getSchemaById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/credentials/create-offer-oob/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createOfferOob)), + app.get('/oob', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.getAllOutOfBandRecords)), - async function MultiTenancyController_createOfferOob(request: any, response: any, next: any) { + async function OutOfBandController_getAllOutOfBandRecords(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - createOfferOptions: {"in":"body","name":"createOfferOptions","required":true,"ref":"CreateOfferOobOptions"}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + invitationId: {"in":"query","name":"invitationId","ref":"RecordId"}, }; // 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 @@ -2334,30 +1329,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createOfferOob.apply(controller, validatedArgs as any); + const promise = controller.getAllOutOfBandRecords.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/credentials/accept-offer/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.acceptOffer)), + app.get('/oob/:outOfBandId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.getOutOfBandRecordById)), - async function MultiTenancyController_acceptOffer(request: any, response: any, next: any) { + async function OutOfBandController_getOutOfBandRecordById(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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}}}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - acceptCredentialOfferOptions: {"in":"body","name":"acceptCredentialOfferOptions","required":true,"ref":"AcceptCredentialOfferOptions"}, }; // 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 @@ -2368,30 +1362,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.acceptOffer.apply(controller, validatedArgs as any); + const promise = controller.getOutOfBandRecordById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/credentials/:credentialRecordId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getCredentialById)), + app.post('/oob/create-invitation', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.createInvitation)), - async function MultiTenancyController_getCredentialById(request: any, response: any, next: any) { + async function OutOfBandController_createInvitation(request: any, response: any, next: any) { const args = { - credentialRecordId: {"in":"path","name":"credentialRecordId","required":true,"ref":"RecordId"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, + config: {"in":"body","name":"config","required":true,"ref":"CreateInvitationOptions"}, }; // 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 @@ -2402,30 +1395,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getCredentialById.apply(controller, validatedArgs as any); + const promise = controller.createInvitation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/credentials/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getAllCredentials)), + app.post('/oob/create-legacy-invitation', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.createLegacyInvitation)), - async function MultiTenancyController_getAllCredentials(request: any, response: any, next: any) { + async function OutOfBandController_createLegacyInvitation(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - threadId: {"in":"query","name":"threadId","dataType":"string"}, - connectionId: {"in":"query","name":"connectionId","dataType":"string"}, - state: {"in":"query","name":"state","ref":"CredentialState"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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"}]}, }; // 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 @@ -2436,28 +1428,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAllCredentials.apply(controller, validatedArgs as any); + const promise = controller.createLegacyInvitation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/proofs/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getAllProofs)), + app.post('/oob/create-legacy-connectionless-invitation', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.createLegacyConnectionlessInvitation)), - async function MultiTenancyController_getAllProofs(request: any, response: any, next: any) { + async function OutOfBandController_createLegacyConnectionlessInvitation(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - threadId: {"in":"query","name":"threadId","dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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 @@ -2468,29 +1462,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAllProofs.apply(controller, validatedArgs as any); + const promise = controller.createLegacyConnectionlessInvitation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/form-data/:tenantId/:proofRecordId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.proofFormData)), + app.post('/oob/receive-invitation', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.receiveInvitation)), - async function MultiTenancyController_proofFormData(request: any, response: any, next: any) { + async function OutOfBandController_receiveInvitation(request: any, response: any, next: any) { const args = { - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationProps"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -2502,29 +1495,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.proofFormData.apply(controller, validatedArgs as any); + const promise = controller.receiveInvitation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/proofs/request-proof/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.requestProof)), + app.post('/oob/receive-invitation-url', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.receiveInvitationFromUrl)), - async function MultiTenancyController_requestProof(request: any, response: any, next: any) { + async function OutOfBandController_receiveInvitationFromUrl(request: any, response: any, next: any) { const args = { - requestProofOptions: {"in":"body","name":"requestProofOptions","required":true,"ref":"RequestProofOptions"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationByUrlProps"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -2536,28 +1528,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.requestProof.apply(controller, validatedArgs as any); + const promise = controller.receiveInvitationFromUrl.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/proofs/create-request-oob/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createRequest)), + app.post('/oob/:outOfBandId/accept-invitation', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.acceptInvitation)), - async function MultiTenancyController_createRequest(request: any, response: any, next: any) { + async function OutOfBandController_acceptInvitation(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - createRequestOptions: {"in":"body","name":"createRequestOptions","required":true,"ref":"CreateProofRequestOobOptions"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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}}}, }; @@ -2569,29 +1563,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createRequest.apply(controller, validatedArgs as any); + const promise = controller.acceptInvitation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/proofs/:proofRecordId/accept-request/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.acceptRequest)), + app.delete('/oob/:outOfBandId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(OutOfBandController)), + ...(fetchMiddlewares(OutOfBandController.prototype.deleteOutOfBandRecord)), - async function MultiTenancyController_acceptRequest(request: any, response: any, next: any) { + async function OutOfBandController_deleteOutOfBandRecord(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, - request: {"in":"body","name":"request","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"comment":{"dataType":"string"},"filterByNonRevocationRequirements":{"dataType":"boolean"},"filterByPresentationPreview":{"dataType":"boolean"}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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}}}, }; @@ -2604,30 +1597,27 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(OutOfBandController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.acceptRequest.apply(controller, validatedArgs as any); + const promise = controller.deleteOutOfBandRecord.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/proofs/:proofRecordId/accept-presentation/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.acceptPresentation)), + app.get('/agent/info', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(AgentController)), + ...(fetchMiddlewares(AgentController.prototype.getAgentInfo)), - async function MultiTenancyController_acceptPresentation(request: any, response: any, next: any) { + async function AgentController_getAgentInfo(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, - 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}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, }; // 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 @@ -2638,30 +1628,27 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(AgentController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.acceptPresentation.apply(controller, validatedArgs as any); + const promise = controller.getAgentInfo.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/proofs/:proofRecordId/:tenantId', + app.post('/agent/token', authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getProofById)), + ...(fetchMiddlewares(AgentController)), + ...(fetchMiddlewares(AgentController.prototype.getAgentToken)), - async function MultiTenancyController_getProofById(request: any, response: any, next: any) { + async function AgentController_getAgentToken(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - proofRecordId: {"in":"path","name":"proofRecordId","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}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, }; // 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 @@ -2672,29 +1659,27 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(AgentController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getProofById.apply(controller, validatedArgs as any); + const promise = controller.getAgentToken.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.delete('/multi-tenancy/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.deleteTenantById)), + app.delete('/agent/wallet', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(AgentController)), + ...(fetchMiddlewares(AgentController.prototype.deleteWallet)), - async function MultiTenancyController_deleteTenantById(request: any, response: any, next: any) { + async function AgentController_deleteWallet(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - 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}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, }; // 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 @@ -2705,29 +1690,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(AgentController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.deleteTenantById.apply(controller, validatedArgs as any); + const promise = controller.deleteWallet.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/did/web/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createDidWeb)), + app.get('/basic-messages/:connectionId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(BasicMessageController)), + ...(fetchMiddlewares(BasicMessageController.prototype.getBasicMessages)), - async function MultiTenancyController_createDidWeb(request: any, response: any, next: any) { + async function BasicMessageController_getBasicMessages(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - didOptions: {"in":"body","name":"didOptions","required":true,"ref":"DidCreate"}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, + connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, }; // 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 @@ -2738,28 +1722,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(BasicMessageController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createDidWeb.apply(controller, validatedArgs as any); + const promise = controller.getBasicMessages.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/did/key:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createDidKey)), + app.post('/basic-messages/:connectionId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(BasicMessageController)), + ...(fetchMiddlewares(BasicMessageController.prototype.sendMessage)), - async function MultiTenancyController_createDidKey(request: any, response: any, next: any) { + async function BasicMessageController_sendMessage(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - didOptions: {"in":"body","name":"didOptions","required":true,"ref":"DidCreate"}, + connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, + requestBody: {"in":"body","name":"requestBody","required":true,"ref":"Record_content.string_"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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}}}, }; @@ -2771,31 +1757,33 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(BasicMessageController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createDidKey.apply(controller, validatedArgs as any); + const promise = controller.sendMessage.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/question-answer/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getQuestionAnswerRecords)), + app.get('/connections', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ConnectionController)), + ...(fetchMiddlewares(ConnectionController.prototype.getAllConnections)), - async function MultiTenancyController_getQuestionAnswerRecords(request: any, response: any, next: any) { + async function ConnectionController_getAllConnections(request: any, response: any, next: any) { const args = { - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - connectionId: {"in":"query","name":"connectionId","dataType":"string"}, - role: {"in":"query","name":"role","ref":"QuestionAnswerRole"}, - state: {"in":"query","name":"state","ref":"QuestionAnswerState"}, - threadId: {"in":"query","name":"threadId","dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + outOfBandId: {"in":"query","name":"outOfBandId","dataType":"string"}, + alias: {"in":"query","name":"alias","dataType":"string"}, + state: {"in":"query","name":"state","ref":"DidExchangeState"}, + myDid: {"in":"query","name":"myDid","dataType":"string"}, + theirDid: {"in":"query","name":"theirDid","dataType":"string"}, + theirLabel: {"in":"query","name":"theirLabel","dataType":"string"}, }; // 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 @@ -2806,31 +1794,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ConnectionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getQuestionAnswerRecords.apply(controller, validatedArgs as any); + const promise = controller.getAllConnections.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/question-answer/question/:connectionId/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.sendQuestion)), + app.get('/connections/:connectionId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ConnectionController)), + ...(fetchMiddlewares(ConnectionController.prototype.getConnectionById)), - async function MultiTenancyController_sendQuestion(request: any, response: any, next: any) { + async function ConnectionController_getConnectionById(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - config: {"in":"body","name":"config","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"detail":{"dataType":"string"},"validResponses":{"dataType":"array","array":{"dataType":"refObject","ref":"ValidResponse"},"required":true},"question":{"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 @@ -2841,29 +1827,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ConnectionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.sendQuestion.apply(controller, validatedArgs as any); + const promise = controller.getConnectionById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/multi-tenancy/question-answer/answer/:id/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.sendAnswer)), + app.delete('/connections/:connectionId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ConnectionController)), + ...(fetchMiddlewares(ConnectionController.prototype.deleteConnection)), - async function MultiTenancyController_sendAnswer(request: any, response: any, next: any) { + async function ConnectionController_deleteConnection(request: any, response: any, next: any) { const args = { - id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, - request: {"in":"body","name":"request","required":true,"ref":"Record_response.string_"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + connectionId: {"in":"path","name":"connectionId","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}}}, }; @@ -2876,29 +1861,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ConnectionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.sendAnswer.apply(controller, validatedArgs as any); + const promise = controller.deleteConnection.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/multi-tenancy/question-answer/:id/:tenantId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getQuestionAnswerRecordById)), + app.post('/connections/:connectionId/accept-request', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ConnectionController)), + ...(fetchMiddlewares(ConnectionController.prototype.acceptRequest)), - async function MultiTenancyController_getQuestionAnswerRecordById(request: any, response: any, next: any) { + async function ConnectionController_acceptRequest(request: any, response: any, next: any) { const args = { - id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, - tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + connectionId: {"in":"path","name":"connectionId","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 @@ -2909,27 +1895,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(MultiTenancyController); + const controller: any = await container.get(ConnectionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getQuestionAnswerRecordById.apply(controller, validatedArgs as any); + const promise = controller.acceptRequest.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/proofs', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.getAllProofs)), + app.post('/connections/:connectionId/accept-response', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(ConnectionController)), + ...(fetchMiddlewares(ConnectionController.prototype.acceptResponse)), - async function ProofController_getAllProofs(request: any, response: any, next: any) { + async function ConnectionController_acceptResponse(request: any, response: any, next: any) { const args = { - threadId: {"in":"query","name":"threadId","dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + connectionId: {"in":"path","name":"connectionId","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 @@ -2940,27 +1929,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(ConnectionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getAllProofs.apply(controller, validatedArgs as any); + const promise = controller.acceptResponse.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/proofs/:proofRecordId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.getProofById)), + app.get('/url/:invitationId', + authenticateMiddleware([{"jwt":["skip"]}]), + ...(fetchMiddlewares(ConnectionController)), + ...(fetchMiddlewares(ConnectionController.prototype.getInvitation)), - async function ProofController_getProofById(request: any, response: any, next: any) { + async function ConnectionController_getInvitation(request: any, response: any, next: any) { const args = { - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"ref":"RecordId"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + invitationId: {"in":"path","name":"invitationId","required":true,"dataType":"string"}, 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}}}, }; @@ -2973,27 +1963,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(ConnectionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getProofById.apply(controller, validatedArgs as any); + const promise = controller.getInvitation.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/proofs/propose-proof', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.proposeProof)), + app.get('/credential-definitions/:credentialDefinitionId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(CredentialDefinitionController)), + ...(fetchMiddlewares(CredentialDefinitionController.prototype.getCredentialDefinitionById)), - async function ProofController_proposeProof(request: any, response: any, next: any) { + async function CredentialDefinitionController_getCredentialDefinitionById(request: any, response: any, next: any) { const args = { - requestProofProposalOptions: {"in":"body","name":"requestProofProposalOptions","required":true,"ref":"RequestProofProposalOptions"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + credentialDefinitionId: {"in":"path","name":"credentialDefinitionId","required":true,"ref":"CredentialDefinitionId"}, + badRequestError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"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}}}, }; @@ -3006,27 +1998,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(CredentialDefinitionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.proposeProof.apply(controller, validatedArgs as any); + const promise = controller.getCredentialDefinitionById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/proofs/:proofRecordId/accept-proposal', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.acceptProposal)), + app.post('/credential-definitions', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(CredentialDefinitionController)), + ...(fetchMiddlewares(CredentialDefinitionController.prototype.createCredentialDefinition)), - async function ProofController_acceptProposal(request: any, response: any, next: any) { + async function CredentialDefinitionController_createCredentialDefinition(request: any, response: any, next: any) { const args = { - acceptProposal: {"in":"body","name":"acceptProposal","required":true,"ref":"AcceptProofProposal"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + credentialDefinitionRequest: {"in":"body","name":"credentialDefinitionRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"endorserDid":{"dataType":"string"},"endorse":{"dataType":"boolean"},"tag":{"dataType":"string","required":true},"schemaId":{"ref":"SchemaId","required":true},"issuerId":{"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}}}, }; @@ -3039,28 +2032,31 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(CredentialDefinitionController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.acceptProposal.apply(controller, validatedArgs as any); + const promise = controller.createCredentialDefinition.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/proofs/request-proof', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.requestProof)), + app.get('/schemas/:schemaId', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(SchemaController)), + ...(fetchMiddlewares(SchemaController.prototype.getSchemaById)), - async function ProofController_requestProof(request: any, response: any, next: any) { + async function SchemaController_getSchemaById(request: any, response: any, next: any) { const args = { - requestProofOptions: {"in":"body","name":"requestProofOptions","required":true,"ref":"RequestProofOptions"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + schemaId: {"in":"path","name":"schemaId","required":true,"ref":"SchemaId"}, notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + forbiddenError: {"in":"res","name":"403","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + badRequestError: {"in":"res","name":"400","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}}}, }; @@ -3072,27 +2068,29 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(SchemaController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.requestProof.apply(controller, validatedArgs as any); + const promise = controller.getSchemaById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/proofs/create-request-oob', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.createRequest)), + app.post('/schemas', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(SchemaController)), + ...(fetchMiddlewares(SchemaController.prototype.createSchema)), - async function ProofController_createRequest(request: any, response: any, next: any) { + async function SchemaController_createSchema(request: any, response: any, next: any) { const args = { - createRequestOptions: {"in":"body","name":"createRequestOptions","required":true,"ref":"CreateProofRequestOobOptions"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + schema: {"in":"body","name":"schema","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"endorserDid":{"dataType":"string"},"endorse":{"dataType":"boolean"},"attributes":{"dataType":"array","array":{"dataType":"string"},"required":true},"version":{"ref":"Version","required":true},"name":{"dataType":"string","required":true},"issuerId":{"dataType":"string","required":true}}}, + forbiddenError: {"in":"res","name":"400","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}}}, }; @@ -3104,30 +2102,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(SchemaController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.createRequest.apply(controller, validatedArgs as any); + const promise = controller.createSchema.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/proofs/:proofRecordId/accept-request', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.acceptRequest)), + app.get('/dids/:did', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(DidController)), + ...(fetchMiddlewares(DidController.prototype.getDidRecordByDid)), - async function ProofController_acceptRequest(request: any, response: any, next: any) { + async function DidController_getDidRecordByDid(request: any, response: any, next: any) { const args = { - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, - request: {"in":"body","name":"request","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"comment":{"dataType":"string"},"filterByNonRevocationRequirements":{"dataType":"boolean"},"filterByPresentationPreview":{"dataType":"boolean"}}}, - 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}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + did: {"in":"path","name":"did","required":true,"ref":"Did"}, }; // 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 @@ -3138,28 +2134,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(DidController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.acceptRequest.apply(controller, validatedArgs as any); + const promise = controller.getDidRecordByDid.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/proofs/:proofRecordId/accept-presentation', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.acceptPresentation)), + app.post('/dids/write', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(DidController)), + ...(fetchMiddlewares(DidController.prototype.writeDid)), - async function ProofController_acceptPresentation(request: any, response: any, next: any) { + async function DidController_writeDid(request: any, response: any, next: any) { const args = { - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createDidOptions: {"in":"body","name":"createDidOptions","required":true,"ref":"DidCreate"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -3171,28 +2167,27 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(DidController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.acceptPresentation.apply(controller, validatedArgs as any); + const promise = controller.writeDid.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/proofs/:proofRecordId/form-data', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(ProofController)), - ...(fetchMiddlewares(ProofController.prototype.proofFormData)), + app.get('/dids', + authenticateMiddleware([{"jwt":[]}]), + ...(fetchMiddlewares(DidController)), + ...(fetchMiddlewares(DidController.prototype.getDids)), - async function ProofController_proofFormData(request: any, response: any, next: any) { + async function DidController_getDids(request: any, response: any, next: any) { const args = { - proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -3204,13 +2199,13 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(ProofController); + const controller: any = await container.get(DidController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.proofFormData.apply(controller, validatedArgs as any); + const promise = controller.getDids.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); @@ -3218,12 +2213,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/transactions/endorse', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(EndorserTransactionController)), ...(fetchMiddlewares(EndorserTransactionController.prototype.endorserTransaction)), async function EndorserTransactionController_endorserTransaction(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, endorserTransaction: {"in":"body","name":"endorserTransaction","required":true,"ref":"EndorserTransaction"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, forbiddenError: {"in":"res","name":"400","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, @@ -3251,12 +2247,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/transactions/set-endorser-role', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(EndorserTransactionController)), ...(fetchMiddlewares(EndorserTransactionController.prototype.didNymTransaction)), async function EndorserTransactionController_didNymTransaction(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, didNymTransaction: {"in":"body","name":"didNymTransaction","required":true,"ref":"DidNymTransaction"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -3283,12 +2280,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/transactions/write', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(EndorserTransactionController)), ...(fetchMiddlewares(EndorserTransactionController.prototype.writeSchemaAndCredDefOnLedger)), async function EndorserTransactionController_writeSchemaAndCredDefOnLedger(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, forbiddenError: {"in":"res","name":"400","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}}}, writeTransaction: {"in":"body","name":"writeTransaction","required":true,"ref":"WriteTransaction"}, @@ -3316,12 +2314,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.get('/credentials', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.getAllCredentials)), async function CredentialController_getAllCredentials(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, threadId: {"in":"query","name":"threadId","dataType":"string"}, connectionId: {"in":"query","name":"connectionId","dataType":"string"}, state: {"in":"query","name":"state","ref":"CredentialState"}, @@ -3349,12 +2348,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.get('/credentials/w3c', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.getAllW3c)), async function CredentialController_getAllW3c(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, }; // 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 @@ -3379,13 +2379,14 @@ export function RegisterRoutes(app: Router) { }); // 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 app.get('/credentials/w3c/:id', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.getW3cById)), async function CredentialController_getW3cById(request: any, response: any, next: any) { const args = { id: {"in":"path","name":"id","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, }; // 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 @@ -3410,12 +2411,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.get('/credentials/:credentialRecordId', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.getCredentialById)), async function CredentialController_getCredentialById(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, credentialRecordId: {"in":"path","name":"credentialRecordId","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}}}, @@ -3443,12 +2445,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/propose-credential', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.proposeCredential)), async function CredentialController_proposeCredential(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, proposeCredentialOptions: {"in":"body","name":"proposeCredentialOptions","required":true,"ref":"ProposeCredentialOptions"}, 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}}}, @@ -3476,12 +2479,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/accept-proposal', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.acceptProposal)), async function CredentialController_acceptProposal(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, 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}}}, acceptCredentialProposal: {"in":"body","name":"acceptCredentialProposal","required":true,"ref":"AcceptCredentialProposalOptions"}, @@ -3509,12 +2513,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/create-offer', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.createOffer)), async function CredentialController_createOffer(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, createOfferOptions: {"in":"body","name":"createOfferOptions","required":true,"ref":"CreateOfferOptions"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -3541,12 +2546,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/create-offer-oob', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.createOfferOob)), async function CredentialController_createOfferOob(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, outOfBandOption: {"in":"body","name":"outOfBandOption","required":true,"ref":"CreateOfferOobOptions"}, internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, }; @@ -3573,12 +2579,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/accept-offer', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.acceptOffer)), async function CredentialController_acceptOffer(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, 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}}}, acceptCredentialOfferOptions: {"in":"body","name":"acceptCredentialOfferOptions","required":true,"ref":"CredentialOfferOptions"}, @@ -3606,12 +2613,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/accept-request', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.acceptRequest)), async function CredentialController_acceptRequest(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, 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}}}, acceptCredentialRequestOptions: {"in":"body","name":"acceptCredentialRequestOptions","required":true,"ref":"AcceptCredentialRequestOptions"}, @@ -3639,12 +2647,13 @@ export function RegisterRoutes(app: Router) { }); // 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 app.post('/credentials/accept-credential', - authenticateMiddleware([{"apiKey":[]}]), + authenticateMiddleware([{"jwt":[]}]), ...(fetchMiddlewares(CredentialController)), ...(fetchMiddlewares(CredentialController.prototype.acceptCredential)), async function CredentialController_acceptCredential(request: any, response: any, next: any) { const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, 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}}}, acceptCredential: {"in":"body","name":"acceptCredential","required":true,"ref":"AcceptCredential"}, @@ -3671,148 +2680,17 @@ export function RegisterRoutes(app: Router) { } }); // 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 - app.post('/polygon/create-keys', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(Polygon)), - ...(fetchMiddlewares(Polygon.prototype.createKeyPair)), - - async function Polygon_createKeyPair(request: any, response: any, next: any) { - const args = { - 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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(Polygon); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createKeyPair.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/polygon/create-schema', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(Polygon)), - ...(fetchMiddlewares(Polygon.prototype.createSchema)), - - async function Polygon_createSchema(request: any, response: any, next: any) { - const args = { - createSchemaRequest: {"in":"body","name":"createSchemaRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"schema":{"dataType":"object","required":true},"schemaName":{"dataType":"string","required":true},"did":{"dataType":"string","required":true}}}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - badRequestError: {"in":"res","name":"400","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(Polygon); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.createSchema.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.post('/polygon/estimate-transaction', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(Polygon)), - ...(fetchMiddlewares(Polygon.prototype.estimateTransaction)), - - async function Polygon_estimateTransaction(request: any, response: any, next: any) { - const args = { - estimateTransactionRequest: {"in":"body","name":"estimateTransactionRequest","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"transaction":{"dataType":"any","required":true},"operation":{"dataType":"any","required":true}}}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - badRequestError: {"in":"res","name":"400","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(Polygon); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.estimateTransaction.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/polygon/:did/:schemaId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(Polygon)), - ...(fetchMiddlewares(Polygon.prototype.getSchemaById)), + app.post('/multi-tenancy/create-tenant', + authenticateMiddleware([{"jwt":["multi-tenant"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.createTenant)), - async function Polygon_getSchemaById(request: any, response: any, next: any) { + async function MultiTenancyController_createTenant(request: any, response: any, next: any) { const args = { - did: {"in":"path","name":"did","required":true,"dataType":"string"}, - schemaId: {"in":"path","name":"schemaId","required":true,"dataType":"string"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createTenantOptions: {"in":"body","name":"createTenantOptions","required":true,"ref":"CreateTenantOptions"}, + 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}}}, - forbiddenError: {"in":"res","name":"401","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 - - let validatedArgs: any[] = []; - try { - validatedArgs = getValidatedArgs(args, request, response); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(Polygon); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - - const promise = controller.getSchemaById.apply(controller, validatedArgs as any); - promiseHandler(controller, promise, response, undefined, next); - } catch (err) { - return next(err); - } - }); - // 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 - app.get('/question-answer', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.getQuestionAnswerRecords)), - - async function QuestionAnswerController_getQuestionAnswerRecords(request: any, response: any, next: any) { - const args = { - connectionId: {"in":"query","name":"connectionId","dataType":"string"}, - role: {"in":"query","name":"role","ref":"QuestionAnswerRole"}, - state: {"in":"query","name":"state","ref":"QuestionAnswerState"}, - threadId: {"in":"query","name":"threadId","dataType":"string"}, }; // 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 @@ -3823,28 +2701,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(QuestionAnswerController); + const controller: any = await container.get(MultiTenancyController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getQuestionAnswerRecords.apply(controller, validatedArgs as any); + const promise = controller.createTenant.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/question-answer/question/:connectionId', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.sendQuestion)), + app.get('/multi-tenancy/:tenantId', + authenticateMiddleware([{"jwt":["multi-tenant"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantById)), - async function QuestionAnswerController_sendQuestion(request: any, response: any, next: any) { + async function MultiTenancyController_getTenantById(request: any, response: any, next: any) { const args = { - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - config: {"in":"body","name":"config","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"detail":{"dataType":"string"},"validResponses":{"dataType":"array","array":{"dataType":"refObject","ref":"ValidResponse"},"required":true},"question":{"dataType":"string","required":true}}}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, 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}}}, }; @@ -3857,28 +2735,28 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(QuestionAnswerController); + const controller: any = await container.get(MultiTenancyController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.sendQuestion.apply(controller, validatedArgs as any); + const promise = controller.getTenantById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.post('/question-answer/answer/:id', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.sendAnswer)), + app.post('/multi-tenancy/get-token/:tenantId', + authenticateMiddleware([{"jwt":["multi-tenant"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantToken)), - async function QuestionAnswerController_sendAnswer(request: any, response: any, next: any) { + async function MultiTenancyController_getTenantToken(request: any, response: any, next: any) { const args = { - id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, - request: {"in":"body","name":"request","required":true,"ref":"Record_response.string_"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, 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}}}, }; @@ -3891,28 +2769,30 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(QuestionAnswerController); + const controller: any = await container.get(MultiTenancyController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.sendAnswer.apply(controller, validatedArgs as any); + const promise = controller.getTenantToken.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // 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 - app.get('/question-answer/:id', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.getQuestionAnswerRecordById)), + app.delete('/multi-tenancy/:tenantId', + authenticateMiddleware([{"jwt":["multi-tenant"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.deleteTenantById)), - async function QuestionAnswerController_getQuestionAnswerRecordById(request: any, response: any, next: any) { + async function MultiTenancyController_deleteTenantById(request: any, response: any, next: any) { const args = { - id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + tenantId: {"in":"path","name":"tenantId","required":true,"dataType":"string"}, 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 @@ -3923,13 +2803,13 @@ export function RegisterRoutes(app: Router) { const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(QuestionAnswerController); + const controller: any = await container.get(MultiTenancyController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } - const promise = controller.getQuestionAnswerRecordById.apply(controller, validatedArgs as any); + const promise = controller.deleteTenantById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); diff --git a/src/routes/swagger.json b/src/routes/swagger.json index d36439fd..0014092c 100644 --- a/src/routes/swagger.json +++ b/src/routes/swagger.json @@ -7,71 +7,190 @@ "requestBodies": {}, "responses": {}, "schemas": { - "AgentInfo": { - "properties": { - "label": { - "type": "string" - }, - "endpoints": { - "items": { - "type": "string" - }, - "type": "array" - }, - "isInitialized": { - "type": "boolean" - }, - "publicDid": {} - }, - "required": [ - "label", - "endpoints", - "isInitialized", - "publicDid" - ], - "type": "object", - "additionalProperties": false - }, "Record_string.unknown_": { "properties": {}, - "additionalProperties": {}, "type": "object", "description": "Construct a type with a set of properties K of type T" }, - "BasicMessageRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" + "QuestionAnswerRole": { + "enum": [ + "questioner", + "responder" + ], + "type": "string" + }, + "QuestionAnswerState": { + "description": "QuestionAnswer states inferred from RFC 0113.", + "enum": [ + "question-sent", + "question-received", + "answer-received", + "answer-sent" + ], + "type": "string" }, "RecordId": { "type": "string", "example": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e" }, - "Record_content.string_": { + "ValidResponse": { "properties": { - "content": { + "text": { "type": "string" } }, "required": [ - "content" + "text" + ], + "type": "object", + "additionalProperties": false + }, + "Record_response.string_": { + "properties": { + "response": { + "type": "string" + } + }, + "required": [ + "response" ], "type": "object", "description": "Construct a type with a set of properties K of type T" }, - "DidExchangeState": { - "description": "Connection states as defined in RFC 0023.", + "AutoAcceptProof": { + "description": "Typing of the state for auto acceptance", "enum": [ - "start", - "invitation-sent", - "invitation-received", - "request-sent", - "request-received", - "response-sent", - "response-received", - "abandoned", - "completed" + "always", + "contentApproved", + "never" ], "type": "string" }, + "RequestProofProposalOptions": { + "properties": { + "connectionId": { + "type": "string" + }, + "proofFormats": {}, + "goalCode": { + "type": "string" + }, + "parentThreadId": { + "type": "string" + }, + "autoAcceptProof": { + "$ref": "#/components/schemas/AutoAcceptProof" + }, + "comment": { + "type": "string" + } + }, + "required": [ + "connectionId", + "proofFormats" + ], + "type": "object", + "additionalProperties": false + }, + "AcceptProofProposal": { + "properties": { + "proofRecordId": { + "type": "string" + }, + "proofFormats": {}, + "comment": { + "type": "string" + }, + "autoAcceptProof": { + "$ref": "#/components/schemas/AutoAcceptProof" + }, + "goalCode": { + "type": "string" + }, + "willConfirm": { + "type": "boolean" + } + }, + "required": [ + "proofRecordId", + "proofFormats" + ], + "type": "object", + "additionalProperties": false + }, + "RequestProofOptions": { + "properties": { + "connectionId": { + "type": "string" + }, + "protocolVersion": { + "type": "string" + }, + "proofFormats": {}, + "comment": { + "type": "string" + }, + "autoAcceptProof": { + "$ref": "#/components/schemas/AutoAcceptProof" + }, + "goalCode": { + "type": "string" + }, + "parentThreadId": { + "type": "string" + }, + "willConfirm": { + "type": "boolean" + } + }, + "required": [ + "connectionId", + "protocolVersion", + "proofFormats", + "comment", + "autoAcceptProof" + ], + "type": "object", + "additionalProperties": false + }, + "CreateProofRequestOobOptions": { + "properties": { + "protocolVersion": { + "type": "string" + }, + "proofFormats": {}, + "goalCode": { + "type": "string" + }, + "parentThreadId": { + "type": "string" + }, + "willConfirm": { + "type": "boolean" + }, + "autoAcceptProof": { + "$ref": "#/components/schemas/AutoAcceptProof" + }, + "comment": { + "type": "string" + }, + "label": { + "type": "string" + }, + "imageUrl": { + "type": "string" + }, + "recipientKey": { + "type": "string" + } + }, + "required": [ + "protocolVersion", + "proofFormats" + ], + "type": "object", + "additionalProperties": false + }, "HandshakeProtocol": { "enum": [ "https://didcomm.org/connections/1.0", @@ -381,10 +500,10 @@ }, "Pick_CreateLegacyInvitationConfig.Exclude_keyofCreateLegacyInvitationConfig.routing__": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -524,10 +643,10 @@ }, "Pick_ReceiveOutOfBandInvitationConfig.Exclude_keyofReceiveOutOfBandInvitationConfig.routing__": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -556,10 +675,10 @@ }, "ReceiveInvitationProps": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -590,10 +709,10 @@ }, "ReceiveInvitationByUrlProps": { "properties": { - "label": { + "alias": { "type": "string" }, - "alias": { + "label": { "type": "string" }, "imageUrl": { @@ -646,44 +765,111 @@ "type": "object", "additionalProperties": false }, - "CredentialDefinitionId": { - "type": "string", - "example": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag" - }, - "SchemaId": { - "type": "string", - "example": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0" - }, - "Version": { - "type": "string", - "example": "1.0.0" - }, - "Record_string.any_": { - "properties": {}, - "type": "object", - "description": "Construct a type with a set of properties K of type T" - }, - "DidResolutionMetadata": { + "AgentInfo": { "properties": { - "contentType": { + "label": { "type": "string" }, - "error": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "enum": [ - "invalidDid", - "notFound", - "representationNotSupported", - "unsupportedDidMethod" - ] - } - ] - }, + "endpoints": { + "items": { + "type": "string" + }, + "type": "array" + }, + "isInitialized": { + "type": "boolean" + }, + "publicDid": {} + }, + "required": [ + "label", + "endpoints", + "isInitialized", + "publicDid" + ], + "type": "object", + "additionalProperties": false + }, + "AgentToken": { + "properties": { + "token": { + "type": "string" + } + }, + "required": [ + "token" + ], + "type": "object", + "additionalProperties": false + }, + "BasicMessageRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "Record_content.string_": { + "properties": { + "content": { + "type": "string" + } + }, + "required": [ + "content" + ], + "type": "object", + "description": "Construct a type with a set of properties K of type T" + }, + "DidExchangeState": { + "description": "Connection states as defined in RFC 0023.", + "enum": [ + "start", + "invitation-sent", + "invitation-received", + "request-sent", + "request-received", + "response-sent", + "response-received", + "abandoned", + "completed" + ], + "type": "string" + }, + "CredentialDefinitionId": { + "type": "string", + "example": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag" + }, + "SchemaId": { + "type": "string", + "example": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0" + }, + "Version": { + "type": "string", + "example": "1.0.0" + }, + "Record_string.any_": { + "properties": {}, + "type": "object", + "description": "Construct a type with a set of properties K of type T" + }, + "DidResolutionMetadata": { + "properties": { + "contentType": { + "type": "string" + }, + "error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "enum": [ + "invalidDid", + "notFound", + "representationNotSupported", + "unsupportedDidMethod" + ] + } + ] + }, "message": { "type": "string" } @@ -772,68 +958,6 @@ "type": "object", "additionalProperties": false }, - "Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__": { - "properties": { - "label": { - "type": "string" - }, - "connectionImageUrl": { - "type": "string" - } - }, - "required": [ - "label" - ], - "type": "object", - "description": "From T, pick a set of properties whose keys are in the union K" - }, - "Omit_TenantConfig.walletConfig_": { - "$ref": "#/components/schemas/Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__", - "description": "Construct a type with the properties of T except for those in type K." - }, - "CreateTenantOptions": { - "properties": { - "config": { - "$ref": "#/components/schemas/Omit_TenantConfig.walletConfig_" - }, - "seed": { - "type": "string" - }, - "method": { - "type": "string" - }, - "role": { - "type": "string" - }, - "endorserDid": { - "type": "string" - }, - "did": { - "type": "string" - } - }, - "required": [ - "config" - ], - "type": "object", - "additionalProperties": false - }, - "DidNymTransaction": { - "properties": { - "did": { - "type": "string" - }, - "nymRequest": { - "type": "string" - } - }, - "required": [ - "did", - "nymRequest" - ], - "type": "object", - "additionalProperties": false - }, "EndorserTransaction": { "properties": { "transaction": { @@ -857,45 +981,21 @@ "type": "object", "additionalProperties": false }, - "Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages__": { + "DidNymTransaction": { "properties": { - "label": { - "type": "string" - }, - "alias": { - "type": "string" - }, - "imageUrl": { - "type": "string" - }, - "multiUseInvitation": { - "type": "boolean" - }, - "autoAcceptConnection": { - "type": "boolean" - }, - "goalCode": { + "did": { "type": "string" }, - "goal": { + "nymRequest": { "type": "string" - }, - "handshake": { - "type": "boolean" - }, - "handshakeProtocols": { - "items": { - "$ref": "#/components/schemas/HandshakeProtocol" - }, - "type": "array" } }, + "required": [ + "did", + "nymRequest" + ], "type": "object", - "description": "From T, pick a set of properties whose keys are in the union K" - }, - "Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_": { - "$ref": "#/components/schemas/Pick_CreateOutOfBandInvitationConfig.Exclude_keyofCreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages__", - "description": "Construct a type with the properties of T except for those in type K." + "additionalProperties": false }, "WriteTransaction": { "properties": { @@ -963,6 +1063,29 @@ "type": "object", "additionalProperties": false }, + "CredentialState": { + "description": "Issue Credential states as defined in RFC 0036 and RFC 0453", + "enum": [ + "proposal-sent", + "proposal-received", + "offer-sent", + "offer-received", + "declined", + "request-sent", + "request-received", + "credential-issued", + "credential-received", + "done", + "abandoned" + ], + "type": "string" + }, + "W3cCredentialRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "ConnectionRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, "AutoAcceptCredential": { "description": "Typing of the state for auto acceptance", "enum": [ @@ -972,42 +1095,150 @@ ], "type": "string" }, - "CreateOfferOptions": { - "properties": { - "protocolVersion": { - "type": "string" - }, - "connectionId": { - "type": "string" - }, - "credentialFormats": {}, - "autoAcceptCredential": { - "$ref": "#/components/schemas/AutoAcceptCredential" - }, - "comment": { - "type": "string" - } - }, - "required": [ - "protocolVersion", - "connectionId", - "credentialFormats" - ], - "type": "object", - "additionalProperties": false - }, - "CredentialPreviewAttributeOptions": { + "ProposeCredentialOptions": { "properties": { - "name": { - "type": "string" - }, - "mimeType": { - "type": "string" + "connectionRecord": { + "$ref": "#/components/schemas/ConnectionRecord" }, - "value": { - "type": "string" - } - }, + "credentialFormats": { + "properties": { + "indy": { + "properties": { + "attributes": { + "items": { + "properties": { + "value": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "value", + "name" + ], + "type": "object" + }, + "type": "array" + }, + "issuerDid": { + "type": "string" + }, + "credentialDefinitionId": { + "type": "string" + }, + "schemaVersion": { + "type": "string" + }, + "schemaName": { + "type": "string" + }, + "schemaId": { + "type": "string" + }, + "schemaIssuerDid": { + "type": "string" + } + }, + "required": [ + "attributes", + "issuerDid", + "credentialDefinitionId", + "schemaVersion", + "schemaName", + "schemaId", + "schemaIssuerDid" + ], + "type": "object" + } + }, + "required": [ + "indy" + ], + "type": "object" + }, + "autoAcceptCredential": { + "$ref": "#/components/schemas/AutoAcceptCredential" + }, + "comment": { + "type": "string" + }, + "connectionId": { + "type": "string" + } + }, + "required": [ + "connectionRecord", + "credentialFormats", + "connectionId" + ], + "type": "object", + "additionalProperties": false + }, + "CredentialFormatPayload_CredentialFormats.acceptProposal_": { + "properties": {}, + "additionalProperties": {}, + "type": "object", + "description": "Get the payload for a specific method from a list of CredentialFormat interfaces and a method" + }, + "AcceptCredentialProposalOptions": { + "properties": { + "credentialRecordId": { + "type": "string" + }, + "credentialFormats": { + "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormats.acceptProposal_" + }, + "autoAcceptCredential": { + "$ref": "#/components/schemas/AutoAcceptCredential" + }, + "comment": { + "type": "string" + } + }, + "required": [ + "credentialRecordId" + ], + "type": "object", + "additionalProperties": false + }, + "CreateOfferOptions": { + "properties": { + "protocolVersion": { + "type": "string" + }, + "connectionId": { + "type": "string" + }, + "credentialFormats": {}, + "autoAcceptCredential": { + "$ref": "#/components/schemas/AutoAcceptCredential" + }, + "comment": { + "type": "string" + } + }, + "required": [ + "protocolVersion", + "connectionId", + "credentialFormats" + ], + "type": "object", + "additionalProperties": false + }, + "CredentialPreviewAttributeOptions": { + "properties": { + "name": { + "type": "string" + }, + "mimeType": { + "type": "string" + }, + "value": { + "type": "string" + } + }, "required": [ "name", "value" @@ -1223,25 +1454,25 @@ "type": "object", "additionalProperties": false }, - "CredentialFormatPayload_CredentialFormatsFromProtocols_CredentialProtocol-Array_.acceptOffer_": { + "CredentialFormatPayload_CredentialFormats.acceptOffer_": { "properties": {}, + "additionalProperties": {}, "type": "object", "description": "Get the payload for a specific method from a list of CredentialFormat interfaces and a method" }, - "AcceptCredentialOfferOptions": { - "description": "Interface for CredentialsApi.acceptOffer. Will send a request\n\ncredentialFormats is optional because this is an accept method", + "CredentialOfferOptions": { "properties": { + "credentialRecordId": { + "type": "string" + }, + "credentialFormats": { + "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormats.acceptOffer_" + }, "autoAcceptCredential": { "$ref": "#/components/schemas/AutoAcceptCredential" }, "comment": { "type": "string" - }, - "credentialRecordId": { - "type": "string" - }, - "credentialFormats": { - "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormatsFromProtocols_CredentialProtocol-Array_.acceptOffer_" } }, "required": [ @@ -1250,3097 +1481,188 @@ "type": "object", "additionalProperties": false }, - "CredentialState": { - "description": "Issue Credential states as defined in RFC 0036 and RFC 0453", - "enum": [ - "proposal-sent", - "proposal-received", - "offer-sent", - "offer-received", - "declined", - "request-sent", - "request-received", - "credential-issued", - "credential-received", - "done", - "abandoned" - ], - "type": "string" + "CredentialExchangeRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" }, - "AutoAcceptProof": { - "description": "Typing of the state for auto acceptance", - "enum": [ - "always", - "contentApproved", - "never" - ], - "type": "string" + "CredentialFormatPayload_CredentialFormats.acceptRequest_": { + "properties": {}, + "additionalProperties": {}, + "type": "object", + "description": "Get the payload for a specific method from a list of CredentialFormat interfaces and a method" }, - "RequestProofOptions": { + "AcceptCredentialRequestOptions": { "properties": { - "connectionId": { - "type": "string" + "credentialRecord": { + "$ref": "#/components/schemas/CredentialExchangeRecord" }, - "protocolVersion": { - "type": "string" + "credentialFormats": { + "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormats.acceptRequest_" + }, + "autoAcceptCredential": { + "$ref": "#/components/schemas/AutoAcceptCredential" }, - "proofFormats": {}, "comment": { "type": "string" - }, - "autoAcceptProof": { - "$ref": "#/components/schemas/AutoAcceptProof" - }, - "goalCode": { + } + }, + "required": [ + "credentialRecord" + ], + "type": "object", + "additionalProperties": false + }, + "AcceptCredential": { + "properties": { + "credentialRecord": { + "$ref": "#/components/schemas/CredentialExchangeRecord" + } + }, + "required": [ + "credentialRecord" + ], + "type": "object", + "additionalProperties": false + }, + "Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__": { + "properties": { + "label": { "type": "string" }, - "parentThreadId": { + "connectionImageUrl": { "type": "string" - }, - "willConfirm": { - "type": "boolean" } }, "required": [ - "connectionId", - "protocolVersion", - "proofFormats", - "comment", - "autoAcceptProof" + "label" ], "type": "object", - "additionalProperties": false + "description": "From T, pick a set of properties whose keys are in the union K" }, - "CreateProofRequestOobOptions": { + "Omit_TenantConfig.walletConfig_": { + "$ref": "#/components/schemas/Pick_TenantConfig.Exclude_keyofTenantConfig.walletConfig__", + "description": "Construct a type with the properties of T except for those in type K." + }, + "CreateTenantOptions": { "properties": { - "protocolVersion": { + "config": { + "$ref": "#/components/schemas/Omit_TenantConfig.walletConfig_" + }, + "seed": { "type": "string" }, - "proofFormats": {}, - "goalCode": { + "method": { "type": "string" }, - "parentThreadId": { + "role": { "type": "string" }, - "willConfirm": { - "type": "boolean" - }, - "autoAcceptProof": { - "$ref": "#/components/schemas/AutoAcceptProof" - }, - "comment": { - "type": "string" - }, - "label": { - "type": "string" - }, - "imageUrl": { - "type": "string" - }, - "recipientKey": { - "type": "string" - } - }, - "required": [ - "protocolVersion", - "proofFormats" - ], - "type": "object", - "additionalProperties": false - }, - "QuestionAnswerRole": { - "enum": [ - "questioner", - "responder" - ], - "type": "string" - }, - "QuestionAnswerState": { - "description": "QuestionAnswer states inferred from RFC 0113.", - "enum": [ - "question-sent", - "question-received", - "answer-received", - "answer-sent" - ], - "type": "string" - }, - "ValidResponse": { - "properties": { - "text": { - "type": "string" - } - }, - "required": [ - "text" - ], - "type": "object", - "additionalProperties": false - }, - "Record_response.string_": { - "properties": { - "response": { - "type": "string" - } - }, - "required": [ - "response" - ], - "type": "object", - "description": "Construct a type with a set of properties K of type T" - }, - "ProofFormat": { - "properties": { - "formatKey": { - "type": "string" - }, - "proofFormats": { - "properties": { - "selectCredentialsForRequest": { - "properties": { - "output": {}, - "input": {} - }, - "required": [ - "output", - "input" - ], - "type": "object" - }, - "getCredentialsForRequest": { - "properties": { - "output": {}, - "input": {} - }, - "required": [ - "output", - "input" - ], - "type": "object" - }, - "acceptRequest": {}, - "createRequest": {}, - "acceptProposal": {}, - "createProposal": {} - }, - "required": [ - "selectCredentialsForRequest", - "getCredentialsForRequest", - "acceptRequest", - "createRequest", - "acceptProposal", - "createProposal" - ], - "type": "object" - }, - "formatData": { - "properties": { - "presentation": {}, - "request": {}, - "proposal": {} - }, - "required": [ - "presentation", - "request", - "proposal" - ], - "type": "object" - } - }, - "required": [ - "formatKey", - "proofFormats", - "formatData" - ], - "type": "object", - "additionalProperties": false - }, - "RequestProofProposalOptions": { - "properties": { - "connectionId": { - "type": "string" - }, - "proofFormats": { - "properties": { - "action": { - "type": "string", - "enum": [ - "createProposal" - ], - "nullable": false - }, - "formats": { - "items": { - "$ref": "#/components/schemas/ProofFormat" - }, - "type": "array" - } - }, - "required": [ - "action", - "formats" - ], - "type": "object" - }, - "goalCode": { - "type": "string" - }, - "parentThreadId": { - "type": "string" - }, - "autoAcceptProof": { - "$ref": "#/components/schemas/AutoAcceptProof" - }, - "comment": { - "type": "string" - } - }, - "required": [ - "connectionId", - "proofFormats" - ], - "type": "object", - "additionalProperties": false - }, - "AcceptProofProposal": { - "properties": { - "proofRecordId": { - "type": "string" - }, - "proofFormats": { - "properties": { - "action": { - "type": "string", - "enum": [ - "acceptProposal" - ], - "nullable": false - }, - "formats": { - "items": { - "$ref": "#/components/schemas/ProofFormat" - }, - "type": "array" - } - }, - "required": [ - "action", - "formats" - ], - "type": "object" - }, - "comment": { - "type": "string" - }, - "autoAcceptProof": { - "$ref": "#/components/schemas/AutoAcceptProof" - }, - "goalCode": { - "type": "string" - }, - "willConfirm": { - "type": "boolean" - } - }, - "required": [ - "proofRecordId", - "proofFormats" - ], - "type": "object", - "additionalProperties": false - }, - "W3cCredentialRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "ConnectionRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "ProposeCredentialOptions": { - "properties": { - "connectionRecord": { - "$ref": "#/components/schemas/ConnectionRecord" - }, - "credentialFormats": { - "properties": { - "indy": { - "properties": { - "attributes": { - "items": { - "properties": { - "value": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "value", - "name" - ], - "type": "object" - }, - "type": "array" - }, - "issuerDid": { - "type": "string" - }, - "credentialDefinitionId": { - "type": "string" - }, - "schemaVersion": { - "type": "string" - }, - "schemaName": { - "type": "string" - }, - "schemaId": { - "type": "string" - }, - "schemaIssuerDid": { - "type": "string" - } - }, - "required": [ - "attributes", - "issuerDid", - "credentialDefinitionId", - "schemaVersion", - "schemaName", - "schemaId", - "schemaIssuerDid" - ], - "type": "object" - } - }, - "required": [ - "indy" - ], - "type": "object" - }, - "autoAcceptCredential": { - "$ref": "#/components/schemas/AutoAcceptCredential" - }, - "comment": { - "type": "string" - }, - "connectionId": { - "type": "string" - } - }, - "required": [ - "connectionRecord", - "credentialFormats", - "connectionId" - ], - "type": "object", - "additionalProperties": false - }, - "CredentialFormatPayload_CredentialFormats.acceptProposal_": { - "properties": {}, - "additionalProperties": {}, - "type": "object", - "description": "Get the payload for a specific method from a list of CredentialFormat interfaces and a method" - }, - "AcceptCredentialProposalOptions": { - "properties": { - "credentialRecordId": { - "type": "string" - }, - "credentialFormats": { - "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormats.acceptProposal_" - }, - "autoAcceptCredential": { - "$ref": "#/components/schemas/AutoAcceptCredential" - }, - "comment": { - "type": "string" - } - }, - "required": [ - "credentialRecordId" - ], - "type": "object", - "additionalProperties": false - }, - "CredentialFormatPayload_CredentialFormats.acceptOffer_": { - "properties": {}, - "additionalProperties": {}, - "type": "object", - "description": "Get the payload for a specific method from a list of CredentialFormat interfaces and a method" - }, - "CredentialOfferOptions": { - "properties": { - "credentialRecordId": { - "type": "string" - }, - "credentialFormats": { - "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormats.acceptOffer_" - }, - "autoAcceptCredential": { - "$ref": "#/components/schemas/AutoAcceptCredential" - }, - "comment": { - "type": "string" - } - }, - "required": [ - "credentialRecordId" - ], - "type": "object", - "additionalProperties": false - }, - "CredentialExchangeRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "CredentialFormatPayload_CredentialFormats.acceptRequest_": { - "properties": {}, - "additionalProperties": {}, - "type": "object", - "description": "Get the payload for a specific method from a list of CredentialFormat interfaces and a method" - }, - "AcceptCredentialRequestOptions": { - "properties": { - "credentialRecord": { - "$ref": "#/components/schemas/CredentialExchangeRecord" - }, - "credentialFormats": { - "$ref": "#/components/schemas/CredentialFormatPayload_CredentialFormats.acceptRequest_" - }, - "autoAcceptCredential": { - "$ref": "#/components/schemas/AutoAcceptCredential" - }, - "comment": { - "type": "string" - } - }, - "required": [ - "credentialRecord" - ], - "type": "object", - "additionalProperties": false - }, - "AcceptCredential": { - "properties": { - "credentialRecord": { - "$ref": "#/components/schemas/CredentialExchangeRecord" - } - }, - "required": [ - "credentialRecord" - ], - "type": "object", - "additionalProperties": false - } - }, - "securitySchemes": { - "apiKey": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - } - }, - "info": { - "title": "@aries-framework/rest", - "version": "0.9.4", - "description": "Rest endpoint wrapper for using your agent over HTTP", - "license": { - "name": "Apache-2.0" - }, - "contact": {} - }, - "paths": { - "/agent": { - "get": { - "operationId": "GetAgentInfo", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AgentInfo" - } - } - } - } - }, - "description": "Retrieve basic agent information", - "tags": [ - "Agent" - ], - "security": [], - "parameters": [] - } - }, - "/agent/wallet": { - "delete": { - "operationId": "DeleteWallet", - "responses": { - "204": { - "description": "No content" - } - }, - "description": "Delete wallet", - "tags": [ - "Agent" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [] - } - }, - "/basic-messages/{connectionId}": { - "get": { - "operationId": "GetBasicMessages", - "responses": { - "200": { - "description": "BasicMessageRecord[]", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/BasicMessageRecord" - }, - "type": "array" - }, - "examples": { - "Example 1": { - "value": [ - { - "_tags": { - "role": "sender", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834" - }, - "metadata": {}, - "id": "74bcf865-1fdc-45b4-b517-9def02dfd25f", - "createdAt": "2022-08-18T08:38:40.216Z", - "content": "string", - "sentTime": "2022-08-18T08:38:40.216Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834" - } - ] - } - } - } - } - } - }, - "description": "Retrieve basic messages by connection id", - "tags": [ - "Basic Messages" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - }, - "post": { - "operationId": "SendMessage", - "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" - } - } - } - } - }, - "description": "Send a basic message to a connection", - "tags": [ - "Basic Messages" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Record_content.string_" - } - } - } - } - } - }, - "/connections": { - "get": { - "operationId": "GetAllConnections", - "responses": { - "200": { - "description": "ConnectionRecord[]", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": [ - { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - ] - } - } - } - } - } - }, - "description": "Retrieve all connections records", - "tags": [ - "Connections" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "query", - "name": "outOfBandId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "description": "Alias", - "in": "query", - "name": "alias", - "required": false, - "schema": { - "type": "string" - } - }, - { - "description": "Connection state", - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/DidExchangeState" - } - }, - { - "description": "My DID", - "in": "query", - "name": "myDid", - "required": false, - "schema": { - "type": "string" - } - }, - { - "description": "Their DID", - "in": "query", - "name": "theirDid", - "required": false, - "schema": { - "type": "string" - } - }, - { - "description": "Their label", - "in": "query", - "name": "theirLabel", - "required": false, - "schema": { - "type": "string" - } - } - ] - } - }, - "/connections/{connectionId}": { - "get": { - "operationId": "GetConnectionById", - "responses": { - "200": { - "description": "ConnectionRecord", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - } - }, - "description": "Retrieve connection record by connection id", - "tags": [ - "Connections" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - }, - "delete": { - "operationId": "DeleteConnection", - "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" - } - } - } - } - }, - "description": "Deletes a connection record from the connection repository.", - "tags": [ - "Connections" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - } - }, - "/connections/{connectionId}/accept-request": { - "post": { - "operationId": "AcceptRequest", - "responses": { - "200": { - "description": "ConnectionRecord", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } - } - } - }, - "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 request as inviter by sending a connection response message\nfor the connection with the specified connection id.\n\nThis is not needed when auto accepting of connection is enabled.", - "tags": [ - "Connections" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - } - }, - "/connections/{connectionId}/accept-response": { - "post": { - "operationId": "AcceptResponse", - "responses": { - "200": { - "description": "ConnectionRecord", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } - } - } - }, - "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 response as invitee by sending a trust ping message\nfor the connection with the specified connection id.\n\nThis is not needed when auto accepting of connection is enabled.", - "tags": [ - "Connections" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - } - }, - "/url/{invitationId}": { - "get": { - "operationId": "GetInvitation", - "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" - } - } - } - } - }, - "tags": [ - "Connections" - ], - "security": [], - "parameters": [ - { - "in": "path", - "name": "invitationId", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, - "/oob": { - "get": { - "operationId": "GetAllOutOfBandRecords", - "responses": { - "200": { - "description": "OutOfBandRecord[]", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "type": "array" - }, - "examples": { - "Example 1": { - "value": [ - { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - } - ] - } - } - } - } - } - }, - "description": "Retrieve all out of band records", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "invitation identifier", - "in": "query", - "name": "invitationId", - "required": false, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - } - }, - "/oob/{outOfBandId}": { - "get": { - "operationId": "GetOutOfBandRecordById", - "responses": { - "200": { - "description": "OutOfBandRecord", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - } - } - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - } - }, - "description": "Retrieve an out of band record by id", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "outOfBandId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - }, - "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" - } - } - } - } - }, - "description": "Deletes an out of band record from the repository.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Record identifier", - "in": "path", - "name": "outOfBandId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - } - }, - "/oob/create-invitation": { - "post": { - "operationId": "CreateInvitation", - "responses": { - "200": { - "description": "Out of band record", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "invitationUrl": "string", - "invitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "outOfBandRecord": { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - } - } - } - } - } - } - }, - "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.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "description": "configuration of how out-of-band invitation should be created", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateInvitationOptions", - "description": "configuration of how out-of-band invitation should be created" - } - } - } - } - } - }, - "/oob/create-legacy-invitation": { - "post": { - "operationId": "CreateLegacyInvitation", - "responses": { - "200": { - "description": "out-of-band record and invitation", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "invitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "outOfBandRecord": { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - } - } - } - } - } - } - }, - "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.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "description": "configuration of how a invitation should be created", - "required": false, - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/Omit_CreateLegacyInvitationConfig.routing_" - }, - { - "$ref": "#/components/schemas/RecipientKeyOption" - } - ], - "description": "configuration of how a invitation should be created" - } - } - } - } - } - }, - "/oob/create-legacy-connectionless-invitation": { - "post": { - "operationId": "CreateLegacyConnectionlessInvitation", - "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": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } - } - }, - "description": "Creates a new connectionless legacy invitation.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "description": "configuration of how a connection invitation should be created", - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "domain": { - "type": "string" - }, - "message": { - "$ref": "#/components/schemas/AgentMessageType" - }, - "recordId": { - "type": "string" - } - }, - "required": [ - "domain", - "message", - "recordId" - ], - "type": "object", - "description": "configuration of how a connection invitation should be created" - } - } - } - } - } - }, - "/oob/receive-invitation": { - "post": { - "operationId": "ReceiveInvitation", - "responses": { - "200": { - "description": "out-of-band record and connection record if one has been created.", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "outOfBandRecord": { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - }, - "connectionRecord": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } - } - } - } - }, - "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.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReceiveInvitationProps" - } - } - } - } - } - }, - "/oob/receive-invitation-url": { - "post": { - "operationId": "ReceiveInvitationFromUrl", - "responses": { - "200": { - "description": "out-of-band record and connection record if one has been created.", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "outOfBandRecord": { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - }, - "connectionRecord": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } - } - } - } - }, - "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.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReceiveInvitationByUrlProps" - } - } - } - } - } - }, - "/oob/{outOfBandId}/accept-invitation": { - "post": { - "operationId": "AcceptInvitation", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "outOfBandRecord": { - "_tags": { - "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", - "state": "await-response", - "role": "sender", - "recipientKeyFingerprints": [ - "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" - ] - }, - "outOfBandInvitation": { - "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", - "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", - "label": "Aries Test Agent", - "accept": [ - "didcomm/aip1", - "didcomm/aip2;env=rfc19" - ], - "handshake_protocols": [ - "https://didcomm.org/didexchange/1.0", - "https://didcomm.org/connections/1.0" - ], - "services": [ - { - "id": "#inline-0", - "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", - "type": "did-communication", - "recipientKeys": [ - "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" - ], - "routingKeys": [] - } - ] - }, - "metadata": {}, - "id": "42a95528-0e30-4f86-a462-0efb02178b53", - "createdAt": "2022-01-01T00:00:00.000Z", - "reusable": false - }, - "connectionRecord": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } - } - } - } - }, - "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.", - "tags": [ - "Out Of Band" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "outOfBandId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AcceptInvitationConfig" - } - } - } - } - } - }, - "/credential-definitions/{credentialDefinitionId}": { - "get": { - "operationId": "GetCredentialDefinitionById", - "responses": { - "200": { - "description": "CredDef", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "ver": "1.0", - "id": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag", - "schemaId": "351936", - "type": "CL", - "tag": "definition", - "value": { - "primary": { - "n": "string", - "s": "string", - "r": { - "master_secret": "string", - "string": "string" - }, - "rctxt": "string", - "z": "string" - }, - "revocation": { - "g": "1 string", - "g_dash": "string", - "h": "string", - "h0": "string", - "h1": "string", - "h2": "string", - "htilde": "string", - "h_cap": "string", - "u": "string", - "pk": "string", - "y": "string" - } - } - } - } - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "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": "Retrieve credential definition by credential definition id", - "tags": [ - "Credential Definitions" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "credentialDefinitionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/CredentialDefinitionId" - } - } - ] - } - }, - "/credential-definitions": { - "post": { - "operationId": "CreateCredentialDefinition", - "responses": { - "200": { - "description": "CredDef", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "ver": "1.0", - "id": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag", - "schemaId": "351936", - "type": "CL", - "tag": "definition", - "value": { - "primary": { - "n": "string", - "s": "string", - "r": { - "master_secret": "string", - "string": "string" - }, - "rctxt": "string", - "z": "string" - }, - "revocation": { - "g": "1 string", - "g_dash": "string", - "h": "string", - "h0": "string", - "h1": "string", - "h2": "string", - "htilde": "string", - "h_cap": "string", - "u": "string", - "pk": "string", - "y": "string" - } - } - } - } - } - } - } - }, - "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": "Creates a new credential definition.", - "tags": [ - "Credential Definitions" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "endorserDid": { - "type": "string" - }, - "endorse": { - "type": "boolean" - }, - "tag": { - "type": "string" - }, - "schemaId": { - "$ref": "#/components/schemas/SchemaId" - }, - "issuerId": { - "type": "string" - } - }, - "required": [ - "tag", - "schemaId", - "issuerId" - ], - "type": "object" - } - } - } - } - } - }, - "/schemas/{schemaId}": { - "get": { - "operationId": "GetSchemaById", - "responses": { - "200": { - "description": "Schema", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "ver": "1.0", - "id": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0", - "name": "schema", - "version": "1.0", - "attrNames": [ - "string" - ], - "seqNo": 351936 - } - } - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "403": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "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": "Retrieve schema by schema id", - "tags": [ - "Schemas" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "schemaId", - "required": true, - "schema": { - "$ref": "#/components/schemas/SchemaId" - } - } - ] - } - }, - "/schemas": { - "post": { - "operationId": "CreateSchema", - "responses": { - "200": { - "description": "schema", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "ver": "1.0", - "id": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0", - "name": "schema", - "version": "1.0", - "attrNames": [ - "string" - ], - "seqNo": 351936 - } - } - } - } - } - }, - "400": { - "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": "Creates a new schema and registers schema on ledger", - "tags": [ - "Schemas" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "endorserDid": { - "type": "string" - }, - "endorse": { - "type": "boolean" - }, - "attributes": { - "items": { - "type": "string" - }, - "type": "array" - }, - "version": { - "$ref": "#/components/schemas/Version" - }, - "name": { - "type": "string" - }, - "issuerId": { - "type": "string" - } - }, - "required": [ - "attributes", - "version", - "name", - "issuerId" - ], - "type": "object" - } - } - } - } - } - }, - "/dids/{did}": { - "get": { - "operationId": "GetDidRecordByDid", - "responses": { - "200": { - "description": "DidResolutionResult", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "properties": { - "importDid": {} - }, - "required": [ - "importDid" - ], - "type": "object" - }, - { - "properties": { - "importDid": {}, - "didDocumentMetadata": { - "$ref": "#/components/schemas/DIDDocumentMetadata" - }, - "didResolutionMetadata": { - "$ref": "#/components/schemas/DidResolutionMetadata" - }, - "didDocument": { - "$ref": "#/components/schemas/Record_string.any_" - } - }, - "required": [ - "didDocumentMetadata", - "didResolutionMetadata", - "didDocument" - ], - "type": "object" - } - ] - }, - "examples": { - "Example 1": { - "value": { - "didDocument": { - "@context": [ - "https://w3id.org/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1", - "https://w3id.org/security/suites/x25519-2019/v1" - ], - "id": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", - "verificationMethod": [ - { - "id": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", - "type": "Ed25519VerificationKey2018", - "controller": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", - "publicKeyBase58": "6fioC1zcDPyPEL19pXRS2E4iJ46zH7xP6uSgAaPdwDrx" - } - ], - "authentication": [ - "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" - ], - "assertionMethod": [ - "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" - ], - "capabilityInvocation": [ - "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" - ], - "capabilityDelegation": [ - "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" - ], - "keyAgreement": [ - { - "id": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6LSrdqo4M24WRDJj1h2hXxgtDTyzjjKCiyapYVgrhwZAySn", - "type": "X25519KeyAgreementKey2019", - "controller": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", - "publicKeyBase58": "FxfdY3DCQxVZddKGAtSjZdFW9bCCW7oRwZn1NFJ2Tbg2" - } - ] - }, - "didDocumentMetadata": {}, - "didResolutionMetadata": { - "contentType": "application/did+ld+json" - } - } - } - } - } - } - } - }, - "description": "Resolves did and returns did resolution result", - "tags": [ - "Dids" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Decentralized Identifier", - "in": "path", - "name": "did", - "required": true, - "schema": { - "$ref": "#/components/schemas/Did" - } - } - ] - } - }, - "/dids/write": { - "post": { - "operationId": "WriteDid", - "responses": { - "200": { - "description": "DidResolutionResult", - "content": { - "application/json": { - "schema": {} - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } - } - }, - "description": "Did nym registration", - "tags": [ - "Dids" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidCreate" - } - } - } - } - } - }, - "/dids": { - "get": { - "operationId": "GetDids", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } - } - }, - "tags": [ - "Dids" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [] - } - }, - "/multi-tenancy/create-tenant": { - "post": { - "operationId": "CreateTenant", - "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" - } - } - } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateTenantOptions" - } - } - } - } - } - }, - "/multi-tenancy/create-did/{tenantId}": { - "post": { - "operationId": "CreateDid", - "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" - } - } - } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } + "endorserDid": { + "type": "string" + }, + "did": { + "type": "string" } + }, + "required": [ + "config" ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidCreate" - } - } - } - } + "type": "object", + "additionalProperties": false + } + }, + "securitySchemes": { + "apiKey": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + }, + "jwt": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" } + } + }, + "info": { + "title": "@aries-framework/rest", + "version": "0.9.4", + "description": "Rest endpoint wrapper for using your agent over HTTP", + "license": { + "name": "Apache-2.0" }, - "/multi-tenancy/dids/{tenantId}": { + "contact": {} + }, + "paths": { + "/question-answer": { "get": { - "operationId": "GetDids", + "operationId": "GetQuestionAnswerRecords", "responses": { "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "500": { - "description": "", + "description": "QuestionAnswerRecord[]", "content": { "application/json": { "schema": { - "properties": { - "message": { - "type": "string" - } + "items": { + "$ref": "#/components/schemas/Record_string.unknown_" }, - "required": [ - "message" - ], - "type": "object" + "type": "array" } } } } }, + "description": "Retrieve question and answer records by query", "tags": [ - "MultiTenancy" + "Question Answer" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { - "in": "path", - "name": "tenantId", - "required": true, + "description": "Connection identifier", + "in": "query", + "name": "connectionId", + "required": false, "schema": { "type": "string" } - } - ] - } - }, - "/multi-tenancy/transactions/set-endorser-role/{tenantId}": { - "post": { - "operationId": "DidNymTransaction", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } + { + "description": "Role of the question", + "in": "query", + "name": "role", + "required": false, + "schema": { + "$ref": "#/components/schemas/QuestionAnswerRole" } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ + }, { - "apiKey": [] - } - ], - "parameters": [ + "description": "State of the question", + "in": "query", + "name": "state", + "required": false, + "schema": { + "$ref": "#/components/schemas/QuestionAnswerState" + } + }, { - "in": "path", - "name": "tenantId", - "required": true, + "description": "Thread identifier", + "in": "query", + "name": "threadId", + "required": false, "schema": { "type": "string" } } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidNymTransaction" - } - } - } - } + ] } }, - "/multi-tenancy/transactions/endorse/{tenantId}": { + "/question-answer/question/{connectionId}": { "post": { - "operationId": "EndorserTransaction", + "operationId": "SendQuestion", "responses": { "200": { "description": "Ok", @@ -4350,7 +1672,7 @@ } } }, - "400": { + "404": { "description": "", "content": { "application/json": { @@ -4387,21 +1709,23 @@ } } }, + "description": "Send a question to a connection", "tags": [ - "MultiTenancy" + "Question Answer" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { + "description": "Connection identifier", "in": "path", - "name": "tenantId", + "name": "connectionId", "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ], @@ -4410,41 +1734,40 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EndorserTransaction" + "properties": { + "detail": { + "type": "string" + }, + "validResponses": { + "items": { + "$ref": "#/components/schemas/ValidResponse" + }, + "type": "array" + }, + "question": { + "type": "string" + } + }, + "required": [ + "validResponses", + "question" + ], + "type": "object" } } } } } }, - "/multi-tenancy/connections/{connectionId}/{tenantId}": { - "get": { - "operationId": "GetConnectionById", + "/question-answer/answer/{id}": { + "post": { + "operationId": "SendAnswer", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "_tags": { - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", - "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" - }, - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", - "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", - "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" - } - } - } + "schema": {} } } }, @@ -4465,47 +1788,6 @@ } } } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "connectionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ] - } - }, - "/multi-tenancy/create-invitation/{tenantId}": { - "post": { - "operationId": "CreateInvitation", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } }, "500": { "description": "", @@ -4526,60 +1808,62 @@ } } }, + "description": "Send a answer to question", "tags": [ - "MultiTenancy" + "Question Answer" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { + "description": "The id of the question answer record", "in": "path", - "name": "tenantId", + "name": "id", "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ], "requestBody": { - "required": false, + "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_" + "$ref": "#/components/schemas/Record_response.string_" } } } } } }, - "/multi-tenancy/create-legacy-invitation/{tenantId}": { - "post": { - "operationId": "CreateLegacyInvitation", + "/question-answer/{id}": { + "get": { + "operationId": "GetQuestionAnswerRecordById", "responses": { "200": { - "description": "Ok", + "description": "ConnectionRecord", "content": { "application/json": { "schema": {} } } }, - "500": { + "404": { "description": "", "content": { "application/json": { "schema": { "properties": { - "message": { + "reason": { "type": "string" } }, "required": [ - "message" + "reason" ], "type": "object" } @@ -4587,113 +1871,119 @@ } } }, + "description": "Retrieve question answer record by id", "tags": [ - "MultiTenancy" + "Question Answer" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", + "name": "id", "required": true, "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/Omit_CreateOutOfBandInvitationConfig.routing-or-appendedAttachments-or-messages_" - }, - { - "$ref": "#/components/schemas/RecipientKeyOption" - } - ] - } + "$ref": "#/components/schemas/RecordId" } } - } + ] } }, - "/multi-tenancy/receive-invitation/{tenantId}": { - "post": { - "operationId": "ReceiveInvitation", + "/proofs": { + "get": { + "operationId": "GetAllProofs", "responses": { "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "500": { - "description": "", + "description": "ProofRecord[]", "content": { "application/json": { "schema": { - "properties": { - "message": { - "type": "string" - } + "items": { + "$ref": "#/components/schemas/Record_string.unknown_" }, - "required": [ - "message" - ], - "type": "object" + "type": "array" + }, + "examples": { + "Example 1": { + "value": [ + { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } + ] + } } } } } }, + "description": "Retrieve all proof records", "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { - "in": "path", - "name": "tenantId", - "required": true, + "in": "query", + "name": "threadId", + "required": false, "schema": { "type": "string" } } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReceiveInvitationProps" - } - } - } - } + ] } }, - "/multi-tenancy/receive-invitation-url/{tenantId}": { - "post": { - "operationId": "ReceiveInvitationFromUrl", + "/proofs/{proofRecordId}": { + "get": { + "operationId": "GetProofById", "responses": { "200": { - "description": "Ok", + "description": "ProofRecord", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + } } } }, @@ -4716,45 +2006,66 @@ } } }, + "description": "Retrieve proof record by proof record id", "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", + "name": "proofRecordId", "required": true, "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReceiveInvitationByUrlProps" - } + "$ref": "#/components/schemas/RecordId" } } - } + ] } }, - "/multi-tenancy/oob/{invitationId}/{tenantId}": { - "get": { - "operationId": "GetAllOutOfBandRecords", + "/proofs/propose-proof": { + "post": { + "operationId": "ProposeProof", "responses": { "200": { - "description": "Ok", + "description": "ProofRecord", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } + } + } + } + } + }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + } } } }, @@ -4777,43 +2088,67 @@ } } }, + "description": "Initiate a new presentation exchange as prover by sending a presentation proposal request\nto the connection with the specified connection id.", "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RequestProofProposalOptions" + } + } + } + } + } + }, + "/proofs/{proofRecordId}/accept-proposal": { + "post": { + "operationId": "AcceptProposal", + "responses": { + "200": { + "description": "ProofRecord", + "content": { + "application/json": { + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } + } + } + } } }, - { - "in": "path", - "name": "invitationId", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, - "/multi-tenancy/connections/{tenantId}": { - "get": { - "operationId": "GetAllConnections", - "responses": { - "200": { - "description": "Ok", + "404": { + "description": "", "content": { "application/json": { - "schema": {} + "schema": { + "properties": { + "reason": { + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + } } } }, @@ -4836,83 +2171,49 @@ } } }, + "description": "Accept a presentation proposal as verifier by sending an accept proposal message\nto the connection associated with the proof record.", "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "outOfBandId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "alias", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/DidExchangeState" - } - }, - { - "in": "query", - "name": "myDid", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "theirDid", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "theirLabel", - "required": false, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AcceptProofProposal" + } } } - ] + } } }, - "/multi-tenancy/url/{tenantId}/{invitationId}": { - "get": { - "operationId": "GetInvitation", + "/proofs/request-proof": { + "post": { + "operationId": "RequestProof", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } + } + } } } }, @@ -4933,35 +2234,50 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + } + } + } } }, "tags": [ - "MultiTenancy" + "Proofs" ], - "security": [], - "parameters": [ - { - "in": "path", - "name": "invitationId", - "required": true, - "schema": { - "type": "string" - } - }, + "security": [ { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" + "jwt": [] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RequestProofOptions" + } } } - ] + } } }, - "/multi-tenancy/schema/{tenantId}": { + "/proofs/create-request-oob": { "post": { - "operationId": "CreateSchema", + "operationId": "CreateRequest", "responses": { "200": { "description": "Ok", @@ -4971,24 +2287,6 @@ } } }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, "500": { "description": "", "content": { @@ -5009,73 +2307,65 @@ } }, "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } + "jwt": [] } ], + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "properties": { - "endorserDid": { - "type": "string" - }, - "endorse": { - "type": "boolean" - }, - "attributes": { - "items": { - "type": "string" - }, - "type": "array" - }, - "version": { - "$ref": "#/components/schemas/Version" - }, - "name": { - "type": "string" - }, - "issuerId": { - "type": "string" + "$ref": "#/components/schemas/CreateProofRequestOobOptions" + } + } + } + } + } + }, + "/proofs/{proofRecordId}/accept-request": { + "post": { + "operationId": "AcceptRequest", + "responses": { + "200": { + "description": "ProofRecord", + "content": { + "application/json": { + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } } - }, - "required": [ - "attributes", - "version", - "name", - "issuerId" - ], - "type": "object" + } } } - } - } - } - }, - "/multi-tenancy/polygon-wc3/schema/{tenantId}": { - "post": { - "operationId": "CreatePolygonW3CSchema", - "responses": { - "200": { - "description": "Ok", + }, + "404": { + "description": "", "content": { "application/json": { - "schema": {} + "schema": { + "properties": { + "reason": { + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + } } } }, @@ -5098,18 +2388,19 @@ } } }, + "description": "Accept a presentation request as prover by sending an accept request message\nto the connection associated with the proof record.", "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", + "name": "proofRecordId", "required": true, "schema": { "type": "string" @@ -5122,22 +2413,16 @@ "application/json": { "schema": { "properties": { - "schema": { - "additionalProperties": false, - "type": "object" - }, - "schemaName": { + "comment": { "type": "string" }, - "did": { - "type": "string" + "filterByNonRevocationRequirements": { + "type": "boolean" + }, + "filterByPresentationPreview": { + "type": "boolean" } }, - "required": [ - "schema", - "schemaName", - "did" - ], "type": "object" } } @@ -5145,37 +2430,31 @@ } } }, - "/multi-tenancy/polygon-wc3/schema/{did}/{schemaId}/{tenantId}": { - "get": { - "operationId": "GetPolygonW3CSchemaById", + "/proofs/{proofRecordId}/accept-presentation": { + "post": { + "operationId": "AcceptPresentation", "responses": { "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "400": { - "description": "", + "description": "ProofRecord", "content": { "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" } - }, - "required": [ - "reason" - ], - "type": "object" + } } } } }, - "401": { + "404": { "description": "", "content": { "application/json": { @@ -5212,34 +2491,19 @@ } } }, + "description": "Accept a presentation as prover by sending an accept presentation message\nto the connection associated with the proof record.", "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "did", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "schemaId", + "name": "proofRecordId", "required": true, "schema": { "type": "string" @@ -5248,19 +2512,31 @@ ] } }, - "/multi-tenancy/transactions/write/{tenantId}": { - "post": { - "operationId": "WriteSchemaAndCredDefOnLedger", + "/proofs/{proofRecordId}/form-data": { + "get": { + "operationId": "ProofFormData", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", + "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", + "protocolVersion": "v1" + } + } + } } } }, - "400": { + "404": { "description": "", "content": { "application/json": { @@ -5298,41 +2574,92 @@ } }, "tags": [ - "MultiTenancy" + "Proofs" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", + "name": "proofRecordId", "required": true, "schema": { "type": "string" } } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WriteTransaction" + ] + } + }, + "/polygon/create-keys": { + "post": { + "operationId": "CreateKeyPair", + "responses": { + "200": { + "description": "Secp256k1KeyPair", + "content": { + "application/json": { + "schema": { + "properties": { + "address": { + "type": "string" + }, + "publicKeyBase58": { + "type": "string" + }, + "privateKey": { + "type": "string" + } + }, + "required": [ + "address", + "publicKeyBase58", + "privateKey" + ], + "type": "object" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + } } } } - } + }, + "description": "Create Secp256k1 key pair for polygon DID", + "tags": [ + "Polygon" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [] } }, - "/multi-tenancy/schema/{schemaId}/{tenantId}": { - "get": { - "operationId": "GetSchemaById", + "/polygon/create-schema": { + "post": { + "operationId": "CreateSchema", "responses": { "200": { - "description": "Ok", + "description": "Schema JSON", "content": { "application/json": { "schema": {} @@ -5357,25 +2684,77 @@ } } }, - "403": { + "500": { "description": "", "content": { "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + } + } + } + } + }, + "description": "Create polygon based W3C schema", + "tags": [ + "Polygon" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "schema": { + "additionalProperties": false, + "type": "object" + }, + "schemaName": { + "type": "string" + }, + "did": { + "type": "string" + } + }, + "required": [ + "schema", + "schemaName", + "did" + ], + "type": "object" + } + } + } + } + } + }, + "/polygon/estimate-transaction": { + "post": { + "operationId": "EstimateTransaction", + "responses": { + "200": { + "description": "Transaction Object", + "content": { + "application/json": { + "schema": {} } } }, - "404": { + "400": { "description": "", "content": { "application/json": { @@ -5412,47 +2791,49 @@ } } }, + "description": "Estimate transaction", "tags": [ - "MultiTenancy" + "Polygon" ], "security": [ { - "apiKey": [] + "jwt": [] } ], - "parameters": [ - { - "in": "path", - "name": "schemaId", - "required": true, - "schema": { - "$ref": "#/components/schemas/SchemaId" - } - }, - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "transaction": {}, + "operation": {} + }, + "required": [ + "transaction", + "operation" + ], + "type": "object" + } } } - ] + } } }, - "/multi-tenancy/credential-definition/{tenantId}": { - "post": { - "operationId": "CreateCredentialDefinition", + "/polygon/{did}/{schemaId}": { + "get": { + "operationId": "GetSchemaById", "responses": { "200": { - "description": "Ok", + "description": "Schema Object", "content": { "application/json": { "schema": {} } } }, - "404": { + "401": { "description": "", "content": { "application/json": { @@ -5489,84 +2870,169 @@ } } }, + "description": "Fetch schema details", "tags": [ - "MultiTenancy" + "Polygon" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", + "name": "did", "required": true, "schema": { "type": "string" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "endorserDid": { - "type": "string" - }, - "endorse": { - "type": "boolean" - }, - "tag": { - "type": "string" - }, - "schemaId": { - "type": "string" - }, - "issuerId": { - "type": "string" - } - }, - "required": [ - "tag", - "schemaId", - "issuerId" - ], - "type": "object" - } + }, + { + "in": "path", + "name": "schemaId", + "required": true, + "schema": { + "type": "string" } } - } + ] } }, - "/multi-tenancy/credential-definition/{credentialDefinitionId}/{tenantId}": { + "/oob": { "get": { - "operationId": "GetCredentialDefinitionById", + "operationId": "GetAllOutOfBandRecords", "responses": { "200": { - "description": "Ok", + "description": "OutOfBandRecord[]", "content": { "application/json": { - "schema": {} + "schema": { + "items": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "type": "array" + }, + "examples": { + "Example 1": { + "value": [ + { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false + } + ] + } + } } } - }, - "400": { - "description": "", + } + }, + "description": "Retrieve all out of band records", + "tags": [ + "Out Of Band" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [ + { + "description": "invitation identifier", + "in": "query", + "name": "invitationId", + "required": false, + "schema": { + "$ref": "#/components/schemas/RecordId" + } + } + ] + } + }, + "/oob/{outOfBandId}": { + "get": { + "operationId": "GetOutOfBandRecordById", + "responses": { + "200": { + "description": "OutOfBandRecord", "content": { "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" + "schema": {}, + "examples": { + "Example 1": { + "value": { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false } - }, - "required": [ - "reason" - ], - "type": "object" + } } } } @@ -5588,57 +3054,30 @@ } } } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, + "description": "Retrieve an out of band record by id", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "credentialDefinitionId", - "required": true, - "schema": { - "$ref": "#/components/schemas/CredentialDefinitionId" - } - }, - { - "in": "path", - "name": "tenantId", + "name": "outOfBandId", "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ] - } - }, - "/multi-tenancy/credentials/create-offer/{tenantId}": { - "post": { - "operationId": "CreateOffer", + }, + "delete": { + "operationId": "DeleteOutOfBandRecord", "responses": { "200": { "description": "Ok", @@ -5648,6 +3087,24 @@ } } }, + "404": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + } + } + } + }, "500": { "description": "", "content": { @@ -5667,45 +3124,106 @@ } } }, + "description": "Deletes an out of band record from the repository.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { + "description": "Record identifier", "in": "path", - "name": "tenantId", + "name": "outOfBandId", "required": true, "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateOfferOptions" - } + "$ref": "#/components/schemas/RecordId" } } - } + ] } }, - "/multi-tenancy/credentials/create-offer-oob/{tenantId}": { + "/oob/create-invitation": { "post": { - "operationId": "CreateOfferOob", + "operationId": "CreateInvitation", "responses": { "200": { - "description": "Ok", + "description": "Out of band record", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "invitationUrl": "string", + "invitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "outOfBandRecord": { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false + } + } + } + } } } }, @@ -5728,62 +3246,106 @@ } } }, + "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.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } + "jwt": [] } ], + "parameters": [], "requestBody": { + "description": "configuration of how out-of-band invitation should be created", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateOfferOobOptions" + "$ref": "#/components/schemas/CreateInvitationOptions", + "description": "configuration of how out-of-band invitation should be created" } } } } } }, - "/multi-tenancy/credentials/accept-offer/{tenantId}": { + "/oob/create-legacy-invitation": { "post": { - "operationId": "AcceptOffer", + "operationId": "CreateLegacyInvitation", "responses": { "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "404": { - "description": "", + "description": "out-of-band record and invitation", "content": { "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" + "schema": {}, + "examples": { + "Example 1": { + "value": { + "invitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "outOfBandRecord": { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false + } } - }, - "required": [ - "reason" - ], - "type": "object" + } } } } @@ -5807,229 +3369,54 @@ } } }, + "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.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } + "jwt": [] } ], + "parameters": [], "requestBody": { - "required": true, + "description": "configuration of how a invitation should be created", + "required": false, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AcceptCredentialOfferOptions" - } - } - } - } - } - }, - "/multi-tenancy/credentials/{credentialRecordId}/{tenantId}": { - "get": { - "operationId": "GetCredentialById", - "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" - } + "allOf": [ + { + "$ref": "#/components/schemas/Omit_CreateLegacyInvitationConfig.routing_" }, - "required": [ - "message" - ], - "type": "object" - } - } - } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "credentialRecordId", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } - }, - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, - "/multi-tenancy/credentials/{tenantId}": { - "get": { - "operationId": "GetAllCredentials", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "threadId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "connectionId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/CredentialState" - } - } - ] - } - }, - "/multi-tenancy/proofs/{tenantId}": { - "get": { - "operationId": "GetAllProofs", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} + { + "$ref": "#/components/schemas/RecipientKeyOption" + } + ], + "description": "configuration of how a invitation should be created" } } } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "threadId", - "required": false, - "schema": { - "type": "string" - } - } - ] + } } }, - "/multi-tenancy/form-data/{tenantId}/{proofRecordId}": { - "get": { - "operationId": "ProofFormData", + "/oob/create-legacy-connectionless-invitation": { + "post": { + "operationId": "CreateLegacyConnectionlessInvitation", "responses": { "200": { - "description": "Ok", + "description": "a message and a invitationUrl", "content": { "application/json": { "schema": {}, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "message": { + "@id": "eac4ff4e-b4fb-4c1d-aef3-b29c89d1cc00", + "@type": "https://didcomm.org/connections/1.0/invitation" + }, + "invitationUrl": "http://example.com/invitation_url" } } } @@ -6073,76 +3460,117 @@ } } }, + "description": "Creates a new connectionless legacy invitation.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] + "jwt": [] } ], - "parameters": [ - { - "in": "path", - "name": "proofRecordId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "description": "configuration of how a connection invitation should be created", + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "domain": { + "type": "string" + }, + "message": { + "$ref": "#/components/schemas/AgentMessageType" + }, + "recordId": { + "type": "string" + } + }, + "required": [ + "domain", + "message", + "recordId" + ], + "type": "object", + "description": "configuration of how a connection invitation should be created" + } } } - ] + } } }, - "/multi-tenancy/proofs/request-proof/{tenantId}": { + "/oob/receive-invitation": { "post": { - "operationId": "RequestProof", + "operationId": "ReceiveInvitation", "responses": { "200": { - "description": "Ok", + "description": "out-of-band record and connection record if one has been created.", "content": { "application/json": { "schema": {}, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "outOfBandRecord": { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false + }, + "connectionRecord": { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } } } } } } }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, "500": { "description": "", "content": { @@ -6162,45 +3590,96 @@ } } }, + "description": "Creates inbound out-of-band record and assigns out-of-band invitation message to it if the\nmessage is valid.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } + "jwt": [] } ], + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RequestProofOptions" + "$ref": "#/components/schemas/ReceiveInvitationProps" } } } } } }, - "/multi-tenancy/proofs/create-request-oob/{tenantId}": { + "/oob/receive-invitation-url": { "post": { - "operationId": "CreateRequest", + "operationId": "ReceiveInvitationFromUrl", "responses": { "200": { - "description": "Ok", + "description": "out-of-band record and connection record if one has been created.", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "outOfBandRecord": { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false + }, + "connectionRecord": { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } + } + } + } } } }, @@ -6223,39 +3702,31 @@ } } }, + "description": "Creates inbound out-of-band record and assigns out-of-band invitation message to it if the\nmessage is valid.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } + "jwt": [] } ], + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateProofRequestOobOptions" + "$ref": "#/components/schemas/ReceiveInvitationByUrlProps" } } } } } }, - "/multi-tenancy/proofs/{proofRecordId}/accept-request/{tenantId}": { + "/oob/{outOfBandId}/accept-invitation": { "post": { - "operationId": "AcceptRequest", + "operationId": "AcceptInvitation", "responses": { "200": { "description": "Ok", @@ -6265,12 +3736,59 @@ "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "outOfBandRecord": { + "_tags": { + "invitationId": "1cbd22e4-1906-41e9-8807-83d84437f978", + "state": "await-response", + "role": "sender", + "recipientKeyFingerprints": [ + "z6MktUCPZjfRJXD4GMcYuXiqX2qZ8vBw6UAYpDFiHEUfwuLj" + ] + }, + "outOfBandInvitation": { + "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/out-of-band/1.1/invitation", + "@id": "d6472943-e5d0-4d95-8b48-790ed5a41931", + "label": "Aries Test Agent", + "accept": [ + "didcomm/aip1", + "didcomm/aip2;env=rfc19" + ], + "handshake_protocols": [ + "https://didcomm.org/didexchange/1.0", + "https://didcomm.org/connections/1.0" + ], + "services": [ + { + "id": "#inline-0", + "serviceEndpoint": "https://6b77-89-20-162-146.ngrok.io", + "type": "did-communication", + "recipientKeys": [ + "did:key:z6MkmTBHTWrvLPN8pBmUj7Ye5ww9GiacXCYMNVvpScSpf1DM" + ], + "routingKeys": [] + } + ] + }, + "metadata": {}, + "id": "42a95528-0e30-4f86-a462-0efb02178b53", + "createdAt": "2022-01-01T00:00:00.000Z", + "reusable": false + }, + "connectionRecord": { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } } } } @@ -6314,29 +3832,22 @@ } } }, + "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.", "tags": [ - "MultiTenancy" + "Out Of Band" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "proofRecordId", + "name": "outOfBandId", "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ], @@ -6345,134 +3856,159 @@ "content": { "application/json": { "schema": { - "properties": { - "comment": { - "type": "string" - }, - "filterByNonRevocationRequirements": { - "type": "boolean" - }, - "filterByPresentationPreview": { - "type": "boolean" - } - }, - "type": "object" + "$ref": "#/components/schemas/AcceptInvitationConfig" } } } } } }, - "/multi-tenancy/proofs/{proofRecordId}/accept-presentation/{tenantId}": { - "post": { - "operationId": "AcceptPresentation", + "/agent/info": { + "get": { + "operationId": "GetAgentInfo", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" - } - } + "schema": { + "$ref": "#/components/schemas/AgentInfo" } } } - }, - "404": { - "description": "", + } + }, + "description": "Retrieve basic agent information", + "tags": [ + "Agent" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [] + } + }, + "/agent/token": { + "post": { + "operationId": "GetAgentToken", + "responses": { + "200": { + "description": "Ok", "content": { "application/json": { "schema": { - "properties": { - "reason": { + "anyOf": [ + { + "$ref": "#/components/schemas/AgentToken" + }, + { "type": "string" } - }, - "required": [ - "reason" - ], - "type": "object" + ] } } } - }, - "500": { - "description": "", + } + }, + "description": "Retrieve agent token", + "tags": [ + "Agent" + ], + "security": [ + { + "apiKey": [] + } + ], + "parameters": [] + } + }, + "/agent/wallet": { + "delete": { + "operationId": "DeleteWallet", + "responses": { + "204": { + "description": "No content" + } + }, + "description": "Delete wallet", + "tags": [ + "Agent" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [] + } + }, + "/basic-messages/{connectionId}": { + "get": { + "operationId": "GetBasicMessages", + "responses": { + "200": { + "description": "BasicMessageRecord[]", "content": { "application/json": { "schema": { - "properties": { - "message": { - "type": "string" - } + "items": { + "$ref": "#/components/schemas/BasicMessageRecord" }, - "required": [ - "message" - ], - "type": "object" + "type": "array" + }, + "examples": { + "Example 1": { + "value": [ + { + "_tags": { + "role": "sender", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834" + }, + "metadata": {}, + "id": "74bcf865-1fdc-45b4-b517-9def02dfd25f", + "createdAt": "2022-08-18T08:38:40.216Z", + "content": "string", + "sentTime": "2022-08-18T08:38:40.216Z", + "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834" + } + ] + } } } } } }, + "description": "Retrieve basic messages by connection id", "tags": [ - "MultiTenancy" + "Basic Messages" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { + "description": "Connection identifier", "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "proofRecordId", + "name": "connectionId", "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ] - } - }, - "/multi-tenancy/proofs/{proofRecordId}/{tenantId}": { - "get": { - "operationId": "GetProofById", + }, + "post": { + "operationId": "SendMessage", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" - } - } - } + "schema": {} } } }, @@ -6513,43 +4049,166 @@ } } }, + "description": "Send a basic message to a connection", + "tags": [ + "Basic Messages" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [ + { + "description": "Connection identifier", + "in": "path", + "name": "connectionId", + "required": true, + "schema": { + "$ref": "#/components/schemas/RecordId" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Record_content.string_" + } + } + } + } + } + }, + "/connections": { + "get": { + "operationId": "GetAllConnections", + "responses": { + "200": { + "description": "ConnectionRecord[]", + "content": { + "application/json": { + "schema": {}, + "examples": { + "Example 1": { + "value": [ + { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } + ] + } + } + } + } + } + }, + "description": "Retrieve all connections records", "tags": [ - "MultiTenancy" + "Connections" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { - "in": "path", - "name": "tenantId", - "required": true, + "in": "query", + "name": "outOfBandId", + "required": false, "schema": { "type": "string" } }, { - "in": "path", - "name": "proofRecordId", - "required": true, + "description": "Alias", + "in": "query", + "name": "alias", + "required": false, "schema": { - "$ref": "#/components/schemas/RecordId" + "type": "string" + } + }, + { + "description": "Connection state", + "in": "query", + "name": "state", + "required": false, + "schema": { + "$ref": "#/components/schemas/DidExchangeState" + } + }, + { + "description": "My DID", + "in": "query", + "name": "myDid", + "required": false, + "schema": { + "type": "string" + } + }, + { + "description": "Their DID", + "in": "query", + "name": "theirDid", + "required": false, + "schema": { + "type": "string" + } + }, + { + "description": "Their label", + "in": "query", + "name": "theirLabel", + "required": false, + "schema": { + "type": "string" } } ] } }, - "/multi-tenancy/{tenantId}": { - "delete": { - "operationId": "DeleteTenantById", + "/connections/{connectionId}": { + "get": { + "operationId": "GetConnectionById", "responses": { "200": { - "description": "Ok", + "description": "ConnectionRecord", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } + } + } } } }, @@ -6570,49 +4229,31 @@ } } } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } } }, + "description": "Retrieve connection record by connection id", "tags": [ - "MultiTenancy" + "Connections" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { + "description": "Connection identifier", "in": "path", - "name": "tenantId", + "name": "connectionId", "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ] - } - }, - "/multi-tenancy/did/web/{tenantId}": { - "post": { - "operationId": "CreateDidWeb", + }, + "delete": { + "operationId": "DeleteConnection", "responses": { "200": { "description": "Ok", @@ -6622,66 +4263,23 @@ } } }, - "500": { + "404": { "description": "", "content": { "application/json": { "schema": { "properties": { - "message": { + "reason": { "type": "string" } }, "required": [ - "message" + "reason" ], "type": "object" } } } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidCreate" - } - } - } - } - } - }, - "/multi-tenancy/did/key{tenantId}": { - "post": { - "operationId": "CreateDidKey", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } }, "500": { "description": "", @@ -6702,121 +4300,56 @@ } } }, + "description": "Deletes a connection record from the connection repository.", "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DidCreate" - } - } - } - } - } - }, - "/multi-tenancy/question-answer/{tenantId}": { - "get": { - "operationId": "GetQuestionAnswerRecords", - "responses": { - "200": { - "description": "QuestionAnswerRecord[]", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "type": "array" - } - } - } - } - }, - "description": "Retrieve question and answer records by query", - "tags": [ - "MultiTenancy" + "Connections" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ - { - "description": "Tenant identifier", - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - }, - { - "description": "Connection identifier", - "in": "query", - "name": "connectionId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "description": "Role of the question", - "in": "query", - "name": "role", - "required": false, - "schema": { - "$ref": "#/components/schemas/QuestionAnswerRole" - } - }, - { - "description": "State of the question", - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/QuestionAnswerState" - } - }, - { - "description": "Thread identifier", - "in": "query", - "name": "threadId", - "required": false, + { + "description": "Connection identifier", + "in": "path", + "name": "connectionId", + "required": true, "schema": { - "type": "string" + "$ref": "#/components/schemas/RecordId" } } ] } }, - "/multi-tenancy/question-answer/question/{connectionId}/{tenantId}": { + "/connections/{connectionId}/accept-request": { "post": { - "operationId": "SendQuestion", + "operationId": "AcceptRequest", "responses": { "200": { - "description": "Ok", + "description": "ConnectionRecord", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } + } + } } } }, @@ -6857,13 +4390,13 @@ } } }, - "description": "Send a question to a connection", + "description": "Accept a connection request as inviter by sending a connection response message\nfor the connection with the specified connection id.\n\nThis is not needed when auto accepting of connection is enabled.", "tags": [ - "MultiTenancy" + "Connections" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ @@ -6875,56 +4408,38 @@ "schema": { "$ref": "#/components/schemas/RecordId" } - }, - { - "description": "Tenant identifier", - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "detail": { - "type": "string" - }, - "validResponses": { - "items": { - "$ref": "#/components/schemas/ValidResponse" - }, - "type": "array" - }, - "question": { - "type": "string" - } - }, - "required": [ - "validResponses", - "question" - ], - "type": "object" - } - } } - } + ] } }, - "/multi-tenancy/question-answer/answer/{id}/{tenantId}": { + "/connections/{connectionId}/accept-response": { "post": { - "operationId": "SendAnswer", + "operationId": "AcceptResponse", "responses": { "200": { - "description": "Ok", + "description": "ConnectionRecord", "content": { "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "_tags": { + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationKey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d", + "verkey": "9HG4rJFpLiWf56MWxHj9rgdpErFzim2zEpHuxy1dw7oz" + }, + "metadata": {}, + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "did": "did:peer:1zQmfQh1T3rSqarP2FZ37uKjdQHPKFdVyo2mGiAPHZ8Ep7hv", + "invitationDid": "did:peer:2.SeyJzIjoiaHR0cHM6Ly9kYTIzLTg5LTIwLTE2Mi0xNDYubmdyb2suaW8iLCJ0IjoiZGlkLWNvbW11bmljYXRpb24iLCJwcmlvcml0eSI6MCwicmVjaXBpZW50S2V5cyI6WyJkaWQ6a2V5Ono2TWtualg3U1lXRmdHMThCYkNEZHJnemhuQnA0UlhyOGVITHZxQ3FvRXllckxiTiN6Nk1rbmpYN1NZV0ZnRzE4QmJDRGRyZ3pobkJwNFJYcjhlSEx2cUNxb0V5ZXJMYk4iXSwiciI6W119", + "outOfBandId": "edbc89fe-785f-4774-a288-46012486881d" + } + } + } } } }, @@ -6965,53 +4480,34 @@ } } }, - "description": "Send a answer to question", + "description": "Accept a connection response as invitee by sending a trust ping message\nfor the connection with the specified connection id.\n\nThis is not needed when auto accepting of connection is enabled.", "tags": [ - "MultiTenancy" + "Connections" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { - "description": "Question Answer Record identifier", + "description": "Connection identifier", "in": "path", - "name": "id", + "name": "connectionId", "required": true, "schema": { "$ref": "#/components/schemas/RecordId" } - }, - { - "description": "Tenant identifier", - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Record_response.string_" - } - } } - } + ] } }, - "/multi-tenancy/question-answer/{id}/{tenantId}": { + "/url/{invitationId}": { "get": { - "operationId": "GetQuestionAnswerRecordById", + "operationId": "GetInvitation", "responses": { "200": { - "description": "ConnectionRecord", + "description": "Ok", "content": { "application/json": { "schema": {} @@ -7035,85 +4531,41 @@ } } } - } - }, - "description": "Retrieve question answer record by id", - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Question Answer Record identifier", - "in": "path", - "name": "id", - "required": true, - "schema": { - "$ref": "#/components/schemas/RecordId" - } }, - { - "description": "Tenant identifier", - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, - "/proofs": { - "get": { - "operationId": "GetAllProofs", - "responses": { - "200": { - "description": "ProofRecord[]", + "500": { + "description": "", "content": { "application/json": { "schema": { - "items": { - "$ref": "#/components/schemas/Record_string.unknown_" + "properties": { + "message": { + "type": "string" + } }, - "type": "array" - }, - "examples": { - "Example 1": { - "value": [ - { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" - } - ] - } + "required": [ + "message" + ], + "type": "object" } } } } }, - "description": "Retrieve all proof records", "tags": [ - "Proofs" + "Connections" ], "security": [ { - "apiKey": [] + "jwt": [ + "skip" + ] } ], "parameters": [ { - "in": "query", - "name": "threadId", - "required": false, + "in": "path", + "name": "invitationId", + "required": true, "schema": { "type": "string" } @@ -7121,26 +4573,68 @@ ] } }, - "/proofs/{proofRecordId}": { + "/credential-definitions/{credentialDefinitionId}": { "get": { - "operationId": "GetProofById", + "operationId": "GetCredentialDefinitionById", "responses": { "200": { - "description": "ProofRecord", + "description": "CredDef", "content": { "application/json": { "schema": {}, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "ver": "1.0", + "id": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag", + "schemaId": "351936", + "type": "CL", + "tag": "definition", + "value": { + "primary": { + "n": "string", + "s": "string", + "r": { + "master_secret": "string", + "string": "string" + }, + "rctxt": "string", + "z": "string" + }, + "revocation": { + "g": "1 string", + "g_dash": "string", + "h": "string", + "h0": "string", + "h1": "string", + "h2": "string", + "htilde": "string", + "h_cap": "string", + "u": "string", + "pk": "string", + "y": "string" + } + } + } + } + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "reason": { + "type": "string" } - } + }, + "required": [ + "reason" + ], + "type": "object" } } } @@ -7182,45 +4676,69 @@ } } }, - "description": "Retrieve proof record by proof record id", + "description": "Retrieve credential definition by credential definition id", "tags": [ - "Proofs" + "Credential Definitions" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ { "in": "path", - "name": "proofRecordId", + "name": "credentialDefinitionId", "required": true, "schema": { - "$ref": "#/components/schemas/RecordId" + "$ref": "#/components/schemas/CredentialDefinitionId" } } ] } }, - "/proofs/propose-proof": { + "/credential-definitions": { "post": { - "operationId": "ProposeProof", + "operationId": "CreateCredentialDefinition", "responses": { "200": { - "description": "ProofRecord", + "description": "CredDef", "content": { "application/json": { "schema": {}, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "ver": "1.0", + "id": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag", + "schemaId": "351936", + "type": "CL", + "tag": "definition", + "value": { + "primary": { + "n": "string", + "s": "string", + "r": { + "master_secret": "string", + "string": "string" + }, + "rctxt": "string", + "z": "string" + }, + "revocation": { + "g": "1 string", + "g_dash": "string", + "h": "string", + "h0": "string", + "h1": "string", + "h2": "string", + "htilde": "string", + "h_cap": "string", + "u": "string", + "pk": "string", + "y": "string" + } + } } } } @@ -7264,13 +4782,13 @@ } } }, - "description": "Initiate a new presentation exchange as prover by sending a presentation proposal request\nto the connection with the specified connection id.", + "description": "Creates a new credential definition.", "tags": [ - "Proofs" + "Credential Definitions" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -7279,38 +4797,62 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RequestProofProposalOptions" + "properties": { + "endorserDid": { + "type": "string" + }, + "endorse": { + "type": "boolean" + }, + "tag": { + "type": "string" + }, + "schemaId": { + "$ref": "#/components/schemas/SchemaId" + }, + "issuerId": { + "type": "string" + } + }, + "required": [ + "tag", + "schemaId", + "issuerId" + ], + "type": "object" } } } } } }, - "/proofs/{proofRecordId}/accept-proposal": { - "post": { - "operationId": "AcceptProposal", + "/schemas/{schemaId}": { + "get": { + "operationId": "GetSchemaById", "responses": { "200": { - "description": "ProofRecord", + "description": "Schema", "content": { "application/json": { "schema": {}, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "ver": "1.0", + "id": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0", + "name": "schema", + "version": "1.0", + "attrNames": [ + "string" + ], + "seqNo": 351936 } } } } } }, - "404": { + "400": { "description": "", "content": { "application/json": { @@ -7328,70 +4870,23 @@ } } }, - "500": { + "403": { "description": "", "content": { "application/json": { "schema": { "properties": { - "message": { + "reason": { "type": "string" } }, "required": [ - "message" + "reason" ], "type": "object" } } } - } - }, - "description": "Accept a presentation proposal as verifier by sending an accept proposal message\nto the connection associated with the proof record.", - "tags": [ - "Proofs" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AcceptProofProposal" - } - } - } - } - } - }, - "/proofs/request-proof": { - "post": { - "operationId": "RequestProof", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" - } - } - } - } - } }, "404": { "description": "", @@ -7430,104 +4925,54 @@ } } }, + "description": "Retrieve schema by schema id", "tags": [ - "Proofs" + "Schemas" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RequestProofOptions" - } - } - } - } - } - }, - "/proofs/create-request-oob": { - "post": { - "operationId": "CreateRequest", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } + "jwt": [] } - }, - "tags": [ - "Proofs" ], - "security": [ + "parameters": [ { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateProofRequestOobOptions" - } + "in": "path", + "name": "schemaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/SchemaId" } } - } + ] } }, - "/proofs/{proofRecordId}/accept-request": { + "/schemas": { "post": { - "operationId": "AcceptRequest", + "operationId": "CreateSchema", "responses": { "200": { - "description": "ProofRecord", + "description": "schema", "content": { "application/json": { "schema": {}, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "ver": "1.0", + "id": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0", + "name": "schema", + "version": "1.0", + "attrNames": [ + "string" + ], + "seqNo": 351936 } } } } } }, - "404": { + "400": { "description": "", "content": { "application/json": { @@ -7564,41 +5009,50 @@ } } }, - "description": "Accept a presentation request as prover by sending an accept request message\nto the connection associated with the proof record.", + "description": "Creates a new schema and registers schema on ledger", "tags": [ - "Proofs" + "Schemas" ], "security": [ { - "apiKey": [] - } - ], - "parameters": [ - { - "in": "path", - "name": "proofRecordId", - "required": true, - "schema": { - "type": "string" - } + "jwt": [] } ], + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { - "comment": { + "endorserDid": { "type": "string" }, - "filterByNonRevocationRequirements": { + "endorse": { "type": "boolean" }, - "filterByPresentationPreview": { - "type": "boolean" + "attributes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "version": { + "$ref": "#/components/schemas/Version" + }, + "name": { + "type": "string" + }, + "issuerId": { + "type": "string" } }, + "required": [ + "attributes", + "version", + "name", + "issuerId" + ], "type": "object" } } @@ -7606,45 +5060,128 @@ } } }, - "/proofs/{proofRecordId}/accept-presentation": { - "post": { - "operationId": "AcceptPresentation", + "/dids/{did}": { + "get": { + "operationId": "GetDidRecordByDid", "responses": { "200": { - "description": "ProofRecord", + "description": "DidResolutionResult", "content": { "application/json": { - "schema": {}, + "schema": { + "anyOf": [ + { + "properties": { + "importDid": {} + }, + "required": [ + "importDid" + ], + "type": "object" + }, + { + "properties": { + "importDid": {}, + "didDocumentMetadata": { + "$ref": "#/components/schemas/DIDDocumentMetadata" + }, + "didResolutionMetadata": { + "$ref": "#/components/schemas/DidResolutionMetadata" + }, + "didDocument": { + "$ref": "#/components/schemas/Record_string.any_" + } + }, + "required": [ + "didDocumentMetadata", + "didResolutionMetadata", + "didDocument" + ], + "type": "object" + } + ] + }, "examples": { "Example 1": { "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" + "didDocument": { + "@context": [ + "https://w3id.org/did/v1", + "https://w3id.org/security/suites/ed25519-2018/v1", + "https://w3id.org/security/suites/x25519-2019/v1" + ], + "id": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", + "verificationMethod": [ + { + "id": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", + "type": "Ed25519VerificationKey2018", + "controller": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", + "publicKeyBase58": "6fioC1zcDPyPEL19pXRS2E4iJ46zH7xP6uSgAaPdwDrx" + } + ], + "authentication": [ + "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" + ], + "assertionMethod": [ + "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" + ], + "capabilityInvocation": [ + "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" + ], + "capabilityDelegation": [ + "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" + ], + "keyAgreement": [ + { + "id": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL#z6LSrdqo4M24WRDJj1h2hXxgtDTyzjjKCiyapYVgrhwZAySn", + "type": "X25519KeyAgreementKey2019", + "controller": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL", + "publicKeyBase58": "FxfdY3DCQxVZddKGAtSjZdFW9bCCW7oRwZn1NFJ2Tbg2" + } + ] + }, + "didDocumentMetadata": {}, + "didResolutionMetadata": { + "contentType": "application/did+ld+json" + } } } } } } - }, - "404": { - "description": "", + } + }, + "description": "Resolves did and returns did resolution result", + "tags": [ + "Dids" + ], + "security": [ + { + "jwt": [] + } + ], + "parameters": [ + { + "description": "Decentralized Identifier", + "in": "path", + "name": "did", + "required": true, + "schema": { + "$ref": "#/components/schemas/Did" + } + } + ] + } + }, + "/dids/write": { + "post": { + "operationId": "WriteDid", + "responses": { + "200": { + "description": "DidResolutionResult", "content": { "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } + "schema": {} } } }, @@ -7667,66 +5204,37 @@ } } }, - "description": "Accept a presentation as prover by sending an accept presentation message\nto the connection associated with the proof record.", + "description": "Did nym registration", "tags": [ - "Proofs" + "Dids" ], "security": [ { - "apiKey": [] + "jwt": [] } ], - "parameters": [ - { - "in": "path", - "name": "proofRecordId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DidCreate" + } } } - ] + } } }, - "/proofs/{proofRecordId}/form-data": { + "/dids": { "get": { - "operationId": "ProofFormData", + "operationId": "GetDids", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "metadata": {}, - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "2aecf74c-3073-4f98-9acb-92415d096834", - "threadId": "0019d466-5eea-4269-8c40-031b4896c5b7", - "protocolVersion": "v1" - } - } - } - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } + "schema": {} } } }, @@ -7750,23 +5258,14 @@ } }, "tags": [ - "Proofs" + "Dids" ], "security": [ { - "apiKey": [] + "jwt": [] } ], - "parameters": [ - { - "in": "path", - "name": "proofRecordId", - "required": true, - "schema": { - "type": "string" - } - } - ] + "parameters": [] } }, "/transactions/endorse": { @@ -7823,7 +5322,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -7875,7 +5374,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -7945,7 +5444,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8011,7 +5510,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ @@ -8065,7 +5564,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [] @@ -8091,7 +5590,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ @@ -8185,7 +5684,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [ @@ -8279,7 +5778,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8374,7 +5873,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8451,7 +5950,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8503,7 +6002,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8598,7 +6097,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8693,7 +6192,7 @@ ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -8717,255 +6216,35 @@ "description": "CredentialExchangeRecord", "content": { "application/json": { - "schema": {}, - "examples": { - "Example 1": { - "value": { - "_tags": { - "state": "offer-sent", - "threadId": "82701488-b43c-4d7b-9244-4bb204a7ae26", - "connectionId": "ac6d0fdd-0db8-4f52-8a3d-de7ff8ddc14b" - }, - "metadata": { - "_internal/indyCredential": { - "credentialDefinitionId": "q7ATwTYbQDgiigVijUAej:3:CL:318187:latest", - "schemaId": "q7ATwTYbQDgiigVijUAej:2:Employee Badge:1.0" - } - }, - "credentials": [], - "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", - "createdAt": "2022-01-01T00:00:00.000Z", - "connectionId": "ac6d0fdd-0db8-4f52-8a3d-de7ff8ddc14b", - "threadId": "82701488-b43c-4d7b-9244-4bb204a7ae26", - "credentialAttributes": [], - "protocolVersion": "v1" - } - } - } - } - } - }, - "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 credential as holder by sending an accept credential message\nto the connection associated with the credential exchange record.", - "tags": [ - "Credentials" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AcceptCredential" - } - } - } - } - } - }, - "/polygon/create-keys": { - "post": { - "operationId": "CreateKeyPair", - "responses": { - "200": { - "description": "Secp256k1KeyPair", - "content": { - "application/json": { - "schema": { - "properties": { - "address": { - "type": "string" - }, - "publicKeyBase58": { - "type": "string" - }, - "privateKey": { - "type": "string" - } - }, - "required": [ - "address", - "publicKeyBase58", - "privateKey" - ], - "type": "object" - } - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } - } - }, - "description": "Create Secp256k1 key pair for polygon DID", - "tags": [ - "Polygon" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [] - } - }, - "/polygon/create-schema": { - "post": { - "operationId": "CreateSchema", - "responses": { - "200": { - "description": "Schema JSON", - "content": { - "application/json": { - "schema": {} - } - } - }, - "400": { - "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": "Create polygon based W3C schema", - "tags": [ - "Polygon" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "schema": { - "additionalProperties": false, - "type": "object" - }, - "schemaName": { - "type": "string" - }, - "did": { - "type": "string" - } - }, - "required": [ - "schema", - "schemaName", - "did" - ], - "type": "object" - } - } - } - } - } - }, - "/polygon/estimate-transaction": { - "post": { - "operationId": "EstimateTransaction", - "responses": { - "200": { - "description": "Transaction Object", - "content": { - "application/json": { - "schema": {} + "schema": {}, + "examples": { + "Example 1": { + "value": { + "_tags": { + "state": "offer-sent", + "threadId": "82701488-b43c-4d7b-9244-4bb204a7ae26", + "connectionId": "ac6d0fdd-0db8-4f52-8a3d-de7ff8ddc14b" + }, + "metadata": { + "_internal/indyCredential": { + "credentialDefinitionId": "q7ATwTYbQDgiigVijUAej:3:CL:318187:latest", + "schemaId": "q7ATwTYbQDgiigVijUAej:2:Employee Badge:1.0" + } + }, + "credentials": [], + "id": "821f9b26-ad04-4f56-89b6-e2ef9c72b36e", + "createdAt": "2022-01-01T00:00:00.000Z", + "connectionId": "ac6d0fdd-0db8-4f52-8a3d-de7ff8ddc14b", + "threadId": "82701488-b43c-4d7b-9244-4bb204a7ae26", + "credentialAttributes": [], + "protocolVersion": "v1" + } + } + } } } }, - "400": { + "404": { "description": "", "content": { "application/json": { @@ -9002,13 +6281,13 @@ } } }, - "description": "Estimate transaction", + "description": "Accept a credential as holder by sending an accept credential message\nto the connection associated with the credential exchange record.", "tags": [ - "Polygon" + "Credentials" ], "security": [ { - "apiKey": [] + "jwt": [] } ], "parameters": [], @@ -9017,34 +6296,26 @@ "content": { "application/json": { "schema": { - "properties": { - "transaction": {}, - "operation": {} - }, - "required": [ - "transaction", - "operation" - ], - "type": "object" + "$ref": "#/components/schemas/AcceptCredential" } } } } } }, - "/polygon/{did}/{schemaId}": { - "get": { - "operationId": "GetSchemaById", + "/multi-tenancy/create-tenant": { + "post": { + "operationId": "CreateTenant", "responses": { "200": { - "description": "Schema Object", + "description": "Ok", "content": { "application/json": { "schema": {} } } }, - "401": { + "404": { "description": "", "content": { "application/json": { @@ -9081,105 +6352,32 @@ } } }, - "description": "Fetch schema details", "tags": [ - "Polygon" + "MultiTenancy" ], "security": [ { - "apiKey": [] + "jwt": [ + "multi-tenant" + ] } ], - "parameters": [ - { - "in": "path", - "name": "did", - "required": true, - "schema": { - "type": "string" - } - }, - { - "in": "path", - "name": "schemaId", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, - "/question-answer": { - "get": { - "operationId": "GetQuestionAnswerRecords", - "responses": { - "200": { - "description": "QuestionAnswerRecord[]", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "type": "array" - } + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTenantOptions" } } } - }, - "description": "Retrieve question and answer records by query", - "tags": [ - "Question Answer" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [ - { - "description": "Connection identifier", - "in": "query", - "name": "connectionId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "description": "Role of the question", - "in": "query", - "name": "role", - "required": false, - "schema": { - "$ref": "#/components/schemas/QuestionAnswerRole" - } - }, - { - "description": "State of the question", - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/QuestionAnswerState" - } - }, - { - "description": "Thread identifier", - "in": "query", - "name": "threadId", - "required": false, - "schema": { - "type": "string" - } - } - ] + } } }, - "/question-answer/question/{connectionId}": { - "post": { - "operationId": "SendQuestion", + "/multi-tenancy/{tenantId}": { + "get": { + "operationId": "GetTenantById", "responses": { "200": { "description": "Ok", @@ -9226,59 +6424,29 @@ } } }, - "description": "Send a question to a connection", "tags": [ - "Question Answer" + "MultiTenancy" ], "security": [ { - "apiKey": [] + "jwt": [ + "multi-tenant" + ] } ], "parameters": [ { - "description": "Connection identifier", "in": "path", - "name": "connectionId", + "name": "tenantId", "required": true, "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "detail": { - "type": "string" - }, - "validResponses": { - "items": { - "$ref": "#/components/schemas/ValidResponse" - }, - "type": "array" - }, - "question": { - "type": "string" - } - }, - "required": [ - "validResponses", - "question" - ], - "type": "object" - } + "type": "string" } } - } - } - }, - "/question-answer/answer/{id}": { - "post": { - "operationId": "SendAnswer", + ] + }, + "delete": { + "operationId": "DeleteTenantById", "responses": { "200": { "description": "Ok", @@ -9325,44 +6493,34 @@ } } }, - "description": "Send a answer to question", "tags": [ - "Question Answer" + "MultiTenancy" ], "security": [ { - "apiKey": [] + "jwt": [ + "multi-tenant" + ] } ], "parameters": [ { - "description": "The id of the question answer record", "in": "path", - "name": "id", + "name": "tenantId", "required": true, "schema": { - "$ref": "#/components/schemas/RecordId" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Record_response.string_" - } + "type": "string" } } - } + ] } }, - "/question-answer/{id}": { - "get": { - "operationId": "GetQuestionAnswerRecordById", + "/multi-tenancy/get-token/{tenantId}": { + "post": { + "operationId": "GetTenantToken", "responses": { "200": { - "description": "ConnectionRecord", + "description": "Ok", "content": { "application/json": { "schema": {} @@ -9386,24 +6544,43 @@ } } } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ], + "type": "object" + } + } + } } }, - "description": "Retrieve question answer record by id", "tags": [ - "Question Answer" + "MultiTenancy" ], "security": [ { - "apiKey": [] + "jwt": [ + "multi-tenant" + ] } ], "parameters": [ { "in": "path", - "name": "id", + "name": "tenantId", "required": true, "schema": { - "$ref": "#/components/schemas/RecordId" + "type": "string" } } ] diff --git a/src/securityMiddleware.ts b/src/securityMiddleware.ts index ea8a5199..9f3daa9d 100644 --- a/src/securityMiddleware.ts +++ b/src/securityMiddleware.ts @@ -1,41 +1,96 @@ import type * as express from 'express' import type { NextFunction } from 'express' +// eslint-disable-next-line import/order +// eslint-disable-next-line import/order import { Middlewares } from '@tsoa/runtime' -import { expressAuthentication } from './authentication' // Import your authentication function +// eslint-disable-next-line import/namespace @Middlewares() export class SecurityMiddleware { + // public async use(request: express.Request, response: express.Response, next: NextFunction) { + // console.log('Race: Reached in Middleware') + // // public async use(request: express.Request, response: express.Response) { + // // try { + + // const agent = container.resolve(Agent) + // let securityName = 'jwt' + + // // Extract route path or controller name from the request + // const routePath = request.path + // const requestMethod = request.method + + // // List of paths for which authentication should be skipped + // const pathsToSkipAuthentication = [ + // { path: '/url/', method: 'GET' }, + // { path: '/multi-tenancy/url/', method: 'GET' }, + // { path: '/agent', method: 'GET' }, + // ] + + // // Check if authentication should be skipped for this route or controller + // const skipAuthentication = pathsToSkipAuthentication.some( + // ({ path, method }) => routePath.includes(path) && requestMethod === method + // ) + // // Krish: here test endpoints will be replaced by all enpoints except 'pathsToSkipAuthentication' + // if (routePath.includes('/agent/token')) { + // securityName = 'apiKey' + // console.log('Reached in securityMiddleware::::: /test-endpoint/') + // // const result = await expressAuthentication(request, securityName); + // } + + // if (skipAuthentication) { + // // Skip authentication for this route or controller + // console.log('Skipped authentication') + // // for skipped authentication there are two ways to handle + // request['agent'] = agent + // next() + // // const agent = container.resolve(Agent) + // // return Promise.resolve({ agent: agent }) + // } else if (securityName) { + // const result = await expressAuthentication(request, securityName, undefined, undefined, agent) + // console.log('Result:::::', result) + // if (typeof result === 'boolean') { + // console.log('Successfully resulted') + // if (result) { + // // Auth: for BW/Dedicated agent + // // Validation for api-key + // // request.user = { agent: agent } + // request['agent'] = agent + // next() + // } else response.status(401).json({ message: `Unauthorized` }) + // // } else return Promise.reject(new StatusException('Unauthorized', 401)) + // } else if (!result) { + // response.status(401).json({ message: `Unauthorized` }) + // // return Promise.reject(new StatusException('Unauthorized', 401)) + // } else if (result.wallet) { + // console.log('this is type of result', result) + // console.log('From securityMiddleware:::::::::') + // // return Promise.resolve({ agent: result }) + // // return result + // // const temp = request.user + // // temp['agent'] = result + // // request.user = temp + // request['agent'] = result + // // request.user['agent'] = result + // console.log('verified agent from middleware') + // console.log('this is request in middleware::::::', request) + // console.log(`this is request.agent`, request.agent) + // // console.log(`this is request.user.agent`, request.user) + // console.log(`this is request.agent.config`, request.agent.config) + // next() + // } + // } else { + // response.status(400).json({ message: 'Bad Request' }) + // // return Promise.reject(new StatusException('Bad Request', 400)) + // } + // // } catch (error) { + // // next(error) + // // } + // } + // eslint-disable-next-line @typescript-eslint/no-unused-vars public async use(request: express.Request, response: express.Response, next: NextFunction) { - try { - const securityName = 'apiKey' - - // Extract route path or controller name from the request - const routePath = request.path - - // List of paths for which authentication should be skipped - const pathsToSkipAuthentication = ['/url/', '/multi-tenancy/url/', '/agent'] - - // Check if authentication should be skipped for this route or controller - const skipAuthentication = pathsToSkipAuthentication.some((path) => routePath.includes(path)) - - if (skipAuthentication) { - // Skip authentication for this route or controller - next() - } else if (securityName) { - const result = await expressAuthentication(request, securityName) - - if (result === 'success') { - next() - } else { - response.status(401).json({ message: 'Unauthorized' }) - } - } else { - response.status(400).json({ message: 'Bad Request' }) - } - } catch (error) { - next(error) - } + // Do nothing + next() } } diff --git a/src/server.ts b/src/server.ts index c0a95010..18e00265 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,8 +1,11 @@ import 'reflect-metadata' +import type { RestAgentModules, RestMultiTenantAgentModules } from './cliAgent' +import type { ApiError } from './error' import type { ServerConfig } from './utils/ServerConfig' import type { Response as ExResponse, Request as ExRequest, NextFunction } from 'express' import { Agent } from '@aries-framework/core' +import { TenantAgent } from '@aries-framework/tenants/build/TenantAgent' import bodyParser from 'body-parser' import cors from 'cors' import express from 'express' @@ -10,20 +13,30 @@ import { rateLimit } from 'express-rate-limit' import { serve, generateHTML } from 'swagger-ui-express' import { container } from 'tsyringe' +// eslint-disable-next-line import/namespace import { setDynamicApiKey } from './authentication' +import { ErrorMessages } from './enums/enum' import { basicMessageEvents } from './events/BasicMessageEvents' import { connectionEvents } from './events/ConnectionEvents' import { credentialEvents } from './events/CredentialEvents' import { proofEvents } from './events/ProofEvents' import { questionAnswerEvents } from './events/QuestionAnswerEvents' import { RegisterRoutes } from './routes/routes' +// eslint-disable-next-line import/no-cycle import { SecurityMiddleware } from './securityMiddleware' import { maxRateLimit, windowMs } from './utils/util' import { ValidateError, type Exception } from 'tsoa' +// Define conditional type for Agent +// type AgentWithModules = Agent & (RestMultiTenantAgentModules | RestAgentModules) -export const setupServer = async (agent: Agent, config: ServerConfig, apiKey?: string) => { - container.registerInstance(Agent, agent) +// setupServer function +export const setupServer = async ( + agent: Agent, + config: ServerConfig, + apiKey?: string +) => { + container.registerInstance(Agent, agent as Agent) const app = config.app ?? express() if (config.cors) app.use(cors()) @@ -43,6 +56,8 @@ export const setupServer = async (agent: Agent, config: ServerConfig, apiKey?: s }) ) + // Krish: there's no need to currently store apiKey + // This will be verified based on the secretKey stored in wallet setDynamicApiKey(apiKey ? apiKey : '') app.use(bodyParser.json()) @@ -62,6 +77,12 @@ export const setupServer = async (agent: Agent, config: ServerConfig, apiKey?: s app.use(securityMiddleware.use) RegisterRoutes(app) + app.use(async (req, _, next) => { + // End tenant session if active + await endTenantSessionIfActive(req) + next() + }) + app.use((req, res, next) => { if (req.url == '/') { res.redirect('/docs') @@ -70,7 +91,15 @@ export const setupServer = async (agent: Agent, config: ServerConfig, apiKey?: s next() }) - app.use(function errorHandler(err: unknown, req: ExRequest, res: ExResponse, next: NextFunction): ExResponse | void { + app.use(async function errorHandler( + err: unknown, + req: ExRequest, + res: ExResponse, + next: NextFunction + ): Promise { + // End tenant session if active + await endTenantSessionIfActive(req) + if (err instanceof ValidateError) { agent.config.logger.warn(`Caught Validation Error for ${req.path}:`, err.fields) return res.status(422).json({ @@ -88,6 +117,13 @@ export const setupServer = async (agent: Agent, config: ServerConfig, apiKey?: s }) } + if (exceptionError.status === 401) { + return res.status(401).json({ + message: `Unauthorized`, + details: err.message !== ErrorMessages.Unauthorized ? err.message : undefined, + } satisfies ApiError) + } + agent.config.logger.error('Internal Server Error.', err) return res.status(500).json({ message: 'Internal Server Error. Check server logging.', @@ -104,3 +140,13 @@ export const setupServer = async (agent: Agent, config: ServerConfig, apiKey?: s return app } + +async function endTenantSessionIfActive(request: ExRequest) { + if ('agent' in request) { + const agent = request?.agent + if (agent instanceof TenantAgent) { + agent.config.logger.debug('Ending tenant session') + await agent.endSession() + } + } +} diff --git a/src/types/request.d.ts b/src/types/request.d.ts new file mode 100644 index 00000000..1589b1fe --- /dev/null +++ b/src/types/request.d.ts @@ -0,0 +1,38 @@ +import type { RestAgentModules, RestMultiTenantAgentModules } from '../cliAgent' +import type { Agent } from '@aries-framework/core' +import type { TenantAgent } from '@aries-framework/tenants/build/TenantAgent' + +// declare global { +// namespace Express { +// interface Request { +// user: { +// [x: string]: any +// agent: Agent | Agent | TenantAgent +// } +// } +// } +// } +type AgentType = Agent | Agent | TenantAgent + +interface IAgent { + agent: AgentType +} + +declare global { + namespace Express { + interface Request { + agent: AgentType + } + } +} + +// declare global { +// namespace Express { +// interface Request { +// user: { +// [x: string]: any +// agent: any +// } +// } +// } +// } diff --git a/src/utils/common.service.ts b/src/utils/common.service.ts new file mode 100644 index 00000000..51a096dd --- /dev/null +++ b/src/utils/common.service.ts @@ -0,0 +1,19 @@ +import { randomBytes } from 'crypto' + +export async function generateSecretKey(length: number = 32): Promise { + // Asynchronously generate a buffer containing random values + const buffer: Buffer = await new Promise((resolve, reject) => { + randomBytes(length, (error, buf) => { + if (error) { + reject(error) + } else { + resolve(buf) + } + }) + }) + + // Convert the buffer to a hexadecimal string + const secretKey: string = buffer.toString('hex') + + return secretKey +} diff --git a/src/utils/util.ts b/src/utils/util.ts index 43b71461..450a58fc 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -161,3 +161,8 @@ export const maxRateLimit = 800 export const DID_CONTRACT_ADDRESS = '0x12513116875BB3E4F098Ce74624739Ee51bAf023' export const SCHEMA_MANAGER_CONTRACT_ADDRESS = '0x552992e9f14b15bBd76488cD4c38c89B80259f37' export const RPC_URL = 'https://rpc-mumbai.maticvigil.com' + +export enum RESULT { + SUCCESS = 'SUCCESS', + FAILED = 'FAILED', +} diff --git a/tsconfig.json b/tsconfig.json index de0ca16d..972d61fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,12 @@ }, "experimentalDecorators": true, "emitDecoratorMetadata": true, - "types": ["jest", "node"] + "types": ["jest", "node"], + "typeRoots": [ + "@types", + "./node_modules/@types", + "src/types" // Add your custom types directory + ] }, "exclude": ["node_modules", "build"] } diff --git a/tsoa.json b/tsoa.json index 5a39d549..92e95bd7 100644 --- a/tsoa.json +++ b/tsoa.json @@ -10,11 +10,16 @@ "type": "apiKey", "name": "Authorization", "in": "header" + }, + "jwt": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" } } }, "routes": { - "routesDir": "src/routes", + "routesDir": "./src/routes", "iocModule": "./src/utils/tsyringeTsoaIocContainer", "authenticationModule": "src/authentication" }