Merge pull request #477 from SimplyDanny/use-protonmail-gopenpgp

Use ProtonMail's GopenPGP library
This commit is contained in:
Mingshen Sun 2021-08-15 01:49:16 -07:00 committed by GitHub
commit 75332270d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 158 additions and 49 deletions

View file

@ -6,12 +6,12 @@
// Copyright © 2019 Bob Sun. All rights reserved.
//
import Crypto
import Gopenpgp
struct GopenPGPInterface: PGPInterface {
private static let errorMapping: [String: Error] = [
"gopenpgp: error in unlocking key: openpgp: invalid data: private key checksum failure": AppError.wrongPassphrase,
"openpgp: incorrect key": AppError.keyExpiredOrIncompatible,
"gopenpgp: error in reading message: openpgp: incorrect key": AppError.keyExpiredOrIncompatible,
]
private var publicKeys: [String: CryptoKey] = [:]