Can we nostrify this?

https://once.com/writebook

Reply to this note

Please Login to reply.

Discussion

I will be utterly unsurprised if next version they release of it speaks nostr; DHH would understand nostr exquisitely well

💯💯 agree, that would be awesome

Yeah, almost done. But with ePub and PDF, not just HTML.

https://wikifreedia.xyz/gc-alexandria/GitCitadel@sovbit.host

Same "markdown upload to online book" concept.

Weird that they didn't bother including a pandoc button.

ooo I think this is the one nostr:npub1wqfzz2p880wq0tumuae9lfwyhs8uz35xd0kr34zrvrwyh3kvrzuskcqsyn tagged me in earlier in the week

nostr:npub1qe3e5wrvnsgpggtkytxteaqfprz0rgxr8c3l34kk3a9t7e2l3acslezefe what do you think about wrapping a native and portable C library to handle cryptography stuff?

😶 Doing that is beyond my current skills as a regular webdeveloper...but I'm open to learn about it. I know PHP is compiled from C, but I have never done a thing with C so it's all unknown to me. What will be all the benefits of doing this?

Well, I'm shilling my noscrypt library :) full disclosure. But really the idea is performance and leaving the tricky binary stuff under the C barrier. From experience I found it quite difficult to implement cryptographic primitives natively in PHP. That being said, I'm interested in building an extension library wrapper for PHP and am sort of gauging interest.

Noscrypt handles of the encryption specs, signatures of course, and I'm currently working on utilities to completely handle nip04 and nip44 utf8 string encryption.

Really interesting to discuss this more.

All the encryption / decrypting stuff is done in PHP at this moment (which I didn't write fyi). To do all these things on C level in a package would be a nice feature (it requires the ability to install this on the server I assume?)

Chip has an article coming up on this subject. Probably today.

Would love to! Noscrypt would have to be a wrapped in PHP plugin which I haven't played with more than hello world. So yes installed on the server just like any other plugin (mysqld, redis, memcached and so on)

Yes, lots of work in progress 😃 Just poke me if you're missing something in the library that you need.

https://nostr-php.dev

I think the CLI is broken.

I've gotten it to write my 30041 events, but it keeps complaining that the $json in Relay.php must be of type string.

But it is a string. 🤷‍♀️

Could you share a snippet of your code of command? I'm debugging the CLI atm which could be broken indeed after the last minor version upgrade.

include_once(__DIR__.'/vendor/autoload.php');

use swentel\nostr\Event\Event;

use swentel\nostr\Message\EventMessage;

use swentel\nostr\Relay\Relay;

use swentel\nostr\Sign\Sign;

$private_key = file_get_contents("private/nostr-private.key");

$note = new Event();

$note->setContent('30041 event test 2');

$note->setKind(30041);

$note->setTags([

['d', 'test-title'],

['title', 'This is the test title for 30041 2'],

]);

$signer = new Sign();

$signer->signEvent($note, $private_key);

$eventMessage = new EventMessage($note);

$relayUrl = "wss://theforest.nostr1.com";

$relay = new Relay($relayUrl);

$relay->setMessage($eventMessage);

$result = $relay->send();

But it also gave me this

PHP Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, WebSocket\Message\Text given in /home/.../vendor/swentel/nostr-php/src/Relay/Relay.php:90

Stack trace:

#0 /home/.../vendor/swentel/nostr-php/src/Relay/Relay.php(90): json_decode()

#1 /home/.../create30041Event.php(28): swentel\nostr\Relay\Relay->send()

#2 {main}

thrown in /home/.../vendor/swentel/nostr-php/src/Relay/Relay.php on line 90

Found it, fixing it and will push a new release asap with the fix.

Might want to see if the tests aren't broken, as well. They seem to be having trouble resolving the Key namespace.

Here's what happened with the CLI.

$ bin/nostr-php --content "Test of CLI" --key /home/.../nostr-private.key --relay wss://theforest.nostr1.com

PHP Fatal error: Uncaught Error: Typed property swentel\nostr\Relay\Relay::$payload must not be accessed before initialization in /home/.../nostr-php/src/Relay/Relay.php:87

Stack trace:

#0 /home/.../nostr-php/src/Application/Client.php(85): swentel\nostr\Relay\Relay->send()

#1 /home/.../nostr-php/bin/nostr-php(47): swentel\nostr\Application\Client->run()

#2 {main}

thrown in /home/.../nostr-php/src/Relay/Relay.php on line 87

Fixed / new release is out.

https://github.com/nostrver-se/nostr-php/releases/tag/1.3.3

$ bin/nostr-php --content "Hello world! Testing this fix" --key privkey --relay wss://nostr.sebastix.dev

Send to Nostr!

Still getting the string error on the $json with the full script using swentel\nostr\Relay\Relay

Switched to RelaySet and it seems to work, but it hangs after writing and throws a fatal error.

PHP Fatal error: Uncaught WebSocket\Exception\ConnectionClosedException: Connection has unexpectedly closed in /home/.../vendor/phrity/websocket/src/Connection.php:374

I didn't have access to a relay. Works now.