From 3ec53efa8e2a966ca2d697de6281291549e72b30 Mon Sep 17 00:00:00 2001 From: Johannes Kulick Date: Sat, 15 Dec 2012 16:40:45 +0100 Subject: add function to list all keys We need that for auto-completion --- alot/crypto.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'alot/crypto.py') diff --git a/alot/crypto.py b/alot/crypto.py index 82b76ecb..0b00564f 100644 --- a/alot/crypto.py +++ b/alot/crypto.py @@ -130,6 +130,18 @@ def get_key(keyid): return key +def list_keys(private=False): + """ + Returns a list of all keys containing keyid. + + :param keyid: The part we search for + :param private: Whether secret keys are listed + :rtype: list + """ + ctx = gpgme.Context() + return ctx.keylist(None, private) + + def detached_signature_for(plaintext_str, key=None): """ Signs the given plaintext string and returns the detached signature. -- cgit v1.2.3