Check existence of PGP keys before encrypt/decrypt

This commit is contained in:
Mingshen Sun 2020-04-14 20:20:16 -07:00
parent 50dec23b02
commit 0cae6af60d
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
6 changed files with 41 additions and 4 deletions

View file

@ -16,7 +16,8 @@ public enum AppError: Error, Equatable {
case GitReset
case GitCommit
case PasswordEntity
case PgpPublicKeyNotExist
case PgpPublicKeyNotFound(keyID: String)
case PgpPrivateKeyNotFound(keyID: String)
case KeyExpiredOrIncompatible
case WrongPassphrase
case WrongPasswordFilename
@ -32,6 +33,8 @@ extension AppError: LocalizedError {
switch self {
case let .RepositoryRemoteBranchNotFound(name), let .RepositoryBranchNotFound(name), let .ReadingFile(name):
return localizationKey.localize(name)
case let .PgpPublicKeyNotFound(keyID), let .PgpPrivateKeyNotFound(keyID):
return localizationKey.localize(keyID)
default:
return localizationKey.localize()
}