add function to generate Apple's style password
This commit is contained in:
parent
663ccd1a85
commit
81ed04b620
3 changed files with 18 additions and 4 deletions
|
|
@ -37,6 +37,17 @@ class Utils {
|
|||
return lastUpdatedTimeString
|
||||
}
|
||||
|
||||
static func generatePassword(length: Int) -> String{
|
||||
switch Defaults[.passwordGenerationMethod] {
|
||||
case "Random":
|
||||
return randomString(length: length)
|
||||
case "Keychain":
|
||||
return Keychain.generatePassword()
|
||||
default:
|
||||
return randomString(length: length)
|
||||
}
|
||||
}
|
||||
|
||||
static func randomString(length: Int) -> String {
|
||||
|
||||
let letters : NSString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue