0.1.1 • Published 5 months ago

@gallolabs/passwd-verifier v0.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Validates passwords with support of htpasswd format.

    import {verifyPasswd, detectHashType} from '@gallolabs/passwd-verifier'

    await verifyPasswd('myPasswd', '$2y$05$L/jPI05ltEKrwIjQThJ4keBFKH/aRDpxY9CaaVWYIZcPu0FXdRO6i') // false
    await verifyPasswd('iAmNotHacker27!', '$2y$05$L/jPI05ltEKrwIjQThJ4keBFKH/aRDpxY9CaaVWYIZcPu0FXdRO6i') // true

    detectHashType('$2y$05$L/jPI05ltEKrwIjQThJ4keBFKH/aRDpxY9CaaVWYIZcPu0FXdRO6i') // BCRYPT

Supports various format (sha, bcrypt, md5, crypt, plain). Like htpasswd command line, in case of plain password looking like crypt one, crypt is used. You can use options to disable crypt and/or plain. You can use detectHashType to refuse some password hash types in your side.