Selaa lähdekoodia

Allow passing a byte representation of a public key to Sphinx.client

Ian Goldberg 6 vuotta sitten
vanhempi
commit
1df690d4b7
1 muutettua tiedostoa jossa 2 lisäystä ja 0 poistoa
  1. 2 0
      relay.py

+ 2 - 0
relay.py

@@ -321,6 +321,8 @@ class Sphinx:
         domain separator is as above.  If is_last is true, don't bother
         domain separator is as above.  If is_last is true, don't bother
         creating the new blinding key, since this is the last iteration,
         creating the new blinding key, since this is the last iteration,
         and we won't be using it."""
         and we won't be using it."""
+        if type(server_pubkey) is bytes:
+            server_pubkey = nacl.public.PublicKey(server_pubkey)
         reblinded_server_pubkey = server_pubkey
         reblinded_server_pubkey = server_pubkey
         for blindkey in blindkey_list:
         for blindkey in blindkey_list:
             reblinded_server_pubkey = Sphinx.reblindpubkey(blindkey,
             reblinded_server_pubkey = Sphinx.reblindpubkey(blindkey,