-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathotp.js
More file actions
46 lines (42 loc) · 1.14 KB
/
Copy pathotp.js
File metadata and controls
46 lines (42 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const express = require('express');
const router = express.Router();
/**
* @swagger
* tags:
* name: OTP
* description: OTP-related endpoints
*/
/**
* @swagger
* /otp:
* post:
* summary: Generate an OTP
* description: Generates a One-Time Password (OTP), simulating a vulnerability due to lack of rate limiting.
* tags: [OTP]
* responses:
* 200:
* description: OTP generated successfully
* content:
* application/json:
* schema:
* type: object
* properties:
* otp:
* type: integer
* example: 1234567
* 500:
* description: Internal server error
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* example: Internal server error
*/
router.post('/otp', (req, res) => {
const otp = Math.floor(100 + Math.random() * 900); // Generate 3-digit random number.
return res.json({ otp });
});
module.exports = router;