password-typo-case
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

password-typo-case

Expand the given password into a list of possible switched-case password.

npm Package Version

This package aim to provider better UX during password-based authentication when the user's device auto switch the cases of password input.

Usage Example

import { expandPasswordList } from 'password-typo-case'

let username = document.querySelector('#username').value
let password = document.querySelector('#password').value // e.g. 'test'
let passwordList = expandPasswordList(password) // e.g. [ 'test', 'TEST', 'Test', 'tEST' ]
let passwordHashList = passwordList.map(hashPassword) // e.g. using bcrypt
fetch('/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    username,
    passwordHashList,
  }),
})

Typescript Signature

export function expandPasswordList(password: string): string[]

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others

Package Sidebar

Install

npm i password-typo-case

Weekly Downloads

3

Version

1.0.2

License

BSD-2-Clause

Unpacked Size

10.3 kB

Total Files

9

Last publish

Collaborators

  • beenotung