summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.