diff --git a/patches/@credo-ts+core+0.6.0-alpha-20250325224513+003+sdjwt-presentation.patch b/patches/@credo-ts+core+0.6.0-alpha-20250325224513+003+sdjwt-presentation.patch new file mode 100644 index 00000000..b47305cd --- /dev/null +++ b/patches/@credo-ts+core+0.6.0-alpha-20250325224513+003+sdjwt-presentation.patch @@ -0,0 +1,14 @@ +diff --git a/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js b/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js +index 20073a3..9df7a4a 100644 +--- a/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js ++++ b/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js +@@ -102,7 +102,8 @@ let SdJwtVcService = class SdJwtVcService { + value: d.value, + })), presentationFrame); + const [jwt] = compactSdJwtVc.split('~'); +- const sdJwt = `${jwt}~${requiredDisclosures.map((d) => d.encoded).join('~')}~`; ++ const disclosureString = requiredDisclosures.length > 0 ? `${requiredDisclosures.map((d) => d.encoded).join('~')}~` : ''; ++ const sdJwt = `${jwt}~${disclosureString}`; + const disclosedDecoded = (0, decodeSdJwtVc_1.decodeSdJwtVc)(sdJwt); + return disclosedDecoded; + } diff --git a/src/controllers/openid4vc/holder/holder.Controller.ts b/src/controllers/openid4vc/holder/holder.Controller.ts index e6724081..846f336e 100644 --- a/src/controllers/openid4vc/holder/holder.Controller.ts +++ b/src/controllers/openid4vc/holder/holder.Controller.ts @@ -1,6 +1,7 @@ import { Agent } from '@credo-ts/core' -import { Body, Get, Post, Route, Security, Tags } from 'tsoa' +import { Body, Controller, Get, Post, Route, Security, Tags, Request } from 'tsoa' import { injectable } from 'tsyringe' +import { Request as Req } from 'express' import { AuthorizeRequestCredentialOffer, @@ -9,84 +10,83 @@ import { ResolveProofRequest, } from '../types/holder.types' -import { HolderService } from './holder.service' +import { holderService } from './holder.service' +import { SCOPES } from '../../../enums/enum' @Tags('oid4vc holders') -@Security('apiKey') +@Security('jwt', [SCOPES.TENANT_AGENT, SCOPES.DEDICATED_AGENT]) @Route('openid4vc/holder') @injectable() -export class HolderController { - private agent: Agent - private holderService: HolderService - - public constructor(agent: Agent) { - this.agent = agent - this.holderService = new HolderService() - } - +export class HolderController extends Controller { + /** * Get SdJwt type of credentials */ @Get('/sd-jwt-vcs') - public async getSdJwtCredentials() { - return await this.holderService.getSdJwtCredentials(this.agent) + public async getSdJwtCredentials(@Request() request: Req) { + return await holderService.getSdJwtCredentials(request) } - /** + /** * Fetch all mso mdoc credentials in wallet */ @Get('/mdoc-vcs') - public async getMdocCredentials() { - return await this.holderService.getMdocCredentials(this.agent) + public async getMdocCredentials(@Request() request: Req) { + return await holderService.getMdocCredentials(request) } /** * Decode mso mdoc credential in wallet */ @Post('/mdoc-vcs/decode') - public async decodeMdocCredential(@Body() body:{ + public async decodeMdocCredential(@Request() request: Req, @Body() body:{ base64Url: string }) { - return await this.holderService.decodeMdocCredential(this.agent, body) + return await holderService.decodeMdocCredential(request, body) } /** * Resolve a credential offer */ - // @Post('resolve-credential-offer') - // public async resolveCredOffer(@Body() body: ResolveCredentialOfferBody) { - // return await this.holderService.resolveCredentialOffer(this.agent, body) - // } + @Post('resolve-credential-offer') + public async resolveCredOffer(@Request() request: Req, @Body() body: ResolveCredentialOfferBody) { + return await holderService.resolveCredentialOffer(request, body) + } - /** - * Initiate an OID4VCI authorization request - */ +// /** +// * Initiate an OID4VCI authorization request +// */ @Post('authorization-request') - public async requestAuthorizationForCredential(@Body() body: AuthorizeRequestCredentialOffer) { - return await this.holderService.requestAuthorizationForCredential(this.agent, body) + public async requestAuthorizationForCredential(@Request() request: Req, @Body() body: AuthorizeRequestCredentialOffer) { + return await holderService.requestAuthorizationForCredential(request, body) } /** * Initiates a token request, then requests credentials from issuer */ @Post('request-credential') - public async requestCredential(@Body() body: RequestCredentialBody) { - return await this.holderService.requestCredential(this.agent, body) + public async requestCredential(@Request() request: Req, @Body() body: RequestCredentialBody) { + return await holderService.requestCredential(request, body) } /** * Resolve a proof request */ @Post('resolve-proof-request') - public async resolveProofRequest(@Body() body: ResolveProofRequest) { - return await this.holderService.resolveProofRequest(this.agent, body) + public async resolveProofRequest(@Request() request: Req, @Body() body: ResolveProofRequest) { + return await holderService.resolveProofRequest(request, body) } /** * Accept a proof request */ @Post('accept-proof-request') - public async acceptProofRequest(@Body() body: ResolveProofRequest) { - return await this.holderService.acceptPresentationRequest(this.agent, body) + public async acceptProofRequest(@Request() request: Req, @Body() body: ResolveProofRequest) { + return await holderService.acceptPresentationRequest(request, body) + } + + @Post('decode-sdjwt') + public async decodeSdJwt(@Request() request: Req, @Body() body: { jwt: string }) { + return await holderService.decodeSdJwt(request, body) } -} +} \ No newline at end of file diff --git a/src/controllers/openid4vc/holder/holder.service.ts b/src/controllers/openid4vc/holder/holder.service.ts index ca548535..8ebe8282 100644 --- a/src/controllers/openid4vc/holder/holder.service.ts +++ b/src/controllers/openid4vc/holder/holder.service.ts @@ -4,7 +4,7 @@ import type { ResolveCredentialOfferBody, ResolveProofRequest, } from '../types/holder.types' -import type { Agent } from '@credo-ts/core' +import type { Agent, DcqlCredentialsForRequest, DcqlQueryResult } from '@credo-ts/core' import type { OpenId4VcAuthorizationCodeTokenRequestOptions, OpenId4VciPreAuthorizedTokenRequestOptions, @@ -26,42 +26,22 @@ import { authorizationCodeGrantIdentifier, preAuthorizedCodeGrantIdentifier, } from '@credo-ts/openid4vc' - -type MappedAttributesReturnType = - | string - | number - | boolean - | { [key: string]: MappedAttributesReturnType } - | null - | undefined - | Array - -function recursivelyMapAttribues(value: unknown): MappedAttributesReturnType { - if (value === null || value === undefined || typeof value === 'number' || typeof value === 'boolean') return value - if (typeof value === 'string') return value - if (value instanceof Map) { - return Object.fromEntries(Array.from(value.entries()).map(([key, value]) => [key, recursivelyMapAttribues(value)])) - } - if (Array.isArray(value)) return value.map(recursivelyMapAttribues) - return Object.fromEntries(Object.entries(value).map(([key, value]) => [key, recursivelyMapAttribues(value)])) -} - +import { Request as Req } from 'express' export class HolderService { private HOLDER_REDIRECT = process.env.HOLDER_REDIRECT ?? 'http://localhost:4001/redirect' private HOLDER_CLIENT_ID = process.env.HOLDER_CLIENT_ID ?? 'wallet' - public async getSdJwtCredentials(agent: Agent) { - return await agent.sdJwtVc.getAll() + public async getSdJwtCredentials(agentReq: Req) { + return await agentReq.agent.sdJwtVc.getAll() } - public async getMdocCredentials(agent: Agent) { - return await agent.mdoc.getAll() + public async getMdocCredentials(agentReq: Req) { + return await agentReq.agent.mdoc.getAll() } - public async decodeMdocCredential(agent: Agent, options: { + public async decodeMdocCredential(agentReq : Req, options: { base64Url: string }) { - const credential = Mdoc.fromBase64Url(options.base64Url) return { namespace: credential.issuerSignedNamespaces, @@ -71,18 +51,18 @@ export class HolderService { } as any } - // public async resolveCredentialOffer(agent: Agent, body: ResolveCredentialOfferBody) { - // return await agent.modules.openId4VcHolderModule.resolveCredentialOffer(body.credentialOfferUri) - // } + public async resolveCredentialOffer(agentReq: Req, body: ResolveCredentialOfferBody) { + return await agentReq.agent.modules.openId4VcHolderModule.resolveCredentialOffer(body.credentialOfferUri) as any + } - public async requestAuthorizationForCredential(agent: Agent, body: AuthorizeRequestCredentialOffer) { + public async requestAuthorizationForCredential(agentReq: Req, body: AuthorizeRequestCredentialOffer) { console.log('Requesting authorization for credential offer:', body) - const resolvedCredentialOffer = await agent.modules.openId4VcHolderModule.resolveCredentialOffer( + const resolvedCredentialOffer = await agentReq.agent.modules.openId4VcHolderModule.resolveCredentialOffer( body.credentialOfferUri, ) console.log('Resolved credential offer:', resolvedCredentialOffer) const resolvedAuthorization = await this.initiateAuthorization( - agent, + agentReq, resolvedCredentialOffer, body.credentialsToRequest, ) @@ -108,11 +88,11 @@ export class HolderService { break } - return { actionToTake, authorizationRequestUrl, codeVerifier } + return { actionToTake, authorizationRequestUrl, codeVerifier } as any } - public async requestCredential(agent: Agent, body: RequestCredentialBody) { - const resolvedCredentialOffer = await agent.modules.openId4VcHolderModule.resolveCredentialOffer( + public async requestCredential(agentReq: Req, body: RequestCredentialBody) { + const resolvedCredentialOffer = await agentReq.agent.modules.openId4VcHolderModule.resolveCredentialOffer( body.credentialOfferUri, ) @@ -133,16 +113,16 @@ export class HolderService { } as OpenId4VcAuthorizationCodeTokenRequestOptions } - return await this.requestAndStoreCredentials(agent, resolvedCredentialOffer, options) + return await this.requestAndStoreCredentials(agentReq, resolvedCredentialOffer, options) as any } private async requestAndStoreCredentials( - agent: Agent, + agentReq: Req, resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer, options: OpenId4VciTokenRequestOptions, ) { - const tokenResponse = await agent.modules.openId4VcHolderModule.requestToken({ ...options }) - const credentialResponse = await agent.modules.openId4VcHolderModule.requestCredentials({ + const tokenResponse = await agentReq.agent.modules.openId4VcHolderModule.requestToken({ ...options }) + const credentialResponse = await agentReq.agent.modules.openId4VcHolderModule.requestCredentials({ ...options, credentialConfigurationIds: resolvedCredentialOffer.credentialOfferPayload.credential_configuration_ids, credentialBindingResolver: async ({ @@ -154,7 +134,7 @@ export class HolderService { supportedDidMethods?: string[] supportsAllDidMethods?: boolean }) => { - const key = await agent.wallet.createKey({ keyType: keyTypes[0] as any }) + const key = await agentReq.agent.wallet.createKey({ keyType: keyTypes[0] as any }) if (supportsAllDidMethods || supportedDidMethods?.includes('did:key')) { const didKey = new DidKey(key) return { method: 'did', didUrl: `${didKey.did}#${didKey.key.fingerprint}` } @@ -172,24 +152,24 @@ export class HolderService { credentialResponse.credentials.map(async (response: any) => { const credential = response.credentials[0] if (credential instanceof W3cJwtVerifiableCredential || credential instanceof W3cJsonLdVerifiableCredential) { - return await agent.w3cCredentials.storeCredential({ credential }) + return await agentReq.agent.w3cCredentials.storeCredential({ credential }) } if (credential instanceof Mdoc) { - return await agent.mdoc.store(credential) + return await agentReq.agent.mdoc.store(credential) } - return await agent.sdJwtVc.store(credential.compact) + return await agentReq.agent.sdJwtVc.store(credential.compact) }), ) - return storedCredentials + return storedCredentials as any } private async initiateAuthorization( - agent: Agent, + agentReq: Req, resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer, credentialsToRequest: string[], ) { - console.log("agent::::::::::::::", Object.keys(agent.modules.openId4VcHolderModule)) + console.log("agent::::::::::::::", Object.keys(agentReq.agent.modules.openId4VcHolderModule)) console.log('Initiating authorization with resolvedCredentialOffer:', resolvedCredentialOffer) console.log('Credentials to request:', credentialsToRequest) @@ -214,7 +194,7 @@ export class HolderService { .map(([id, val]) => (credentialsToRequest.includes(id) ? val.scope : undefined)) .filter((v): v is string => Boolean(v)) - const resolved = await agent.modules.openId4VcHolderModule.resolveIssuanceAuthorizationRequest( + const resolved = await agentReq.agent.modules.openId4VcHolderModule.resolveOpenId4VciAuthorizationRequest( resolvedCredentialOffer, { clientId: this.HOLDER_CLIENT_ID, @@ -234,34 +214,67 @@ export class HolderService { return { ...resolved, authorizationFlow: 'Oauth2Redirect' as const, - } + } as any } // ❌ Unsupported grant throw new Error('Unsupported grant type') } - public async resolveProofRequest(agent: Agent, body: ResolveProofRequest) { - return await agent.modules.openId4VcHolderModule.resolveOpenId4VpAuthorizationRequest(body.proofRequestUri) + public async resolveProofRequest(agentReq: Req, body: ResolveProofRequest) { + return await agentReq.agent.modules.openId4VcHolderModule.resolveOpenId4VpAuthorizationRequest(body.proofRequestUri) as any } - public async acceptPresentationRequest(agent: Agent, body: ResolveProofRequest) { - const resolved = await agent.modules.openId4VcHolderModule.resolveOpenId4VpAuthorizationRequest( + public async acceptPresentationRequest(agentReq: Req, body: ResolveProofRequest) { + const resolved = await agentReq.agent.modules.openId4VcHolderModule.resolveOpenId4VpAuthorizationRequest( body.proofRequestUri, ) - const presentationExchangeService = agent.dependencyManager.resolve(DifPresentationExchangeService) + console.log('Resolved proof request:', resolved) + // const presentationExchangeService = agent.dependencyManager.resolve(DifPresentationExchangeService) + + const dcqlService = agentReq.agent.dependencyManager.resolve(DifPresentationExchangeService) + + // console.log('Resolved proof request:', resolved) - if (!resolved.presentationExchange) throw new Error('Missing presentation exchange on request') + // console.log('Presentation exchange service:', presentationExchangeService) - const submissionResult = await agent.modules.openId4VcHolderModule.acceptOpenId4VpAuthorizationRequest({ + if (!resolved.dcql) throw new Error('Missing DCQL on request') + console.log('DCQL query result:', resolved.dcql.queryResult) + // + let dcqlCredentials + try { + dcqlCredentials = await agentReq.agent.modules.openId4VcHolderModule.selectCredentialsForDcqlRequest( + resolved.dcql.queryResult + ) + console.log('Selected credentials for DCQL request:', dcqlCredentials) + } catch (error) { + console.error('Error selecting credentials for DCQL request:', error) + throw error + } + const submissionResult = await agentReq.agent.modules.openId4VcHolderModule.acceptOpenId4VpAuthorizationRequest({ authorizationRequestPayload: resolved.authorizationRequestPayload, - presentationExchange: { - credentials: presentationExchangeService.selectCredentialsForRequest( - resolved.presentationExchange.credentialsForRequest, - ), + dcql: { + credentials: dcqlCredentials as DcqlCredentialsForRequest, }, }) - + console.log('Presentation submission result:', submissionResult) return submissionResult.serverResponse } + + public async decodeSdJwt(agentReq: Req, body: { jwt: string }) { + const sdJwt = agentReq.agent.sdJwtVc.fromCompact(body.jwt) + return sdJwt as any + } + + public async getSelectedCredentialsForRequest( + dcqlQueryResult: DcqlQueryResult, + selectedCredentials: { [credentialQueryId: string]: string } + ) { + if (!dcqlQueryResult.canBeSatisfied) { + throw new Error('Cannot select the credentials for the dcql query presentation if the request cannot be satisfied') + } + // TODO: Implement logic to select credentials based on selectedCredentials + return {} as any; // Placeholder return to avoid errors + } } +export const holderService = new HolderService() \ No newline at end of file diff --git a/src/controllers/openid4vc/types/issuer.types.ts b/src/controllers/openid4vc/types/issuer.types.ts index 7b695f68..30f432d5 100644 --- a/src/controllers/openid4vc/types/issuer.types.ts +++ b/src/controllers/openid4vc/types/issuer.types.ts @@ -128,7 +128,7 @@ export interface CredentialConfigurationSupportedWithFormats { vct?: string, doctype?: string, scope?: string - claims?: Record + claims?: any cryptographic_binding_methods_supported?: string[] credential_signing_alg_values_supported?: string[] proof_types_supported?: Record diff --git a/src/controllers/openid4vc/types/verifier.types.ts b/src/controllers/openid4vc/types/verifier.types.ts index e0fb544a..d83d3227 100644 --- a/src/controllers/openid4vc/types/verifier.types.ts +++ b/src/controllers/openid4vc/types/verifier.types.ts @@ -4,14 +4,17 @@ import type { SubmissionRequirement, Format, Issuance, InputDescriptorV2 } from export enum ResponseModeEnum { DIRECT_POST = 'direct_post', - DIRECT_POSJWT = 'direct_post.jwt', -}// export interface SubmissionRequirementModel extends SubmissionRequirement { + DIRECT_POST_JWT = 'direct_post.jwt', +} + +/* -------------------------------------------------------------------------- */ +/* PRESENTATION MODELS */ +/* -------------------------------------------------------------------------- */ export interface InputDescriptorV2Model extends InputDescriptorV2 { format?: Format group?: string[] issuance?: Issuance[] - // constraints already inherited } export interface DifPresentationExchangeDefinitionV2Model extends DifPresentationExchangeDefinitionV2 { @@ -25,13 +28,61 @@ export interface PresentationDefinition { definition: DifPresentationExchangeDefinitionV2Model } +/* -------------------------------------------------------------------------- */ +/* DCQL MODELS */ +/* -------------------------------------------------------------------------- */ + +export interface DcqlClaim { + path: string[] + intent_to_retain?: boolean +} + +export interface DcqlCredential { + id: string + format: string + meta?: Record + require_cryptographic_holder_binding?: boolean + claims: DcqlClaim[] +} + +export interface DcqlQuery { + combine?: 'all' | 'any' + credentials: DcqlCredential[] +} + +export interface DcqlDefinition { + query: DcqlQuery +} + +/* -------------------------------------------------------------------------- */ +/* AUTHORIZATION REQUEST MODEL */ +/* -------------------------------------------------------------------------- */ +export interface OpenId4VcJwtIssuerDid { + method: 'did' + didUrl: string +} + +export interface OpenId4VcIssuerX5c { + method: 'x5c' + issuer: string + x5c: string[] + alg: string +} + export interface CreateAuthorizationRequest { verifierId: string - verifierDid: string - presentationExchange: PresentationDefinition + presentationExchange?: PresentationDefinition + dcql?: string | DcqlDefinition + responseMode?: ResponseModeEnum + + requestSigner: OpenId4VcJwtIssuerDid } +/* -------------------------------------------------------------------------- */ +/* VERIFIER METADATA */ +/* -------------------------------------------------------------------------- */ + export class OpenId4VcSiopVerifierClientMetadata { client_name?: string logo_uri?: string @@ -43,6 +94,6 @@ export class OpenId4VcSiopCreateVerifierOptions { } export class OpenId4VcUpdateVerifierRecordOptions { - verifierId!: string + verifierId?: string clientMetadata?: OpenId4VcSiopVerifierClientMetadata -} +} \ No newline at end of file diff --git a/src/controllers/openid4vc/verifier-sessions/verification-sessions.Controller.ts b/src/controllers/openid4vc/verifier-sessions/verification-sessions.Controller.ts index 7c9c1257..20d47555 100644 --- a/src/controllers/openid4vc/verifier-sessions/verification-sessions.Controller.ts +++ b/src/controllers/openid4vc/verifier-sessions/verification-sessions.Controller.ts @@ -1,30 +1,33 @@ import { Agent } from '@credo-ts/core' import { OpenId4VcVerificationSessionState } from '@credo-ts/openid4vc' -import { Controller, Get, Path, Query, Route, Request, Security, Tags } from 'tsoa' +import { Controller, Get, Path, Query, Route, Request, Security, Tags, Post, Body } from 'tsoa' import { injectable } from 'tsyringe' import ErrorHandlingService from '../../../errorHandlingService' import { verificationSessionService } from './verification-sessions.service' import { SCOPES } from '../../../enums' import { Request as Req } from 'express' +import { CreateAuthorizationRequest } from '../types/verifier.types' @Tags('oid4vc verification sessions') @Route('/openid4vc/verification-sessions') @Security('jwt', [SCOPES.TENANT_AGENT, SCOPES.DEDICATED_AGENT]) @injectable() export class VerificationSessionsController extends Controller { - /** * Create an authorization request, acting as a Relying Party (RP) */ -// @Post('/create-presentation-request') -// public async createProofRequest(@Body() createAuthorizationRequest: any) { -// try { -// return await verificationSessionService.createProofRequest(this.agent, createAuthorizationRequest) -// } catch (error) { -// throw ErrorHandlingService.handle(error) -// } -// } + @Post('/create-presentation-request') + public async createProofRequest( + @Request() request: Req, + @Body() createAuthorizationRequest: CreateAuthorizationRequest, + ) { + try { + return await verificationSessionService.createProofRequest(request, createAuthorizationRequest) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } /** * Retrieve all verification session records @@ -56,7 +59,10 @@ export class VerificationSessionsController extends Controller { * Get verification session by ID */ @Get('/:verificationSessionId') - public async getVerificationSessionsById(@Request() request: Req, @Path('verificationSessionId') verificationSessionId: string) { + public async getVerificationSessionsById( + @Request() request: Req, + @Path('verificationSessionId') verificationSessionId: string, + ) { try { return await verificationSessionService.getVerificationSessionsById(request, verificationSessionId) } catch (error) { @@ -67,12 +73,15 @@ export class VerificationSessionsController extends Controller { // /** // * Get verification response by verification Session ID // */ - // @Get('/response/:verificationSessionId') - // public async getVerifiedAuthorizationResponse(@Path('verificationSessionId') verificationSessionId: string) { - // try { - // return await verificationSessionService.getVerifiedAuthorizationResponse(this.agent, verificationSessionId) - // } catch (error) { - // throw ErrorHandlingService.handle(error) - // } - // } + @Get('/response/:verificationSessionId') + public async getVerifiedAuthorizationResponse( + @Request() request: Req, + @Path('verificationSessionId') verificationSessionId: string, + ) { + try { + return await verificationSessionService.getVerifiedAuthorizationResponse(request, verificationSessionId) + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } } diff --git a/src/controllers/openid4vc/verifier-sessions/verification-sessions.service.ts b/src/controllers/openid4vc/verifier-sessions/verification-sessions.service.ts index e890e7c9..319a49b6 100644 --- a/src/controllers/openid4vc/verifier-sessions/verification-sessions.service.ts +++ b/src/controllers/openid4vc/verifier-sessions/verification-sessions.service.ts @@ -4,41 +4,66 @@ import { Agent, ClaimFormat, DidKey, + JsonEncoder, + JsonTransformer, Jwt, + MdocDeviceResponse, + RecordNotFoundError, + TypedArrayEncoder, W3cJsonLdVerifiablePresentation, W3cJwtVerifiablePresentation, } from '@credo-ts/core' import { OpenId4VcVerificationSessionState } from '@credo-ts/openid4vc' import { injectable } from 'tsyringe' import { Request as Req } from 'express' +import { CreateAuthorizationRequest } from '../types/verifier.types' // import { CreateAuthorizationRequest } from '../types/verifier.types' @injectable() class VerificationSessionsService { -// public async createProofRequest( -// verifierAgent: Agent | Agent, -// dto: any, // CreateAuthorizationRequest -// ) { -// const didDocument = await verifierAgent.dids.resolveDidDocument(dto.verifierDid) - -// let verifierDidUrl: string | undefined = undefined -// if (!verifierDidUrl && didDocument.verificationMethod?.[0].id) { -// verifierDidUrl = didDocument.verificationMethod?.[0].id -// } - -// if (!verifierDidUrl) throw new Error('No matching verification method found') - -// return await verifierAgent.modules.openId4VcVerifier.createAuthorizationRequest({ -// requestSigner: { -// method: 'did', -// didUrl: verifierDidUrl, -// }, -// verifierId: dto.verifierId, -// presentationExchange: dto.presentationExchange, -// responseMode: dto.responseMode, -// }) -// } + public async createProofRequest(agentReq: Req, dto: CreateAuthorizationRequest) { + try { + const didToResolve = dto.requestSigner?.didUrl + if (!didToResolve) { + throw new Error('No DID provided to resolve (neither requestSigner.didUrl nor verifierDid present)') + } + + const didDocument = await agentReq.agent.dids.resolveDidDocument(didToResolve) + + let verifierDidUrl: string | undefined = undefined + if (didDocument.verificationMethod?.[0]?.id) { + verifierDidUrl = didDocument.verificationMethod[0].id + } + + if (!verifierDidUrl) { + throw new Error('No matching verification method found on verifier DID document') + } + let requestSigner = dto.requestSigner + if (!requestSigner) { + requestSigner = { method: 'did', didUrl: verifierDidUrl } as any + } else if (requestSigner.method === 'did') { + if (!requestSigner.didUrl || !String(requestSigner.didUrl).includes('#')) { + requestSigner.didUrl = verifierDidUrl + } + } + const options: any = { + requestSigner, + verifierId: dto.verifierId, + } + + if (dto.responseMode) options.responseMode = dto.responseMode + if (dto.presentationExchange) { + options.presentationExchange = dto.presentationExchange + } else if (dto.dcql) { + options.dcql = dto.dcql + } + + return (await agentReq.agent.modules.openId4VcVerifier.createAuthorizationRequest(options)) as any + } catch (error) { + throw error + } + } public async findVerificationSessionsByQuery( agentReq: Req, @@ -57,53 +82,105 @@ class VerificationSessionsService { }) } - public async getVerificationSessionsById( - agentReq: Req, - verificationSessionId: string, - ) { + public async getVerificationSessionsById(agentReq: Req, verificationSessionId: string) { return await agentReq.agent.modules.openId4VcVerifier.getVerificationSessionById(verificationSessionId) } - public async getVerifiedAuthorizationResponse( - verifierAgent: Agent | Agent, - verificationSessionId: string, - ) { - const verifiedAuthorizationResponse = - await verifierAgent.modules.openId4VcVerifier.getVerifiedAuthorizationResponse(verificationSessionId) - - const presentations = verifiedAuthorizationResponse.presentationExchange?.presentations.map((presentation) => { - if (presentation instanceof W3cJsonLdVerifiablePresentation) { - return { - format: presentation.claimFormat, - encoded: presentation.toJSON(), - vcPayload: presentation.toJSON(), - } - } else if (presentation instanceof W3cJwtVerifiablePresentation) { - return { - format: presentation.claimFormat, - encoded: presentation.serializedJwt, - vcPayload: presentation.presentation.toJSON(), - signedPayload: presentation.jwt.payload.toJson(), - header: presentation.jwt.header, - } - } else { - const sdJwtPresentation: any = presentation - return { - format: ClaimFormat.SdJwtVc, - encoded: sdJwtPresentation.compact, - vcPayload: sdJwtPresentation.prettyClaims, - signedPayload: sdJwtPresentation.payload, - header: sdJwtPresentation.header as Jwt['header'], - } - } - }) + public async getVerifiedAuthorizationResponse(request: Req, verificationSessionId: string) { + const verificationSession = + await request.agent.modules.openId4VcVerifier.getVerificationSessionById(verificationSessionId) + const verified = await request.agent.modules.openId4VcVerifier.getVerifiedAuthorizationResponse( + verificationSession.id, + ) + console.log(verified.presentationExchange?.presentations) + console.log(verified.dcql?.presentationResult) + + const presentations = await Promise.all( + (verified.presentationExchange?.presentations ?? Object.values(verified.dcql?.presentations ?? {})) + .flat() + .map(async (presentation) => { + if (presentation instanceof W3cJsonLdVerifiablePresentation) { + return { + pretty: presentation.toJson(), + encoded: presentation.toJson(), + } + } + + if (presentation instanceof W3cJwtVerifiablePresentation) { + return { + pretty: JsonTransformer.toJSON(presentation.presentation), + encoded: presentation.serializedJwt, + } + } + + if (presentation instanceof MdocDeviceResponse) { + return { + pretty: JsonTransformer.toJSON({ + documents: presentation.documents.map((doc) => ({ + doctype: doc.docType, + alg: doc.alg, + base64Url: doc.base64Url, + validityInfo: doc.validityInfo, + deviceSignedNamespaces: doc.deviceSignedNamespaces, + issuerSignedNamespaces: Object.entries(doc.issuerSignedNamespaces).map( + ([nameSpace, nameSpacEntries]) => [ + nameSpace, + Object.entries(nameSpacEntries).map(([key, value]) => + value instanceof Uint8Array + ? [`base64:${key}`, `data:image/jpeg;base64,${TypedArrayEncoder.toBase64(value)}`] + : [key, value], + ), + ], + ), + })), + }), + encoded: presentation.base64Url, + } + } + + // if ( + // presentation instanceof W3cV2JwtVerifiablePresentation || + // presentation instanceof W3cV2SdJwtVerifiablePresentation + // ) { + // throw new Error('W3C V2 presentations are not supported yet') + // } + + return { + pretty: { + ...presentation, + compact: undefined, + }, + encoded: presentation.compact, + } + }) ?? [], + ) + + const dcqlSubmission = verified.dcql + ? Object.keys(verified.dcql.presentations).map((key, index) => ({ + queryCredentialId: key, + presentationIndex: index, + })) + : undefined + + console.log('presentations', presentations) return { - ...verifiedAuthorizationResponse, - presentationExchange: verifiedAuthorizationResponse.presentationExchange - ? { ...verifiedAuthorizationResponse.presentationExchange, presentations } + verificationSessionId: verificationSession.id, + responseStatus: verificationSession.state, + error: verificationSession.errorMessage, + //authorizationRequest, + + presentations: presentations, + + submission: verified.presentationExchange?.submission, + definition: verified.presentationExchange?.definition, + transactionDataSubmission: verified.transactionData, + + // dcqlQuery, + dcqlSubmission: verified.dcql + ? { ...verified.dcql.presentationResult, vpTokenMapping: dcqlSubmission } : undefined, - } + } as any } } diff --git a/src/controllers/openid4vc/verifiers/verifier.Controller.ts b/src/controllers/openid4vc/verifiers/verifier.Controller.ts index af8e7dbc..21266961 100644 --- a/src/controllers/openid4vc/verifiers/verifier.Controller.ts +++ b/src/controllers/openid4vc/verifiers/verifier.Controller.ts @@ -2,7 +2,7 @@ import { SCOPES } from '../../../enums' import { Body, Delete, Get, Path, Post, Put, Query, Route, Request, Security, Tags } from 'tsoa' import { Request as Req } from 'express' -// import { OpenId4VcSiopCreateVerifierOptions, OpenId4VcUpdateVerifierRecordOptions } from '../types/verifier.types' +import { OpenId4VcSiopCreateVerifierOptions, OpenId4VcUpdateVerifierRecordOptions } from '../types/verifier.types' import { VerifierService } from '../verifiers/verifier.service' @Tags('oid4vc verifiers') @@ -19,7 +19,7 @@ export class VerifierController { * Create a new verifier and store the verifier record */ @Post('/') - public async createVerifier(@Request() request: Req, @Body() options: any) { + public async createVerifier(@Request() request: Req, @Body() options: OpenId4VcSiopCreateVerifierOptions) { return await this.verifierService.createVerifier(request, options) } @@ -30,7 +30,7 @@ export class VerifierController { public async updateVerifierMetadata( @Request() request: Req, @Path('publicVerifierId') publicVerifierId: string, - @Body() verifierRecordOptions: any, + @Body() verifierRecordOptions: OpenId4VcUpdateVerifierRecordOptions, ) { return await this.verifierService.updateVerifierMetadata(request, { verifierId: publicVerifierId, diff --git a/src/routes/routes.ts b/src/routes/routes.ts index fa10f105..b9e61d89 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -34,12 +34,12 @@ import { MultiTenancyController } from './../controllers/multi-tenancy/MultiTena // WARNING: This 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 { IssuanceSessionsController } from './../controllers/openid4vc/issuance-sessions/issuance-sessions.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 { HolderController } from './../controllers/openid4vc/holder/holder.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 { IssuerController } from './../controllers/openid4vc/issuers/issuer.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 { VerificationSessionsController } from './../controllers/openid4vc/verifier-sessions/verification-sessions.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 { HolderController } from './../controllers/openid4vc/holder/holder.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 { VerifierController } from './../controllers/openid4vc/verifiers/verifier.Controller'; import { expressAuthentication } from './../authentication'; // @ts-ignore - no great way to install types from subpackage @@ -1706,45 +1706,6 @@ const models: TsoaRoute.Models = { "enums": ["OfferCreated","OfferUriRetrieved","AuthorizationInitiated","AuthorizationGranted","AccessTokenRequested","AccessTokenCreated","CredentialRequestReceived","CredentialsPartiallyIssued","Completed","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 - "SdJwtVcRecord": { - "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 - "MdocRecord": { - "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 - "AuthorizeRequestCredentialOffer": { - "dataType": "refObject", - "properties": { - "credentialOfferUri": {"dataType":"string","required":true}, - "credentialsToRequest": {"dataType":"array","array":{"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 - "RequestCredentialBody": { - "dataType": "refObject", - "properties": { - "credentialOfferUri": {"dataType":"string","required":true}, - "credentialsToRequest": {"dataType":"array","array":{"dataType":"string"},"required":true}, - "authorizationCode": {"dataType":"string"}, - "codeVerifier": {"dataType":"string"}, - "txCode": {"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 - "ResolveProofRequest": { - "dataType": "refObject", - "properties": { - "proofRequestUri": {"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 "OpenId4VcIssuerRecord": { "dataType": "refAlias", "type": {"ref":"Record_string.unknown_","validators":{}}, @@ -1829,7 +1790,7 @@ const models: TsoaRoute.Models = { "vct": {"dataType":"string"}, "doctype": {"dataType":"string"}, "scope": {"dataType":"string"}, - "claims": {"ref":"Record_string.unknown_"}, + "claims": {"dataType":"any"}, "cryptographic_binding_methods_supported": {"dataType":"array","array":{"dataType":"string"}}, "credential_signing_alg_values_supported": {"dataType":"array","array":{"dataType":"string"}}, "proof_types_supported": {"ref":"Record_string.ProofTypeConfig_"}, @@ -1877,6 +1838,348 @@ 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 + "JwtObject": { + "dataType": "refObject", + "properties": { + "alg": {"dataType":"array","array":{"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 + "LdpObject": { + "dataType": "refObject", + "properties": { + "proof_type": {"dataType":"array","array":{"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 + "DiObject": { + "dataType": "refObject", + "properties": { + "proof_type": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "cryptosuite": {"dataType":"array","array":{"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 + "SdJwtObject": { + "dataType": "refObject", + "properties": { + "undefined": {"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 + "MsoMdocObject": { + "dataType": "refObject", + "properties": { + "alg": {"dataType":"array","array":{"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 + "Format": { + "dataType": "refObject", + "properties": { + "jwt": {"ref":"JwtObject"}, + "jwt_vc": {"ref":"JwtObject"}, + "jwt_vc_json": {"ref":"JwtObject"}, + "jwt_vp": {"ref":"JwtObject"}, + "jwt_vp_json": {"ref":"JwtObject"}, + "ldp": {"ref":"LdpObject"}, + "ldp_vc": {"ref":"LdpObject"}, + "ldp_vp": {"ref":"LdpObject"}, + "di": {"ref":"DiObject"}, + "di_vc": {"ref":"DiObject"}, + "di_vp": {"ref":"DiObject"}, + "undefined": {"ref":"SdJwtObject"}, + "mso_mdoc": {"ref":"MsoMdocObject"}, + }, + "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 + "Issuance": { + "dataType": "refObject", + "properties": { + "manifest": {"dataType":"string"}, + }, + "additionalProperties": {"dataType":"union","subSchemas":[{"dataType":"any"},{"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 + "Optionality": { + "dataType": "refAlias", + "type": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["required"]},{"dataType":"enum","enums":["preferred"]}],"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 + "Directives": { + "dataType": "refAlias", + "type": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["required"]},{"dataType":"enum","enums":["allowed"]},{"dataType":"enum","enums":["disallowed"]}],"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 + "PdStatus": { + "dataType": "refObject", + "properties": { + "directive": {"ref":"Directives"}, + }, + "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 + "Statuses": { + "dataType": "refObject", + "properties": { + "active": {"ref":"PdStatus"}, + "suspended": {"ref":"PdStatus"}, + "revoked": {"ref":"PdStatus"}, + }, + "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 + "OneOfNumberStringBoolean": { + "dataType": "refAlias", + "type": {"dataType":"union","subSchemas":[{"dataType":"boolean"},{"dataType":"double"},{"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 + "OneOfNumberString": { + "dataType": "refAlias", + "type": {"dataType":"union","subSchemas":[{"dataType":"double"},{"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 + "FilterV2": { + "dataType": "refObject", + "properties": { + "const": {"ref":"OneOfNumberStringBoolean"}, + "enum": {"dataType":"array","array":{"dataType":"refAlias","ref":"OneOfNumberStringBoolean"}}, + "exclusiveMinimum": {"ref":"OneOfNumberString"}, + "exclusiveMaximum": {"ref":"OneOfNumberString"}, + "format": {"dataType":"string"}, + "formatMaximum": {"dataType":"string"}, + "formatMinimum": {"dataType":"string"}, + "formatExclusiveMaximum": {"dataType":"string"}, + "formatExclusiveMinimum": {"dataType":"string"}, + "minLength": {"dataType":"double"}, + "maxLength": {"dataType":"double"}, + "minimum": {"ref":"OneOfNumberString"}, + "maximum": {"ref":"OneOfNumberString"}, + "not": {"dataType":"object"}, + "pattern": {"dataType":"string"}, + "type": {"dataType":"string"}, + "contains": {"ref":"FilterV2"}, + "items": {"ref":"FilterV2Items"}, + }, + "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 + "FilterV2Items": { + "dataType": "refObject", + "properties": { + "const": {"ref":"OneOfNumberStringBoolean"}, + "enum": {"dataType":"array","array":{"dataType":"refAlias","ref":"OneOfNumberStringBoolean"}}, + "exclusiveMinimum": {"ref":"OneOfNumberString"}, + "exclusiveMaximum": {"ref":"OneOfNumberString"}, + "format": {"dataType":"string"}, + "formatMaximum": {"dataType":"string"}, + "formatMinimum": {"dataType":"string"}, + "formatExclusiveMaximum": {"dataType":"string"}, + "formatExclusiveMinimum": {"dataType":"string"}, + "minLength": {"dataType":"double"}, + "maxLength": {"dataType":"double"}, + "minimum": {"ref":"OneOfNumberString"}, + "maximum": {"ref":"OneOfNumberString"}, + "not": {"dataType":"object"}, + "pattern": {"dataType":"string"}, + "type": {"dataType":"string"}, + "contains": {"ref":"FilterV2"}, + "items": {"ref":"FilterV2Items"}, + }, + "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 + "FieldV2": { + "dataType": "refObject", + "properties": { + "id": {"dataType":"string"}, + "path": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "purpose": {"dataType":"string"}, + "filter": {"ref":"FilterV2"}, + "predicate": {"ref":"Optionality"}, + "intent_to_retain": {"dataType":"boolean"}, + "name": {"dataType":"string"}, + "optional": {"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 + "HolderSubject": { + "dataType": "refObject", + "properties": { + "field_id": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "directive": {"ref":"Optionality","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 + "ConstraintsV2": { + "dataType": "refObject", + "properties": { + "limit_disclosure": {"ref":"Optionality"}, + "statuses": {"ref":"Statuses"}, + "fields": {"dataType":"array","array":{"dataType":"refObject","ref":"FieldV2"}}, + "subject_is_issuer": {"ref":"Optionality"}, + "is_holder": {"dataType":"array","array":{"dataType":"refObject","ref":"HolderSubject"}}, + "same_subject": {"dataType":"array","array":{"dataType":"refObject","ref":"HolderSubject"}}, + }, + "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 + "InputDescriptorV2Model": { + "dataType": "refObject", + "properties": { + "id": {"dataType":"string","required":true}, + "name": {"dataType":"string"}, + "purpose": {"dataType":"string"}, + "format": {"ref":"Format"}, + "group": {"dataType":"array","array":{"dataType":"string"}}, + "issuance": {"dataType":"array","array":{"dataType":"refObject","ref":"Issuance"}}, + "constraints": {"ref":"ConstraintsV2","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 + "Rules": { + "dataType": "refAlias", + "type": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["all"]},{"dataType":"enum","enums":["pick"]}],"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 + "SubmissionRequirement": { + "dataType": "refObject", + "properties": { + "name": {"dataType":"string"}, + "purpose": {"dataType":"string"}, + "rule": {"ref":"Rules","required":true}, + "count": {"dataType":"double"}, + "min": {"dataType":"double"}, + "max": {"dataType":"double"}, + "from": {"dataType":"string"}, + "from_nested": {"dataType":"array","array":{"dataType":"refObject","ref":"SubmissionRequirement"}}, + }, + "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 + "InputDescriptorV2": { + "dataType": "refObject", + "properties": { + "id": {"dataType":"string","required":true}, + "name": {"dataType":"string"}, + "purpose": {"dataType":"string"}, + "format": {"ref":"Format"}, + "group": {"dataType":"array","array":{"dataType":"string"}}, + "issuance": {"dataType":"array","array":{"dataType":"refObject","ref":"Issuance"}}, + "constraints": {"ref":"ConstraintsV2","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 + "PresentationDefinitionV2": { + "dataType": "refObject", + "properties": { + "id": {"dataType":"string","required":true}, + "name": {"dataType":"string"}, + "purpose": {"dataType":"string"}, + "format": {"ref":"Format"}, + "submission_requirements": {"dataType":"array","array":{"dataType":"refObject","ref":"SubmissionRequirement"}}, + "input_descriptors": {"dataType":"array","array":{"dataType":"refObject","ref":"InputDescriptorV2"},"required":true}, + "frame": {"dataType":"object"}, + }, + "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 + "DifPresentationExchangeDefinitionV2Model": { + "dataType": "refObject", + "properties": { + "id": {"dataType":"string","required":true}, + "name": {"dataType":"string"}, + "purpose": {"dataType":"string"}, + "format": {"ref":"Format"}, + "submission_requirements": {"dataType":"array","array":{"dataType":"any"}}, + "input_descriptors": {"dataType":"array","array":{"dataType":"refObject","ref":"InputDescriptorV2Model"},"required":true}, + "frame": {"dataType":"object"}, + }, + "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 + "PresentationDefinition": { + "dataType": "refObject", + "properties": { + "definition": {"ref":"DifPresentationExchangeDefinitionV2Model","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 + "DcqlClaim": { + "dataType": "refObject", + "properties": { + "path": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "intent_to_retain": {"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 + "DcqlCredential": { + "dataType": "refObject", + "properties": { + "id": {"dataType":"string","required":true}, + "format": {"dataType":"string","required":true}, + "meta": {"ref":"Record_string.any_"}, + "require_cryptographic_holder_binding": {"dataType":"boolean"}, + "claims": {"dataType":"array","array":{"dataType":"refObject","ref":"DcqlClaim"},"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 + "DcqlQuery": { + "dataType": "refObject", + "properties": { + "combine": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["all"]},{"dataType":"enum","enums":["any"]}]}, + "credentials": {"dataType":"array","array":{"dataType":"refObject","ref":"DcqlCredential"},"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 + "DcqlDefinition": { + "dataType": "refObject", + "properties": { + "query": {"ref":"DcqlQuery","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 + "ResponseModeEnum": { + "dataType": "refEnum", + "enums": ["direct_post","direct_post.jwt"], + }, + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + "OpenId4VcJwtIssuerDid": { + "dataType": "refObject", + "properties": { + "method": {"dataType":"enum","enums":["did"],"required":true}, + "didUrl": {"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 + "CreateAuthorizationRequest": { + "dataType": "refObject", + "properties": { + "verifierId": {"dataType":"string","required":true}, + "presentationExchange": {"ref":"PresentationDefinition"}, + "dcql": {"dataType":"union","subSchemas":[{"dataType":"string"},{"ref":"DcqlDefinition"}]}, + "responseMode": {"ref":"ResponseModeEnum"}, + "requestSigner": {"ref":"OpenId4VcJwtIssuerDid","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 "OpenId4VcVerificationSessionRecord": { "dataType": "refAlias", "type": {"ref":"Record_string.unknown_","validators":{}}, @@ -1887,36 +2190,110 @@ const models: TsoaRoute.Models = { "enums": ["RequestCreated","RequestUriRetrieved","ResponseVerified","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 - "OpenId4VcVerifierRecord": { + "SdJwtVcRecord": { "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 -}; -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)), + "MdocRecord": { + "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 + "ResolveCredentialOfferBody": { + "dataType": "refObject", + "properties": { + "credentialOfferUri": {"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 + "AuthorizeRequestCredentialOffer": { + "dataType": "refObject", + "properties": { + "credentialOfferUri": {"dataType":"string","required":true}, + "credentialsToRequest": {"dataType":"array","array":{"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 + "RequestCredentialBody": { + "dataType": "refObject", + "properties": { + "credentialOfferUri": {"dataType":"string","required":true}, + "credentialsToRequest": {"dataType":"array","array":{"dataType":"string"},"required":true}, + "authorizationCode": {"dataType":"string"}, + "codeVerifier": {"dataType":"string"}, + "txCode": {"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 + "ResolveProofRequest": { + "dataType": "refObject", + "properties": { + "proofRequestUri": {"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 + "OpenId4VcVerifierRecord": { + "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 + "OpenId4VcSiopVerifierClientMetadata": { + "dataType": "refObject", + "properties": { + "client_name": {"dataType":"string"}, + "logo_uri": {"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 + "OpenId4VcSiopCreateVerifierOptions": { + "dataType": "refObject", + "properties": { + "verifierId": {"dataType":"string"}, + "clientMetadata": {"ref":"OpenId4VcSiopVerifierClientMetadata"}, + }, + "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 + "OpenId4VcUpdateVerifierRecordOptions": { + "dataType": "refObject", + "properties": { + "verifierId": {"dataType":"string"}, + "clientMetadata": {"ref":"OpenId4VcSiopVerifierClientMetadata"}, + }, + "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) { @@ -4514,44 +4891,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_getTenants: Record = { - request: {"in":"request","name":"request","required":true,"dataType":"object"}, - notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}}, - internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}}, - }; - app.get('/multi-tenancy', - authenticateMiddleware([{"jwt":["Basewallet"]}]), - ...(fetchMiddlewares(MultiTenancyController)), - ...(fetchMiddlewares(MultiTenancyController.prototype.getTenants)), - - async function MultiTenancyController_getTenants(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_getTenants, 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: 'getTenants', - 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"}, @@ -4782,30 +5121,32 @@ 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 argsHolderController_getSdJwtCredentials: Record = { + const argsIssuerController_createIssuer: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createIssuerOptions: {"in":"body","name":"createIssuerOptions","required":true,"ref":"CreateIssuerOptions"}, }; - app.get('/openid4vc/holder/sd-jwt-vcs', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.getSdJwtCredentials)), + app.post('/openid4vc/issuer', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(IssuerController)), + ...(fetchMiddlewares(IssuerController.prototype.createIssuer)), - async function HolderController_getSdJwtCredentials(request: ExRequest, response: ExResponse, next: any) { + async function IssuerController_createIssuer(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: argsHolderController_getSdJwtCredentials, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsIssuerController_createIssuer, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(HolderController); + const controller: any = await container.get(IssuerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getSdJwtCredentials', + methodName: 'createIssuer', controller, response, next, @@ -4817,30 +5158,33 @@ 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 argsHolderController_getMdocCredentials: Record = { + const argsIssuerController_updateIssuerMetadata: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + publicIssuerId: {"in":"path","name":"publicIssuerId","required":true,"dataType":"string"}, + updateIssuerRecordOptions: {"in":"body","name":"updateIssuerRecordOptions","required":true,"ref":"UpdateIssuerRecordOptions"}, }; - app.get('/openid4vc/holder/mdoc-vcs', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.getMdocCredentials)), + app.put('/openid4vc/issuer/:publicIssuerId', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(IssuerController)), + ...(fetchMiddlewares(IssuerController.prototype.updateIssuerMetadata)), - async function HolderController_getMdocCredentials(request: ExRequest, response: ExResponse, next: any) { + async function IssuerController_updateIssuerMetadata(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: argsHolderController_getMdocCredentials, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsIssuerController_updateIssuerMetadata, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(HolderController); + const controller: any = await container.get(IssuerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getMdocCredentials', + methodName: 'updateIssuerMetadata', controller, response, next, @@ -4852,31 +5196,32 @@ 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 argsHolderController_decodeMdocCredential: Record = { - body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"base64Url":{"dataType":"string","required":true}}}, + const argsIssuerController_getIssuerAgentMetaData: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + issuerId: {"in":"path","name":"issuerId","required":true,"dataType":"string"}, }; - app.post('/openid4vc/holder/mdoc-vcs/decode', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.decodeMdocCredential)), + app.get('/openid4vc/issuer/:issuerId/metadata', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(IssuerController)), + ...(fetchMiddlewares(IssuerController.prototype.getIssuerAgentMetaData)), - async function HolderController_decodeMdocCredential(request: ExRequest, response: ExResponse, next: any) { + async function IssuerController_getIssuerAgentMetaData(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: argsHolderController_decodeMdocCredential, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsIssuerController_getIssuerAgentMetaData, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(HolderController); + const controller: any = await container.get(IssuerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'decodeMdocCredential', + methodName: 'getIssuerAgentMetaData', controller, response, next, @@ -4888,31 +5233,32 @@ 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 argsHolderController_requestAuthorizationForCredential: Record = { - body: {"in":"body","name":"body","required":true,"ref":"AuthorizeRequestCredentialOffer"}, + const argsIssuerController_getIssuersByQuery: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + publicIssuerId: {"in":"query","name":"publicIssuerId","dataType":"string"}, }; - app.post('/openid4vc/holder/authorization-request', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.requestAuthorizationForCredential)), + app.get('/openid4vc/issuer', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(IssuerController)), + ...(fetchMiddlewares(IssuerController.prototype.getIssuersByQuery)), - async function HolderController_requestAuthorizationForCredential(request: ExRequest, response: ExResponse, next: any) { + async function IssuerController_getIssuersByQuery(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: argsHolderController_requestAuthorizationForCredential, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsIssuerController_getIssuersByQuery, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(HolderController); + const controller: any = await container.get(IssuerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'requestAuthorizationForCredential', + methodName: 'getIssuersByQuery', controller, response, next, @@ -4924,31 +5270,32 @@ 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 argsHolderController_requestCredential: Record = { - body: {"in":"body","name":"body","required":true,"ref":"RequestCredentialBody"}, + const argsIssuerController_getIssuer: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + publicIssuerId: {"in":"path","name":"publicIssuerId","required":true,"dataType":"string"}, }; - app.post('/openid4vc/holder/request-credential', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.requestCredential)), + app.get('/openid4vc/issuer/:publicIssuerId', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(IssuerController)), + ...(fetchMiddlewares(IssuerController.prototype.getIssuer)), - async function HolderController_requestCredential(request: ExRequest, response: ExResponse, next: any) { + async function IssuerController_getIssuer(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: argsHolderController_requestCredential, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsIssuerController_getIssuer, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(HolderController); + const controller: any = await container.get(IssuerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'requestCredential', + methodName: 'getIssuer', controller, response, next, @@ -4960,31 +5307,32 @@ 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 argsHolderController_resolveProofRequest: Record = { - body: {"in":"body","name":"body","required":true,"ref":"ResolveProofRequest"}, + const argsIssuerController_deleteIssuer: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + id: {"in":"path","name":"id","required":true,"dataType":"string"}, }; - app.post('/openid4vc/holder/resolve-proof-request', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.resolveProofRequest)), + app.delete('/openid4vc/issuer/:id', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(IssuerController)), + ...(fetchMiddlewares(IssuerController.prototype.deleteIssuer)), - async function HolderController_resolveProofRequest(request: ExRequest, response: ExResponse, next: any) { + async function IssuerController_deleteIssuer(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: argsHolderController_resolveProofRequest, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsIssuerController_deleteIssuer, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(HolderController); + const controller: any = await container.get(IssuerController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'resolveProofRequest', + methodName: 'deleteIssuer', controller, response, next, @@ -4996,21 +5344,173 @@ 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 argsHolderController_acceptProofRequest: Record = { - body: {"in":"body","name":"body","required":true,"ref":"ResolveProofRequest"}, + const argsVerificationSessionsController_createProofRequest: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + createAuthorizationRequest: {"in":"body","name":"createAuthorizationRequest","required":true,"ref":"CreateAuthorizationRequest"}, }; - app.post('/openid4vc/holder/accept-proof-request', - authenticateMiddleware([{"apiKey":[]}]), - ...(fetchMiddlewares(HolderController)), - ...(fetchMiddlewares(HolderController.prototype.acceptProofRequest)), + app.post('/openid4vc/verification-sessions/create-presentation-request', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(VerificationSessionsController)), + ...(fetchMiddlewares(VerificationSessionsController.prototype.createProofRequest)), - async function HolderController_acceptProofRequest(request: ExRequest, response: ExResponse, next: any) { + async function VerificationSessionsController_createProofRequest(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: argsHolderController_acceptProofRequest, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsVerificationSessionsController_createProofRequest, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(VerificationSessionsController); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'createProofRequest', + 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 argsVerificationSessionsController_getAllVerificationSessions: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + publicVerifierId: {"in":"query","name":"publicVerifierId","dataType":"string"}, + payloadState: {"in":"query","name":"payloadState","dataType":"string"}, + state: {"in":"query","name":"state","ref":"OpenId4VcVerificationSessionState"}, + authorizationRequestUri: {"in":"query","name":"authorizationRequestUri","dataType":"string"}, + nonce: {"in":"query","name":"nonce","dataType":"string"}, + }; + app.get('/openid4vc/verification-sessions', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(VerificationSessionsController)), + ...(fetchMiddlewares(VerificationSessionsController.prototype.getAllVerificationSessions)), + + async function VerificationSessionsController_getAllVerificationSessions(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: argsVerificationSessionsController_getAllVerificationSessions, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(VerificationSessionsController); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'getAllVerificationSessions', + 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 argsVerificationSessionsController_getVerificationSessionsById: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + verificationSessionId: {"in":"path","name":"verificationSessionId","required":true,"dataType":"string"}, + }; + app.get('/openid4vc/verification-sessions/:verificationSessionId', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(VerificationSessionsController)), + ...(fetchMiddlewares(VerificationSessionsController.prototype.getVerificationSessionsById)), + + async function VerificationSessionsController_getVerificationSessionsById(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: argsVerificationSessionsController_getVerificationSessionsById, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(VerificationSessionsController); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'getVerificationSessionsById', + 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 argsVerificationSessionsController_getVerifiedAuthorizationResponse: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + verificationSessionId: {"in":"path","name":"verificationSessionId","required":true,"dataType":"string"}, + }; + app.get('/openid4vc/verification-sessions/response/:verificationSessionId', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(VerificationSessionsController)), + ...(fetchMiddlewares(VerificationSessionsController.prototype.getVerifiedAuthorizationResponse)), + + async function VerificationSessionsController_getVerifiedAuthorizationResponse(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: argsVerificationSessionsController_getVerifiedAuthorizationResponse, request, response }); + + const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; + + const controller: any = await container.get(VerificationSessionsController); + if (typeof controller['setStatus'] === 'function') { + controller.setStatus(undefined); + } + + await templateService.apiHandler({ + methodName: 'getVerifiedAuthorizationResponse', + 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 argsHolderController_getSdJwtCredentials: Record = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + }; + app.get('/openid4vc/holder/sd-jwt-vcs', + authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.getSdJwtCredentials)), + + async function HolderController_getSdJwtCredentials(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: argsHolderController_getSdJwtCredentials, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; @@ -5020,7 +5520,7 @@ export function RegisterRoutes(app: Router) { } await templateService.apiHandler({ - methodName: 'acceptProofRequest', + methodName: 'getSdJwtCredentials', controller, response, next, @@ -5032,32 +5532,31 @@ 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 argsIssuerController_createIssuer: Record = { + const argsHolderController_getMdocCredentials: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - createIssuerOptions: {"in":"body","name":"createIssuerOptions","required":true,"ref":"CreateIssuerOptions"}, }; - app.post('/openid4vc/issuer', + app.get('/openid4vc/holder/mdoc-vcs', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(IssuerController)), - ...(fetchMiddlewares(IssuerController.prototype.createIssuer)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.getMdocCredentials)), - async function IssuerController_createIssuer(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_getMdocCredentials(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: argsIssuerController_createIssuer, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_getMdocCredentials, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(IssuerController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'createIssuer', + methodName: 'getMdocCredentials', controller, response, next, @@ -5069,33 +5568,32 @@ 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 argsIssuerController_updateIssuerMetadata: Record = { + const argsHolderController_decodeMdocCredential: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - publicIssuerId: {"in":"path","name":"publicIssuerId","required":true,"dataType":"string"}, - updateIssuerRecordOptions: {"in":"body","name":"updateIssuerRecordOptions","required":true,"ref":"UpdateIssuerRecordOptions"}, + body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"base64Url":{"dataType":"string","required":true}}}, }; - app.put('/openid4vc/issuer/:publicIssuerId', + app.post('/openid4vc/holder/mdoc-vcs/decode', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(IssuerController)), - ...(fetchMiddlewares(IssuerController.prototype.updateIssuerMetadata)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.decodeMdocCredential)), - async function IssuerController_updateIssuerMetadata(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_decodeMdocCredential(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: argsIssuerController_updateIssuerMetadata, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_decodeMdocCredential, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(IssuerController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'updateIssuerMetadata', + methodName: 'decodeMdocCredential', controller, response, next, @@ -5107,32 +5605,32 @@ 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 argsIssuerController_getIssuerAgentMetaData: Record = { + const argsHolderController_resolveCredOffer: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - issuerId: {"in":"path","name":"issuerId","required":true,"dataType":"string"}, + body: {"in":"body","name":"body","required":true,"ref":"ResolveCredentialOfferBody"}, }; - app.get('/openid4vc/issuer/:issuerId/metadata', + app.post('/openid4vc/holder/resolve-credential-offer', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(IssuerController)), - ...(fetchMiddlewares(IssuerController.prototype.getIssuerAgentMetaData)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.resolveCredOffer)), - async function IssuerController_getIssuerAgentMetaData(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_resolveCredOffer(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: argsIssuerController_getIssuerAgentMetaData, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_resolveCredOffer, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(IssuerController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getIssuerAgentMetaData', + methodName: 'resolveCredOffer', controller, response, next, @@ -5144,32 +5642,32 @@ 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 argsIssuerController_getIssuersByQuery: Record = { + const argsHolderController_requestAuthorizationForCredential: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - publicIssuerId: {"in":"query","name":"publicIssuerId","dataType":"string"}, + body: {"in":"body","name":"body","required":true,"ref":"AuthorizeRequestCredentialOffer"}, }; - app.get('/openid4vc/issuer', + app.post('/openid4vc/holder/authorization-request', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(IssuerController)), - ...(fetchMiddlewares(IssuerController.prototype.getIssuersByQuery)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.requestAuthorizationForCredential)), - async function IssuerController_getIssuersByQuery(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_requestAuthorizationForCredential(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: argsIssuerController_getIssuersByQuery, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_requestAuthorizationForCredential, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(IssuerController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getIssuersByQuery', + methodName: 'requestAuthorizationForCredential', controller, response, next, @@ -5181,32 +5679,32 @@ 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 argsIssuerController_getIssuer: Record = { + const argsHolderController_requestCredential: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - publicIssuerId: {"in":"path","name":"publicIssuerId","required":true,"dataType":"string"}, + body: {"in":"body","name":"body","required":true,"ref":"RequestCredentialBody"}, }; - app.get('/openid4vc/issuer/:publicIssuerId', + app.post('/openid4vc/holder/request-credential', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(IssuerController)), - ...(fetchMiddlewares(IssuerController.prototype.getIssuer)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.requestCredential)), - async function IssuerController_getIssuer(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_requestCredential(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: argsIssuerController_getIssuer, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_requestCredential, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(IssuerController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getIssuer', + methodName: 'requestCredential', controller, response, next, @@ -5218,32 +5716,32 @@ 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 argsIssuerController_deleteIssuer: Record = { + const argsHolderController_resolveProofRequest: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - id: {"in":"path","name":"id","required":true,"dataType":"string"}, + body: {"in":"body","name":"body","required":true,"ref":"ResolveProofRequest"}, }; - app.delete('/openid4vc/issuer/:id', + app.post('/openid4vc/holder/resolve-proof-request', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(IssuerController)), - ...(fetchMiddlewares(IssuerController.prototype.deleteIssuer)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.resolveProofRequest)), - async function IssuerController_deleteIssuer(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_resolveProofRequest(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: argsIssuerController_deleteIssuer, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_resolveProofRequest, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(IssuerController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'deleteIssuer', + methodName: 'resolveProofRequest', controller, response, next, @@ -5255,36 +5753,32 @@ 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 argsVerificationSessionsController_getAllVerificationSessions: Record = { + const argsHolderController_acceptProofRequest: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - publicVerifierId: {"in":"query","name":"publicVerifierId","dataType":"string"}, - payloadState: {"in":"query","name":"payloadState","dataType":"string"}, - state: {"in":"query","name":"state","ref":"OpenId4VcVerificationSessionState"}, - authorizationRequestUri: {"in":"query","name":"authorizationRequestUri","dataType":"string"}, - nonce: {"in":"query","name":"nonce","dataType":"string"}, + body: {"in":"body","name":"body","required":true,"ref":"ResolveProofRequest"}, }; - app.get('/openid4vc/verification-sessions', + app.post('/openid4vc/holder/accept-proof-request', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(VerificationSessionsController)), - ...(fetchMiddlewares(VerificationSessionsController.prototype.getAllVerificationSessions)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.acceptProofRequest)), - async function VerificationSessionsController_getAllVerificationSessions(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_acceptProofRequest(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: argsVerificationSessionsController_getAllVerificationSessions, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_acceptProofRequest, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(VerificationSessionsController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getAllVerificationSessions', + methodName: 'acceptProofRequest', controller, response, next, @@ -5296,32 +5790,32 @@ 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 argsVerificationSessionsController_getVerificationSessionsById: Record = { + const argsHolderController_decodeSdJwt: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - verificationSessionId: {"in":"path","name":"verificationSessionId","required":true,"dataType":"string"}, + body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"jwt":{"dataType":"string","required":true}}}, }; - app.get('/openid4vc/verification-sessions/:verificationSessionId', + app.post('/openid4vc/holder/decode-sdjwt', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), - ...(fetchMiddlewares(VerificationSessionsController)), - ...(fetchMiddlewares(VerificationSessionsController.prototype.getVerificationSessionsById)), + ...(fetchMiddlewares(HolderController)), + ...(fetchMiddlewares(HolderController.prototype.decodeSdJwt)), - async function VerificationSessionsController_getVerificationSessionsById(request: ExRequest, response: ExResponse, next: any) { + async function HolderController_decodeSdJwt(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: argsVerificationSessionsController_getVerificationSessionsById, request, response }); + validatedArgs = templateService.getValidatedArgs({ args: argsHolderController_decodeSdJwt, request, response }); const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer; - const controller: any = await container.get(VerificationSessionsController); + const controller: any = await container.get(HolderController); if (typeof controller['setStatus'] === 'function') { controller.setStatus(undefined); } await templateService.apiHandler({ - methodName: 'getVerificationSessionsById', + methodName: 'decodeSdJwt', controller, response, next, @@ -5335,7 +5829,7 @@ 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 argsVerifierController_createVerifier: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, - options: {"in":"body","name":"options","required":true,"dataType":"any"}, + options: {"in":"body","name":"options","required":true,"ref":"OpenId4VcSiopCreateVerifierOptions"}, }; app.post('/openid4vc/verifier', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), @@ -5373,7 +5867,7 @@ export function RegisterRoutes(app: Router) { const argsVerifierController_updateVerifierMetadata: Record = { request: {"in":"request","name":"request","required":true,"dataType":"object"}, publicVerifierId: {"in":"path","name":"publicVerifierId","required":true,"dataType":"string"}, - verifierRecordOptions: {"in":"body","name":"verifierRecordOptions","required":true,"dataType":"any"}, + verifierRecordOptions: {"in":"body","name":"verifierRecordOptions","required":true,"ref":"OpenId4VcUpdateVerifierRecordOptions"}, }; app.put('/openid4vc/verifier/:publicVerifierId', authenticateMiddleware([{"jwt":["tenant","dedicated"]}]), diff --git a/src/routes/swagger.json b/src/routes/swagger.json index 575ba001..149c444b 100644 --- a/src/routes/swagger.json +++ b/src/routes/swagger.json @@ -3966,71 +3966,6 @@ ], "type": "string" }, - "SdJwtVcRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "MdocRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "AuthorizeRequestCredentialOffer": { - "properties": { - "credentialOfferUri": { - "type": "string" - }, - "credentialsToRequest": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - "required": [ - "credentialOfferUri", - "credentialsToRequest" - ], - "type": "object", - "additionalProperties": false - }, - "RequestCredentialBody": { - "properties": { - "credentialOfferUri": { - "type": "string" - }, - "credentialsToRequest": { - "items": { - "type": "string" - }, - "type": "array" - }, - "authorizationCode": { - "type": "string" - }, - "codeVerifier": { - "type": "string" - }, - "txCode": { - "type": "string" - } - }, - "required": [ - "credentialOfferUri", - "credentialsToRequest" - ], - "type": "object", - "additionalProperties": false - }, - "ResolveProofRequest": { - "properties": { - "proofRequestUri": { - "type": "string" - } - }, - "required": [ - "proofRequestUri" - ], - "type": "object", - "additionalProperties": false - }, "OpenId4VcIssuerRecord": { "$ref": "#/components/schemas/Record_string.unknown_", "description": "For OID4VC you need to expose metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.\nSo we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints\nand metadata files" @@ -4187,9 +4122,7 @@ "scope": { "type": "string" }, - "claims": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, + "claims": {}, "cryptographic_binding_methods_supported": { "items": { "type": "string" @@ -4308,157 +4241,1033 @@ "type": "object", "additionalProperties": false }, - "OpenId4VcVerificationSessionRecord": { - "$ref": "#/components/schemas/Record_string.unknown_" - }, - "OpenId4VcVerificationSessionState": { - "enum": [ - "RequestCreated", - "RequestUriRetrieved", - "ResponseVerified", - "Error" - ], - "type": "string" - }, - "OpenId4VcVerifierRecord": { - "$ref": "#/components/schemas/Record_string.unknown_", - "description": "For OID4VC you need to expos metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.\nSo we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints\nand metadata files" - } - }, - "securitySchemes": { - "apiKey": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - }, - "jwt": { - "type": "http", - "scheme": "bearer", - "bearerFormat": "JWT" - } - } - }, - "info": { - "title": "credo-controller", - "version": "2.0.0", - "description": "Rest endpoint wrapper for using your agent over HTTP", - "license": { - "name": "Apache-2.0" - }, - "contact": {} - }, - "paths": { - "/x509": { - "post": { - "operationId": "CreateX509Certificate", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "properties": { - "publicCertificateBase64": { - "type": "string" - } - }, - "required": [ - "publicCertificateBase64" - ], - "type": "object" - } - } - } + "JwtObject": { + "properties": { + "alg": { + "items": { + "type": "string" + }, + "type": "array" } }, - "tags": [ - "x509" - ], - "security": [ - { - "jwt": [ - "tenant", - "dedicated" - ] - } + "required": [ + "alg" ], - "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" - } - } - } + "type": "object", + "additionalProperties": false + }, + "LdpObject": { + "properties": { + "proof_type": { + "items": { + "type": "string" + }, + "type": "array" } }, - "tags": [ - "x509" + "required": [ + "proof_type" ], - "security": [ - { - "jwt": [ - "tenant", - "dedicated" - ] + "type": "object", + "additionalProperties": false + }, + "DiObject": { + "properties": { + "proof_type": { + "items": { + "type": "string" + }, + "type": "array" + }, + "cryptosuite": { + "items": { + "type": "string" + }, + "type": "array" } + }, + "required": [ + "proof_type", + "cryptosuite" ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/X509ImportCertificateOptionsDto" - } - } + "type": "object", + "additionalProperties": false + }, + "SdJwtObject": { + "properties": { + "undefined": { + "items": { + "type": "string" + }, + "type": "array" } - } - } - }, - "/x509/trusted": { - "post": { - "operationId": "AddTrustedCertificate", - "responses": { - "204": { - "description": "No content" + }, + "type": "object", + "additionalProperties": false + }, + "MsoMdocObject": { + "properties": { + "alg": { + "items": { + "type": "string" + }, + "type": "array" } }, - "tags": [ - "x509" + "required": [ + "alg" ], - "security": [ - { - "jwt": [ - "tenant", - "dedicated" - ] + "type": "object", + "additionalProperties": false + }, + "Format": { + "properties": { + "jwt": { + "$ref": "#/components/schemas/JwtObject" + }, + "jwt_vc": { + "$ref": "#/components/schemas/JwtObject" + }, + "jwt_vc_json": { + "$ref": "#/components/schemas/JwtObject" + }, + "jwt_vp": { + "$ref": "#/components/schemas/JwtObject" + }, + "jwt_vp_json": { + "$ref": "#/components/schemas/JwtObject" + }, + "ldp": { + "$ref": "#/components/schemas/LdpObject" + }, + "ldp_vc": { + "$ref": "#/components/schemas/LdpObject" + }, + "ldp_vp": { + "$ref": "#/components/schemas/LdpObject" + }, + "di": { + "$ref": "#/components/schemas/DiObject" + }, + "di_vc": { + "$ref": "#/components/schemas/DiObject" + }, + "di_vp": { + "$ref": "#/components/schemas/DiObject" + }, + "undefined": { + "$ref": "#/components/schemas/SdJwtObject" + }, + "mso_mdoc": { + "$ref": "#/components/schemas/MsoMdocObject" + } + }, + "type": "object", + "additionalProperties": false + }, + "Issuance": { + "properties": { + "manifest": { + "type": "string" + } + }, + "type": "object", + "additionalProperties": {} + }, + "Optionality": { + "type": "string", + "enum": [ + "required", + "preferred" + ] + }, + "Directives": { + "type": "string", + "enum": [ + "required", + "allowed", + "disallowed" + ] + }, + "PdStatus": { + "properties": { + "directive": { + "$ref": "#/components/schemas/Directives" + } + }, + "type": "object", + "additionalProperties": false + }, + "Statuses": { + "properties": { + "active": { + "$ref": "#/components/schemas/PdStatus" + }, + "suspended": { + "$ref": "#/components/schemas/PdStatus" + }, + "revoked": { + "$ref": "#/components/schemas/PdStatus" + } + }, + "type": "object", + "additionalProperties": false + }, + "OneOfNumberStringBoolean": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "number", + "format": "double" + }, + { + "type": "string" + } + ] + }, + "OneOfNumberString": { + "anyOf": [ + { + "type": "number", + "format": "double" + }, + { + "type": "string" + } + ] + }, + "FilterV2": { + "properties": { + "const": { + "$ref": "#/components/schemas/OneOfNumberStringBoolean" + }, + "enum": { + "items": { + "$ref": "#/components/schemas/OneOfNumberStringBoolean" + }, + "type": "array" + }, + "exclusiveMinimum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "exclusiveMaximum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "format": { + "type": "string" + }, + "formatMaximum": { + "type": "string" + }, + "formatMinimum": { + "type": "string" + }, + "formatExclusiveMaximum": { + "type": "string" + }, + "formatExclusiveMinimum": { + "type": "string" + }, + "minLength": { + "type": "number", + "format": "double" + }, + "maxLength": { + "type": "number", + "format": "double" + }, + "minimum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "maximum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "not": { + "additionalProperties": false, + "type": "object" + }, + "pattern": { + "type": "string" + }, + "type": { + "type": "string" + }, + "contains": { + "$ref": "#/components/schemas/FilterV2" + }, + "items": { + "$ref": "#/components/schemas/FilterV2Items" + } + }, + "type": "object", + "additionalProperties": false + }, + "FilterV2Items": { + "properties": { + "const": { + "$ref": "#/components/schemas/OneOfNumberStringBoolean" + }, + "enum": { + "items": { + "$ref": "#/components/schemas/OneOfNumberStringBoolean" + }, + "type": "array" + }, + "exclusiveMinimum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "exclusiveMaximum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "format": { + "type": "string" + }, + "formatMaximum": { + "type": "string" + }, + "formatMinimum": { + "type": "string" + }, + "formatExclusiveMaximum": { + "type": "string" + }, + "formatExclusiveMinimum": { + "type": "string" + }, + "minLength": { + "type": "number", + "format": "double" + }, + "maxLength": { + "type": "number", + "format": "double" + }, + "minimum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "maximum": { + "$ref": "#/components/schemas/OneOfNumberString" + }, + "not": { + "additionalProperties": false, + "type": "object" + }, + "pattern": { + "type": "string" + }, + "type": { + "type": "string" + }, + "contains": { + "$ref": "#/components/schemas/FilterV2" + }, + "items": { + "$ref": "#/components/schemas/FilterV2Items" + } + }, + "type": "object", + "additionalProperties": false + }, + "FieldV2": { + "properties": { + "id": { + "type": "string" + }, + "path": { + "items": { + "type": "string" + }, + "type": "array" + }, + "purpose": { + "type": "string" + }, + "filter": { + "$ref": "#/components/schemas/FilterV2" + }, + "predicate": { + "$ref": "#/components/schemas/Optionality" + }, + "intent_to_retain": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "optional": { + "type": "boolean" + } + }, + "required": [ + "path" + ], + "type": "object", + "additionalProperties": false + }, + "HolderSubject": { + "properties": { + "field_id": { + "items": { + "type": "string" + }, + "type": "array" + }, + "directive": { + "$ref": "#/components/schemas/Optionality" + } + }, + "required": [ + "field_id", + "directive" + ], + "type": "object", + "additionalProperties": false + }, + "ConstraintsV2": { + "properties": { + "limit_disclosure": { + "$ref": "#/components/schemas/Optionality" + }, + "statuses": { + "$ref": "#/components/schemas/Statuses" + }, + "fields": { + "items": { + "$ref": "#/components/schemas/FieldV2" + }, + "type": "array" + }, + "subject_is_issuer": { + "$ref": "#/components/schemas/Optionality" + }, + "is_holder": { + "items": { + "$ref": "#/components/schemas/HolderSubject" + }, + "type": "array" + }, + "same_subject": { + "items": { + "$ref": "#/components/schemas/HolderSubject" + }, + "type": "array" + } + }, + "type": "object", + "additionalProperties": false + }, + "InputDescriptorV2Model": { + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "format": { + "$ref": "#/components/schemas/Format" + }, + "group": { + "items": { + "type": "string" + }, + "type": "array" + }, + "issuance": { + "items": { + "$ref": "#/components/schemas/Issuance" + }, + "type": "array" + }, + "constraints": { + "$ref": "#/components/schemas/ConstraintsV2" + } + }, + "required": [ + "id", + "constraints" + ], + "type": "object", + "additionalProperties": false + }, + "Rules": { + "type": "string", + "enum": [ + "all", + "pick" + ] + }, + "SubmissionRequirement": { + "properties": { + "name": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "rule": { + "$ref": "#/components/schemas/Rules" + }, + "count": { + "type": "number", + "format": "double" + }, + "min": { + "type": "number", + "format": "double" + }, + "max": { + "type": "number", + "format": "double" + }, + "from": { + "type": "string" + }, + "from_nested": { + "items": { + "$ref": "#/components/schemas/SubmissionRequirement" + }, + "type": "array" + } + }, + "required": [ + "rule" + ], + "type": "object", + "additionalProperties": false + }, + "InputDescriptorV2": { + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "format": { + "$ref": "#/components/schemas/Format" + }, + "group": { + "items": { + "type": "string" + }, + "type": "array" + }, + "issuance": { + "items": { + "$ref": "#/components/schemas/Issuance" + }, + "type": "array" + }, + "constraints": { + "$ref": "#/components/schemas/ConstraintsV2" + } + }, + "required": [ + "id", + "constraints" + ], + "type": "object", + "additionalProperties": false + }, + "PresentationDefinitionV2": { + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "format": { + "$ref": "#/components/schemas/Format" + }, + "submission_requirements": { + "items": { + "$ref": "#/components/schemas/SubmissionRequirement" + }, + "type": "array" + }, + "input_descriptors": { + "items": { + "$ref": "#/components/schemas/InputDescriptorV2" + }, + "type": "array" + }, + "frame": { + "additionalProperties": false, + "type": "object" + } + }, + "required": [ + "id", + "input_descriptors" + ], + "type": "object", + "additionalProperties": false + }, + "DifPresentationExchangeDefinitionV2Model": { + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "format": { + "$ref": "#/components/schemas/Format" + }, + "submission_requirements": { + "items": {}, + "type": "array" + }, + "input_descriptors": { + "items": { + "$ref": "#/components/schemas/InputDescriptorV2Model" + }, + "type": "array" + }, + "frame": { + "additionalProperties": false, + "type": "object" + } + }, + "required": [ + "id", + "input_descriptors" + ], + "type": "object", + "additionalProperties": false + }, + "PresentationDefinition": { + "properties": { + "definition": { + "$ref": "#/components/schemas/DifPresentationExchangeDefinitionV2Model" + } + }, + "required": [ + "definition" + ], + "type": "object", + "additionalProperties": false + }, + "DcqlClaim": { + "properties": { + "path": { + "items": { + "type": "string" + }, + "type": "array" + }, + "intent_to_retain": { + "type": "boolean" + } + }, + "required": [ + "path" + ], + "type": "object", + "additionalProperties": false + }, + "DcqlCredential": { + "properties": { + "id": { + "type": "string" + }, + "format": { + "type": "string" + }, + "meta": { + "$ref": "#/components/schemas/Record_string.any_" + }, + "require_cryptographic_holder_binding": { + "type": "boolean" + }, + "claims": { + "items": { + "$ref": "#/components/schemas/DcqlClaim" + }, + "type": "array" + } + }, + "required": [ + "id", + "format", + "claims" + ], + "type": "object", + "additionalProperties": false + }, + "DcqlQuery": { + "properties": { + "combine": { + "type": "string", + "enum": [ + "all", + "any" + ] + }, + "credentials": { + "items": { + "$ref": "#/components/schemas/DcqlCredential" + }, + "type": "array" + } + }, + "required": [ + "credentials" + ], + "type": "object", + "additionalProperties": false + }, + "DcqlDefinition": { + "properties": { + "query": { + "$ref": "#/components/schemas/DcqlQuery" + } + }, + "required": [ + "query" + ], + "type": "object", + "additionalProperties": false + }, + "ResponseModeEnum": { + "enum": [ + "direct_post", + "direct_post.jwt" + ], + "type": "string" + }, + "OpenId4VcJwtIssuerDid": { + "properties": { + "method": { + "type": "string", + "enum": [ + "did" + ], + "nullable": false + }, + "didUrl": { + "type": "string" + } + }, + "required": [ + "method", + "didUrl" + ], + "type": "object", + "additionalProperties": false + }, + "CreateAuthorizationRequest": { + "properties": { + "verifierId": { + "type": "string" + }, + "presentationExchange": { + "$ref": "#/components/schemas/PresentationDefinition" + }, + "dcql": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/DcqlDefinition" + } + ] + }, + "responseMode": { + "$ref": "#/components/schemas/ResponseModeEnum" + }, + "requestSigner": { + "$ref": "#/components/schemas/OpenId4VcJwtIssuerDid" + } + }, + "required": [ + "verifierId", + "requestSigner" + ], + "type": "object", + "additionalProperties": false + }, + "OpenId4VcVerificationSessionRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "OpenId4VcVerificationSessionState": { + "enum": [ + "RequestCreated", + "RequestUriRetrieved", + "ResponseVerified", + "Error" + ], + "type": "string" + }, + "SdJwtVcRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "MdocRecord": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "ResolveCredentialOfferBody": { + "properties": { + "credentialOfferUri": { + "type": "string" + } + }, + "required": [ + "credentialOfferUri" + ], + "type": "object", + "additionalProperties": false + }, + "AuthorizeRequestCredentialOffer": { + "properties": { + "credentialOfferUri": { + "type": "string" + }, + "credentialsToRequest": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "credentialOfferUri", + "credentialsToRequest" + ], + "type": "object", + "additionalProperties": false + }, + "RequestCredentialBody": { + "properties": { + "credentialOfferUri": { + "type": "string" + }, + "credentialsToRequest": { + "items": { + "type": "string" + }, + "type": "array" + }, + "authorizationCode": { + "type": "string" + }, + "codeVerifier": { + "type": "string" + }, + "txCode": { + "type": "string" + } + }, + "required": [ + "credentialOfferUri", + "credentialsToRequest" + ], + "type": "object", + "additionalProperties": false + }, + "ResolveProofRequest": { + "properties": { + "proofRequestUri": { + "type": "string" + } + }, + "required": [ + "proofRequestUri" + ], + "type": "object", + "additionalProperties": false + }, + "OpenId4VcVerifierRecord": { + "$ref": "#/components/schemas/Record_string.unknown_", + "description": "For OID4VC you need to expos metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.\nSo we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints\nand metadata files" + }, + "OpenId4VcSiopVerifierClientMetadata": { + "properties": { + "client_name": { + "type": "string" + }, + "logo_uri": { + "type": "string" + } + }, + "type": "object", + "additionalProperties": false + }, + "OpenId4VcSiopCreateVerifierOptions": { + "properties": { + "verifierId": { + "type": "string" + }, + "clientMetadata": { + "$ref": "#/components/schemas/OpenId4VcSiopVerifierClientMetadata" + } + }, + "type": "object", + "additionalProperties": false + }, + "OpenId4VcUpdateVerifierRecordOptions": { + "properties": { + "verifierId": { + "type": "string" + }, + "clientMetadata": { + "$ref": "#/components/schemas/OpenId4VcSiopVerifierClientMetadata" + } + }, + "type": "object", + "additionalProperties": false + } + }, + "securitySchemes": { + "apiKey": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + }, + "jwt": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + }, + "info": { + "title": "credo-controller", + "version": "2.0.0", + "description": "Rest endpoint wrapper for using your agent over HTTP", + "license": { + "name": "Apache-2.0" + }, + "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": [], @@ -8701,78 +9510,7 @@ ] }, "delete": { - "operationId": "DeleteTenantById", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - }, - "404": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" - } - } - } - }, - "500": { - "description": "", - "content": { - "application/json": { - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ], - "type": "object" - } - } - } - } - }, - "tags": [ - "MultiTenancy" - ], - "security": [ - { - "jwt": [ - "Basewallet" - ] - } - ], - "parameters": [ - { - "in": "path", - "name": "tenantId", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, - "/multi-tenancy": { - "get": { - "operationId": "GetTenants", + "operationId": "DeleteTenantById", "responses": { "200": { "description": "Ok", @@ -8829,7 +9567,16 @@ ] } ], - "parameters": [] + "parameters": [ + { + "in": "path", + "name": "tenantId", + "required": true, + "schema": { + "type": "string" + } + } + ] } }, "/openid4vc/issuance-sessions/create-credential-offer": { @@ -9055,295 +9802,31 @@ "type": "string" } }, - { - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/OpenId4VcIssuanceSessionState" - } - }, - { - "in": "query", - "name": "credentialOfferUri", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "authorizationCode", - "required": false, - "schema": { - "type": "string" - } - } - ] - } - }, - "/openid4vc/holder/sd-jwt-vcs": { - "get": { - "operationId": "GetSdJwtCredentials", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/SdJwtVcRecord" - }, - "type": "array" - } - } - } - } - }, - "description": "Get SdJwt type of credentials", - "tags": [ - "oid4vc holders" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [] - } - }, - "/openid4vc/holder/mdoc-vcs": { - "get": { - "operationId": "GetMdocCredentials", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/MdocRecord" - }, - "type": "array" - } - } - } - } - }, - "description": "Fetch all mso mdoc credentials in wallet", - "tags": [ - "oid4vc holders" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [] - } - }, - "/openid4vc/holder/mdoc-vcs/decode": { - "post": { - "operationId": "DecodeMdocCredential", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "description": "Decode mso mdoc credential in wallet", - "tags": [ - "oid4vc holders" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "properties": { - "base64Url": { - "type": "string" - } - }, - "required": [ - "base64Url" - ], - "type": "object" - } - } - } - } - } - }, - "/openid4vc/holder/authorization-request": { - "post": { - "operationId": "RequestAuthorizationForCredential", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "properties": { - "codeVerifier": { - "type": "string" - }, - "authorizationRequestUrl": { - "type": "string" - }, - "actionToTake": { - "type": "string" - } - }, - "required": [ - "codeVerifier", - "authorizationRequestUrl", - "actionToTake" - ], - "type": "object" - } - } - } - } - }, - "description": "Resolve a credential offer", - "tags": [ - "oid4vc holders" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthorizeRequestCredentialOffer" - } - } - } - } - } - }, - "/openid4vc/holder/request-credential": { - "post": { - "operationId": "RequestCredential", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "items": {}, - "type": "array" - } - } - } - } - }, - "description": "Initiates a token request, then requests credentials from issuer", - "tags": [ - "oid4vc holders" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RequestCredentialBody" - } - } - } - } - } - }, - "/openid4vc/holder/resolve-proof-request": { - "post": { - "operationId": "ResolveProofRequest", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } - } - } - }, - "description": "Resolve a proof request", - "tags": [ - "oid4vc holders" - ], - "security": [ - { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ResolveProofRequest" - } + { + "in": "query", + "name": "state", + "required": false, + "schema": { + "$ref": "#/components/schemas/OpenId4VcIssuanceSessionState" } - } - } - } - }, - "/openid4vc/holder/accept-proof-request": { - "post": { - "operationId": "AcceptProofRequest", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": {} - } + }, + { + "in": "query", + "name": "credentialOfferUri", + "required": false, + "schema": { + "type": "string" } - } - }, - "description": "Accept a proof request", - "tags": [ - "oid4vc holders" - ], - "security": [ + }, { - "apiKey": [] - } - ], - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ResolveProofRequest" - } + "in": "query", + "name": "authorizationCode", + "required": false, + "schema": { + "type": "string" } } - } + ] } }, "/openid4vc/issuer": { @@ -9657,9 +10140,245 @@ } } }, - "description": "Creates an issuer with issuer metadata.", + "description": "Creates an issuer with issuer metadata.", + "tags": [ + "oid4vc issuers" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateIssuerOptions" + } + } + } + } + }, + "get": { + "operationId": "GetIssuersByQuery", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/OpenId4VcIssuerRecord" + }, + "type": "array" + } + } + } + } + }, + "description": "Query issuers by optional publicIssuerId.", + "tags": [ + "oid4vc issuers" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "query", + "name": "publicIssuerId", + "required": false, + "schema": { + "type": "string" + } + } + ] + } + }, + "/openid4vc/issuer/{publicIssuerId}": { + "put": { + "operationId": "UpdateIssuerMetadata", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenId4VcIssuerRecord" + } + } + } + } + }, + "description": "Updates issuer metadata for a given publicIssuerId.", + "tags": [ + "oid4vc issuers" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "publicIssuerId", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateIssuerRecordOptions" + } + } + } + } + }, + "get": { + "operationId": "GetIssuer", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenId4VcIssuerRecord" + } + } + } + } + }, + "description": "Returns a specific issuer by publicIssuerId.", + "tags": [ + "oid4vc issuers" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "publicIssuerId", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, + "/openid4vc/issuer/{issuerId}/metadata": { + "get": { + "operationId": "GetIssuerAgentMetaData", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "type": "number", + "format": "double" + } + } + } + } + }, + "description": "Returns metadata for a specific issuer.", + "tags": [ + "oid4vc issuers" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "issuerId", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, + "/openid4vc/issuer/{id}": { + "delete": { + "operationId": "DeleteIssuer", + "responses": { + "204": { + "description": "No content" + } + }, + "description": "Deletes a specific issuer by record id.", + "tags": [ + "oid4vc issuers" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, + "/openid4vc/verification-sessions/create-presentation-request": { + "post": { + "operationId": "CreateProofRequest", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "description": "Create an authorization request, acting as a Relying Party (RP)", "tags": [ - "oid4vc issuers" + "oid4vc verification sessions" ], "security": [ { @@ -9675,14 +10394,16 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateIssuerOptions" + "$ref": "#/components/schemas/CreateAuthorizationRequest" } } } } - }, + } + }, + "/openid4vc/verification-sessions": { "get": { - "operationId": "GetIssuersByQuery", + "operationId": "GetAllVerificationSessions", "responses": { "200": { "description": "Ok", @@ -9690,7 +10411,7 @@ "application/json": { "schema": { "items": { - "$ref": "#/components/schemas/OpenId4VcIssuerRecord" + "$ref": "#/components/schemas/OpenId4VcVerificationSessionRecord" }, "type": "array" } @@ -9698,9 +10419,9 @@ } } }, - "description": "Query issuers by optional publicIssuerId.", + "description": "Retrieve all verification session records", "tags": [ - "oid4vc issuers" + "oid4vc verification sessions" ], "security": [ { @@ -9713,33 +10434,250 @@ "parameters": [ { "in": "query", - "name": "publicIssuerId", + "name": "publicVerifierId", + "required": false, + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "payloadState", + "required": false, + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "state", + "required": false, + "schema": { + "$ref": "#/components/schemas/OpenId4VcVerificationSessionState" + } + }, + { + "in": "query", + "name": "authorizationRequestUri", + "required": false, + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "nonce", "required": false, "schema": { "type": "string" } } - ] + ] + } + }, + "/openid4vc/verification-sessions/{verificationSessionId}": { + "get": { + "operationId": "GetVerificationSessionsById", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenId4VcVerificationSessionRecord" + } + } + } + } + }, + "description": "Get verification session by ID", + "tags": [ + "oid4vc verification sessions" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "verificationSessionId", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, + "/openid4vc/verification-sessions/response/{verificationSessionId}": { + "get": { + "operationId": "GetVerifiedAuthorizationResponse", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "tags": [ + "oid4vc verification sessions" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [ + { + "in": "path", + "name": "verificationSessionId", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, + "/openid4vc/holder/sd-jwt-vcs": { + "get": { + "operationId": "GetSdJwtCredentials", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/SdJwtVcRecord" + }, + "type": "array" + } + } + } + } + }, + "description": "Get SdJwt type of credentials", + "tags": [ + "oid4vc holders" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [] + } + }, + "/openid4vc/holder/mdoc-vcs": { + "get": { + "operationId": "GetMdocCredentials", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/MdocRecord" + }, + "type": "array" + } + } + } + } + }, + "description": "Fetch all mso mdoc credentials in wallet", + "tags": [ + "oid4vc holders" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [] + } + }, + "/openid4vc/holder/mdoc-vcs/decode": { + "post": { + "operationId": "DecodeMdocCredential", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "description": "Decode mso mdoc credential in wallet", + "tags": [ + "oid4vc holders" + ], + "security": [ + { + "jwt": [ + "tenant", + "dedicated" + ] + } + ], + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "base64Url": { + "type": "string" + } + }, + "required": [ + "base64Url" + ], + "type": "object" + } + } + } + } } }, - "/openid4vc/issuer/{publicIssuerId}": { - "put": { - "operationId": "UpdateIssuerMetadata", + "/openid4vc/holder/resolve-credential-offer": { + "post": { + "operationId": "ResolveCredOffer", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/OpenId4VcIssuerRecord" - } + "schema": {} } } } }, - "description": "Updates issuer metadata for a given publicIssuerId.", + "description": "Resolve a credential offer", "tags": [ - "oid4vc issuers" + "oid4vc holders" ], "security": [ { @@ -9749,44 +10687,34 @@ ] } ], - "parameters": [ - { - "in": "path", - "name": "publicIssuerId", - "required": true, - "schema": { - "type": "string" - } - } - ], + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateIssuerRecordOptions" + "$ref": "#/components/schemas/ResolveCredentialOfferBody" } } } } - }, - "get": { - "operationId": "GetIssuer", + } + }, + "/openid4vc/holder/authorization-request": { + "post": { + "operationId": "RequestAuthorizationForCredential", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/OpenId4VcIssuerRecord" - } + "schema": {} } } } }, - "description": "Returns a specific issuer by publicIssuerId.", "tags": [ - "oid4vc issuers" + "oid4vc holders" ], "security": [ { @@ -9796,37 +10724,35 @@ ] } ], - "parameters": [ - { - "in": "path", - "name": "publicIssuerId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthorizeRequestCredentialOffer" + } } } - ] + } } }, - "/openid4vc/issuer/{issuerId}/metadata": { - "get": { - "operationId": "GetIssuerAgentMetaData", + "/openid4vc/holder/request-credential": { + "post": { + "operationId": "RequestCredential", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": { - "type": "number", - "format": "double" - } + "schema": {} } } } }, - "description": "Returns metadata for a specific issuer.", + "description": "Initiates a token request, then requests credentials from issuer", "tags": [ - "oid4vc issuers" + "oid4vc holders" ], "security": [ { @@ -9836,29 +10762,35 @@ ] } ], - "parameters": [ - { - "in": "path", - "name": "issuerId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RequestCredentialBody" + } } } - ] + } } }, - "/openid4vc/issuer/{id}": { - "delete": { - "operationId": "DeleteIssuer", + "/openid4vc/holder/resolve-proof-request": { + "post": { + "operationId": "ResolveProofRequest", "responses": { - "204": { - "description": "No content" + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": {} + } + } } }, - "description": "Deletes a specific issuer by record id.", + "description": "Resolve a proof request", "tags": [ - "oid4vc issuers" + "oid4vc holders" ], "security": [ { @@ -9868,39 +10800,77 @@ ] } ], - "parameters": [ - { - "in": "path", - "name": "id", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResolveProofRequest" + } } } - ] + } } }, - "/openid4vc/verification-sessions": { - "get": { - "operationId": "GetAllVerificationSessions", + "/openid4vc/holder/accept-proof-request": { + "post": { + "operationId": "AcceptProofRequest", "responses": { "200": { "description": "Ok", "content": { "application/json": { "schema": { - "items": { - "$ref": "#/components/schemas/OpenId4VcVerificationSessionRecord" - }, - "type": "array" + "anyOf": [ + { + "properties": { + "body": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/Record_string.unknown_" + } + ] + }, + "status": { + "type": "number", + "format": "double" + } + }, + "required": [ + "body", + "status" + ], + "type": "object" + }, + { + "properties": { + "body": { + "$ref": "#/components/schemas/Record_string.unknown_" + }, + "status": { + "type": "number", + "format": "double" + } + }, + "required": [ + "body", + "status" + ], + "type": "object" + } + ] } } } } }, - "description": "Create an authorization request, acting as a Relying Party (RP)", + "description": "Accept a proof request", "tags": [ - "oid4vc verification sessions" + "oid4vc holders" ], "security": [ { @@ -9910,68 +10880,34 @@ ] } ], - "parameters": [ - { - "in": "query", - "name": "publicVerifierId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "payloadState", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "state", - "required": false, - "schema": { - "$ref": "#/components/schemas/OpenId4VcVerificationSessionState" - } - }, - { - "in": "query", - "name": "authorizationRequestUri", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "nonce", - "required": false, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResolveProofRequest" + } } } - ] + } } }, - "/openid4vc/verification-sessions/{verificationSessionId}": { - "get": { - "operationId": "GetVerificationSessionsById", + "/openid4vc/holder/decode-sdjwt": { + "post": { + "operationId": "DecodeSdJwt", "responses": { "200": { "description": "Ok", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/OpenId4VcVerificationSessionRecord" - } + "schema": {} } } } }, - "description": "Get verification session by ID", "tags": [ - "oid4vc verification sessions" + "oid4vc holders" ], "security": [ { @@ -9981,16 +10917,25 @@ ] } ], - "parameters": [ - { - "in": "path", - "name": "verificationSessionId", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "jwt": { + "type": "string" + } + }, + "required": [ + "jwt" + ], + "type": "object" + } } } - ] + } } }, "/openid4vc/verifier": { @@ -10025,7 +10970,9 @@ "required": true, "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/OpenId4VcSiopCreateVerifierOptions" + } } } } @@ -10112,7 +11059,9 @@ "required": true, "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/OpenId4VcUpdateVerifierRecordOptions" + } } } } diff --git a/src/server.ts b/src/server.ts index 1b4d2768..2201dfb2 100644 --- a/src/server.ts +++ b/src/server.ts @@ -29,6 +29,7 @@ import { questionAnswerEvents } from './events/QuestionAnswerEvents' import { reuseConnectionEvents } from './events/ReuseConnectionEvents' import { RegisterRoutes } from './routes/routes' import { SecurityMiddleware } from './securityMiddleware' +import { openId4VcIssuanceSessionEvents } from './events/openId4VcIssuanceSessionEvents' dotenv.config() @@ -50,6 +51,7 @@ export const setupServer = async ( basicMessageEvents(agent, config) connectionEvents(agent, config) credentialEvents(agent, config) + openId4VcIssuanceSessionEvents(agent, config) proofEvents(agent, config) reuseConnectionEvents(agent, config) }