1.0.2 • Published 3 years ago

password-typo-case v1.0.2

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
3 years ago

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