What is Nostr?
prolic
npub18wx…4xra
2024-08-29 18:07:58
in reply to nevent1q…s83c

prolic on Nostr: let hex = showHexBS $ exportPubKeyXO pk let comb = "02" ++ hex let pubKeyXY' = ...

let hex = showHexBS $ exportPubKeyXO pk
let comb = "02" ++ hex
let pubKeyXY' = showHexBS (prefix BS.cons exportPubKeyXO pk)
let pubKeyXY = read pubKeyXY' :: S.PubKeyXY

this gives me a pubkey XY from a pubkey XO.

let sharedSecret = BA.convert $ S.ecdh (getSecKey sk) pubKeyXY

this gives me the conversation key

given the nip44 test vectors:
sec1: 315e59ff51cb9209768cf7da80791ddcaae56ac9775eb25b6dee1234bc5d2268
pub2:
c2f9d9948dc8c7c38321e4b85c8558872eafa0641cd269db76848a6073e69133

I should get a conversation key of:
5ad01c0fc57ed5f92a0518b6440ca876eb1f247ddbb237ba1caaabbf4cebbdce

but I see this:
810e3a763e4588c9a1528092ed99b94a1199b673e9b2a422a44aa3396f2003e0

I don't know if my hkdf expand stuff is correctly implemented, but I get already wrong results on the steps before.
Author Public Key
npub18wxf0t5jsmcpy57ylzx595twskx8eyj382lj7wp9rtlhzdg5hnnqvt4xra