akkounts/docs/dev/nostr.md
Râu Cao b29a0abb0b
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 3s
Document strfry integration
2025-04-16 17:34:10 +04:00

1.8 KiB

Nostr

strfry

The extras/strfry directory contains code to integrate strfry with akkounts, so that notes published to the relay have to be authored by (or in some cases just related to) local users who have verified their Nostr public key.

Requirements

Deno needs to be installed on the machine that you run strfry on.

We provide a Docker image with recent strfry and Deno builds:

https://gitea.kosmos.org/kosmos/-/packages/container/strfry-deno/

Configuration

You can use either environment variables (see e.g. the strfry service in docker-compose-yml) or a local .env file in the same working directory that you place the extra files in (e.g. /opt/strfry).

In your strfry.conf, configure strfry-policy.ts as the write policy, like so:

writePolicy {
    plugin = "/opt/strfry/strfry-policy.ts"
}

All dependencies will be downloaded and cached automatically when the plugin is called for the first time.

Manual tasks

You can sync all notes authored by local users (any account that has verified their Nostr pubkey with akkounts) from a remote strfry relay via negentropy sync:

deno run -A /opt/strfry/strfry-sync.ts wss://nostr.kosmos.org

Or, in the running container when using Docker Compose:

docker compose exec strfry deno run -A /opt/strfry/strfry-sync.ts wss://nostr.kosmos.org

The strfry service container also exposes the local relay on your local host on port 4777.

nak is a helpful tool for manual Nostr tasks. Here's how you can grab a note by its event ID from a remote relay and publish it to your local strfry for example:

nak req -i 0fb010192685b86b0810b3de3706fbbf3b8c1db30b14533094a2b9700c820cdc nostr.kosmos.org | nak event ws://localhost:4777