1
0

Make lntransport not require lnutil.

This will be useful if we decide to ship lntransport as a separate
package. It is also a conceptual cleanup.

Notes:
 - lntransport still requires crypto.py
 - parsing node id from a bolt11 invoice is not supported.
This commit is contained in:
ThomasV
2024-10-21 15:04:37 +02:00
parent 8db2489739
commit c58c4d7451
17 changed files with 177 additions and 178 deletions

View File

@@ -492,3 +492,11 @@ def ecies_decrypt_message(
if mac != hmac_oneshot(key_m, encrypted[:-32], hashlib.sha256):
raise InvalidPassword()
return aes_decrypt_with_iv(key_e, iv, ciphertext)
def get_ecdh(priv: bytes, pub: bytes) -> bytes:
pt = ecc.ECPubkey(pub) * ecc.string_to_number(priv)
return sha256(pt.get_public_key_bytes())
def privkey_to_pubkey(priv: bytes) -> bytes:
return ecc.ECPrivkey(priv[:32]).get_public_key_bytes()