bigchaindb/cryptoconditions

Example ed25519_example.py breaking

Closed this issue · 1 comments

After generating the public and private key following the code, it always fails with a 32 byte error seed and something interesting is that the actual byte length from:

len(sk.encode()) is 44
which is strange considering that it is requesting a 32 byte length seed on SigningKey

message = 'Hello World! Conditions are here!'
sk_b58 = base58.b58encode(binascii.unhexlify('833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42'))
sk = SigningKey(sk_b58)
ed25519_fulfillment = cc.Ed25519Sha256()
ed25519_fulfillment.sign(message, sk)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/X/.conda/envs/tac_node_signature/lib/python3.6/site-packages/cryptoconditions/types/ed25519.py", line 115, in sign
    sk = SigningKey(private_key)
  File "/home/X/.conda/envs/tac_node_signature/lib/python3.6/site-packages/nacl/signing.py", line 152, in __init__
    "SigningKey must be created from a 32 byte seed")
nacl.exceptions.TypeError: SigningKey must be created from a 32 byte seed

Example fixed and pull request done.