Commit Graph
845 Commits
Author SHA1 Message Date
Kaiandfiatjaf_ 8be6d08a43 fix(nip47): support multiple relays in parseConnectionString
Addresses #494. The NIP-47 spec allows multiple relay parameters in
connection strings, but parseConnectionString only returned the first one.

Changes:
- Add 'relays' field to NWCConnection interface (string array)
- Use searchParams.getAll('relay') to capture all relays
- Keep 'relay' field for backwards compatibility (returns first relay)

This is backwards compatible - existing code using connection.relay
will continue to work, while new code can use connection.relays to
access all specified relays.
2026-03-27 07:02:47 -03:00
d3vv3andfiatjaf 1b955bdbcb fix: window.printer is undefined in AbstractRelay._onmessage 2026-02-28 01:01:07 -03:00
fiatjaf 1c1e2cc51a verify event should catch exceptions from basic validation. v2.23.2 2026-02-26 18:10:39 -03:00
arthurfrancaandGitHub 54199504a7 oninvalidevent 2026-02-26 18:08:17 -03:00
fiatjaf e45a9987e2 pool: prevent edge case with undefined subcloser. v2.23.1 2026-02-12 15:08:13 -03:00
fiatjaf 0c2c2cd4d8 nip13: improve mining by skipping hex. 2026-02-08 01:06:01 -03:00
fiatjaf 28f7553187 fix a type so jsr is happy. v2.23.0 2026-02-02 18:49:17 -03:00
fiatjaf ca29d9b515 ok, we need the prepareSubscription method. 2026-02-02 18:46:50 -03:00
fiatjaf ab802c8dbe automatic prune broken relay objects and keep track of relay idleness so they can be pruned. 2026-02-02 18:44:52 -03:00
fiatjaf 9db705d86c delete queue test since we don't have queues anymore. 2026-02-02 17:01:59 -03:00
fiatjaf be9b91318f relay: get rid of the message queue, because js is single-threaded. 2026-02-02 09:06:56 -03:00
fiatjaf c2423f7f31 nip27: fix hashtag parsing after newline or other characters. 2026-02-02 08:56:18 -03:00
fiatjaf 05b1fba511 export source files so they can be imported by other ts apps and libraries better. 2026-02-02 00:38:15 -03:00
fiatjaf 2d1345096b subscribeMany and subscribeManyEose are the same as subscribe/subscribeEose. 2026-02-01 17:19:58 -03:00
fiatjaf 6fc7788a4f utils: merging two (reverse) sorted lists of events. 2026-02-01 08:44:49 -03:00
fiatjaf 2180c7a1fe add onRelayConnectionSuccess to pair with onRelayConnectionFailure. 2026-01-31 19:27:45 -03:00
fiatjaf b4bec2097d finally stop reconnecting when the first connection fails once and for all. 2026-01-31 19:27:45 -03:00
fiatjaf fb7de7f1aa prevent reconnections when initial connection fails. 2026-01-31 13:57:33 -03:00
fiatjaf ccb9641fb9 pool: maxWaitForConnection parameter.
this was so obvious.
2026-01-31 00:27:55 -03:00
fiatjaf b624ad4059 pool: hooks to notify when a relay fails to connect, then ask whether a connection should be attempted. v2.22.1 2026-01-30 17:35:46 -03:00
fiatjaf b3d314643a make everything dependent on npm again. v2.22.0 2026-01-30 07:16:04 -03:00
fiatjaf 30ac8a02c2 readme to point only to jsr because npm is awful. 2026-01-28 17:28:27 -03:00
fiatjaf 42c9c7554d migrate to jsr dependencies for @noble and @scure. 2026-01-27 23:54:50 -03:00
fiatjaf 3588d30044 do the same for @noble/ciphers and @scure packages. 2026-01-27 22:43:54 -03:00
b40f59af74 Upgrade to @noble/curves ^2.0.1 and @noble/hashes ^2.0.1
This commit upgrades the noble cryptography dependencies to v2.0.1, which includes:

Breaking changes addressed:
- Updated all @noble imports to include .js extensions (required by v2 ESM-only API)
- Changed @noble/hashes/sha256 to @noble/hashes/sha2.js across 8 files
- Fixed secp256k1 API changes: methods now require Uint8Array instead of hex strings
- Updated schnorr.utils.randomPrivateKey() to schnorr.utils.randomSecretKey()

Files modified (27 total):
- package.json: Bump dependency versions
- Source files (12): pure.ts, nip04.ts, nip06.ts, nip13.ts, nip19.ts, nip44.ts,
  nip49.ts, nip77.ts, nip98.ts, nipb7.ts, utils.ts, wasm.ts
- Test files (14): All corresponding test files updated

Benefits:
- Latest security updates from audited noble libraries
- Smaller bundle sizes from v2 optimizations
- Future-proof ESM-only compatibility
- All tests passing

Co-authored-by: OpenCode <opencode@anomalyco.com>
2026-01-24 09:41:15 -03:00
fiatjaf bfa40da316 nip46: improve fromURI() and implement "switch_relays". v2.20.0 2026-01-22 21:50:30 -03:00
fiatjaf 9078f45a64 optionally take an AbortSignal on subscriptions. 2026-01-22 21:49:39 -03:00
fiatjaf 6ebe59f123 nip27: support note1 entities for now, but treat them like nevent. v2.19.4 2025-12-17 17:48:35 -03:00
fiatjaf 0235b490fa nip27: fix trailing / in urls. 2025-12-11 21:23:32 -03:00
fiatjaf e290f98a86 label forced ping subscription. 2025-12-10 21:06:31 -03:00
fiatjaf 7a50d9328d add some more kinds. v2.19.3 2025-12-09 10:56:43 -03:00
fiatjaf 65412e5b85 NostrEvent > Event. 2025-12-06 12:21:56 -03:00
fiatjaf ca36ae9530 update README with new enableReconnect() behavior. 2025-12-05 21:59:52 -03:00
fiatjaf 0b6543e1a8 use setInterval() instead of nested setTimeout()s for pingpong.
prevent call stacks from building up
v2.19.2
2025-12-05 21:46:16 -03:00
fiatjaf 693b262b7c CLOSED answers to dummyReq are also ok. 2025-12-05 21:03:34 -03:00
fiatjaf 85c964be3d enableReconnect() always update the filters to the time of the last received event on each subscription. v2.19.1 2025-12-05 13:24:49 -03:00
fiatjaf de7d459f6f only transform filters with enableReconnect() when we're actually reconnecting. v2.19.0 2025-12-05 09:22:33 -03:00
fiatjaf 21ec5bb2dc allow automatically performing AUTH against all relays. 2025-12-05 09:12:59 -03:00
fiatjaf e959409c14 fix classifyKind() test. v2.18.2 2025-11-25 22:21:46 -03:00
fiatjaf 8a76c4e329 fix normalizeUrl to make websocket urls out of http urls. 2025-11-25 22:20:38 -03:00
fiatjaf 34a1d8db47 kinds: more reliable regular/replaceable kind figuring. v2.18.1 2025-11-24 20:08:15 -03:00
fiatjaf d3ddd490c2 nip27: test emoji behavior when no tags. 2025-11-22 22:23:03 -03:00
fiatjaf 7730e321a5 nip27: support more image, audio and video extensions. 2025-11-22 20:36:04 -03:00
fiatjaf 400d132612 nip77: negentropy tests and small fixes. v2.18.0 2025-11-21 19:51:55 -03:00
fiatjaf 01880b6fb5 nip27: parse emoji shortcodes and hashtags too. 2025-11-21 00:37:40 -03:00
fiatjaf e87ffc433c build "core" although we shouldn't. 2025-11-21 00:37:40 -03:00
fiatjaf c45e861493 fire subscriptions.
this was broken during the negentropy stuff.

fixes https://github.com/nbd-wtf/nostr-tools/issues/517
v2.17.4
2025-11-19 14:53:24 -03:00
fiatjaf 66cc55c7f0 nip77: negentropy implementation and nip77 interface.
supersedes https://github.com/nbd-wtf/nostr-tools/pull/516
v2.17.3
2025-11-18 09:33:11 -03:00
fiatjaf 5841b0936b throw when subscription is created without filters.
fixes https://github.com/nbd-wtf/nostr-tools/pull/497
2025-11-18 08:09:45 -03:00
max-gyandfiatjaf_ f5d0c0eb0f fix prettier checks on nip77 related *ts files 2025-11-18 08:06:26 -03:00