Split PasswordHelpers and move components into Parser
This commit is contained in:
parent
d4d8d7267a
commit
6817f61e3b
4 changed files with 52 additions and 20 deletions
35
passKit/Parser/OtpType.swift
Normal file
35
passKit/Parser/OtpType.swift
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// OtpType.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 01.12.2018.
|
||||
// Copyright © 2018 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import OneTimePassword
|
||||
|
||||
public enum OtpType {
|
||||
case totp, hotp, none
|
||||
|
||||
init(token: Token?) {
|
||||
switch token?.generator.factor {
|
||||
case .some(.counter):
|
||||
self = .hotp
|
||||
case .some(.timer):
|
||||
self = .totp
|
||||
default:
|
||||
self = .none
|
||||
}
|
||||
}
|
||||
|
||||
init(name: String?) {
|
||||
switch name?.lowercased() {
|
||||
case Constants.HOTP:
|
||||
self = .hotp
|
||||
case Constants.TOTP:
|
||||
self = .totp
|
||||
default:
|
||||
self = .none
|
||||
}
|
||||
}
|
||||
}
|
||||
13
passKit/Parser/PasswordChange.swift
Normal file
13
passKit/Parser/PasswordChange.swift
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// PasswordChange.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 01.12.2018.
|
||||
// Copyright © 2018 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
enum PasswordChange: Int {
|
||||
case path = 0x01
|
||||
case content = 0x02
|
||||
case none = 0x00
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue