Commit graph

15 commits

Author SHA1 Message Date
randogoth
1fee9e5d34 Nip44Encrypt 2026-07-11 17:33:08 +03:00
randogoth
60f9e4ccfa Bound the relay connect handshake so a fetch can't hang forever 2026-07-05 16:50:28 +03:00
randogoth
0e70aba755 verifyNostrEvent helper 2026-07-05 16:49:10 +03:00
randogoth
f69fcb661f Authenticate and unwrap received gift-wrapped DMs
Harden unwrapGift for the receive side: verify the seal's BIP-340 signature
and recomputed id, enforce that the rumor's author matches the seal signer
(NIP-59 anti-spoofing), and check the rumor id against its contents. The
rumor is unsigned by design, so sender authentication rests on the seal.

Add UnwrapDirectMessage to NostrDmActor, returning the authenticated sender,
content, timestamp, and tags. Cover both with tests: an unwrap round-trip and
a rejection of a wrap whose inner rumor spoofs a different author.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 18:26:52 +03:00
randogoth
f8ccd5d56b Add NIP-17 gift-wrapped direct messages
Add outbound NIP-17 private messaging: build the kind-14 rumor -> kind-13
seal -> kind-1059 gift wrap chain on the existing NIP-44 primitives, wrapped
in NostrDmActor (WrapDirectMessage/GiftWrapped). Publishing is left to
NostrPublishActor.

Extract nostrEventId() from signNostrEvent so the unsigned rumor can compute
its id without a signature. Export the new actor and nip17 helpers. Add a
round-trip test (wrap -> unwrap) and a negative decryption test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 17:48:23 +03:00
randogoth
582b0505cb Add NIP-19 (npub/nsec), NIP-05 verification, and arbitrary-pubkey profile fetch
- nip19.dart: bech32 encodeNpub/encodeNsec for raw keys (no TLV entities),
  verified against the canonical NIP-19 test vectors.
- nip05.dart: verifyNip05 with an injectable http.Client plus a pure
  nip05MatchesPubkey helper for the .well-known/nostr.json check.
- fetchProfileFor(fetcher, pubkey): fetches and parses any user's kind-0 into
  a typed NostrProfile (newest-wins), generalizing the own-key FetchProfile.
- Export all three from swarm.dart; unit tests for each (bech32 vectors,
  MockClient HTTP cases, fake-relay profile parsing).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 11:34:35 +03:00
randogoth
719aaca022 code review 2026-06-10 11:20:20 +03:00
randogoth
128190975e nip46 remote signer actor
Drop-in replacement for NostrSignerActor that delegates signing to an
external signer over NIP-46 (bunker:// URI, NIP-44 encrypted kind-24133).
Includes 8 tests with a fully self-contained fake relay helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 15:27:31 +03:00
randogoth
0596fdec27 file download actor 2026-06-08 12:33:37 +03:00
randogoth
0cdf3d7dbf nostr account actor 2026-06-08 12:25:26 +03:00
randogoth
f55083ea1b file upload actor 2026-06-08 11:08:00 +03:00
randogoth
cabac5ec49 geohash actor 2026-06-07 16:51:14 +03:00
randogoth
f1e54f2722 basic nostr actors 2026-06-07 16:45:43 +03:00
randogoth
c14de9c3e9 binary file r/w 2026-06-07 16:18:52 +03:00
randogoth
8c165edc0c file actor 2026-06-07 15:26:11 +03:00