Closed pedromvpg closed 11 months ago
$signer->signEvent($note, "nsec1s3ul24jggks7fn2...5u6ph3flgxdjkcsl5tc7q");
Looks like the second argument (nsec1s3ul24jggks7fn2...5u6ph3flgxdjkcsl5tc7q
) in signEvent
is not a valid private key string.
You could try nsec1vl029mgpspedva04g90vltkh6fvh240zqtv9k0t9af8935ke9laqsnlfe5
which can be found in one of the tests.
Thanks, the private key was not valide because I replaced some of the characters with "...". Tried with the sample one provided from other tests and returns the same result.
Does it work for you?
A quick test: https://play.phpsandbox.io/swentel/nostr-php/VBgz6pXzOm5kdnvN
Exception with message "Invalid characters"
null
Possibly related to https://github.com/swentel/nostr-php/issues/23? @swentel any ideas?
If it is related to #23 you could try it again while running the patch I supplied in #27 which reliably fixes #23 for me.
@pedromvpg Have you tried it with private key in hex value? I just found out that the code is expecting a private key in hex and doesn't convert your nsec to hex when the event is signed.
In your test you can convert your keys to hex in this way:
$key = new Key();
$private_key_in_hex = $key->convertToHex('nsec1...');
For some reason the line $signer->signEvent($note, "nsec1s3ul24jggks7fn2...5u6ph3flgxdjkcsl5tc7q"); is stopping the script but I can't see any error.
Here's the code I'm running.