Skip to content

Commit 94f0474

Browse files
committed
feat: add password-hash command
1 parent 7be3c51 commit 94f0474

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/commands/generate/password-hash/create.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ export default class extends Command {
8383
"saltLength": process.cli.options[ "salt-length" ],
8484
"hashLength": process.cli.options[ "hash-length" ],
8585
} ),
86-
hash = await passwordHash.createHash( process.cli.arguments.password );
86+
res = await passwordHash.createHash( process.cli.arguments.password );
8787

88-
console.log( hash.phc );
88+
if ( res.ok ) {
89+
console.log( res.data.phc );
90+
}
91+
92+
return res;
8993
}
9094
}

lib/commands/generate/password-hash/verify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ export default class extends Command {
7979
res = await passwordHash.verifyHash( process.cli.arguments.digest, process.cli.arguments.password, { "update": true } );
8080

8181
console.log( "Hash is valid:", res.ok );
82-
console.log( "Update is required:", res.data.requireUpdate );
8382

84-
if ( res.data.phc ) {
83+
if ( res.data?.phc ) {
84+
console.log( "Update is required:", res.data.requireUpdate );
8585
console.log( "Updated hash:", res.data.phc );
8686
}
8787

0 commit comments

Comments
 (0)