Commit 1c2d5cd8 by Scott Duckworth

make key_parse() return KeyInfo namedtuple

parent 0bac8180
......@@ -26,8 +26,12 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from collections import namedtuple
SSHKEY_LOOKUP_URL_DEFAULT = 'http://localhost:8000/sshkey/lookup'
KeyInfo = namedtuple('KeyInfo', 'type b64key comment fingerprint')
class SSHKeyFormatError(Exception):
def __init__(self, text):
self.text = text
......@@ -91,7 +95,7 @@ def key_parse(text):
fp = hashlib.md5(key).hexdigest()
fp = ':'.join(a+b for a,b in zip(fp[::2], fp[1::2]))
return (type, b64key, comment, fp)
return KeyInfo(type, b64key, comment, fp)
def lookup_all(url):
import urllib
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment