-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
32 lines (26 loc) · 839 Bytes
/
Copy pathindex.ts
File metadata and controls
32 lines (26 loc) · 839 Bytes
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
import express from 'express'
import obtainResult from './obtainResult';
const app: express.Express = express()
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
//CORS対応(本番環境では見直し)
app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "*")
res.header("Access-Control-Allow-Headers", "*");
next();
})
app.listen(3000, () => {
console.log("Start on port 3000.")
})
app.post('/verify_vp', async function(req, res) {
const isProofVerified = await obtainResult(
req.body.proof,
req.body.publicKey,
req.body.messages,
req.body.nonce,
);
res.json({
"isProofVerified": isProofVerified
});
})