This pull request is implementing Schnorr signature scheme and NIP/01. It fixes a lot of bugs and defines all the types and records needed for the other NIP. A simple client can be used. Here a non-exhaustive list of all modification:
[x] nostrlib:encode/1 and nostrlib:encode/2 functions are able to encode all JSON messages in NIP/01. These functions are automatically generating the event identifier and the signature if they are undefined.
[x] nostrlib:decode/1 and nostrlib:decoded/2` functions are able to decode all JSON messages in NIP/01. These functions are returning a record and a label. The label is an indicator of the event quality based on checks.
[x] nostrlib:sign/1, nostrlib:verify/1, nostrlib:verify/3, nostrlib:check/1 and nostrlib:check/2 are helpers/wrappers functions around nostrlib_schnorr module.
[x] nostrlib_schnorr:new_private_key/0 and nostrlib_schnorr:new_public_key/1 are able to generate a private key and derivate a public key from this last one
[x] nostrlib_schnorr:sign/2 and nostrlib_schnorr:sign/3 are able to sign arbitrary messages like defined in BIP-0340
[x] nostrlib_schnorr:verify/3 is able to validate arbitrary messages and signature like defined in BIP-0340
[x] nostr_client:connect/1 and nostr_client:connect/2 functions are able to create a long living connection using the nostr_client supervision tree.
[x] nostr_client:event/4 can send events with kind 0, 1 and 2, to a relay like defined in NIP/01
[x] nostr_client:request/2 and nostr_client:request/3 can send request event to a relay like defined in NIP/01
[x] nostr_client:close/2 and nostr_client:close/3 can send a close event to a relay like defined in NIP/01
closes #3 #12
This pull request is implementing Schnorr signature scheme and NIP/01. It fixes a lot of bugs and defines all the types and records needed for the other NIP. A simple client can be used. Here a non-exhaustive list of all modification:
nostrlib:encode/1
andnostrlib:encode/2
functions are able to encode all JSON messages in NIP/01. These functions are automatically generating the event identifier and the signature if they are undefined.nostrlib:decode/1
and nostrlib:decoded/2` functions are able to decode all JSON messages in NIP/01. These functions are returning a record and a label. The label is an indicator of the event quality based on checks.nostrlib:sign/1
,nostrlib:verify/1
,nostrlib:verify/3
,nostrlib:check/1
andnostrlib:check/2
are helpers/wrappers functions aroundnostrlib_schnorr
module.nostrlib_schnorr:new_private_key/0
andnostrlib_schnorr:new_public_key/1
are able to generate a private key and derivate a public key from this last onenostrlib_schnorr:sign/2
andnostrlib_schnorr:sign/3
are able to sign arbitrary messages like defined in BIP-0340nostrlib_schnorr:verify/3
is able to validate arbitrary messages and signature like defined in BIP-0340nostr_client:connect/1
andnostr_client:connect/2
functions are able to create a long living connection using the nostr_client supervision tree.nostr_client:event/4
can send events with kind 0, 1 and 2, to a relay like defined in NIP/01nostr_client:request/2
andnostr_client:request/3
can send request event to a relay like defined in NIP/01nostr_client:close/2
andnostr_client:close/3
can send a close event to a relay like defined in NIP/01nostrlib
coverage is 86%nostrlib_schnorr
coverage is 99%