nostrver-se / nostr-php

PHP helper library for Nostr https://nostr-php.dev
https://nostr-php.dev
MIT License
53 stars 15 forks source link

Figure out why the id generation fails when using json_encode #6

Closed swentel closed 1 year ago

swentel commented 1 year ago

Follow up to #5

swentel commented 1 year ago

Looks like it's newlines, cf https://www.drupal.org/project/nostr_simple_publish/issues/3344527#comment-14946650

From the NIP-01:

To obtain the event.id, we sha256 the serialized event. The serialization is done over the UTF-8 JSON-serialized string (with no white space or line breaks) of the following structure.

swentel commented 1 year ago

So it turns out it was a mix of problems:

Changed the code so to use that option + a new method generateEvent which returns ["EVENT", ' The Drupal module now uses this too.