Skip to content

Commit b45d89e

Browse files
authored
Merge pull request #10546 from f321x/bolt12_preparation_1
bolt12: preparation 1
2 parents 16c8cb5 + 4254c9a commit b45d89e

6 files changed

Lines changed: 398 additions & 134 deletions

File tree

electrum/lnonion.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,17 @@ def get_blinded_node_id(node_id: bytes, shared_secret: bytes):
193193
return blinded_node_id.get_public_key_bytes()
194194

195195

196+
def blinding_privkey(privkey: bytes, blinding: bytes) -> bytes:
197+
shared_secret = get_ecdh(privkey, blinding)
198+
b_hmac = get_bolt04_onion_key(b'blinded_node_id', shared_secret)
199+
b_hmac_int = int.from_bytes(b_hmac, byteorder="big")
200+
201+
our_privkey_int = int.from_bytes(privkey, byteorder="big")
202+
our_privkey_int = our_privkey_int * b_hmac_int % ecc.CURVE_ORDER
203+
our_privkey = our_privkey_int.to_bytes(32, byteorder="big")
204+
return our_privkey
205+
206+
196207
def new_onion_packet(
197208
payment_path_pubkeys: Sequence[bytes],
198209
session_key: bytes,

0 commit comments

Comments
 (0)