Split PasswordHelpers and move components into Parser

This commit is contained in:
Danny Moesch 2018-12-01 15:52:01 +01:00 committed by Bob Sun
parent d4d8d7267a
commit 6817f61e3b
4 changed files with 52 additions and 20 deletions

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

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