password-entropy-thermostat
v1.0.1
Published
<h1 align="center"> password-entropy-thermostat </h1>
Downloads
64
Maintainers
Readme
Um projeto desenvolvido em javascript que calcula a complexidade de uma senha.
Utilização
Instalação:
npm i --save password-entropy-thermostat
Uso:
import PasswordEntropyThermostat from 'password-entropy-thermostat'
const result = PasswordEntropyThermostat.measurePassword('myPassword')
Resposta da lib
Password level:
{
"results": [
{
"method": "minLengthValue",
"value": 0.1
},
{
"method": "lengthValue",
"value": 0.2
},
{
"method": "hasNumberAndLetter",
"value": 0.2
},
{
"method": "hasSpecialChar",
"value": 0
},
{
"method": "capitalAndSmallChar",
"value": 0
},
{
"method": "sequenceAndPatterns",
"value": 0
}
],
"value": 0.5
}
Configurar peso dos cálculos Para configurar quanto cada validação corresponde para segurança da senha basta chamar o método setWeight e passar o objeto de configuração com os pesos. (valor máximo somado deve ser 1).
const config = {
minLengthValue: 0.2,
lengthValue: 0.2,
hasNumberAndLetter: 0.2,
hasSpecialChar: 0.2,
capitalAndSmallChar: 0.1,
sequenceAndPatterns: 0.1
}
PassEntropyThermostat.setWeight(config)