Commits

Daniel Holth committed 37719c5 Draft

use relative imports, per-implementation Keypair()

  • Participants
  • Parent commits 9dba08a

Comments (0)

Files changed (1)

File ed25519ll/ed25519py.py

 import warnings
 import os
 
-import ed25519ll
-from ed25519ll import djbec
+from collections import namedtuple
+from . import djbec
 
 __all__ = ['crypto_sign', 'crypto_sign_open', 'crypto_sign_keypair', 'Keypair',
            'PUBLICKEYBYTES', 'SECRETKEYBYTES', 'SIGNATUREBYTES']
 SECRETKEYBYTES=64
 SIGNATUREBYTES=64
 
+Keypair = namedtuple('Keypair', ('vk', 'sk')) # verifying key, secret key
+
 def crypto_sign_keypair(seed=None):
     """Return (verifying, secret) key from a given seed, or os.urandom(32)"""    
     if seed is None:
     # XXX should seed be constrained to be less than 2**255-19?
     skbytes = seed
     vkbytes = djbec.publickey(skbytes)
-    return ed25519ll.Keypair(vkbytes, skbytes+vkbytes)
+    return Keypair(vkbytes, skbytes+vkbytes)
 
 
 def crypto_sign(msg, sk):