File

src/issuer/oid4vci/oid4vci.controller.ts

Prefix

:tenantId/vci

Index

Methods

Methods

credential
credential(req: Request, tenantId: string)
Decorators :
@Post('credential')
@SessionLogger('state', 'OID4VCI')

Endpoint to issue credentials

Parameters :
Name Type Optional
req Request No
tenantId string No
notifications
notifications(body: NotificationRequestDto, req: Request, tenantId: string)
Decorators :
@Post('notification')
@SessionLogger('notification_id', 'OID4VCI')

Notification endpoint

Parameters :
Name Type Optional
body NotificationRequestDto No
req Request No
tenantId string No
Returns : any
import {
    Body,
    Controller,
    Param,
    Post,
    Req,
    UseInterceptors,
} from '@nestjs/common';
import type { CredentialResponse } from '@openid4vc/openid4vci';
import type { Request } from 'express';
import { Oid4vciService } from '../../issuer/oid4vci/oid4vci.service';
import { NotificationRequestDto } from './dto/notification-request.dto';
import { SessionLogger } from '../../utils/session-logger.decorator';
import { SessionLoggerInterceptor } from '../../utils/session-logger.interceptor';

@Controller(':tenantId/vci')
@UseInterceptors(SessionLoggerInterceptor)
export class Oid4vciController {
    constructor(private readonly oid4vciService: Oid4vciService) {}

    /**
     * Endpoint to issue credentials
     * @param req
     * @returns
     */
    @Post('credential')
    @SessionLogger('state', 'OID4VCI')
    credential(
        @Req() req: Request,
        @Param('tenantId') tenantId: string,
    ): Promise<CredentialResponse> {
        return this.oid4vciService.getCredential(req, tenantId);
    }

    /**
     * Notification endpoint
     * @param body
     * @returns
     */
    @Post('notification')
    @SessionLogger('notification_id', 'OID4VCI')
    notifications(
        @Body() body: NotificationRequestDto,
        @Req() req: Request,
        @Param('tenantId') tenantId: string,
    ) {
        return this.oid4vciService.handleNotification(req, body, tenantId);
    }

    //TODO: this endpoint may be relevant for the wallet attestation.
    /* @Get('session')
  session() {
    console.log('Session requested');
    //TODO store session and created at
    const session = randomUUID();
    return {
      session_id: session,
    };
  } */
}

results matching ""

    No results matching ""