Add PoW module
This commit is contained in:
24
src/pow/pow.controller.ts
Normal file
24
src/pow/pow.controller.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Body, Controller, Get, Post, Query } from '@nestjs/common';
|
||||
import { PowService } from './pow.service';
|
||||
import { ApiBody, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('pow')
|
||||
@Controller('pow')
|
||||
export class PowController {
|
||||
constructor(
|
||||
private readonly powService: PowService,
|
||||
) { }
|
||||
|
||||
|
||||
@Get('challenge')
|
||||
async generateChallenge() {
|
||||
return this.powService.generateChallenge();
|
||||
}
|
||||
|
||||
@Post('challenge')
|
||||
@ApiBody({ schema: { properties: { challenge: { type: 'string' }, proof: { type: 'string' } } } })
|
||||
async verifyChallenge(@Body() body: { challenge: string, proof: string }) {
|
||||
return this.powService.verifyChallenge(body.challenge, body.proof);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user