From eac10c525aa7b161b866d810d8b5f0af1c955b98 Mon Sep 17 00:00:00 2001 From: Krishna Waske Date: Tue, 16 Dec 2025 19:19:37 +0530 Subject: [PATCH 1/8] fix: x509 controller Signed-off-by: Krishna Waske --- src/controllers/x509/x509.Controller.ts | 144 +++--- src/controllers/x509/x509.service.ts | 526 +++++++++++--------- src/routes/routes.ts | 372 +++++++++++++- src/routes/swagger.json | 623 +++++++++++++++++++++++- 4 files changed, 1349 insertions(+), 316 deletions(-) diff --git a/src/controllers/x509/x509.Controller.ts b/src/controllers/x509/x509.Controller.ts index a8e3e4bb..61a412eb 100644 --- a/src/controllers/x509/x509.Controller.ts +++ b/src/controllers/x509/x509.Controller.ts @@ -1,78 +1,78 @@ -// import { injectable } from '@credo-ts/core' -// import { Request as Req } from 'express' -// import { Body, Controller, Post, Route, Tags, Security, Request, Get } from 'tsoa' +import { injectable } from '@credo-ts/core' +import { Request as Req } from 'express' +import { Body, Controller, Post, Route, Tags, Security, Request, Get } from 'tsoa' -// import { SCOPES } from '../../enums' -// import ErrorHandlingService from '../../errorHandlingService' -// import { X509ImportCertificateOptionsDto } from '../types' -// import { x509ServiceT } from './x509.service' -// import { X509CreateCertificateOptionsDto } from './x509.types' +import { SCOPES } from '../../enums' +import ErrorHandlingService from '../../errorHandlingService' +import { X509ImportCertificateOptionsDto } from '../types' +import { x509ServiceT } from './x509.service' +import { X509CreateCertificateOptionsDto } from './x509.types' -// @Tags('x509') -// @Security('jwt', [SCOPES.TENANT_AGENT, SCOPES.DEDICATED_AGENT]) -// @Route('/x509') -// @injectable() -// export class X509Controller extends Controller { -// @Post('/') -// public async createX509Certificate( -// @Request() request: Req, -// @Body() createX509Options: X509CreateCertificateOptionsDto, -// ) { -// try { -// return await x509ServiceT.createCertificate(request, createX509Options) -// } catch (error) { -// throw ErrorHandlingService.handle(error) -// } -// } +@Tags('x509') +@Security('jwt', [SCOPES.TENANT_AGENT, SCOPES.DEDICATED_AGENT]) +@Route('/x509') +@injectable() +export class X509Controller extends Controller { + @Post('/') + public async createX509Certificate( + @Request() request: Req, + @Body() createX509Options: X509CreateCertificateOptionsDto, + ) { + try { + return await x509ServiceT.createCertificate(request, createX509Options) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } -// @Post('/import') -// public async ImportX509Certificates( -// @Request() request: Req, -// @Body() importX509Options: X509ImportCertificateOptionsDto, -// ) { -// try { -// return await x509ServiceT.ImportX509Certificates(request, importX509Options) -// } catch (error) { -// throw ErrorHandlingService.handle(error) -// } -// } + @Post('/import') + public async ImportX509Certificates( + @Request() request: Req, + @Body() importX509Options: X509ImportCertificateOptionsDto, + ) { + try { + return await x509ServiceT.ImportX509Certificates(request, importX509Options) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } -// @Post('/trusted') -// public async addTrustedCertificate( -// @Request() request: Req, -// @Body() -// options: { -// certificate: string -// }, -// ) { -// try { -// return await x509ServiceT.addTrustedCertificate(request, options) -// } catch (error) { -// throw ErrorHandlingService.handle(error) -// } -// } + @Post('/trusted') + public async addTrustedCertificate( + @Request() request: Req, + @Body() + options: { + certificate: string + }, + ) { + try { + return await x509ServiceT.addTrustedCertificate(request, options) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } -// @Get('/trusted') -// public async getTrustedCertificates(@Request() request: Req) { -// try { -// return await x509ServiceT.getTrustedCertificates(request) -// } catch (error) { -// throw ErrorHandlingService.handle(error) -// } -// } + @Get('/trusted') + public async getTrustedCertificates(@Request() request: Req) { + try { + return await x509ServiceT.getTrustedCertificates(request) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } -// @Post('/decode') -// public async decodeCertificate( -// @Request() request: Req, -// @Body() -// options: { -// certificate: string -// }, -// ) { -// try { -// return await x509ServiceT.decodeCertificate(request, options) -// } catch (error) { -// throw ErrorHandlingService.handle(error) -// } -// } -// } + @Post('/decode') + public async decodeCertificate( + @Request() request: Req, + @Body() + options: { + certificate: string + }, + ) { + try { + return await x509ServiceT.decodeCertificate(request, options) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } +} diff --git a/src/controllers/x509/x509.service.ts b/src/controllers/x509/x509.service.ts index 6bdef914..9693ddbb 100644 --- a/src/controllers/x509/x509.service.ts +++ b/src/controllers/x509/x509.service.ts @@ -1,219 +1,307 @@ -// import type { X509CreateCertificateOptionsDto } from './x509.types' -// import type { BasicX509CreateCertificateConfig, X509ImportCertificateOptionsDto } from '../types' -// import type { CredoError } from '@credo-ts/core' -// import type { Request as Req } from 'express' - -// import { -// TypedArrayEncoder, -// X509Certificate, -// X509ExtendedKeyUsage, -// X509KeyUsage, -// X509ModuleConfig, -// X509Service, -// type Agent, -// } from '@credo-ts/core' - -// import { generateSecretKey, getCertificateValidityForSystem } from '../../utils/helpers' - -// import { pemToRawEd25519PrivateKey } from './crypto-util' -// import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' - -// class x509Service { -// public async createSelfSignedDCS(createX509Options: BasicX509CreateCertificateConfig, agentReq: Req) { -// const agent = agentReq.agent - -// const authorityKey = await createKey(agent as Agent, createX509Options.keyType) -// const AGENT_HOST = createX509Options.issuerAlternativeNameURL -// const AGENT_DNS = AGENT_HOST.replace('https://', '') -// const selfSignedx509certificate = await X509Service.createCertificate(agent.context, { -// authorityKey: authorityKey, //createX509Options.subjectKey, -// issuer: { countryName: createX509Options.countryName, commonName: createX509Options.commonName }, -// validity: getCertificateValidityForSystem(false), -// extensions: { -// subjectKeyIdentifier: { -// include: true, -// }, -// keyUsage: { -// usages: [X509KeyUsage.KeyCertSign, X509KeyUsage.CrlSign, X509KeyUsage.DigitalSignature], -// markAsCritical: true, -// }, -// subjectAlternativeName: { -// name: [ -// { type: 'dns', value: AGENT_DNS }, -// { type: 'url', value: AGENT_HOST }, -// ], -// }, -// issuerAlternativeName: { -// // biome-ignore lint/style/noNonNullAssertion: -// //name: rootCertificate.issuerAlternativeNames!, -// name: [ -// { type: 'dns', value: AGENT_DNS }, -// { type: 'url', value: AGENT_HOST }, -// ], -// }, -// extendedKeyUsage: { -// usages: [X509ExtendedKeyUsage.MdlDs], -// markAsCritical: true, -// }, -// basicConstraints: { -// ca: true, -// pathLenConstraint: 0, -// markAsCritical: true, -// }, -// // TODO: Create revocation list and add URL here - store this in platform -// // crlDistributionPoints: { -// // urls: [`${"AGENT_HOST"}/crl`], -// // }, -// }, -// }) - -// agent.config.logger.info('======= X.509 IACA Self Signed Certificate ===========') -// const selfSignedx509certificateBase64 = selfSignedx509certificate.toString('base64') -// agent.config.logger.debug('selfSignedx509certificateBase64', { selfSignedx509certificateBase64 }) -// return { publicCertificateBase64: selfSignedx509certificateBase64 } -// } - -// public async createCertificate(agentReq: Req, options: X509CreateCertificateOptionsDto) { -// const agent = agentReq.agent - -// let authorityKeyID, subjectPublicKeyID - -// agent.config.logger.debug(`createCertificate options:`, options) - -// if (options.authorityKey && options?.authorityKey?.seed) { -// authorityKeyID = await agent.context.wallet.createKey({ -// keyType: options.authorityKey.keyType ?? KeyAlgorithm.EcSecp256r1, -// seed: TypedArrayEncoder.fromString(options.authorityKey.seed), -// }) -// } else { -// authorityKeyID = await agent.context.wallet.createKey({ -// keyType: KeyAlgorithm.EcSecp256r1, -// }) -// } - -// if (options.subjectPublicKey) { -// if (options?.subjectPublicKey?.seed) { -// subjectPublicKeyID = await agent.context.wallet.createKey({ -// keyType: options.subjectPublicKey.keyType ?? KeyAlgorithm.EcSecp256r1, -// seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), -// }) -// } else { -// subjectPublicKeyID = await agent.context.wallet.createKey({ -// keyType: KeyAlgorithm.EcSecp256r1, -// }) -// } -// } - -// const certificate = await agent.x509.createCertificate({ -// authorityKey: authorityKeyID as Key, -// subjectPublicKey: (subjectPublicKeyID as Key) ?? undefined, -// serialNumber: options.serialNumber, -// issuer: options.issuer, -// extensions: options.extensions, -// subject: options.subject, -// validity: options.validity, -// }) - -// const issuerCertificate = certificate.toString('base64') -// return { publicCertificateBase64: issuerCertificate } -// } - -// public async ImportX509Certificates(agentReq: Req, options: X509ImportCertificateOptionsDto) { -// const agent = agentReq.agent -// agent.config.logger.debug(`Start validating keys`) -// const secretHexKey = await pemToRawEd25519PrivateKey(options.privateKey ?? '') -// const privateKey = TypedArrayEncoder.fromHex(secretHexKey) - -// agent.config.logger.debug(`Decode certificate`) -// const parsedCertificate = X509Service.parseCertificate(agent.context, { -// encodedCertificate: options.certificate, -// }) -// const issuerCertficicate = parsedCertificate.toString('base64') - -// try { -// const documentSignerKey = await agent.wallet.createKey({ -// privateKey: privateKey, -// keyType: options.keyType, -// }) - -// if ( -// parsedCertificate.publicKey.keyType !== options.keyType || -// !Buffer.from(parsedCertificate.publicKey.publicKey).equals(Buffer.from(documentSignerKey.publicKey)) -// ) { -// throw new Error(`Key mismatched in provided X509_CERTIFICATE to import`) -// } -// console.log(`Keys matched with certificate`) -// } catch (error) { -// // If the key already exists, we assume the self-signed certificate is already created -// if (error instanceof WalletKeyExistsError) { -// console.error( -// `key already exists while importing certificate ${JSON.stringify(parsedCertificate.privateKey)}`, -// parsedCertificate.privateKey, -// ) -// } else { -// agent.config.logger.error(`${JSON.stringify(error)}`) -// throw error -// } -// } - -// return { issuerCertficicate } -// } - -// public addTrustedCertificate( -// agentReq: Req, -// options: { -// certificate: string -// }, -// ) { -// const agent = agentReq.agent -// return agent.x509.addTrustedCertificate(options.certificate) -// } - -// public getTrustedCertificates(agentReq: Req) { -// const trustedCertificates = agentReq.agent.context.dependencyManager -// .resolve(X509ModuleConfig) -// .trustedCertificates?.map((cert) => X509Certificate.fromEncodedCertificate(cert).toString('base64')) // as [string, ...string[]] - -// return trustedCertificates -// } - -// /** -// * Parses a base64-encoded X.509 certificate into a X509Certificate -// * -// * @param issuerAgent {Agent} -// * @param options {x509Input} -// * @returns -// */ -// public decodeCertificate( -// agentReq: Req, -// options: { -// certificate: string -// }, -// ) { -// const parsedCertificate = X509Service.parseCertificate(agentReq.agent.context, { -// encodedCertificate: options.certificate, -// }) - -// return parsedCertificate -// } -// } - -// export const x509ServiceT = new x509Service() - -// export async function createKey(agent: Agent, keyType: KeyAlgorithm) { -// try { -// const seed = await generateSecretKey(keyType === KeyAlgorithm.EcSecp256r1 ? 64 : 32) - -// agent.config.logger.debug(`createKey: got seed ${seed}`) - -// const authorityKey = await agent.kms.createKey({ -// algorithm: keyType, -// seed: TypedArrayEncoder.fromString(seed), -// }) - -// return authorityKey -// } catch (error) { -// agent.config.logger.debug(`Error while creating authorityKey`, { message: (error as CredoError).message }) -// throw error -// } -// } +import type { X509CreateCertificateOptionsDto } from './x509.types' +import type { BasicX509CreateCertificateConfig, X509ImportCertificateOptionsDto } from '../types' +import type { CredoError } from '@credo-ts/core' +import type { Request as Req } from 'express' + +import { + Kms, + TypedArrayEncoder, + X509Certificate, + X509ExtendedKeyUsage, + X509KeyUsage, + X509ModuleConfig, + X509Service, + type Agent, +} from '@credo-ts/core' + +import { generateSecretKey, getCertificateValidityForSystem } from '../../utils/helpers' + +import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' +import { transformPrivateKeyToPrivateJwk, transformSeedToPrivateJwk } from '@credo-ts/askar' + +class x509Service { + public async createSelfSignedDCS(createX509Options: BasicX509CreateCertificateConfig, agentReq: Req) { + const agent = agentReq.agent + + const authorityKey = await createKey(agent as Agent, createX509Options.keyType) + const AGENT_HOST = createX509Options.issuerAlternativeNameURL + const AGENT_DNS = AGENT_HOST.replace('https://', '') + const selfSignedx509certificate = await X509Service.createCertificate(agent.context, { + authorityKey: Kms.PublicJwk.fromPublicJwk(authorityKey.publicJwk), //createX509Options.subjectKey, + issuer: { countryName: createX509Options.countryName, commonName: createX509Options.commonName }, + validity: getCertificateValidityForSystem(false), + extensions: { + subjectKeyIdentifier: { + include: true, + }, + keyUsage: { + usages: [X509KeyUsage.KeyCertSign, X509KeyUsage.CrlSign, X509KeyUsage.DigitalSignature], + markAsCritical: true, + }, + subjectAlternativeName: { + name: [ + { type: 'dns', value: AGENT_DNS }, + { type: 'url', value: AGENT_HOST }, + ], + }, + issuerAlternativeName: { + // biome-ignore lint/style/noNonNullAssertion: + //name: rootCertificate.issuerAlternativeNames!, + name: [ + { type: 'dns', value: AGENT_DNS }, + { type: 'url', value: AGENT_HOST }, + ], + }, + extendedKeyUsage: { + usages: [X509ExtendedKeyUsage.MdlDs], + markAsCritical: true, + }, + basicConstraints: { + ca: true, + pathLenConstraint: 0, + markAsCritical: true, + }, + // TODO: Create revocation list and add URL here - store this in platform + // crlDistributionPoints: { + // urls: [`${"AGENT_HOST"}/crl`], + // }, + }, + }) + + agent.config.logger.info('======= X.509 IACA Self Signed Certificate ===========') + const selfSignedx509certificateBase64 = selfSignedx509certificate.toString('base64') + agent.config.logger.debug('selfSignedx509certificateBase64', { selfSignedx509certificateBase64 }) + return { publicCertificateBase64: selfSignedx509certificateBase64 } + } + + public async createCertificate(agentReq: Req, options: X509CreateCertificateOptionsDto) { + const agent = agentReq.agent + + let authorityKeyID, subjectPublicKeyID + + agent.config.logger.debug(`createCertificate options:`, options) + + + + + if (options.authorityKey && options?.authorityKey?.seed) { + const { privateJwk } = transformSeedToPrivateJwk({ + // type: { + // crv: 'P-256', + // kty: 'EC', + // }, + type: { + crv: 'Ed25519', + kty: 'OKP', + }, + seed: TypedArrayEncoder.fromString(options.authorityKey!.seed!), + }) + + const { publicJwk } = await agent.kms.importKey({ privateJwk }) + authorityKeyID = publicJwk + // type: options.authorityKey.keyType ?? KeyAlgorithm.EcSecp256r1, + // seed: TypedArrayEncoder.fromString(options.authorityKey.seed), + // }) + } else { + const { publicJwk } = await agent.kms.createKey({ + // type: { + // crv: 'P-256', + // kty: 'EC', + // } + type: { + crv: 'Ed25519', + kty: 'OKP', + } + }) + authorityKeyID = publicJwk + } + + if (options.subjectPublicKey) { + if (options?.subjectPublicKey?.seed) { + // subjectPublicKeyID = await agent.kms.createKey({ + // keyType: options.subjectPublicKey.keyType ?? KeyAlgorithm.EcSecp256r1, + // seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), + // }) + + // const { privateJwk } = transformSeedToPrivateJwk({ + // type: { + // crv: 'Ed25519', + // kty: 'OKP', + // }, + // seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), + // }) + // const { keyId: subjectPublicKeyID } = await agent.kms.importKey({ privateJwk }) + const importedKey = await agentReq.agent.kms.importKey({ + privateJwk: transformSeedToPrivateJwk({ + seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), + type: { + crv: 'P-256', + kty: 'EC', + }, + }).privateJwk, + }) + + subjectPublicKeyID = importedKey.publicJwk + + } else { + // subjectPublicKeyID = await agent.context.createKey({ + // keyType: KeyAlgorithm.EcSecp256r1, + // }) + const { keyId, publicJwk } = await agent.kms.createKey({ + type: { + crv: 'P-256', + kty: 'EC', + } + }) + subjectPublicKeyID = publicJwk + } + } + + console.log("This is authorityKeyID", authorityKeyID) + console.log("This is subjectPublicKeyID", subjectPublicKeyID) + + const certificate = await agent.x509.createCertificate({ + // authorityKey: authorityKeyID as Key, + authorityKey: Kms.PublicJwk.fromPublicJwk(authorityKeyID), + // subjectPublicKey: Kms.PublicJwk.fromPublicJwk(subjectPublicKeyID!), + serialNumber: options.serialNumber, + issuer: options.issuer, + extensions: options.extensions, + subject: options.subject, + validity: options.validity, + }) + console.log("Result") + + const issuerCertificate = certificate.toString('base64') + return { publicCertificateBase64: issuerCertificate } + } + + public async ImportX509Certificates(agentReq: Req, options: X509ImportCertificateOptionsDto) { + const agent = agentReq.agent + agent.config.logger.debug(`Start validating keys`) + // const secretHexKey = await pemToRawEd25519PrivateKey(options.privateKey ?? '') + // const privateKey = TypedArrayEncoder.fromHex(secretHexKey) + + agent.config.logger.debug(`Decode certificate`) + const parsedCertificate = X509Service.parseCertificate(agent.context, { + encodedCertificate: options.certificate, + }) + const issuerCertficicate = parsedCertificate.toString('base64') + + try { + // const documentSignerKey = await agent.wallet.createKey({ + // privateKey: privateKey, + // keyType: options.keyType, + // }) + const { privateJwk } = transformPrivateKeyToPrivateJwk({ + type: { + crv: 'Ed25519', + kty: 'OKP', + }, + // type: { + // crv: 'P-256', + // kty: 'EC', + // }, + privateKey: TypedArrayEncoder.fromString(options.privateKey!), + }) + + const key = await agent.kms.importKey({ + privateJwk, + }) + + if ( + parsedCertificate.publicJwk.publicKey.kty !== options.keyType || + !parsedCertificate.publicJwk.equals(Kms.PublicJwk.fromPublicJwk(key.publicJwk)) + ) { + // if ( + // parsedCertificate.publicKey.keyType !== options.keyType || + // !Buffer.from(parsedCertificate.publicKey.publicKey).equals(Buffer.from(documentSignerKey.publicKey)) + // ) { + throw new Error(`Key mismatched in provided X509_CERTIFICATE to import`) + } + console.log(`Keys matched with certificate`) + } catch (error) { + console.log(`Error caught`) + + // If the key already exists, we assume the self-signed certificate is already created + if (error instanceof Kms.KeyManagementKeyExistsError) { + console.error( + `key already exists while importing certificate ${JSON.stringify(parsedCertificate.privateKey)}`, + parsedCertificate.privateKey, + ) + } else { + agent.config.logger.error(`${JSON.stringify(error)}`) + throw error + } + } + + return { issuerCertficicate } + } + + public addTrustedCertificate( + agentReq: Req, + options: { + certificate: string + }, + ) { + const agent = agentReq.agent + return agent.x509.config.addTrustedCertificate(options.certificate) + } + + public getTrustedCertificates(agentReq: Req) { + const trustedCertificates = agentReq.agent.context.dependencyManager + .resolve(X509ModuleConfig) + .trustedCertificates?.map((cert) => X509Certificate.fromEncodedCertificate(cert).toString('base64')) // as [string, ...string[]] + + return trustedCertificates + } + + /** + * Parses a base64-encoded X.509 certificate into a X509Certificate + * + * @param issuerAgent {Agent} + * @param options {x509Input} + * @returns + */ + public decodeCertificate( + agentReq: Req, + options: { + certificate: string + }, + ) { + const parsedCertificate = X509Service.parseCertificate(agentReq.agent.context, { + encodedCertificate: options.certificate, + }) + + return parsedCertificate + } +} + +export const x509ServiceT = new x509Service() + +export async function createKey(agent: Agent, keyType: KeyAlgorithm) { + try { + const seed = await generateSecretKey(keyType === KeyAlgorithm.EcSecp256r1 ? 64 : 32) + + agent.config.logger.debug(`createKey: got seed ${seed}`) + + // const authorityKey = await agent.kms.createKey({ + // keyType: keyType, + // seed: TypedArrayEncoder.fromString(seed), + // }) + const importedKey = await agent.kms.importKey({ + privateJwk: transformSeedToPrivateJwk({ + seed: TypedArrayEncoder.fromString(seed), + type: { + crv: 'P-256', + kty: 'EC', + }, + }).privateJwk, + }) + + return importedKey + } catch (error) { + agent.config.logger.debug(`Error while creating authorityKey`, { message: (error as CredoError).message }) + throw error + } +} diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 85b7514b..022568db 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -4,6 +4,8 @@ import type { TsoaRoute } from '@tsoa/runtime'; import { fetchMiddlewares, ExpressTemplateService } 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 { X509Controller } from './../controllers/x509/x509.Controller'; +// WARNING: This 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/didcomm/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 { OutOfBandController } from './../controllers/didcomm/outofband/OutOfBandController'; @@ -27,6 +29,187 @@ const expressAuthenticationRecasted = expressAuthentication as (req: ExRequest, // WARNING: This 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 = { + "KeyAlgorithm": { + "dataType": "refEnum", + "enums": ["a128gcm","a256gcm","a128cbchs256","a256cbchs512","a128kw","a256kw","bls12381g1","bls12381g2","c20p","xc20p","ed25519","x25519","k256","p256","p384"], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "AuthorityAndSubjectKeyDto": { + "dataType": "refObject", + "properties": { + "seed": {"dataType":"string"}, + "publicKeyBase58": {"dataType":"string"}, + "keyType": {"ref":"KeyAlgorithm"}, + }, + "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 + "X509CertificateIssuerAndSubjectOptionsDto": { + "dataType": "refObject", + "properties": { + "countryName": {"dataType":"string"}, + "stateOrProvinceName": {"dataType":"string"}, + "organizationalUnit": {"dataType":"string"}, + "commonName": {"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 + "ValidityDto": { + "dataType": "refObject", + "properties": { + "notBefore": {"dataType":"datetime"}, + "notAfter": {"dataType":"datetime"}, + }, + "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 + "X509KeyUsage": { + "dataType": "refEnum", + "enums": [1,2,4,8,16,32,64,128,256], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "KeyUsageDto": { + "dataType": "refObject", + "properties": { + "usages": {"dataType":"array","array":{"dataType":"refEnum","ref":"X509KeyUsage"},"required":true}, + "markAsCritical": {"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 + "X509ExtendedKeyUsage": { + "dataType": "refEnum", + "enums": ["1.3.6.1.5.5.7.3.1","1.3.6.1.5.5.7.3.2","1.3.6.1.5.5.7.3.3","1.3.6.1.5.5.7.3.4","1.3.6.1.5.5.7.3.8","1.3.6.1.5.5.7.3.9","1.0.18013.5.1.2"], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "ExtendedKeyUsageDto": { + "dataType": "refObject", + "properties": { + "usages": {"dataType":"array","array":{"dataType":"refEnum","ref":"X509ExtendedKeyUsage"},"required":true}, + "markAsCritical": {"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 + "AuthorityAndSubjectKeyIdentifierDto": { + "dataType": "refObject", + "properties": { + "include": {"dataType":"boolean","required":true}, + "markAsCritical": {"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 + "GeneralNameType": { + "dataType": "refEnum", + "enums": ["dns","dn","email","guid","ip","url","upn","id"], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "NameDto": { + "dataType": "refObject", + "properties": { + "type": {"ref":"GeneralNameType","required":true}, + "value": {"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 + "NameListDto": { + "dataType": "refObject", + "properties": { + "name": {"dataType":"array","array":{"dataType":"refObject","ref":"NameDto"},"required":true}, + "markAsCritical": {"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 + "BasicConstraintsDto": { + "dataType": "refObject", + "properties": { + "ca": {"dataType":"boolean","required":true}, + "pathLenConstraint": {"dataType":"double"}, + "markAsCritical": {"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 + "CrlDistributionPointsDto": { + "dataType": "refObject", + "properties": { + "urls": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "markAsCritical": {"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 + "X509CertificateExtensionsOptionsDto": { + "dataType": "refObject", + "properties": { + "keyUsage": {"ref":"KeyUsageDto"}, + "extendedKeyUsage": {"ref":"ExtendedKeyUsageDto"}, + "authorityKeyIdentifier": {"ref":"AuthorityAndSubjectKeyIdentifierDto"}, + "subjectKeyIdentifier": {"ref":"AuthorityAndSubjectKeyIdentifierDto"}, + "issuerAlternativeName": {"ref":"NameListDto"}, + "subjectAlternativeName": {"ref":"NameListDto"}, + "basicConstraints": {"ref":"BasicConstraintsDto"}, + "crlDistributionPoints": {"ref":"CrlDistributionPointsDto"}, + }, + "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 + "X509CreateCertificateOptionsDto": { + "dataType": "refObject", + "properties": { + "authorityKey": {"ref":"AuthorityAndSubjectKeyDto"}, + "subjectPublicKey": {"ref":"AuthorityAndSubjectKeyDto"}, + "serialNumber": {"dataType":"string"}, + "issuer": {"dataType":"union","subSchemas":[{"ref":"X509CertificateIssuerAndSubjectOptionsDto"},{"dataType":"string"}],"required":true}, + "subject": {"dataType":"union","subSchemas":[{"ref":"X509CertificateIssuerAndSubjectOptionsDto"},{"dataType":"string"}]}, + "validity": {"ref":"ValidityDto"}, + "extensions": {"ref":"X509CertificateExtensionsOptionsDto"}, + }, + "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 + "X509ImportCertificateOptionsDto": { + "dataType": "refObject", + "properties": { + "certificate": {"dataType":"string","required":true}, + "privateKey": {"dataType":"string"}, + "keyType": {"dataType":"any","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 + "PublicJwk": { + "dataType": "refObject", + "properties": { + }, + "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 + "Uint8Array": { + "dataType": "refObject", + "properties": { + }, + "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 + "AnyUint8Array": { + "dataType": "refAlias", + "type": {"ref":"Uint8Array","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 + "X509Certificate": { + "dataType": "refObject", + "properties": { + "publicJwk": {"ref":"PublicJwk","required":true}, + "privateKey": {"ref":"AnyUint8Array"}, + }, + "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"], @@ -338,11 +521,6 @@ 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 - "KeyAlgorithm": { - "dataType": "refEnum", - "enums": ["a128gcm","a256gcm","a128cbchs256","a256cbchs512","a128kw","a256kw","bls12381g1","bls12381g2","c20p","xc20p","ed25519","x25519","k256","p256","p384"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "DidDocument": { "dataType": "refAlias", "type": {"ref":"Record_string.any_","validators":{}}, @@ -618,6 +796,190 @@ export function RegisterRoutes(app: Router) { + const argsX509Controller_createX509Certificate: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createX509Options: {"in":"body","name":"createX509Options","required":true,"ref":"X509CreateCertificateOptionsDto"}, + }; + app.post('/x509', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(X509Controller)), + ...(fetchMiddlewares(X509Controller.prototype.createX509Certificate)), + + async function X509Controller_createX509Certificate(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_createX509Certificate, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(X509Controller); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'createX509Certificate', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsX509Controller_ImportX509Certificates: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + importX509Options: {"in":"body","name":"importX509Options","required":true,"ref":"X509ImportCertificateOptionsDto"}, + }; + app.post('/x509/import', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(X509Controller)), + ...(fetchMiddlewares(X509Controller.prototype.ImportX509Certificates)), + + async function X509Controller_ImportX509Certificates(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_ImportX509Certificates, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(X509Controller); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'ImportX509Certificates', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsX509Controller_addTrustedCertificate: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + options: {"in":"body","name":"options","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"certificate":{"dataType":"string","required":true}}}, + }; + app.post('/x509/trusted', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(X509Controller)), + ...(fetchMiddlewares(X509Controller.prototype.addTrustedCertificate)), + + async function X509Controller_addTrustedCertificate(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_addTrustedCertificate, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(X509Controller); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'addTrustedCertificate', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsX509Controller_getTrustedCertificates: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + }; + app.get('/x509/trusted', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(X509Controller)), + ...(fetchMiddlewares(X509Controller.prototype.getTrustedCertificates)), + + async function X509Controller_getTrustedCertificates(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_getTrustedCertificates, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(X509Controller); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'getTrustedCertificates', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsX509Controller_decodeCertificate: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + options: {"in":"body","name":"options","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"certificate":{"dataType":"string","required":true}}}, + }; + app.post('/x509/decode', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(X509Controller)), + ...(fetchMiddlewares(X509Controller.prototype.decodeCertificate)), + + async function X509Controller_decodeCertificate(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_decodeCertificate, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(X509Controller); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'decodeCertificate', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 const argsQuestionAnswerController_getQuestionAnswerRecords: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, connectionId: {"in":"query","name":"connectionId","dataType":"string"}, diff --git a/src/routes/swagger.json b/src/routes/swagger.json index f6749323..41ebc7e3 100644 --- a/src/routes/swagger.json +++ b/src/routes/swagger.json @@ -7,6 +7,398 @@ "requestBodies": {}, "responses": {}, "schemas": { + "KeyAlgorithm": { + "enum": [ + "a128gcm", + "a256gcm", + "a128cbchs256", + "a256cbchs512", + "a128kw", + "a256kw", + "bls12381g1", + "bls12381g2", + "c20p", + "xc20p", + "ed25519", + "x25519", + "k256", + "p256", + "p384" + ], + "type": "string" + }, + "AuthorityAndSubjectKeyDto": { + "properties": { + "seed": { + "type": "string", + "example": "my-seed-12345" + }, + "publicKeyBase58": { + "type": "string", + "example": "3yPQbnk6WwLgX8K3JZ4t7vBnJ8XqY2mMpRcD9fNvGtHw" + }, + "keyType": { + "$ref": "#/components/schemas/KeyAlgorithm", + "example": "p256" + } + }, + "type": "object", + "additionalProperties": false + }, + "X509CertificateIssuerAndSubjectOptionsDto": { + "properties": { + "countryName": { + "type": "string", + "example": "US" + }, + "stateOrProvinceName": { + "type": "string", + "example": "California" + }, + "organizationalUnit": { + "type": "string", + "example": "IT Department" + }, + "commonName": { + "type": "string", + "example": "Example Corporation" + } + }, + "type": "object", + "additionalProperties": false + }, + "ValidityDto": { + "properties": { + "notBefore": { + "type": "string", + "format": "date-time", + "example": "2024-01-01T00:00:00.000Z" + }, + "notAfter": { + "type": "string", + "format": "date-time", + "example": "2025-01-01T00:00:00.000Z" + } + }, + "type": "object", + "additionalProperties": false + }, + "X509KeyUsage": { + "enum": [ + 1, + 2, + 4, + 8, + 16, + 32, + 64, + 128, + 256 + ], + "type": "number" + }, + "KeyUsageDto": { + "properties": { + "usages": { + "items": { + "$ref": "#/components/schemas/X509KeyUsage" + }, + "type": "array", + "example": [ + "digitalSignature", + "keyEncipherment", + "crlSign" + ] + }, + "markAsCritical": { + "type": "boolean", + "example": true + } + }, + "required": [ + "usages" + ], + "type": "object", + "additionalProperties": false + }, + "X509ExtendedKeyUsage": { + "enum": [ + "1.3.6.1.5.5.7.3.1", + "1.3.6.1.5.5.7.3.2", + "1.3.6.1.5.5.7.3.3", + "1.3.6.1.5.5.7.3.4", + "1.3.6.1.5.5.7.3.8", + "1.3.6.1.5.5.7.3.9", + "1.0.18013.5.1.2" + ], + "type": "string" + }, + "ExtendedKeyUsageDto": { + "properties": { + "usages": { + "items": { + "$ref": "#/components/schemas/X509ExtendedKeyUsage" + }, + "type": "array", + "example": [ + "MdlDs", + "ServerAuth", + "ClientAuth" + ] + }, + "markAsCritical": { + "type": "boolean", + "example": true + } + }, + "required": [ + "usages" + ], + "type": "object", + "additionalProperties": false + }, + "AuthorityAndSubjectKeyIdentifierDto": { + "properties": { + "include": { + "type": "boolean", + "example": true + }, + "markAsCritical": { + "type": "boolean", + "example": true + } + }, + "required": [ + "include" + ], + "type": "object", + "additionalProperties": false + }, + "GeneralNameType": { + "enum": [ + "dns", + "dn", + "email", + "guid", + "ip", + "url", + "upn", + "id" + ], + "type": "string" + }, + "NameDto": { + "properties": { + "type": { + "$ref": "#/components/schemas/GeneralNameType", + "example": "dns" + }, + "value": { + "type": "string", + "example": "example.com" + } + }, + "required": [ + "type", + "value" + ], + "type": "object", + "additionalProperties": false + }, + "NameListDto": { + "properties": { + "name": { + "items": { + "$ref": "#/components/schemas/NameDto" + }, + "type": "array", + "example": [ + { + "type": "dns", + "value": "example.com" + }, + { + "type": "email", + "value": "admin@example.com" + } + ] + }, + "markAsCritical": { + "type": "boolean", + "example": true + } + }, + "required": [ + "name" + ], + "type": "object", + "additionalProperties": false + }, + "BasicConstraintsDto": { + "properties": { + "ca": { + "type": "boolean", + "example": false + }, + "pathLenConstraint": { + "type": "number", + "format": "double", + "example": 0 + }, + "markAsCritical": { + "type": "boolean", + "example": true + } + }, + "required": [ + "ca" + ], + "type": "object", + "additionalProperties": false + }, + "CrlDistributionPointsDto": { + "properties": { + "urls": { + "items": { + "type": "string" + }, + "type": "array", + "example": [ + "http://crl.example.com/ca.crl" + ] + }, + "markAsCritical": { + "type": "boolean", + "example": true + } + }, + "required": [ + "urls" + ], + "type": "object", + "additionalProperties": false + }, + "X509CertificateExtensionsOptionsDto": { + "properties": { + "keyUsage": { + "$ref": "#/components/schemas/KeyUsageDto" + }, + "extendedKeyUsage": { + "$ref": "#/components/schemas/ExtendedKeyUsageDto" + }, + "authorityKeyIdentifier": { + "$ref": "#/components/schemas/AuthorityAndSubjectKeyIdentifierDto" + }, + "subjectKeyIdentifier": { + "$ref": "#/components/schemas/AuthorityAndSubjectKeyIdentifierDto" + }, + "issuerAlternativeName": { + "$ref": "#/components/schemas/NameListDto" + }, + "subjectAlternativeName": { + "$ref": "#/components/schemas/NameListDto" + }, + "basicConstraints": { + "$ref": "#/components/schemas/BasicConstraintsDto" + }, + "crlDistributionPoints": { + "$ref": "#/components/schemas/CrlDistributionPointsDto" + } + }, + "type": "object", + "additionalProperties": false + }, + "X509CreateCertificateOptionsDto": { + "properties": { + "authorityKey": { + "$ref": "#/components/schemas/AuthorityAndSubjectKeyDto" + }, + "subjectPublicKey": { + "$ref": "#/components/schemas/AuthorityAndSubjectKeyDto" + }, + "serialNumber": { + "type": "string", + "example": "1234567890" + }, + "issuer": { + "anyOf": [ + { + "$ref": "#/components/schemas/X509CertificateIssuerAndSubjectOptionsDto" + }, + { + "type": "string" + } + ] + }, + "subject": { + "anyOf": [ + { + "$ref": "#/components/schemas/X509CertificateIssuerAndSubjectOptionsDto" + }, + { + "type": "string" + } + ] + }, + "validity": { + "$ref": "#/components/schemas/ValidityDto" + }, + "extensions": { + "$ref": "#/components/schemas/X509CertificateExtensionsOptionsDto" + } + }, + "required": [ + "issuer" + ], + "type": "object", + "additionalProperties": false + }, + "X509ImportCertificateOptionsDto": { + "properties": { + "certificate": { + "type": "string" + }, + "privateKey": { + "type": "string" + }, + "keyType": {} + }, + "required": [ + "certificate", + "keyType" + ], + "type": "object", + "additionalProperties": false + }, + "PublicJwk": { + "properties": {}, + "type": "object", + "additionalProperties": false + }, + "Uint8Array": { + "description": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "properties": {}, + "type": "object", + "additionalProperties": false + }, + "AnyUint8Array": { + "$ref": "#/components/schemas/Uint8Array" + }, + "X509Certificate": { + "properties": { + "publicJwk": { + "$ref": "#/components/schemas/PublicJwk" + }, + "privateKey": { + "$ref": "#/components/schemas/AnyUint8Array" + } + }, + "required": [ + "publicJwk" + ], + "type": "object", + "additionalProperties": false + }, "QuestionAnswerRole": { "enum": [ "questioner", @@ -712,26 +1104,6 @@ "type": "string", "example": "did:key:z6Mkk7yqnGF3YwTrLpqrW6PGsKci7dNqh1CjnvMbzrMerSeL" }, - "KeyAlgorithm": { - "enum": [ - "a128gcm", - "a256gcm", - "a128cbchs256", - "a256cbchs512", - "a128kw", - "a256kw", - "bls12381g1", - "bls12381g2", - "c20p", - "xc20p", - "ed25519", - "x25519", - "k256", - "p256", - "p384" - ], - "type": "string" - }, "DidDocument": { "$ref": "#/components/schemas/Record_string.any_" }, @@ -1306,6 +1678,217 @@ "contact": {} }, "paths": { + "/x509": { + "post": { + "operationId": "CreateX509Certificate", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "properties": { + "publicCertificateBase64": { + "type": "string" + } + }, + "required": [ + "publicCertificateBase64" + ], + "type": "object" + } + } + } + } + }, + "tags": [ + "x509" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/X509CreateCertificateOptionsDto" + } + } + } + } + } + }, + "/x509/import": { + "post": { + "operationId": "ImportX509Certificates", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "properties": { + "issuerCertficicate": { + "type": "string" + } + }, + "required": [ + "issuerCertficicate" + ], + "type": "object" + } + } + } + } + }, + "tags": [ + "x509" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/X509ImportCertificateOptionsDto" + } + } + } + } + } + }, + "/x509/trusted": { + "post": { + "operationId": "AddTrustedCertificate", + "responses": { + "204": { + "description": "No content" + } + }, + "tags": [ + "x509" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "certificate": { + "type": "string" + } + }, + "required": [ + "certificate" + ], + "type": "object" + } + } + } + } + }, + "get": { + "operationId": "GetTrustedCertificates", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "items": { + "type": "string" + }, + "type": "array" + } + } + } + } + }, + "tags": [ + "x509" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [] + } + }, + "/x509/decode": { + "post": { + "operationId": "DecodeCertificate", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/X509Certificate" + } + } + } + } + }, + "tags": [ + "x509" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "certificate": { + "type": "string" + } + }, + "required": [ + "certificate" + ], + "type": "object" + } + } + } + } + } + }, "/didcomm/question-answer": { "get": { "operationId": "GetQuestionAnswerRecords", From bebb8e6501eff61a3bfdaee85a05625e2a8e47cc Mon Sep 17 00:00:00 2001 From: Krishna Waske Date: Tue, 16 Dec 2025 19:33:34 +0530 Subject: [PATCH 2/8] fix: x509 import fix Signed-off-by: Krishna Waske --- src/controllers/x509/x509.service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/x509/x509.service.ts b/src/controllers/x509/x509.service.ts index 9693ddbb..9123f860 100644 --- a/src/controllers/x509/x509.service.ts +++ b/src/controllers/x509/x509.service.ts @@ -16,6 +16,7 @@ import { import { generateSecretKey, getCertificateValidityForSystem } from '../../utils/helpers' +import { pemToRawEd25519PrivateKey } from './crypto-util' import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' import { transformPrivateKeyToPrivateJwk, transformSeedToPrivateJwk } from '@credo-ts/askar' @@ -179,8 +180,8 @@ class x509Service { public async ImportX509Certificates(agentReq: Req, options: X509ImportCertificateOptionsDto) { const agent = agentReq.agent agent.config.logger.debug(`Start validating keys`) - // const secretHexKey = await pemToRawEd25519PrivateKey(options.privateKey ?? '') - // const privateKey = TypedArrayEncoder.fromHex(secretHexKey) + const secretHexKey = await pemToRawEd25519PrivateKey(options.privateKey ?? '') + const privateKey = TypedArrayEncoder.fromHex(secretHexKey) agent.config.logger.debug(`Decode certificate`) const parsedCertificate = X509Service.parseCertificate(agent.context, { @@ -202,7 +203,7 @@ class x509Service { // crv: 'P-256', // kty: 'EC', // }, - privateKey: TypedArrayEncoder.fromString(options.privateKey!), + privateKey, }) const key = await agent.kms.importKey({ From 32480fae22244ff0172f9ac14a5afaa1e9f7b941 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 23 Dec 2025 12:48:09 +0530 Subject: [PATCH 3/8] fix/added dynamic implementation for keyType of x509 Signed-off-by: sujitaw --- src/controllers/did/DidController.ts | 38 ++++++++++------- src/controllers/x509/x509.service.ts | 44 ++++++------------- src/controllers/x509/x509.types.ts | 64 +++++++++++++++++++++++++++- src/enums/enum.ts | 11 ++++- src/utils/constant.ts | 20 +++++++++ src/utils/helpers.ts | 42 +++++++++++++++++- 6 files changed, 169 insertions(+), 50 deletions(-) diff --git a/src/controllers/did/DidController.ts b/src/controllers/did/DidController.ts index 193ee075..ce38dc26 100644 --- a/src/controllers/did/DidController.ts +++ b/src/controllers/did/DidController.ts @@ -1,7 +1,9 @@ + import type { DidResolutionResultProps } from '../types' import type { PolygonDidCreateOptions } from '@ayanworks/credo-polygon-w3c-module/build/dids' import type { DidDocument, KeyDidCreateOptions, PeerDidNumAlgo2CreateOptions } from '@credo-ts/core' +import { transformPrivateKeyToPrivateJwk, transformSeedToPrivateJwk } from '@credo-ts/askar' import { TypedArrayEncoder, DidDocumentBuilder, @@ -11,19 +13,23 @@ import { Kms, Hasher, } from '@credo-ts/core' +import { Key, KeyAlgorithm,askar } from '@openwallet-foundation/askar-nodejs' import axios from 'axios' import { Request as Req } from 'express' +import { get } from 'http' import { Body, Controller, Example, Get, Path, Post, Route, Tags, Security, Request } from 'tsoa' import { injectable } from 'tsyringe' -import { DidMethod, Network, Role, SCOPES } from '../../enums' +import { DidMethod, KeyAlgorithmCurve, Network, Role, SCOPES } from '../../enums' import ErrorHandlingService from '../../errorHandlingService' import { BadRequestError, InternalServerError } from '../../errors' import { AgentType } from '../../types' +import { keyAlgorithmToCurve } from '../../utils/constant' +import { getTypeFromCurve } from '../../utils/helpers' import { CreateDidResponse, Did, DidRecordExample } from '../examples' import { DidCreate } from '../types' -import { KeyAlgorithm,askar } from '@openwallet-foundation/askar-nodejs' -import { transformPrivateKeyToPrivateJwk, transformSeedToPrivateJwk } from '@credo-ts/askar' +import { supportedKeyTypesDID } from '../x509/x509.types' + @Tags('Dids') @@ -369,13 +375,14 @@ export class DidController extends Controller { const key = await agent.kms.importKey({ privateJwk }) const publicJwk = Kms.PublicJwk.fromPublicJwk(key.publicJwk) + const completeDid = `${didMethod}:${did}` await agent.dids.import({ - did, + did: completeDid, keys: [ { kmsKeyId: key.keyId, - // TODO: Find what to add here - didDocumentRelativeKeyId: '' + didDocumentRelativeKeyId: '#verkey', + } ] }) @@ -395,10 +402,15 @@ export class DidController extends Controller { if (didOptions.keyType === KeyAlgorithm.Bls12381G2) { throw new BadRequestError('didOptions.keyType for type "bls12381g2" has been deprecated') } - if (didOptions.keyType !== KeyAlgorithm.Ed25519) { - throw new BadRequestError('Only ed25519 and bls12381g2 key type supported') + if (didOptions.keyType === 'p521' as KeyAlgorithm) { + throw new BadRequestError('didOptions.keyType for type p521 is not supported') + } + const normalizedCurve = keyAlgorithmToCurve[didOptions.keyType as KeyAlgorithm] + if (!(normalizedCurve && supportedKeyTypesDID[DidMethod.Key]?.some(kt => kt.crv === normalizedCurve))) { + throw new BadRequestError(`Invalid keyType: ${didOptions.keyType}`) } + if (!didOptions.did) { console.log("This is inside if") // Transform seed to private JWK and @@ -423,17 +435,13 @@ export class DidController extends Controller { // }, // }) const privateJwk = transformPrivateKeyToPrivateJwk({ - privateKey: TypedArrayEncoder.fromString('96213c3d7fc8d4d6754c7a0fd969598e'), - type: { - kty: 'OKP', - crv: 'Ed25519', - }, + privateKey: TypedArrayEncoder.fromString(didOptions.seed), + type: getTypeFromCurve(didOptions.keyType ?? KeyAlgorithm.Ed25519), }).privateJwk - const { keyId } = await agent.kms.importKey({ privateJwk, }) - + console.log("This is keyId::::::", keyId) const didResponse = await agent.dids.create({ method: 'key', options: { diff --git a/src/controllers/x509/x509.service.ts b/src/controllers/x509/x509.service.ts index 9123f860..a03f42e2 100644 --- a/src/controllers/x509/x509.service.ts +++ b/src/controllers/x509/x509.service.ts @@ -1,8 +1,9 @@ -import type { X509CreateCertificateOptionsDto } from './x509.types' + import type { BasicX509CreateCertificateConfig, X509ImportCertificateOptionsDto } from '../types' import type { CredoError } from '@credo-ts/core' import type { Request as Req } from 'express' +import { transformPrivateKeyToPrivateJwk, transformSeedToPrivateJwk } from '@credo-ts/askar' import { Kms, TypedArrayEncoder, @@ -13,12 +14,12 @@ import { X509Service, type Agent, } from '@credo-ts/core' +import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' -import { generateSecretKey, getCertificateValidityForSystem } from '../../utils/helpers' +import { generateSecretKey, getCertificateValidityForSystem, getTypeFromCurve } from '../../utils/helpers' import { pemToRawEd25519PrivateKey } from './crypto-util' -import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' -import { transformPrivateKeyToPrivateJwk, transformSeedToPrivateJwk } from '@credo-ts/askar' +import { type X509CreateCertificateOptionsDto } from './x509.types' class x509Service { public async createSelfSignedDCS(createX509Options: BasicX509CreateCertificateConfig, agentReq: Req) { @@ -80,9 +81,7 @@ class x509Service { let authorityKeyID, subjectPublicKeyID - agent.config.logger.debug(`createCertificate options:`, options) - - + agent.config.logger.debug(`createCertificate options:`, options) if (options.authorityKey && options?.authorityKey?.seed) { @@ -91,11 +90,8 @@ class x509Service { // crv: 'P-256', // kty: 'EC', // }, - type: { - crv: 'Ed25519', - kty: 'OKP', - }, - seed: TypedArrayEncoder.fromString(options.authorityKey!.seed!), + type: getTypeFromCurve(options.authorityKey.keyType ?? 'P-256'), + seed: TypedArrayEncoder.fromString(options.authorityKey!.seed!), }) const { publicJwk } = await agent.kms.importKey({ privateJwk }) @@ -109,10 +105,7 @@ class x509Service { // crv: 'P-256', // kty: 'EC', // } - type: { - crv: 'Ed25519', - kty: 'OKP', - } + type: getTypeFromCurve(options.authorityKey?.keyType ?? 'P-256') }) authorityKeyID = publicJwk } @@ -135,10 +128,7 @@ class x509Service { const importedKey = await agentReq.agent.kms.importKey({ privateJwk: transformSeedToPrivateJwk({ seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), - type: { - crv: 'P-256', - kty: 'EC', - }, + type: getTypeFromCurve(options.subjectPublicKey?.keyType ?? 'P-256'), }).privateJwk, }) @@ -149,10 +139,7 @@ class x509Service { // keyType: KeyAlgorithm.EcSecp256r1, // }) const { keyId, publicJwk } = await agent.kms.createKey({ - type: { - crv: 'P-256', - kty: 'EC', - } + type: getTypeFromCurve(options.subjectPublicKey?.keyType ?? 'P-256') }) subjectPublicKeyID = publicJwk } @@ -194,11 +181,9 @@ class x509Service { // privateKey: privateKey, // keyType: options.keyType, // }) + const keyTypeInfo = getTypeFromCurve(options.keyType) const { privateJwk } = transformPrivateKeyToPrivateJwk({ - type: { - crv: 'Ed25519', - kty: 'OKP', - }, + type: keyTypeInfo, // type: { // crv: 'P-256', // kty: 'EC', @@ -209,9 +194,8 @@ class x509Service { const key = await agent.kms.importKey({ privateJwk, }) - if ( - parsedCertificate.publicJwk.publicKey.kty !== options.keyType || + parsedCertificate.publicJwk.publicKey.kty !== keyTypeInfo.kty || !parsedCertificate.publicJwk.equals(Kms.PublicJwk.fromPublicJwk(key.publicJwk)) ) { // if ( diff --git a/src/controllers/x509/x509.types.ts b/src/controllers/x509/x509.types.ts index 9a0f2f9e..311f6697 100644 --- a/src/controllers/x509/x509.types.ts +++ b/src/controllers/x509/x509.types.ts @@ -1,8 +1,10 @@ import type { X509ExtendedKeyUsage, X509KeyUsage } from '@credo-ts/core' -import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' +import type { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' import { Extension, Example } from 'tsoa' +import { DidMethod } from '../../enums/enum' + // Enum remains the same export enum GeneralNameType { DNS = 'dns', @@ -33,7 +35,7 @@ export interface AuthorityAndSubjectKeyDto { * @description Type of the key used for signing the X.509 Certificate (default is p256) */ // FIXME: Check type - keyType?: KeyAlgorithm + keyType?: Curve } export interface NameDto { @@ -204,3 +206,61 @@ export interface X509CreateCertificateOptionsDto { validity?: ValidityDto extensions?: X509CertificateExtensionsOptionsDto } + +export type OkpCurve = 'Ed25519' | 'X25519' +export type EcCurve = 'P-256' | 'P-384' | 'P-521' | 'secp256k1' + +export type OkpType = { + kty: 'OKP' + crv: 'Ed25519' | 'X25519' +} + +export type EcType = { + kty: 'EC' + crv: 'P-256' | 'P-384' | 'P-521' | 'secp256k1' +} + +export type Curve = 'Ed25519' | 'X25519' | 'P-256' | 'P-384' | 'P-521' | 'secp256k1' + +export enum RsaModulusLength { + RSA_2048 = 2048, + RSA_3072 = 3072, + RSA_4096 = 4096, +} + +export type KmsCreateKeyTypeAssymetric = + | { + kty: 'OKP' + crv: 'Ed25519' | 'X25519' + } + | { + kty: 'EC' + crv: 'P-256' | 'P-384' | 'P-521' | 'secp256k1' + } + +export const supportedKeyTypesDID: Record = { + [DidMethod.Indy]: [{ kty: 'OKP', crv: 'Ed25519' }], + + [DidMethod.Peer]: [ + { kty: 'OKP', crv: 'Ed25519' }, + { kty: 'OKP', crv: 'X25519' }, + ], + + [DidMethod.Key]: [ + { kty: 'OKP', crv: 'Ed25519' }, + { kty: 'OKP', crv: 'X25519' }, + { kty: 'EC', crv: 'P-256' }, + { kty: 'EC', crv: 'P-384' }, + { kty: 'EC', crv: 'P-521' }, + { kty: 'EC', crv: 'secp256k1' }, + ], + + [DidMethod.Web]: [ + { kty: 'OKP', crv: 'Ed25519' }, + { kty: 'OKP', crv: 'X25519' }, + { kty: 'EC', crv: 'P-256' }, + { kty: 'EC', crv: 'secp256k1' }, + ], + + [DidMethod.Polygon]: [{ kty: 'EC', crv: 'secp256k1' }], +} diff --git a/src/enums/enum.ts b/src/enums/enum.ts index 16ee0de1..b2c3f6a8 100644 --- a/src/enums/enum.ts +++ b/src/enums/enum.ts @@ -97,4 +97,13 @@ export enum SCOPES { export enum SignerMethod { Did = 'did', X5c = 'x5c', -} \ No newline at end of file +} +export declare enum KeyAlgorithmCurve { + Ed25519 = 'Ed25519', + X25519 = 'X25519', + P256 = 'P-256', + P384 = 'P-384', + P521 = 'P-521', + secp256k1 = 'secp256k1', + Bls12381G2 = 'bls12381g2', +} diff --git a/src/utils/constant.ts b/src/utils/constant.ts index 03741d0a..e5d3e7eb 100644 --- a/src/utils/constant.ts +++ b/src/utils/constant.ts @@ -1 +1,21 @@ +import type { Curve } from '../controllers/x509/x509.types' + +import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' + export const X509_CERTIFICATE_RECORD = 'X509_CERTIFICATE' +export const keyAlgorithmToCurve: Partial> = { + [KeyAlgorithm.Ed25519]: 'Ed25519', + [KeyAlgorithm.X25519]: 'X25519', + + [KeyAlgorithm.EcSecp256r1]: 'P-256', + [KeyAlgorithm.EcSecp384r1]: 'P-384', + [KeyAlgorithm.EcSecp256k1]: 'secp256k1', +} +export const curveToKty = { + Ed25519: 'OKP', + X25519: 'OKP', + 'P-256': 'EC', + 'P-384': 'EC', + 'P-521': 'EC', + secp256k1: 'EC', +} as const diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index fdee31ae..598658d4 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -1,6 +1,12 @@ +import type { Curve, EcCurve, EcType, OkpCurve, OkpType } from '../controllers/x509/x509.types' +import type { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' + import { JsonEncoder, JsonTransformer } from '@credo-ts/core' import { randomBytes } from 'crypto' +import { curveToKty, keyAlgorithmToCurve } from './constant' + + export function objectToJson(result: T) { const serialized = JsonTransformer.serialize(result) return JsonEncoder.fromString(serialized) @@ -24,7 +30,6 @@ export async function generateSecretKey(length: number = 32): Promise { return secretKey } - export function getCertificateValidityForSystem(IsRootCA = false) { let options: { validityYears?: number, startFromCurrentMonth?: boolean }; if (IsRootCA) { @@ -64,4 +69,37 @@ export function getCertificateValidity(options?: { const notAfter = new Date(Date.UTC(startYear + validityYears, startMonth, startDay, 0, 0, 0)) return { notBefore, notAfter } -} \ No newline at end of file +} + +function normalizeToCurve(input: Curve | KeyAlgorithm): Curve | undefined { + // Already a Curve + if (input in curveToKty) { + return input as Curve + } + + // Try mapping from KeyAlgorithm + return keyAlgorithmToCurve[input as KeyAlgorithm] +} + +export function getTypeFromCurve(key: Curve | KeyAlgorithm): OkpType | EcType { + let keyTypeInfo: OkpType | EcType + const normalizedCurve = normalizeToCurve(key) + if (normalizedCurve && curveToKty[normalizedCurve] === 'OKP') { + keyTypeInfo = { + kty: 'OKP', + crv: normalizedCurve as OkpCurve, + } + } else if (normalizedCurve && curveToKty[normalizedCurve] === 'EC') { + keyTypeInfo = { + kty: 'EC', + crv: normalizedCurve as EcCurve, + } + } else { + keyTypeInfo = { + kty: 'EC', + crv: 'P-256', + } + } + console.log("keyTypeInfo",keyTypeInfo) + return keyTypeInfo +} From 20cac403b63c71a87337edc9cedfa743c9bff072 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 23 Dec 2025 12:56:14 +0530 Subject: [PATCH 4/8] fix/sonarqube issue Signed-off-by: sujitaw --- src/routes/routes.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 022568db..1dca8307 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -29,9 +29,9 @@ const expressAuthenticationRecasted = expressAuthentication as (req: ExRequest, // WARNING: This 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 = { - "KeyAlgorithm": { - "dataType": "refEnum", - "enums": ["a128gcm","a256gcm","a128cbchs256","a256cbchs512","a128kw","a256kw","bls12381g1","bls12381g2","c20p","xc20p","ed25519","x25519","k256","p256","p384"], + "Curve": { + "dataType": "refAlias", + "type": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["Ed25519"]},{"dataType":"enum","enums":["X25519"]},{"dataType":"enum","enums":["P-256"]},{"dataType":"enum","enums":["P-384"]},{"dataType":"enum","enums":["P-521"]},{"dataType":"enum","enums":["secp256k1"]}],"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 "AuthorityAndSubjectKeyDto": { @@ -39,7 +39,7 @@ const models: TsoaRoute.Models = { "properties": { "seed": {"dataType":"string"}, "publicKeyBase58": {"dataType":"string"}, - "keyType": {"ref":"KeyAlgorithm"}, + "keyType": {"ref":"Curve"}, }, "additionalProperties": false, }, @@ -521,6 +521,11 @@ 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 + "KeyAlgorithm": { + "dataType": "refEnum", + "enums": ["a128gcm","a256gcm","a128cbchs256","a256cbchs512","a128kw","a256kw","bls12381g1","bls12381g2","c20p","xc20p","ed25519","x25519","k256","p256","p384"], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa "DidDocument": { "dataType": "refAlias", "type": {"ref":"Record_string.any_","validators":{}}, From 0fc2b6a3a68f614c8d6997fcb1a97e888d780dc1 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 23 Dec 2025 12:59:30 +0530 Subject: [PATCH 5/8] fix/sonarqube issue Signed-off-by: sujitaw --- src/routes/routes.ts | 404 +++++++++++++++++++++---------------------- 1 file changed, 202 insertions(+), 202 deletions(-) diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 1dca8307..7810a3b7 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -6,6 +6,8 @@ import { fetchMiddlewares, ExpressTemplateService } 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 { X509Controller } from './../controllers/x509/x509.Controller'; // WARNING: This 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 { QuestionAnswerController } from './../controllers/didcomm/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 { OutOfBandController } from './../controllers/didcomm/outofband/OutOfBandController'; @@ -15,8 +17,6 @@ import { ConnectionController } from './../controllers/didcomm/connections/Conne 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 { 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 { 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'; @@ -210,6 +210,52 @@ 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 + "TenantConfig": { + "dataType": "refAlias", + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"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 + "Record_string.any_": { + "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 + "MetadataValue": { + "dataType": "refAlias", + "type": {"ref":"Record_string.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 + "MetadataBase": { + "dataType": "refAlias", + "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"MetadataValue"},"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 + "Metadata____": { + "dataType": "refObject", + "properties": { + "data": {"ref":"MetadataBase","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_CustomTenantConfig.Exclude_keyofCustomTenantConfig.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_CustomTenantConfig.walletConfig_": { + "dataType": "refAlias", + "type": {"ref":"Pick_CustomTenantConfig.Exclude_keyofCustomTenantConfig.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": { + "dataType": "refObject", + "properties": { + "config": {"ref":"Omit_CustomTenantConfig.walletConfig_","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 "QuestionAnswerRole": { "dataType": "refEnum", "enums": ["questioner","responder"], @@ -484,11 +530,6 @@ const models: TsoaRoute.Models = { "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_string.any_": { - "dataType": "refAlias", - "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 "DidResolutionMetadata": { "dataType": "refObject", "properties": { @@ -743,47 +784,6 @@ const models: TsoaRoute.Models = { "additionalProperties": false, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "TenantConfig": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"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 - "MetadataValue": { - "dataType": "refAlias", - "type": {"ref":"Record_string.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 - "MetadataBase": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"MetadataValue"},"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 - "Metadata____": { - "dataType": "refObject", - "properties": { - "data": {"ref":"MetadataBase","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_CustomTenantConfig.Exclude_keyofCustomTenantConfig.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_CustomTenantConfig.walletConfig_": { - "dataType": "refAlias", - "type": {"ref":"Pick_CustomTenantConfig.Exclude_keyofCustomTenantConfig.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": { - "dataType": "refObject", - "properties": { - "config": {"ref":"Omit_CustomTenantConfig.walletConfig_","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 }; const templateService = new ExpressTemplateService(models, {"noImplicitAdditionalProperties":"throw-on-extras","bodyCoercion":true}); @@ -985,6 +985,160 @@ 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 + const argsMultiTenancyController_createTenant: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createTenantOptions: {"in":"body","name":"createTenantOptions","required":true,"ref":"CreateTenantOptions"}, + }; + app.post('/multi-tenancy/create-tenant', + authenticateMiddleware([{"jwt":["Basewallet"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.createTenant)), + + async function MultiTenancyController_createTenant(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_createTenant, 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); + } + + await templateService.apiHandler({ + methodName: 'createTenant', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsMultiTenancyController_getTenantToken: Record = { + 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}}}, + }; + app.post('/multi-tenancy/get-token/:tenantId', + authenticateMiddleware([{"jwt":["Basewallet"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantToken)), + + async function MultiTenancyController_getTenantToken(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_getTenantToken, 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); + } + + await templateService.apiHandler({ + methodName: 'getTenantToken', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsMultiTenancyController_getTenantById: Record = { + 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}}}, + }; + app.get('/multi-tenancy/:tenantId', + authenticateMiddleware([{"jwt":["Basewallet"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantById)), + + async function MultiTenancyController_getTenantById(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_getTenantById, 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); + } + + await templateService.apiHandler({ + methodName: 'getTenantById', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 + const argsMultiTenancyController_deleteTenantById: Record = { + 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}}}, + }; + app.delete('/multi-tenancy/:tenantId', + authenticateMiddleware([{"jwt":["Basewallet"]}]), + ...(fetchMiddlewares(MultiTenancyController)), + ...(fetchMiddlewares(MultiTenancyController.prototype.deleteTenantById)), + + async function MultiTenancyController_deleteTenantById(request: ExRequest, response: ExResponse, next: any) { + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_deleteTenantById, 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); + } + + await templateService.apiHandler({ + methodName: 'deleteTenantById', + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } 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 const argsQuestionAnswerController_getQuestionAnswerRecords: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, connectionId: {"in":"query","name":"connectionId","dataType":"string"}, @@ -1880,160 +2034,6 @@ 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 - const argsMultiTenancyController_createTenant: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - createTenantOptions: {"in":"body","name":"createTenantOptions","required":true,"ref":"CreateTenantOptions"}, - }; - app.post('/multi-tenancy/create-tenant', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createTenant)), - - async function MultiTenancyController_createTenant(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_createTenant, 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); - } - - await templateService.apiHandler({ - methodName: 'createTenant', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_getTenantToken: Record = { - 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}}}, - }; - app.post('/multi-tenancy/get-token/:tenantId', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantToken)), - - async function MultiTenancyController_getTenantToken(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_getTenantToken, 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); - } - - await templateService.apiHandler({ - methodName: 'getTenantToken', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_getTenantById: Record = { - 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}}}, - }; - app.get('/multi-tenancy/:tenantId', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantById)), - - async function MultiTenancyController_getTenantById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_getTenantById, 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); - } - - await templateService.apiHandler({ - methodName: 'getTenantById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_deleteTenantById: Record = { - 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}}}, - }; - app.delete('/multi-tenancy/:tenantId', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.deleteTenantById)), - - async function MultiTenancyController_deleteTenantById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_deleteTenantById, 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); - } - - await templateService.apiHandler({ - methodName: 'deleteTenantById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa From df9e61c135c1d9618e74ec5c549e0e7bdb0ab7d8 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 23 Dec 2025 13:01:08 +0530 Subject: [PATCH 6/8] fix/sonar cube issue Signed-off-by: sujitaw --- src/routes/routes.ts | 2114 ------------------------------------------ 1 file changed, 2114 deletions(-) delete mode 100644 src/routes/routes.ts diff --git a/src/routes/routes.ts b/src/routes/routes.ts deleted file mode 100644 index 7810a3b7..00000000 --- a/src/routes/routes.ts +++ /dev/null @@ -1,2114 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// WARNING: This 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 type { TsoaRoute } from '@tsoa/runtime'; -import { fetchMiddlewares, ExpressTemplateService } 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 { X509Controller } from './../controllers/x509/x509.Controller'; -// WARNING: This 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 { QuestionAnswerController } from './../controllers/didcomm/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 { OutOfBandController } from './../controllers/didcomm/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 { ConnectionController } from './../controllers/didcomm/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 { 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 { AgentController } from './../controllers/agent/AgentController'; -import { expressAuthentication } from './../authentication'; -// @ts-ignore - no great way to install types from subpackage -import { iocContainer } from './../utils/tsyringeTsoaIocContainer'; -import type { IocContainer, IocContainerFactory } from '@tsoa/runtime'; -import type { Request as ExRequest, Response as ExResponse, RequestHandler, Router } from 'express'; - -const expressAuthenticationRecasted = expressAuthentication as (req: ExRequest, securityName: string, scopes?: string[], res?: ExResponse) => Promise; - - -// WARNING: This 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 = { - "Curve": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["Ed25519"]},{"dataType":"enum","enums":["X25519"]},{"dataType":"enum","enums":["P-256"]},{"dataType":"enum","enums":["P-384"]},{"dataType":"enum","enums":["P-521"]},{"dataType":"enum","enums":["secp256k1"]}],"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 - "AuthorityAndSubjectKeyDto": { - "dataType": "refObject", - "properties": { - "seed": {"dataType":"string"}, - "publicKeyBase58": {"dataType":"string"}, - "keyType": {"ref":"Curve"}, - }, - "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 - "X509CertificateIssuerAndSubjectOptionsDto": { - "dataType": "refObject", - "properties": { - "countryName": {"dataType":"string"}, - "stateOrProvinceName": {"dataType":"string"}, - "organizationalUnit": {"dataType":"string"}, - "commonName": {"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 - "ValidityDto": { - "dataType": "refObject", - "properties": { - "notBefore": {"dataType":"datetime"}, - "notAfter": {"dataType":"datetime"}, - }, - "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 - "X509KeyUsage": { - "dataType": "refEnum", - "enums": [1,2,4,8,16,32,64,128,256], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "KeyUsageDto": { - "dataType": "refObject", - "properties": { - "usages": {"dataType":"array","array":{"dataType":"refEnum","ref":"X509KeyUsage"},"required":true}, - "markAsCritical": {"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 - "X509ExtendedKeyUsage": { - "dataType": "refEnum", - "enums": ["1.3.6.1.5.5.7.3.1","1.3.6.1.5.5.7.3.2","1.3.6.1.5.5.7.3.3","1.3.6.1.5.5.7.3.4","1.3.6.1.5.5.7.3.8","1.3.6.1.5.5.7.3.9","1.0.18013.5.1.2"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "ExtendedKeyUsageDto": { - "dataType": "refObject", - "properties": { - "usages": {"dataType":"array","array":{"dataType":"refEnum","ref":"X509ExtendedKeyUsage"},"required":true}, - "markAsCritical": {"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 - "AuthorityAndSubjectKeyIdentifierDto": { - "dataType": "refObject", - "properties": { - "include": {"dataType":"boolean","required":true}, - "markAsCritical": {"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 - "GeneralNameType": { - "dataType": "refEnum", - "enums": ["dns","dn","email","guid","ip","url","upn","id"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "NameDto": { - "dataType": "refObject", - "properties": { - "type": {"ref":"GeneralNameType","required":true}, - "value": {"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 - "NameListDto": { - "dataType": "refObject", - "properties": { - "name": {"dataType":"array","array":{"dataType":"refObject","ref":"NameDto"},"required":true}, - "markAsCritical": {"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 - "BasicConstraintsDto": { - "dataType": "refObject", - "properties": { - "ca": {"dataType":"boolean","required":true}, - "pathLenConstraint": {"dataType":"double"}, - "markAsCritical": {"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 - "CrlDistributionPointsDto": { - "dataType": "refObject", - "properties": { - "urls": {"dataType":"array","array":{"dataType":"string"},"required":true}, - "markAsCritical": {"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 - "X509CertificateExtensionsOptionsDto": { - "dataType": "refObject", - "properties": { - "keyUsage": {"ref":"KeyUsageDto"}, - "extendedKeyUsage": {"ref":"ExtendedKeyUsageDto"}, - "authorityKeyIdentifier": {"ref":"AuthorityAndSubjectKeyIdentifierDto"}, - "subjectKeyIdentifier": {"ref":"AuthorityAndSubjectKeyIdentifierDto"}, - "issuerAlternativeName": {"ref":"NameListDto"}, - "subjectAlternativeName": {"ref":"NameListDto"}, - "basicConstraints": {"ref":"BasicConstraintsDto"}, - "crlDistributionPoints": {"ref":"CrlDistributionPointsDto"}, - }, - "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 - "X509CreateCertificateOptionsDto": { - "dataType": "refObject", - "properties": { - "authorityKey": {"ref":"AuthorityAndSubjectKeyDto"}, - "subjectPublicKey": {"ref":"AuthorityAndSubjectKeyDto"}, - "serialNumber": {"dataType":"string"}, - "issuer": {"dataType":"union","subSchemas":[{"ref":"X509CertificateIssuerAndSubjectOptionsDto"},{"dataType":"string"}],"required":true}, - "subject": {"dataType":"union","subSchemas":[{"ref":"X509CertificateIssuerAndSubjectOptionsDto"},{"dataType":"string"}]}, - "validity": {"ref":"ValidityDto"}, - "extensions": {"ref":"X509CertificateExtensionsOptionsDto"}, - }, - "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 - "X509ImportCertificateOptionsDto": { - "dataType": "refObject", - "properties": { - "certificate": {"dataType":"string","required":true}, - "privateKey": {"dataType":"string"}, - "keyType": {"dataType":"any","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 - "PublicJwk": { - "dataType": "refObject", - "properties": { - }, - "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 - "Uint8Array": { - "dataType": "refObject", - "properties": { - }, - "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 - "AnyUint8Array": { - "dataType": "refAlias", - "type": {"ref":"Uint8Array","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 - "X509Certificate": { - "dataType": "refObject", - "properties": { - "publicJwk": {"ref":"PublicJwk","required":true}, - "privateKey": {"ref":"AnyUint8Array"}, - }, - "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 - "TenantConfig": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"label":{"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 - "Record_string.any_": { - "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 - "MetadataValue": { - "dataType": "refAlias", - "type": {"ref":"Record_string.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 - "MetadataBase": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"MetadataValue"},"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 - "Metadata____": { - "dataType": "refObject", - "properties": { - "data": {"ref":"MetadataBase","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_CustomTenantConfig.Exclude_keyofCustomTenantConfig.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_CustomTenantConfig.walletConfig_": { - "dataType": "refAlias", - "type": {"ref":"Pick_CustomTenantConfig.Exclude_keyofCustomTenantConfig.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": { - "dataType": "refObject", - "properties": { - "config": {"ref":"Omit_CustomTenantConfig.walletConfig_","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 - "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 - "Record_string.unknown_": { - "dataType": "refAlias", - "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 - "RecordId": { - "dataType": "refAlias", - "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 - "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 - "DidCommPlaintextMessage": { - "dataType": "refObject", - "properties": { - "@type": {"dataType":"string","required":true}, - "@id": {"dataType":"string","required":true}, - "~thread": {"dataType":"nestedObjectLiteral","nestedProperties":{"pthid":{"dataType":"string"},"thid":{"dataType":"string"}}}, - }, - "additionalProperties": {"dataType":"any"}, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "DidCommHandshakeProtocol": { - "dataType": "refEnum", - "enums": ["https://didcomm.org/didexchange/1.x","https://didcomm.org/connections/1.x"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "DidCommMessage": { - "dataType": "refAlias", - "type": {"ref":"DidCommPlaintextMessage","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 - "PublicJwk_Ed25519PublicJwk_": { - "dataType": "refObject", - "properties": { - }, - "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 - "DidCommRouting": { - "dataType": "refObject", - "properties": { - "endpoints": {"dataType":"array","array":{"dataType":"string"},"required":true}, - "recipientKey": {"ref":"PublicJwk_Ed25519PublicJwk_","required":true}, - "routingKeys": {"dataType":"array","array":{"dataType":"refObject","ref":"PublicJwk_Ed25519PublicJwk_"},"required":true}, - "mediatorId": {"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 - "JsonValue": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"dataType":"string"},{"dataType":"double"},{"dataType":"boolean"},{"dataType":"enum","enums":[null]},{"ref":"JsonObject"},{"ref":"JsonArray"}],"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 - "JsonObject": { - "dataType": "refObject", - "properties": { - }, - "additionalProperties": {"ref":"JsonValue"}, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "JsonArray": { - "dataType": "refAlias", - "type": {"dataType":"array","array":{"dataType":"refAlias","ref":"JsonValue"},"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 - "Pick_JwsGeneralFormat.Exclude_keyofJwsGeneralFormat.payload__": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"header":{"ref":"Record_string.unknown_","required":true},"signature":{"dataType":"string","required":true},"protected":{"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 - "Omit_JwsGeneralFormat.payload_": { - "dataType": "refAlias", - "type": {"ref":"Pick_JwsGeneralFormat.Exclude_keyofJwsGeneralFormat.payload__","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 - "JwsDetachedFormat": { - "dataType": "refAlias", - "type": {"ref":"Omit_JwsGeneralFormat.payload_","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 - "JwsFlattenedDetachedFormat": { - "dataType": "refObject", - "properties": { - "signatures": {"dataType":"array","array":{"dataType":"refAlias","ref":"JwsDetachedFormat"},"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 - "DidCommAttachmentData": { - "dataType": "refObject", - "properties": { - "base64": {"dataType":"string"}, - "json": {"ref":"JsonValue"}, - "links": {"dataType":"array","array":{"dataType":"string"}}, - "jws": {"dataType":"union","subSchemas":[{"ref":"JwsDetachedFormat"},{"ref":"JwsFlattenedDetachedFormat"}]}, - "sha256": {"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 - "DidCommAttachment": { - "dataType": "refObject", - "properties": { - "id": {"dataType":"string","required":true}, - "description": {"dataType":"string"}, - "filename": {"dataType":"string"}, - "mimeType": {"dataType":"string"}, - "lastmodTime": {"dataType":"datetime"}, - "byteCount": {"dataType":"double"}, - "data": {"ref":"DidCommAttachmentData","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 - "CreateInvitationOptions": { - "dataType": "refObject", - "properties": { - "label": {"dataType":"string"}, - "alias": {"dataType":"string"}, - "imageUrl": {"dataType":"string"}, - "goalCode": {"dataType":"string"}, - "goal": {"dataType":"string"}, - "handshake": {"dataType":"boolean"}, - "handshakeProtocols": {"dataType":"array","array":{"dataType":"refEnum","ref":"DidCommHandshakeProtocol"}}, - "messages": {"dataType":"array","array":{"dataType":"refAlias","ref":"DidCommMessage"}}, - "multiUseInvitation": {"dataType":"boolean"}, - "autoAcceptConnection": {"dataType":"boolean"}, - "routing": {"ref":"DidCommRouting"}, - "appendedAttachments": {"dataType":"array","array":{"dataType":"refObject","ref":"DidCommAttachment"}}, - "invitationDid": {"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 - "RecipientKeyOption": { - "dataType": "refObject", - "properties": { - "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 - "DidCommOutOfBandRecord": { - "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 - "CustomHandshakeProtocol": { - "dataType": "refEnum", - "enums": ["https://didcomm.org/didexchange/1.1","https://didcomm.org/connections/1.0"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "SingleOrArray_string-or-Record_string.unknown__": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"dataType":"union","subSchemas":[{"dataType":"string"},{"ref":"Record_string.unknown_"}]},{"dataType":"array","array":{"dataType":"union","subSchemas":[{"dataType":"string"},{"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 - "OutOfBandDidCommService": { - "dataType": "refObject", - "properties": { - "id": {"dataType":"string","required":true}, - "serviceEndpoint": {"dataType":"string","required":true}, - "type": {"dataType":"string","required":true}, - "recipientKeys": {"dataType":"array","array":{"dataType":"string"},"required":true}, - "routingKeys": {"dataType":"array","array":{"dataType":"string"}}, - "accept": {"dataType":"array","array":{"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 - "OutOfBandInvitationSchema": { - "dataType": "refObject", - "properties": { - "@id": {"dataType":"string"}, - "@type": {"dataType":"string","required":true}, - "label": {"dataType":"string","required":true}, - "goalCode": {"dataType":"string"}, - "goal": {"dataType":"string"}, - "accept": {"dataType":"array","array":{"dataType":"string"}}, - "handshake_protocols": {"dataType":"array","array":{"dataType":"refEnum","ref":"CustomHandshakeProtocol"}}, - "services": {"dataType":"array","array":{"dataType":"union","subSchemas":[{"ref":"OutOfBandDidCommService"},{"dataType":"string"}]},"required":true}, - "imageUrl": {"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 - "Pick_ReceiveOutOfBandInvitationConfig.Exclude_keyofReceiveOutOfBandInvitationConfig.routing__": { - "dataType": "refAlias", - "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"alias":{"dataType":"string"},"label":{"dataType":"string","required":true},"imageUrl":{"dataType":"string"},"autoAcceptInvitation":{"dataType":"boolean"},"autoAcceptConnection":{"dataType":"boolean"},"reuseConnection":{"dataType":"boolean"},"acceptInvitationTimeoutMs":{"dataType":"double"},"ourDid":{"dataType":"string"}},"validators":{}}, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "Omit_ReceiveOutOfBandInvitationConfig.routing_": { - "dataType": "refAlias", - "type": {"ref":"Pick_ReceiveOutOfBandInvitationConfig.Exclude_keyofReceiveOutOfBandInvitationConfig.routing__","validators":{}}, - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "ReceiveInvitationProps": { - "dataType": "refObject", - "properties": { - "alias": {"dataType":"string"}, - "label": {"dataType":"string","required":true}, - "imageUrl": {"dataType":"string"}, - "autoAcceptInvitation": {"dataType":"boolean"}, - "autoAcceptConnection": {"dataType":"boolean"}, - "reuseConnection": {"dataType":"boolean"}, - "acceptInvitationTimeoutMs": {"dataType":"double"}, - "ourDid": {"dataType":"string"}, - "invitation": {"ref":"OutOfBandInvitationSchema","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 - "ReceiveInvitationByUrlProps": { - "dataType": "refObject", - "properties": { - "alias": {"dataType":"string"}, - "label": {"dataType":"string","required":true}, - "imageUrl": {"dataType":"string"}, - "autoAcceptInvitation": {"dataType":"boolean"}, - "autoAcceptConnection": {"dataType":"boolean"}, - "reuseConnection": {"dataType":"boolean"}, - "acceptInvitationTimeoutMs": {"dataType":"double"}, - "ourDid": {"dataType":"string"}, - "invitationUrl": {"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 - "AcceptInvitationConfig": { - "dataType": "refObject", - "properties": { - "autoAcceptConnection": {"dataType":"boolean"}, - "reuseConnection": {"dataType":"boolean"}, - "label": {"dataType":"string","required":true}, - "alias": {"dataType":"string"}, - "imageUrl": {"dataType":"string"}, - "mediatorId": {"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 - "DidCommDidExchangeState": { - "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 - "DidCommConnectionRecord": { - "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 - "DidResolutionMetadata": { - "dataType": "refObject", - "properties": { - "contentType": {"dataType":"string"}, - "error": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["invalidDid"]},{"dataType":"enum","enums":["notFound"]},{"dataType":"enum","enums":["representationNotSupported"]},{"dataType":"enum","enums":["unsupportedDidMethod"]},{"dataType":"string"}]}, - "message": {"dataType":"string"}, - "servedFromCache": {"dataType":"boolean"}, - "servedFromDidRecord": {"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 - "DIDDocumentMetadata": { - "dataType": "refObject", - "properties": { - "created": {"dataType":"string"}, - "updated": {"dataType":"string"}, - "deactivated": {"dataType":"boolean"}, - "versionId": {"dataType":"string"}, - "nextUpdate": {"dataType":"string"}, - "nextVersionId": {"dataType":"string"}, - "equivalentId": {"dataType":"string"}, - "canonicalId": {"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 - "Did": { - "dataType": "refAlias", - "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 - "KeyAlgorithm": { - "dataType": "refEnum", - "enums": ["a128gcm","a256gcm","a128cbchs256","a256cbchs512","a128kw","a256kw","bls12381g1","bls12381g2","c20p","xc20p","ed25519","x25519","k256","p256","p384"], - }, - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - "DidDocument": { - "dataType": "refAlias", - "type": {"ref":"Record_string.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 - "DidCreate": { - "dataType": "refObject", - "properties": { - "keyType": {"ref":"KeyAlgorithm"}, - "seed": {"dataType":"string"}, - "domain": {"dataType":"string"}, - "method": {"dataType":"string","required":true}, - "network": {"dataType":"string"}, - "did": {"dataType":"string"}, - "role": {"dataType":"string"}, - "endorserDid": {"dataType":"string"}, - "didDocument": {"ref":"DidDocument"}, - "privatekey": {"dataType":"string"}, - "endpoint": {"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 - "DidRecord": { - "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 - "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 - "Partial_W3cCredentialValidations_": { - "dataType": "refAlias", - "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 - "Error": { - "dataType": "refObject", - "properties": { - "name": {"dataType":"string","required":true}, - "message": {"dataType":"string","required":true}, - "stack": {"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 - "W3cVerifyResult_W3cCredentialValidations_": { - "dataType": "refObject", - "properties": { - "isValid": {"dataType":"boolean","required":true}, - "validations": {"ref":"Partial_W3cCredentialValidations_","required":true}, - "error": {"ref":"Error"}, - }, - "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 - "W3cVerifyCredentialResult": { - "dataType": "refAlias", - "type": {"ref":"W3cVerifyResult_W3cCredentialValidations_","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 - "DataIntegrityProofOptions": { - "dataType": "refObject", - "properties": { - "type": {"dataType":"string","required":true}, - "cryptosuite": {"dataType":"string","required":true}, - "verificationMethod": {"dataType":"string","required":true}, - "proofPurpose": {"dataType":"string","required":true}, - "domain": {"dataType":"string"}, - "challenge": {"dataType":"string"}, - "nonce": {"dataType":"string"}, - "created": {"dataType":"string"}, - "expires": {"dataType":"string"}, - "proofValue": {"dataType":"string"}, - "previousProof": {"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 - "SingleOrArray_any-or-DataIntegrityProofOptions_": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"dataType":"union","subSchemas":[{"dataType":"any"},{"ref":"DataIntegrityProofOptions"}]},{"dataType":"array","array":{"dataType":"union","subSchemas":[{"dataType":"any"},{"ref":"DataIntegrityProofOptions"}]}}],"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 - "LinkedDataProof": { - "dataType": "refObject", - "properties": { - "type": {"dataType":"string","required":true}, - "proofPurpose": {"dataType":"string","required":true}, - "verificationMethod": {"dataType":"string","required":true}, - "created": {"dataType":"string","required":true}, - "domain": {"dataType":"string"}, - "challenge": {"dataType":"string"}, - "jws": {"dataType":"string"}, - "proofValue": {"dataType":"string"}, - "nonce": {"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 - "DataIntegrityProof": { - "dataType": "refObject", - "properties": { - "type": {"dataType":"string","required":true}, - "cryptosuite": {"dataType":"string","required":true}, - "proofPurpose": {"dataType":"string","required":true}, - "verificationMethod": {"dataType":"string","required":true}, - "domain": {"dataType":"string"}, - "challenge": {"dataType":"string"}, - "nonce": {"dataType":"string"}, - "created": {"dataType":"string"}, - "expires": {"dataType":"string"}, - "proofValue": {"dataType":"string"}, - "previousProof": {"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 - "SingleOrArray_LinkedDataProof-or-DataIntegrityProof_": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"dataType":"union","subSchemas":[{"ref":"LinkedDataProof"},{"ref":"DataIntegrityProof"}]},{"dataType":"array","array":{"dataType":"union","subSchemas":[{"ref":"LinkedDataProof"},{"ref":"DataIntegrityProof"}]}}],"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 - "W3cIssuer": { - "dataType": "refObject", - "properties": { - "id": {"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 - "W3cCredentialSubject": { - "dataType": "refObject", - "properties": { - "id": {"dataType":"string"}, - "claims": {"ref":"Record_string.unknown_"}, - }, - "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 - "SingleOrArray_W3cCredentialSubject_": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"ref":"W3cCredentialSubject"},{"dataType":"array","array":{"dataType":"refObject","ref":"W3cCredentialSubject"}}],"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 - "W3cCredentialSchema": { - "dataType": "refObject", - "properties": { - "id": {"dataType":"string","required":true}, - "type": {"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 - "SingleOrArray_W3cCredentialSchema_": { - "dataType": "refAlias", - "type": {"dataType":"union","subSchemas":[{"ref":"W3cCredentialSchema"},{"dataType":"array","array":{"dataType":"refObject","ref":"W3cCredentialSchema"}}],"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 - "W3cCredentialStatus": { - "dataType": "refObject", - "properties": { - "id": {"dataType":"string","required":true}, - "type": {"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 - "W3cJsonLdVerifiableCredential": { - "dataType": "refObject", - "properties": { - "context": {"dataType":"array","array":{"dataType":"union","subSchemas":[{"dataType":"string"},{"ref":"JsonObject"}]},"required":true}, - "id": {"dataType":"string"}, - "type": {"dataType":"array","array":{"dataType":"string"},"required":true}, - "issuer": {"dataType":"union","subSchemas":[{"dataType":"string"},{"ref":"W3cIssuer"}],"required":true}, - "issuanceDate": {"dataType":"string","required":true}, - "expirationDate": {"dataType":"string"}, - "credentialSubject": {"ref":"SingleOrArray_W3cCredentialSubject_","required":true}, - "credentialSchema": {"ref":"SingleOrArray_W3cCredentialSchema_"}, - "credentialStatus": {"ref":"W3cCredentialStatus"}, - "proof": {"ref":"SingleOrArray_LinkedDataProof-or-DataIntegrityProof_","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 - "ProofPurpose": { - "dataType": "refAlias", - "type": {"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 - "SafeW3cJsonLdVerifyCredentialOptions": { - "dataType": "refObject", - "properties": { - "credential": {"ref":"W3cJsonLdVerifiableCredential","required":true}, - "verifyCredentialStatus": {"dataType":"boolean"}, - "proofPurpose": {"ref":"ProofPurpose"}, - "proof": {"ref":"SingleOrArray_any-or-DataIntegrityProofOptions_","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 -}; -const templateService = new ExpressTemplateService(models, {"noImplicitAdditionalProperties":"throw-on-extras","bodyCoercion":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 - - - - -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 - // ########################################################################################################### - - - - const argsX509Controller_createX509Certificate: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - createX509Options: {"in":"body","name":"createX509Options","required":true,"ref":"X509CreateCertificateOptionsDto"}, - }; - app.post('/x509', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(X509Controller)), - ...(fetchMiddlewares(X509Controller.prototype.createX509Certificate)), - - async function X509Controller_createX509Certificate(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_createX509Certificate, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(X509Controller); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'createX509Certificate', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsX509Controller_ImportX509Certificates: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - importX509Options: {"in":"body","name":"importX509Options","required":true,"ref":"X509ImportCertificateOptionsDto"}, - }; - app.post('/x509/import', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(X509Controller)), - ...(fetchMiddlewares(X509Controller.prototype.ImportX509Certificates)), - - async function X509Controller_ImportX509Certificates(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_ImportX509Certificates, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(X509Controller); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'ImportX509Certificates', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsX509Controller_addTrustedCertificate: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - options: {"in":"body","name":"options","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"certificate":{"dataType":"string","required":true}}}, - }; - app.post('/x509/trusted', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(X509Controller)), - ...(fetchMiddlewares(X509Controller.prototype.addTrustedCertificate)), - - async function X509Controller_addTrustedCertificate(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_addTrustedCertificate, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(X509Controller); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'addTrustedCertificate', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsX509Controller_getTrustedCertificates: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - }; - app.get('/x509/trusted', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(X509Controller)), - ...(fetchMiddlewares(X509Controller.prototype.getTrustedCertificates)), - - async function X509Controller_getTrustedCertificates(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_getTrustedCertificates, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(X509Controller); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'getTrustedCertificates', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsX509Controller_decodeCertificate: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - options: {"in":"body","name":"options","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"certificate":{"dataType":"string","required":true}}}, - }; - app.post('/x509/decode', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(X509Controller)), - ...(fetchMiddlewares(X509Controller.prototype.decodeCertificate)), - - async function X509Controller_decodeCertificate(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsX509Controller_decodeCertificate, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(X509Controller); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'decodeCertificate', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_createTenant: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - createTenantOptions: {"in":"body","name":"createTenantOptions","required":true,"ref":"CreateTenantOptions"}, - }; - app.post('/multi-tenancy/create-tenant', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.createTenant)), - - async function MultiTenancyController_createTenant(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_createTenant, 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); - } - - await templateService.apiHandler({ - methodName: 'createTenant', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_getTenantToken: Record = { - 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}}}, - }; - app.post('/multi-tenancy/get-token/:tenantId', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantToken)), - - async function MultiTenancyController_getTenantToken(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_getTenantToken, 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); - } - - await templateService.apiHandler({ - methodName: 'getTenantToken', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_getTenantById: Record = { - 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}}}, - }; - app.get('/multi-tenancy/:tenantId', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getTenantById)), - - async function MultiTenancyController_getTenantById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_getTenantById, 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); - } - - await templateService.apiHandler({ - methodName: 'getTenantById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsMultiTenancyController_deleteTenantById: Record = { - 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}}}, - }; - app.delete('/multi-tenancy/:tenantId', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.deleteTenantById)), - - async function MultiTenancyController_deleteTenantById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsMultiTenancyController_deleteTenantById, 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); - } - - await templateService.apiHandler({ - methodName: 'deleteTenantById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsQuestionAnswerController_getQuestionAnswerRecords: Record = { - 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"}, - }; - app.get('/didcomm/question-answer', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.getQuestionAnswerRecords)), - - async function QuestionAnswerController_getQuestionAnswerRecords(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsQuestionAnswerController_getQuestionAnswerRecords, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(QuestionAnswerController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'getQuestionAnswerRecords', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsQuestionAnswerController_sendQuestion: Record = { - 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}}}, - }; - app.post('/didcomm/question-answer/question/:connectionId', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.sendQuestion)), - - async function QuestionAnswerController_sendQuestion(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsQuestionAnswerController_sendQuestion, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(QuestionAnswerController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'sendQuestion', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsQuestionAnswerController_sendAnswer: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, - body: {"in":"body","name":"body","required":true,"ref":"Record_response.string_"}, - }; - app.post('/didcomm/question-answer/answer/:id', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.sendAnswer)), - - async function QuestionAnswerController_sendAnswer(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsQuestionAnswerController_sendAnswer, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(QuestionAnswerController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'sendAnswer', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsQuestionAnswerController_getQuestionAnswerRecordById: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - id: {"in":"path","name":"id","required":true,"ref":"RecordId"}, - }; - app.get('/didcomm/question-answer/:id', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(QuestionAnswerController)), - ...(fetchMiddlewares(QuestionAnswerController.prototype.getQuestionAnswerRecordById)), - - async function QuestionAnswerController_getQuestionAnswerRecordById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsQuestionAnswerController_getQuestionAnswerRecordById, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(QuestionAnswerController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'getQuestionAnswerRecordById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_getAllOutOfBandRecords: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - invitationId: {"in":"query","name":"invitationId","ref":"RecordId"}, - }; - app.get('/didcomm/oob', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.getAllOutOfBandRecords)), - - async function OutOfBandController_getAllOutOfBandRecords(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_getAllOutOfBandRecords, 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); - } - - await templateService.apiHandler({ - methodName: 'getAllOutOfBandRecords', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_getOutOfBandRecordById: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - outOfBandId: {"in":"path","name":"outOfBandId","required":true,"ref":"RecordId"}, - }; - app.get('/didcomm/oob/:outOfBandId', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.getOutOfBandRecordById)), - - async function OutOfBandController_getOutOfBandRecordById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_getOutOfBandRecordById, 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); - } - - await templateService.apiHandler({ - methodName: 'getOutOfBandRecordById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_createInvitation: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - config: {"in":"body","name":"config","required":true,"dataType":"intersection","subSchemas":[{"ref":"CreateInvitationOptions"},{"ref":"RecipientKeyOption"}]}, - }; - app.post('/didcomm/oob/create-invitation', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.createInvitation)), - - async function OutOfBandController_createInvitation(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_createInvitation, 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); - } - - await templateService.apiHandler({ - methodName: 'createInvitation', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_createLegacyConnectionlessInvitation: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - config: {"in":"body","name":"config","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"routing":{"ref":"DidCommRouting"},"domain":{"dataType":"string","required":true},"message":{"ref":"Record_string.unknown_","required":true},"recordId":{"dataType":"string","required":true}}}, - }; - app.post('/didcomm/oob/create-legacy-connectionless-invitation', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.createLegacyConnectionlessInvitation)), - - async function OutOfBandController_createLegacyConnectionlessInvitation(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_createLegacyConnectionlessInvitation, 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); - } - - await templateService.apiHandler({ - methodName: 'createLegacyConnectionlessInvitation', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_receiveInvitation: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationProps"}, - }; - app.post('/didcomm/oob/receive-invitation', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.receiveInvitation)), - - async function OutOfBandController_receiveInvitation(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_receiveInvitation, 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); - } - - await templateService.apiHandler({ - methodName: 'receiveInvitation', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_receiveInvitationFromUrl: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - invitationRequest: {"in":"body","name":"invitationRequest","required":true,"ref":"ReceiveInvitationByUrlProps"}, - }; - app.post('/didcomm/oob/receive-invitation-url', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.receiveInvitationFromUrl)), - - async function OutOfBandController_receiveInvitationFromUrl(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_receiveInvitationFromUrl, 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); - } - - await templateService.apiHandler({ - methodName: 'receiveInvitationFromUrl', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_acceptInvitation: Record = { - 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"}, - }; - app.post('/didcomm/oob/:outOfBandId/accept-invitation', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.acceptInvitation)), - - async function OutOfBandController_acceptInvitation(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_acceptInvitation, 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); - } - - await templateService.apiHandler({ - methodName: 'acceptInvitation', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsOutOfBandController_deleteOutOfBandRecord: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - outOfBandId: {"in":"path","name":"outOfBandId","required":true,"ref":"RecordId"}, - }; - app.delete('/didcomm/oob/:outOfBandId', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(OutOfBandController)), - ...(fetchMiddlewares(OutOfBandController.prototype.deleteOutOfBandRecord)), - - async function OutOfBandController_deleteOutOfBandRecord(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsOutOfBandController_deleteOutOfBandRecord, 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); - } - - await templateService.apiHandler({ - methodName: 'deleteOutOfBandRecord', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsConnectionController_getAllConnections: Record = { - 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":"DidCommDidExchangeState"}, - myDid: {"in":"query","name":"myDid","dataType":"string"}, - theirDid: {"in":"query","name":"theirDid","dataType":"string"}, - theirLabel: {"in":"query","name":"theirLabel","dataType":"string"}, - }; - app.get('/didcomm/connections', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.getAllConnections)), - - async function ConnectionController_getAllConnections(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsConnectionController_getAllConnections, 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); - } - - await templateService.apiHandler({ - methodName: 'getAllConnections', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsConnectionController_getConnectionById: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - }; - app.get('/didcomm/connections/:connectionId', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.getConnectionById)), - - async function ConnectionController_getConnectionById(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsConnectionController_getConnectionById, 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); - } - - await templateService.apiHandler({ - methodName: 'getConnectionById', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsConnectionController_deleteConnection: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - }; - app.delete('/didcomm/connections/:connectionId', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.deleteConnection)), - - async function ConnectionController_deleteConnection(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsConnectionController_deleteConnection, 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); - } - - await templateService.apiHandler({ - methodName: 'deleteConnection', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsConnectionController_acceptRequest: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - }; - app.post('/didcomm/connections/:connectionId/accept-request', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.acceptRequest)), - - async function ConnectionController_acceptRequest(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsConnectionController_acceptRequest, 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); - } - - await templateService.apiHandler({ - methodName: 'acceptRequest', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsConnectionController_acceptResponse: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - connectionId: {"in":"path","name":"connectionId","required":true,"ref":"RecordId"}, - }; - app.post('/didcomm/connections/:connectionId/accept-response', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.acceptResponse)), - - async function ConnectionController_acceptResponse(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsConnectionController_acceptResponse, 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); - } - - await templateService.apiHandler({ - methodName: 'acceptResponse', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsConnectionController_getInvitation: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - invitationId: {"in":"path","name":"invitationId","required":true,"dataType":"string"}, - }; - app.get('/didcomm/url/:invitationId', - ...(fetchMiddlewares(ConnectionController)), - ...(fetchMiddlewares(ConnectionController.prototype.getInvitation)), - - async function ConnectionController_getInvitation(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsConnectionController_getInvitation, 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); - } - - await templateService.apiHandler({ - methodName: 'getInvitation', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsDidController_getDidRecordByDid: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - did: {"in":"path","name":"did","required":true,"ref":"Did"}, - }; - app.get('/dids/:did', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(DidController)), - ...(fetchMiddlewares(DidController.prototype.getDidRecordByDid)), - - async function DidController_getDidRecordByDid(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsDidController_getDidRecordByDid, 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); - } - - await templateService.apiHandler({ - methodName: 'getDidRecordByDid', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsDidController_writeDid: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - createDidOptions: {"in":"body","name":"createDidOptions","required":true,"ref":"DidCreate"}, - }; - app.post('/dids/write', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(DidController)), - ...(fetchMiddlewares(DidController.prototype.writeDid)), - - async function DidController_writeDid(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsDidController_writeDid, 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); - } - - await templateService.apiHandler({ - methodName: 'writeDid', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsDidController_getDids: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - }; - app.get('/dids', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(DidController)), - ...(fetchMiddlewares(DidController.prototype.getDids)), - - async function DidController_getDids(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsDidController_getDids, 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); - } - - await templateService.apiHandler({ - methodName: 'getDids', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsAgentController_getAgentInfo: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - }; - app.get('/agent', - authenticateMiddleware([{"jwt":["tenant","dedicated","Basewallet"]}]), - ...(fetchMiddlewares(AgentController)), - ...(fetchMiddlewares(AgentController.prototype.getAgentInfo)), - - async function AgentController_getAgentInfo(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsAgentController_getAgentInfo, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(AgentController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'getAgentInfo', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsAgentController_getAgentToken: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - }; - app.post('/agent/token', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(AgentController)), - ...(fetchMiddlewares(AgentController.prototype.getAgentToken)), - - async function AgentController_getAgentToken(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsAgentController_getAgentToken, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(AgentController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'getAgentToken', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - const argsAgentController_verifyCredential: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - credentialToVerify: {"in":"body","name":"credentialToVerify","required":true,"dataType":"union","subSchemas":[{"ref":"SafeW3cJsonLdVerifyCredentialOptions"},{"dataType":"any"}]}, - }; - app.post('/agent/credential/verify', - authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(AgentController)), - ...(fetchMiddlewares(AgentController.prototype.verifyCredential)), - - async function AgentController_verifyCredential(request: ExRequest, response: ExResponse, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - let validatedArgs: any[] = []; - try { - validatedArgs = templateService.getValidatedArgs({ args: argsAgentController_verifyCredential, request, response }); - - const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - - const controller: any = await container.get(AgentController); - if (typeof controller['setStatus'] === 'function') { - controller.setStatus(undefined); - } - - await templateService.apiHandler({ - methodName: 'verifyCredential', - controller, - response, - next, - validatedArgs, - successStatus: undefined, - }); - } 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 - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - function authenticateMiddleware(security: TsoaRoute.Security[] = []) { - return async function runAuthenticationMiddleware(request: any, response: any, next: any) { - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - // keep track of failed auth attempts so we can hand back the most - // recent one. This behavior was previously existing so preserving it - // here - const failedAttempts: any[] = []; - const pushAndRethrow = (error: any) => { - failedAttempts.push(error); - throw error; - }; - - const secMethodOrPromises: Promise[] = []; - for (const secMethod of security) { - if (Object.keys(secMethod).length > 1) { - const secMethodAndPromises: Promise[] = []; - - for (const name in secMethod) { - secMethodAndPromises.push( - expressAuthenticationRecasted(request, name, secMethod[name], response) - .catch(pushAndRethrow) - ); - } - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - secMethodOrPromises.push(Promise.all(secMethodAndPromises) - .then(users => { return users[0]; })); - } else { - for (const name in secMethod) { - secMethodOrPromises.push( - expressAuthenticationRecasted(request, name, secMethod[name], response) - .catch(pushAndRethrow) - ); - } - } - } - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - - try { - request['user'] = await Promise.any(secMethodOrPromises); - - // Response was sent in middleware, abort - if (response.writableEnded) { - return; - } - - next(); - } - catch(err) { - // Show most recent error as response - const error = failedAttempts.pop(); - error.status = error.status || 401; - - // Response was sent in middleware, abort - if (response.writableEnded) { - return; - } - next(error); - } - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa - } - } - - // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa -} - -// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa From ed539f396154e3c380a871b22c5cbf56e452f1ea Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 23 Dec 2025 15:54:56 +0530 Subject: [PATCH 7/8] fix/code rabbit comments Signed-off-by: sujitaw --- src/controllers/did/DidController.ts | 2 -- src/controllers/x509/x509.service.ts | 21 ++++++++------------- src/enums/enum.ts | 2 +- src/utils/helpers.ts | 1 - 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/controllers/did/DidController.ts b/src/controllers/did/DidController.ts index ce38dc26..9774a5f7 100644 --- a/src/controllers/did/DidController.ts +++ b/src/controllers/did/DidController.ts @@ -16,7 +16,6 @@ import { import { Key, KeyAlgorithm,askar } from '@openwallet-foundation/askar-nodejs' import axios from 'axios' import { Request as Req } from 'express' -import { get } from 'http' import { Body, Controller, Example, Get, Path, Post, Route, Tags, Security, Request } from 'tsoa' import { injectable } from 'tsyringe' @@ -412,7 +411,6 @@ export class DidController extends Controller { if (!didOptions.did) { - console.log("This is inside if") // Transform seed to private JWK and // const { privateJwk } = transformSeedToPrivateJwk({ // type: { diff --git a/src/controllers/x509/x509.service.ts b/src/controllers/x509/x509.service.ts index a03f42e2..81b8773c 100644 --- a/src/controllers/x509/x509.service.ts +++ b/src/controllers/x509/x509.service.ts @@ -16,10 +16,12 @@ import { } from '@credo-ts/core' import { KeyAlgorithm } from '@openwallet-foundation/askar-nodejs' +import { keyAlgorithmToCurve } from '../../utils/constant' import { generateSecretKey, getCertificateValidityForSystem, getTypeFromCurve } from '../../utils/helpers' import { pemToRawEd25519PrivateKey } from './crypto-util' import { type X509CreateCertificateOptionsDto } from './x509.types' +import { error } from 'console' class x509Service { public async createSelfSignedDCS(createX509Options: BasicX509CreateCertificateConfig, agentReq: Req) { @@ -47,8 +49,6 @@ class x509Service { ], }, issuerAlternativeName: { - // biome-ignore lint/style/noNonNullAssertion: - //name: rootCertificate.issuerAlternativeNames!, name: [ { type: 'dns', value: AGENT_DNS }, { type: 'url', value: AGENT_HOST }, @@ -145,7 +145,6 @@ class x509Service { } } - console.log("This is authorityKeyID", authorityKeyID) console.log("This is subjectPublicKeyID", subjectPublicKeyID) const certificate = await agent.x509.createCertificate({ @@ -174,7 +173,7 @@ class x509Service { const parsedCertificate = X509Service.parseCertificate(agent.context, { encodedCertificate: options.certificate, }) - const issuerCertficicate = parsedCertificate.toString('base64') + const issuerCertificate = parsedCertificate.toString('base64') try { // const documentSignerKey = await agent.wallet.createKey({ @@ -210,17 +209,14 @@ class x509Service { // If the key already exists, we assume the self-signed certificate is already created if (error instanceof Kms.KeyManagementKeyExistsError) { - console.error( - `key already exists while importing certificate ${JSON.stringify(parsedCertificate.privateKey)}`, - parsedCertificate.privateKey, - ) + console.error( 'key already exists while importing certificate') } else { agent.config.logger.error(`${JSON.stringify(error)}`) throw error } } - return { issuerCertficicate } + return { issuerCertificate } } public addTrustedCertificate( @@ -274,13 +270,12 @@ export async function createKey(agent: Agent, keyType: KeyAlgorithm) { // keyType: keyType, // seed: TypedArrayEncoder.fromString(seed), // }) + const normalizedCurve = keyAlgorithmToCurve[keyType] + if (!normalizedCurve) throw new Error('Unspported key type for method importKey') const importedKey = await agent.kms.importKey({ privateJwk: transformSeedToPrivateJwk({ seed: TypedArrayEncoder.fromString(seed), - type: { - crv: 'P-256', - kty: 'EC', - }, + type: getTypeFromCurve(normalizedCurve), }).privateJwk, }) diff --git a/src/enums/enum.ts b/src/enums/enum.ts index b2c3f6a8..b58196a2 100644 --- a/src/enums/enum.ts +++ b/src/enums/enum.ts @@ -98,7 +98,7 @@ export enum SignerMethod { Did = 'did', X5c = 'x5c', } -export declare enum KeyAlgorithmCurve { +export enum KeyAlgorithmCurve { Ed25519 = 'Ed25519', X25519 = 'X25519', P256 = 'P-256', diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 598658d4..464125db 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -100,6 +100,5 @@ export function getTypeFromCurve(key: Curve | KeyAlgorithm): OkpType | EcType { crv: 'P-256', } } - console.log("keyTypeInfo",keyTypeInfo) return keyTypeInfo } From 8d93c695b7932570a6456d6b67e6c081ec389341 Mon Sep 17 00:00:00 2001 From: sujitaw Date: Tue, 23 Dec 2025 17:28:39 +0530 Subject: [PATCH 8/8] fix/pr comments Signed-off-by: sujitaw --- src/controllers/did/DidController.ts | 63 +++++++--------------------- src/controllers/x509/x509.service.ts | 51 ++-------------------- src/utils/constant.ts | 3 ++ 3 files changed, 22 insertions(+), 95 deletions(-) diff --git a/src/controllers/did/DidController.ts b/src/controllers/did/DidController.ts index 9774a5f7..1bc214ea 100644 --- a/src/controllers/did/DidController.ts +++ b/src/controllers/did/DidController.ts @@ -12,6 +12,8 @@ import { PeerDidNumAlgo, Kms, Hasher, + LogLevel, + Agent, } from '@credo-ts/core' import { Key, KeyAlgorithm,askar } from '@openwallet-foundation/askar-nodejs' import axios from 'axios' @@ -23,11 +25,13 @@ import { DidMethod, KeyAlgorithmCurve, Network, Role, SCOPES } from '../../enums import ErrorHandlingService from '../../errorHandlingService' import { BadRequestError, InternalServerError } from '../../errors' import { AgentType } from '../../types' -import { keyAlgorithmToCurve } from '../../utils/constant' +import { keyAlgorithmToCurve, p521, verkey } from '../../utils/constant' import { getTypeFromCurve } from '../../utils/helpers' import { CreateDidResponse, Did, DidRecordExample } from '../examples' import { DidCreate } from '../types' import { supportedKeyTypesDID } from '../x509/x509.types' +import { container } from 'tsyringe' +import { RestMultiTenantAgentModules } from '../../cliAgent' @@ -41,6 +45,8 @@ export class DidController extends Controller { * @param did Decentralized Identifier * @returns DidResolutionResult */ + private agent = container.resolve(Agent) + @Example(DidRecordExample) @Get('/:did') public async getDidRecordByDid(@Request() request: Req, @Path('did') did: Did) { @@ -71,7 +77,7 @@ export class DidController extends Controller { public async writeDid(@Request() request: Req, @Body() createDidOptions: DidCreate) { let didRes - console.log("dsajsa", askar.version()) + this.agent.config.logger.info(`askar version ${askar.version()}`) try { if (!createDidOptions.method) { throw new BadRequestError('Method is required') @@ -329,7 +335,6 @@ export class DidController extends Controller { const buffer = Hasher.hash(verificationKey.publicKey.publicKey, 'sha-256') const did = TypedArrayEncoder.toBase58(buffer.slice(0, 16)) - // const did = `did:indy:${endorserNamespace}:${namespaceIdentifier let body if (createDidOptions.network === Network.Indicio_Testnet) { @@ -380,7 +385,7 @@ export class DidController extends Controller { keys: [ { kmsKeyId: key.keyId, - didDocumentRelativeKeyId: '#verkey', + didDocumentRelativeKeyId: verkey, } ] @@ -401,7 +406,7 @@ export class DidController extends Controller { if (didOptions.keyType === KeyAlgorithm.Bls12381G2) { throw new BadRequestError('didOptions.keyType for type "bls12381g2" has been deprecated') } - if (didOptions.keyType === 'p521' as KeyAlgorithm) { + if (didOptions.keyType === p521 as KeyAlgorithm) { throw new BadRequestError('didOptions.keyType for type p521 is not supported') } const normalizedCurve = keyAlgorithmToCurve[didOptions.keyType as KeyAlgorithm] @@ -411,27 +416,6 @@ export class DidController extends Controller { if (!didOptions.did) { - // Transform seed to private JWK and - // const { privateJwk } = transformSeedToPrivateJwk({ - // type: { - // kty: 'OKP', - // crv: 'Ed25519', - // }, - // seed: TypedArrayEncoder.fromString(didOptions.seed), - // }) - // console.log("This is privateJwk::::::", JSON.stringify(privateJwk)) - - // // Import the key using KMS - // const { keyId } = await agent.kms.importKey({ privateJwk }) - // console.log("This is keyId", keyId) - - // // Create DID using the imported key - // const didResponse = await agent.dids.create({ - // method: 'key', - // options: { - // keyId, - // }, - // }) const privateJwk = transformPrivateKeyToPrivateJwk({ privateKey: TypedArrayEncoder.fromString(didOptions.seed), type: getTypeFromCurve(didOptions.keyType ?? KeyAlgorithm.Ed25519), @@ -439,34 +423,17 @@ export class DidController extends Controller { const { keyId } = await agent.kms.importKey({ privateJwk, }) - console.log("This is keyId::::::", keyId) + this.agent.config.logger.info(`This is keyId:::::: ${keyId}`) const didResponse = await agent.dids.create({ - method: 'key', + method: DidMethod.Key, options: { keyId, }, }) - console.log("This is didResponse::::::", JSON.stringify(didResponse)) + this.agent.config.logger.info(`This is didResponse:::::: ${JSON.stringify(didResponse)}`) did = `${didResponse.didState.did}` didDocument = didResponse.didState.didDocument - - // await agent.kms.createKey({ - // keyType: didOptions.keyType, - // seed: TypedArrayEncoder.fromString(didOptions.seed), - // }) - - // didResponse = await agent.dids.create({ - // method: DidMethod.Key, - // options: { - // keyType: KeyAlgorithm.Ed25519, - // }, - // secret: { - // privateKey: TypedArrayEncoder.fromString(didOptions.seed), - // }, - // }) - // did = `${didResponse.didState.did}` - // didDocument = didResponse.didState.didDocument } else { did = didOptions.did const createdDid = await agent.dids.getCreatedDids({ @@ -476,8 +443,8 @@ export class DidController extends Controller { didDocument = createdDid[0]?.didDocument } - console.log('This is did', did) - console.log('This is didDocument', didDocument) + this.agent.config.logger.info(`This is did ${did}` ) + this.agent.config.logger.info(`This is didDocument ${didDocument}` ) await agent.dids.import({ did, diff --git a/src/controllers/x509/x509.service.ts b/src/controllers/x509/x509.service.ts index 81b8773c..8e0ca051 100644 --- a/src/controllers/x509/x509.service.ts +++ b/src/controllers/x509/x509.service.ts @@ -86,25 +86,14 @@ class x509Service { if (options.authorityKey && options?.authorityKey?.seed) { const { privateJwk } = transformSeedToPrivateJwk({ - // type: { - // crv: 'P-256', - // kty: 'EC', - // }, type: getTypeFromCurve(options.authorityKey.keyType ?? 'P-256'), seed: TypedArrayEncoder.fromString(options.authorityKey!.seed!), }) const { publicJwk } = await agent.kms.importKey({ privateJwk }) authorityKeyID = publicJwk - // type: options.authorityKey.keyType ?? KeyAlgorithm.EcSecp256r1, - // seed: TypedArrayEncoder.fromString(options.authorityKey.seed), - // }) } else { const { publicJwk } = await agent.kms.createKey({ - // type: { - // crv: 'P-256', - // kty: 'EC', - // } type: getTypeFromCurve(options.authorityKey?.keyType ?? 'P-256') }) authorityKeyID = publicJwk @@ -112,19 +101,6 @@ class x509Service { if (options.subjectPublicKey) { if (options?.subjectPublicKey?.seed) { - // subjectPublicKeyID = await agent.kms.createKey({ - // keyType: options.subjectPublicKey.keyType ?? KeyAlgorithm.EcSecp256r1, - // seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), - // }) - - // const { privateJwk } = transformSeedToPrivateJwk({ - // type: { - // crv: 'Ed25519', - // kty: 'OKP', - // }, - // seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), - // }) - // const { keyId: subjectPublicKeyID } = await agent.kms.importKey({ privateJwk }) const importedKey = await agentReq.agent.kms.importKey({ privateJwk: transformSeedToPrivateJwk({ seed: TypedArrayEncoder.fromString(options.subjectPublicKey.seed), @@ -135,9 +111,6 @@ class x509Service { subjectPublicKeyID = importedKey.publicJwk } else { - // subjectPublicKeyID = await agent.context.createKey({ - // keyType: KeyAlgorithm.EcSecp256r1, - // }) const { keyId, publicJwk } = await agent.kms.createKey({ type: getTypeFromCurve(options.subjectPublicKey?.keyType ?? 'P-256') }) @@ -145,7 +118,7 @@ class x509Service { } } - console.log("This is subjectPublicKeyID", subjectPublicKeyID) + agent.config.logger.info('This is subjectPublicKeyID', subjectPublicKeyID) const certificate = await agent.x509.createCertificate({ // authorityKey: authorityKeyID as Key, @@ -157,7 +130,7 @@ class x509Service { subject: options.subject, validity: options.validity, }) - console.log("Result") + agent.config.logger.info("Result") const issuerCertificate = certificate.toString('base64') return { publicCertificateBase64: issuerCertificate } @@ -176,17 +149,9 @@ class x509Service { const issuerCertificate = parsedCertificate.toString('base64') try { - // const documentSignerKey = await agent.wallet.createKey({ - // privateKey: privateKey, - // keyType: options.keyType, - // }) const keyTypeInfo = getTypeFromCurve(options.keyType) const { privateJwk } = transformPrivateKeyToPrivateJwk({ type: keyTypeInfo, - // type: { - // crv: 'P-256', - // kty: 'EC', - // }, privateKey, }) @@ -197,15 +162,11 @@ class x509Service { parsedCertificate.publicJwk.publicKey.kty !== keyTypeInfo.kty || !parsedCertificate.publicJwk.equals(Kms.PublicJwk.fromPublicJwk(key.publicJwk)) ) { - // if ( - // parsedCertificate.publicKey.keyType !== options.keyType || - // !Buffer.from(parsedCertificate.publicKey.publicKey).equals(Buffer.from(documentSignerKey.publicKey)) - // ) { throw new Error(`Key mismatched in provided X509_CERTIFICATE to import`) } - console.log(`Keys matched with certificate`) + agent.config.logger.info(`Keys matched with certificate`) } catch (error) { - console.log(`Error caught`) + agent.config.logger.error(`Error caught`) // If the key already exists, we assume the self-signed certificate is already created if (error instanceof Kms.KeyManagementKeyExistsError) { @@ -266,10 +227,6 @@ export async function createKey(agent: Agent, keyType: KeyAlgorithm) { agent.config.logger.debug(`createKey: got seed ${seed}`) - // const authorityKey = await agent.kms.createKey({ - // keyType: keyType, - // seed: TypedArrayEncoder.fromString(seed), - // }) const normalizedCurve = keyAlgorithmToCurve[keyType] if (!normalizedCurve) throw new Error('Unspported key type for method importKey') const importedKey = await agent.kms.importKey({ diff --git a/src/utils/constant.ts b/src/utils/constant.ts index e5d3e7eb..cfb07dba 100644 --- a/src/utils/constant.ts +++ b/src/utils/constant.ts @@ -19,3 +19,6 @@ export const curveToKty = { 'P-521': 'EC', secp256k1: 'EC', } as const + +export const verkey = '#verkey' +export const p521 = 'p521'