Add logic for more customizable password generator
This commit is contained in:
parent
49a371d495
commit
ff014a5699
10 changed files with 352 additions and 131 deletions
38
passKit/Passwords/PasswordGeneratorFlavor.swift
Normal file
38
passKit/Passwords/PasswordGeneratorFlavor.swift
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// PasswordGeneratorFlavor.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 28.11.18.
|
||||
// Copyright © 2018 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
public typealias LengthLimits = (min: Int, max: Int)
|
||||
|
||||
public enum PasswordGeneratorFlavor: String {
|
||||
case random = "Random"
|
||||
case xkcd = "XKCD"
|
||||
|
||||
public var localized: String {
|
||||
return rawValue.localize()
|
||||
}
|
||||
|
||||
public var longNameLocalized: String {
|
||||
switch self {
|
||||
case .random:
|
||||
return "RandomString".localize()
|
||||
case .xkcd:
|
||||
return "XKCDStyle".localize()
|
||||
}
|
||||
}
|
||||
|
||||
public var lengthLimits: LengthLimits {
|
||||
switch self {
|
||||
case .random:
|
||||
return (4, 64)
|
||||
case .xkcd:
|
||||
return (2, 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension PasswordGeneratorFlavor: CaseIterable {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue