Use ProtonMail's GopenPGP library

This allows for a simpler setup and the usage of a recent version of Go. The library provides a build script which creates an XCFramework containing binaries for multiple target architectures. The gnu-dummy.patch is taken from mssun/gopenpgp. The forks are not needed anymore.
This commit is contained in:
Danny Moesch 2021-06-20 00:33:48 +02:00
parent 867931ab89
commit 93954f3bec
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] = [:]