Spaces:
Sleeping
Sleeping
Igor commited on
Fix: Support 33-byte public keys (leading null strip) in CLI and Web Terminal
Browse files- cli.py +4 -0
- web/index.html +4 -0
cli.py
CHANGED
|
@@ -82,6 +82,10 @@ def derive(peer_shitpost, key, out):
|
|
| 82 |
if missing_padding:
|
| 83 |
b64_str += '=' * (4 - missing_padding)
|
| 84 |
peer_pub_bytes = base64.b64decode(b64_str)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
except:
|
| 86 |
peer_pub_bytes = decode_string(peer_shitpost)
|
| 87 |
else:
|
|
|
|
| 82 |
if missing_padding:
|
| 83 |
b64_str += '=' * (4 - missing_padding)
|
| 84 |
peer_pub_bytes = base64.b64decode(b64_str)
|
| 85 |
+
|
| 86 |
+
# Handle 33-byte keys (leading null byte)
|
| 87 |
+
if len(peer_pub_bytes) == 33 and peer_pub_bytes[0] == 0:
|
| 88 |
+
peer_pub_bytes = peer_pub_bytes[1:]
|
| 89 |
except:
|
| 90 |
peer_pub_bytes = decode_string(peer_shitpost)
|
| 91 |
else:
|
web/index.html
CHANGED
|
@@ -169,6 +169,10 @@ def bridge_derive(peer_signal, my_priv_b64):
|
|
| 169 |
if missing_padding:
|
| 170 |
b64_str += '=' * (4 - missing_padding)
|
| 171 |
peer_pub = base64.b64decode(b64_str)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
else:
|
| 173 |
raise ValueError("Not Base64")
|
| 174 |
except:
|
|
|
|
| 169 |
if missing_padding:
|
| 170 |
b64_str += '=' * (4 - missing_padding)
|
| 171 |
peer_pub = base64.b64decode(b64_str)
|
| 172 |
+
|
| 173 |
+
# Handle 33-byte keys (leading null byte)
|
| 174 |
+
if len(peer_pub) == 33 and peer_pub[0] == 0:
|
| 175 |
+
peer_pub = peer_pub[1:]
|
| 176 |
else:
|
| 177 |
raise ValueError("Not Base64")
|
| 178 |
except:
|