Name classes/structs consistently
This commit is contained in:
parent
072f824158
commit
4c2693e2c7
11 changed files with 80 additions and 80 deletions
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// GopenPgp.swift
|
||||
// GopenPGPInterface.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 08.09.19.
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import Crypto
|
||||
|
||||
struct GopenPgp: PgpInterface {
|
||||
struct GopenPGPInterface: PGPInterface {
|
||||
|
||||
private static let errorMapping: [String: Error] = [
|
||||
"gopenpgp: error in unlocking key: openpgp: invalid data: private key checksum failure": AppError.WrongPassphrase,
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// ObjectivePgp.swift
|
||||
// ObjectivePGPInterface.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 08.09.19.
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import ObjectivePGP
|
||||
|
||||
struct ObjectivePgp: PgpInterface {
|
||||
struct ObjectivePGPInterface: PGPInterface {
|
||||
|
||||
private let publicKey: Key
|
||||
private let privateKey: Key
|
||||
|
|
@ -11,7 +11,7 @@ public class PGPAgent {
|
|||
public static let shared: PGPAgent = PGPAgent()
|
||||
|
||||
private let keyStore: KeyStore
|
||||
private var pgpInterface: PgpInterface?
|
||||
private var pgpInterface: PGPInterface?
|
||||
private var latestDecryptStatus: Bool = true
|
||||
|
||||
public init(keyStore: KeyStore = AppKeychain.shared) {
|
||||
|
|
@ -25,9 +25,9 @@ public class PGPAgent {
|
|||
throw AppError.KeyImport
|
||||
}
|
||||
do {
|
||||
pgpInterface = try GopenPgp(publicArmoredKey: publicKey, privateArmoredKey: privateKey)
|
||||
pgpInterface = try GopenPGPInterface(publicArmoredKey: publicKey, privateArmoredKey: privateKey)
|
||||
} catch {
|
||||
pgpInterface = try ObjectivePgp(publicArmoredKey: publicKey, privateArmoredKey: privateKey)
|
||||
pgpInterface = try ObjectivePGPInterface(publicArmoredKey: publicKey, privateArmoredKey: privateKey)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
//
|
||||
// PgpInterface.swift
|
||||
// PGPInterface.swift
|
||||
// passKit
|
||||
//
|
||||
// Created by Danny Moesch on 08.09.19.
|
||||
// Copyright © 2019 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
protocol PgpInterface {
|
||||
protocol PGPInterface {
|
||||
|
||||
func decrypt(encryptedData: Data, keyID: String, passphrase: String) throws -> Data?
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ public class Password {
|
|||
public var plainText: String
|
||||
|
||||
public var changed: Int = 0
|
||||
public var otpType: OtpType = .none
|
||||
public var otpType: OTPType = .none
|
||||
|
||||
private var parser = Parser(plainText: "")
|
||||
private var additions = [AdditionField]()
|
||||
|
|
@ -24,7 +24,7 @@ public class Password {
|
|||
|
||||
private var otpToken: Token? {
|
||||
didSet {
|
||||
otpType = OtpType(token: otpToken)
|
||||
otpType = OTPType(token: otpToken)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import OneTimePassword
|
||||
|
||||
public enum OtpType: String {
|
||||
public enum OTPType: String {
|
||||
case totp = "TimeBased"
|
||||
case hotp = "HmacBased"
|
||||
case none = "None"
|
||||
|
|
@ -30,7 +30,7 @@ class TokenBuilder {
|
|||
|
||||
private var name: String = ""
|
||||
private var secret: Data?
|
||||
private var type: OtpType = .totp
|
||||
private var type: OTPType = .totp
|
||||
private var algorithm: Generator.Algorithm = .sha1
|
||||
private var digits: Int? = Constants.DEFAULT_DIGITS
|
||||
private var period: Double? = Constants.DEFAULT_PERIOD
|
||||
|
|
@ -49,7 +49,7 @@ class TokenBuilder {
|
|||
}
|
||||
|
||||
func usingType(_ type: String?) -> TokenBuilder {
|
||||
self.type = OtpType(name: type)
|
||||
self.type = OTPType(name: type)
|
||||
return self
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue