Swiftpack.co -  moriturus/Ainu as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
moriturus/Ainu
Password Validator & Strength Evaluator influenced by Navajo and written in Swift completely.
.package(url: "https://github.com/moriturus/Ainu.git", from: "6.0.0")

Ainu

Carthage compatible MIT License

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.

Requirement

  • OSX 10.10+
  • iOS 9.0+
  • watchOS 3.0+
  • tvOS 9.0+

Installation

If you want to use Carthage, please use the commitment tagged 5.0.1

Swift Package Manager

Add this lines to your Package.swift.

dependencies: [
    .package(
        url: "https://github.com/moriturus/Ainu.git",
        from: "6.0.0"
    )
]

Usage

Validating Password

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)
    }

}

Available Validation Rules

  • Allowed Characters
  • Required Characters (e.g. lowercase, uppercase, decimal, symbol)
  • Non-Dictionary Word (OSX/iOS only)
  • Minimum / Maximum Length
  • Predicate Match
  • Regular Expression Match
  • Function Evaluation

Evaluating Password Strength

Password strength is evaluated in terms of information entropy.

let password = "password"
let strength = Strength(password: password)

NSLog(strength.description) // prints "Very Weak"

Contact

Henrique Sasaki Yuya

License

Ainu is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 9
Last commit: 1 year ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

2.0.3
5 years ago
  • Add a rule uses Strength.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API