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

32
patch/gnu-dummy.patch Normal file
View file

@ -0,0 +1,32 @@
diff --git a/crypto/key.go b/crypto/key.go
index 49af11e..fd59ec4 100644
--- a/crypto/key.go
+++ b/crypto/key.go
@@ -150,10 +150,12 @@ func (key *Key) Unlock(passphrase []byte) (*Key, error) {
return nil, err
}
- err = unlockedKey.entity.PrivateKey.Decrypt(passphrase)
- if err != nil {
- return nil, errors.Wrap(err, "gopenpgp: error in unlocking key")
- }
+ if !unlockedKey.entity.PrivateKey.Dummy() {
+ err = unlockedKey.entity.PrivateKey.Decrypt(passphrase)
+ if err != nil {
+ return nil, errors.Wrap(err, "gopenpgp: error in unlocking key")
+ }
+ }
for _, sub := range unlockedKey.entity.Subkeys {
if sub.PrivateKey != nil {
@@ -286,6 +288,10 @@ func (key *Key) IsLocked() (bool, error) {
}
}
+ if key.entity.PrivateKey.Dummy() {
+ return true, nil
+ }
+
return key.entity.PrivateKey.Encrypted, nil
}