aboutsummaryrefslogtreecommitdiffstats
path: root/lib/keystore.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/keystore.go')
-rw-r--r--lib/keystore.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/keystore.go b/lib/keystore.go
index c2110676..0b9d41af 100644
--- a/lib/keystore.go
+++ b/lib/keystore.go
@@ -53,6 +53,16 @@ func UnlockKeyring() {
os.Remove(lockpath)
}
+func GetEntityByEmail(email string) (e *openpgp.Entity, err error) {
+ for _, entity := range Keyring {
+ ident := entity.PrimaryIdentity()
+ if ident != nil && ident.UserId.Email == email {
+ return entity, nil
+ }
+ }
+ return nil, fmt.Errorf("entity not found in keyring")
+}
+
func GetSignerEntityByEmail(email string) (e *openpgp.Entity, err error) {
for _, key := range Keyring.DecryptionKeys() {
if key.Entity == nil {