forked from dsh/panel-auth
panel-auth: DSH web panel password gate plugin (Basic auth + signed cookie, fail-open)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
// Usage:
|
||||
// node hash.js <username> <password> → prints the cordis.patch.yml user entry
|
||||
// node hash.js --secret → prints a random signing secret
|
||||
import { hashPassword } from './crypto.js'
|
||||
import { randomBytes } from 'node:crypto'
|
||||
|
||||
const argv = process.argv.slice(2)
|
||||
if (argv[0] === '--secret') {
|
||||
console.log(randomBytes(32).toString('hex'))
|
||||
process.exit(0)
|
||||
}
|
||||
const [username, password] = argv
|
||||
if (!username || password === undefined) {
|
||||
console.error('usage: node hash.js <username> <password>')
|
||||
console.error(' node hash.js --secret')
|
||||
process.exit(1)
|
||||
}
|
||||
console.log(` - username: ${username}\n passwordHash: '${hashPassword(password)}'`)
|
||||
Reference in New Issue
Block a user