mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
did stuff
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
const bcrypt = require('bcrypt');
|
||||
const readline = require('readline');
|
||||
|
||||
const passwordFromArg = process.argv[2];
|
||||
|
||||
async function hashPassword(password) {
|
||||
try {
|
||||
const hash = await bcrypt.hash(password, 10);
|
||||
console.log(`Password: ${password}`);
|
||||
console.log(`Hash: ${hash}`);
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
console.error('Error hashing password:', err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (passwordFromArg) {
|
||||
hashPassword(passwordFromArg);
|
||||
} else {
|
||||
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
||||
rl.question('Password to hash: ', (answer) => {
|
||||
rl.close();
|
||||
hashPassword(answer);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user