that's not the one you use

and see, the abomination...

decred

here is the proper version, i cleaned all of that up from btcd:

https://mleku.online/git/ec

you need to use the functions in the "schnorr" folder, in my code it is used many times so you can also see there: https://github.com/Hubmakerlabs/replicatr - in the pkg/nostr folder is all the nostr things including event handling, in the event folder is shown the correct method to make and verify BIP-340 signatures and pubkeys

btw, don't depend on replicatr's pkg/nostr folder yet, it's not stablised, for example just now i refactored the inconsistently ordered compute shared secret function in nip4, as in my library and in most ways of discussing ECDH you say My Secret Key, Your Public Key and the nip4 fiatjaf fiasco has it backwards, there's a lot of other little subtle things i change like in my ec library you can use the more logical and easier to shorten "secret key" instead of "private key" versus "public key" that pattern doesn't leave you an option for shortening it, sk/pk is more logical which derives from secret/public

i have yet to clean up that nip44 encryption/message formatting scheme yet, it's horribly written, as the audit points out it does no bounds checking on the keys derived out of the hex, not even checking the hex is the right length (which would be sufficient and make more sense to check before doing the work of decoding the hex)

i just am directing you to look at it because it will show you how to do the BIP340 nostr style signatures correctly

my work is not finished yet but it has been a while since i've made more than two small changes in that pkg/nostr folder in a week, so i think once i hit my current milestone target for an MVP relay i'll be pushing it out into its own package on my git hosting

another thing you need to know as a go programmer, if you are writing an app, and developing a general purpose library or ten at the same time, don't separate them until the libraries are unchanging for a substantial amount of time because it's a huge pain to keep the go modules synced up

Reply to this note

Please Login to reply.

Discussion

No replies yet.