# nostr The shared Nostr protocol code: codecs, event/filter/tag types, the wire envelope, key encoding and the crypto primitives. Both the `morly` relay (native) and the `musiquay` web app (wasm) build against this module through a `replace git.smesh.lol/nostr => ../nostr` directive in their `moxie.mod`. ## Layout pkg/bech32encoding bech32/npub/nsec encoding pkg/codec the structural codec's nostr value helpers pkg/core the app-side nostr core types (package nostr) pkg/crypto aes256gcm, chacha20, chacha20poly1305, hkdf, nip44 pkg/envelope the relay wire envelope (EVENT/EOSE/OK/... framing) pkg/event event type, id/signature checks, serialization pkg/filter REQ filters and matching pkg/hex hex encode/decode pkg/httpauth NIP-98 / HTTP auth headers pkg/ints integer conversion helpers pkg/keys key types pkg/kind event kinds pkg/lol logging and error helpers pkg/normalize string normalization (URLs, relay hints, ...) pkg/signer signer interface (p8k: the local key signer) pkg/tag tag parsing and lookup pkg/text text helpers (escaping, truncation) pkg/timestamp timestamp parsing/formatting pkg/types shared type aliases pkg/units unit conversions pkg/varint varint encoding pkg/ws websocket client: native only (//:build !wasm) Everything except `pkg/ws` must stay wasm-safe: no `os`, no `net`, no syscalls. This is the constraint that produced the `pkg/` layout - the compiler's user-code restrictions do not apply under a `/pkg/` path segment, and these packages are shared libraries, not application code. ## Build and test make test-unit # every package under pkg/ carrying a *_test.mx The compiler lives in `../moxie` (`moxie` binary, `MOXIEROOT` set from there). `moxie test` takes one package argument at a time; the Makefile walks the tree.