Password Validator & Strength Evaluator influenced by Navajo.
Ainu is completely written in Swift 4.
Ainu is named in honour of the famed non-Japonic Languages speakers in the north of Japan.
If you want to use Carthage
, please use the commitment tagged 5.0.1
Add this lines to your Package.swift
.
dependencies: [
.package(
url: "https://github.com/moriturus/Ainu.git",
from: "6.0.0"
)
]
let password = "abc123"
// default validator's rule is `LengthRule(minimum: 8, maximum: 128)`
let validator = Validator()
let result = validator.validate(password)
switch result {
case .OK:
// do something with the validated password
break
case .Failure(let failingRules):
failingRules.forEach { rule in
NSLog(rule.localizedErrorDescription)
}
}
Password strength is evaluated in terms of information entropy.
let password = "password"
let strength = Strength(password: password)
NSLog(strength.description) // prints "Very Weak"
Ainu is available under the MIT license. See the LICENSE file for more info.
link |
Stars: 10 |
Last commit: 4 years ago |
Strength
.Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics