blob: 0ab2ed2957e0ffdc53aa94a644a59a3d3b5e4a4a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# Copyright (C) 2011-2019 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
from alot import crypto
from .stringlist import StringlistCompleter
class CryptoKeyCompleter(StringlistCompleter):
"""completion for gpg keys"""
def __init__(self, private=False):
"""
:param private: return private keys
:type private: bool
"""
keys = crypto.list_keys(private=private)
resultlist = []
for k in keys:
for s in k.subkeys:
resultlist.append(s.keyid)
for u in k.uids:
resultlist.append(u.email)
super().__init__(resultlist, match_anywhere = True)
|