0.1.1 • Published 5 years ago

ynw-secure-password v0.1.1

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

YnwSecurePassword

A JavaScript secure password library for generating and validating a secure password with multiple configurations

npm version npm downloads Build Status License: MIT Coverage Status FOSSA Status

Example

Live demo: https://ynw-team.github.io/YnwSecurePasswordDemo

Code: https://github.com/YNW-Team/YnwSecurePasswordDemo

Features

  • ✨ Generate secure password:
    • Using default configuration
    • Using default configuration with customized length
    • Using customized configuration of character set and length
  • ✅ Checking conformity of password with pre-defined configuration:
    • Using default configuration
    • Using default configuration with customized length
    • Using customized configuration of character set and length

Installation

Install using NPM:

npm install ynw-secure-password

Install using YARN:

yarn add ynw-secure-password

Usage

  • Generator

Using:
Example code:
import YnwSecurePassword from 'ynw-secure-password';

// generator without arg, it will use default config
const password_without_arg = YnwSecurePassword.generator();
console.log(password_without_arg);

// generator with length (must be equal 0 or great than or equal 4), it will use default config
const password_with_length = YnwSecurePassword.generator(10);
console.log(password_with_length);

// generator with config (must be validated), it will use default config
const config = {
	length: 15,
	rules: [
		{
			chars: 'abcde',
		},
		{
			chars: '01234',
			min: 1,
		},
		{
			chars: 'AZERTY',
			min: 2,
		},
	],
};
const password_with_config = YnwSecurePassword.generator(config);
console.log(password_with_config);
  • Validator

Using:
Example code
import YnwSecurePassword from 'ynw-secure-password';

// generator without arg, it will use default config
const password_without_arg = YnwSecurePassword.validator('Ynw-Secure-Password-2021');
console.log(password_without_arg.isValid);

// generator with length (must be great thanor equal 4), it will use default config
const password_with_length = YnwSecurePassword.generator('Ynw-Secure-Password-2021', 10);
console.log(password_with_length.isValid);

// generator with config (must be validated), it will use default config
const config = {
	length: 15,
	rules: [
		{
			chars: 'abcde',
		},
		{
			chars: '01234',
			min: 1,
		},
		{
			chars: 'AZERTY',
			min: 2,
		},
	],
};
const password_with_config = YnwSecurePassword.validator('Ynw-Secure-Password-2021', config);
console.log(password_with_config.isValid);

API

Interfaces

Constants MATH

Constants CHARACTERS

Constants CONFIG

License

YnwSecurePassword is freely distributable under the terms of the MIT license.

FOSSA Status