The first byte is the sign. 02 or 03 for negative or positive. Then the next 32 bytes or 256 bits are the X coord.

Reply to this note

Please Login to reply.

Discussion

there is two valid 33 byte keys for any given 32 byte key

when you derive ECDH you have to have the correct 33 byte key

otherwise, essentially there is two secrets that can come out of the ECDH, the odd, and the even one... the information is literally elided from the pubkey, so this means that i have to generate two secrets, one from your npub as even, one as odd, and one of them will be correct

and the only way i would be able to know that, is if there is a sentinel in the ciphertext that i can use to determine, preferably, quickly, that it's odd or even

it sorta seems to me like an ECDH protocol has to use 33 bytes, no matter what

yeah, i found the problem

when you generate keys you have to derive the pubkey and check the key is even (02) or it's not valid 32 byte BIP-340 key

i'm now needing to go check through all my stuff because generating secrets for nostr requires this, period.