Name classes/structs consistently

This commit is contained in:
Danny Moesch 2020-04-19 15:41:30 +02:00 committed by Mingshen Sun
parent 072f824158
commit 4c2693e2c7
11 changed files with 80 additions and 80 deletions

View file

@ -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,

View file

@ -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

View file

@ -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)
}
}

View file

@ -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?