-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtriels.js
33 lines (24 loc) · 973 Bytes
/
triels.js
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
// // console.log(process.env.NODE_ENV);
// const bcrypt = require("bcrypt");
// const password = "1234"
// const hash = "$2b$10$eyjJNhxh9INwsoKxxwoHKOQE4YxA3lcBTAKT0AYRzMoVO6KYRfSRq"
// // bcrypt.hash(password, 10).then (result =>
// // {
// // console.log(result);
// // })
// bcrypt.compare(password, hash).then(result => console.log(result))
//jwt
// const jwt = require("jsonwebtoken");
// const _=require("lodash");
// const users= {
// _id:1,
// name:"Ahmed",
// password:"ajsdllfklfklflmu",
// isAdmin: true
// }
// // console.log(_.pick(users, ["_id","isAdmin"]));
// const token =jwt.sign(_.pick(users, ["_id","isAdmin"]), "mySecretKey")
// // console.log(token);
// const tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOjEsImlzQWRtaW4iOnRydWUsImlhdCI6MTY0MTMxNzY1OH0.6yxQMXoLMya10k7zf6bAD0iHVKMDO7nTc25E30tr4v8";
// const result = jwt.verify(tokenString,"mySecretKey" )
// console.log(result);