summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIsis Lovecruft <isis@torproject.org>2013-01-31 02:37:19 +0000
committerIsis Lovecruft <isis@torproject.org>2013-01-31 02:37:19 +0000
commit29427dbba0cde178e4440148df5dc7a10765825d (patch)
treee3c37afbc717e988609be52975ab98c73a84911a /src
parent2d13c3be08a6fddc76258e375952314b4107cae5 (diff)
Add UUID creator to alias_resolver.
Diffstat (limited to 'src')
-rw-r--r--src/leap/mx/alias_resolver.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/mx/alias_resolver.py b/src/leap/mx/alias_resolver.py
index 3d20ff7..da37314 100644
--- a/src/leap/mx/alias_resolver.py
+++ b/src/leap/mx/alias_resolver.py
@@ -12,6 +12,7 @@ Classes for resolving postfix aliases.
'''
import os
+import uuid
try:
from paisley import client
@@ -30,6 +31,19 @@ except ImportError:
from leap.mx import net, log ## xxx implement log
+def createID(alias):
+ """
+ Creates Universal Unique ID by taking the SHA-1 HASH of an email alias:
+
+ >>> uuid.uuid5(uuid.NAMESPACE_URL, "isis@leap.se")
+ UUID('7194878e-4aea-563f-85a4-4f58519f3c4f')
+
+ @param alias: An email address alias.
+ @returns: A :class:`uuid.UUID` containing attributes specifying the UUID.
+ """
+ return uuid.uuid5(uuid.NAMESPACE_URL, str(alias))
+
+
class ConnectedCouchDB(client.CouchDB):
"""
Connect to a CouchDB instance.