-
Notifications
You must be signed in to change notification settings - Fork 0
/
password.js
28 lines (24 loc) · 853 Bytes
/
password.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
// The SHRN variable in the .env file is supposed to be a hashed password
// Run `npm run pw` (or `yarn pw`) to run this script and generate your hashed password using bcryptjs
// store the hashed password in the `.env` file as `SHRTN`
const readline = require('readline')
const bcrypt = require('bcryptjs')
const clipboardy = require('clipboardy')
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
rl.question('Enter the password you want to use: ', function (password) {
bcrypt.genSalt(10, function (err, salt) {
bcrypt.hash(password, salt, function (err, hash) {
if (err) {
console.log(err)
}
console.log(`\n${hash}`)
clipboardy.writeSync(hash)
console.log('Add this as the `SHRTN` variable in the `.env` file.')
console.log('(Copied to clipboard)\n')
process.exit(0)
})
})
})