Commit Graph
115 Commits
Author SHA1 Message Date
Laan Tungir ff07264e8f Fix use-after-free in nsigner_client_call error handling that caused segfaults on RPC error responses v0.6.15 2026-08-06 18:30:03 -04:00
Laan Tungir 4b7c04dc49 v0.6.14 - Remove nostr_signer_nsigner_set_nostr_index compatibility shim; add nostr_signer_nsigner_set_derive_index v0.6.14 2026-08-06 13:07:11 -04:00
Laan Tungir c91670f7da Remove nostr_signer_nsigner_set_nostr_index compatibility shim
The shim expanded NIP-06 index N into role=main + role_path=m/44'/1237'/N'/0/0
client-side. It is removed — callers must now use
nostr_signer_nsigner_set_role_path explicitly.

Added nostr_signer_nsigner_set_derive_index for the derive verb's algorithm
index (previously set as a side effect of the shim).

Updated NSIGNER_INTEGRATION.md and plan docs to reflect the removal.

Tests: 8/8 pass.
2026-08-06 13:06:44 -04:00
Laan Tungir 71a72dc7ed Add nostr_signer_nsigner_from_client, nostr_signer_last_error, make from_transport public
- nostr_signer_nsigner_from_transport: made public (was static) so callers
  who open their own transport can create a signer from it.
- nostr_signer_nsigner_from_client: new constructor that creates a signer
  from an already-created low-level nsigner_client_t. Lets callers use both
  the high-level typed wrappers and the low-level nsigner_client_call for
  raw passthrough on the same connection.
- nostr_signer_last_error: returns the raw n_signer RPC error message
  (e.g. 'path_not_allowed', 'unknown_role') from the last failed call.
  Delegates to nsigner_client_last_error for the remote backend.
- Forward declarations for nsigner_transport_t and nsigner_client_t added
  to nostr_signer.h so the new constructors can be declared without
  pulling in the transport/client headers.
2026-08-06 10:17:17 -04:00
Laan Tungir d575e8cdbc Add 10 high-level algorithm-verb wrappers to nostr_signer_t
The high-level nostr_signer_t API only covered 6 of n_signer's 16 verbs
(the Nostr protocol verbs + derive_hmac). The other 10 (get_info,
get_public_key algorithm-based, sign, verify, encapsulate, decapsulate,
derive_shared_secret, otp encrypt/decrypt, mine_event) had no library
wrapper — clients had to drop down to the low-level nsigner_client_call
and hand-build cJSON params.

This adds typed wrappers for all 10:
- nostr_signer_get_info
- nostr_signer_get_public_key_alg
- nostr_signer_sign / nostr_signer_verify
- nostr_signer_encapsulate / nostr_signer_decapsulate
- nostr_signer_derive_shared_secret
- nostr_signer_otp_encrypt / nostr_signer_otp_decrypt
- nostr_signer_mine_event

The local backend returns NOSTR_ERROR_NOT_SUPPORTED for all 10 (they
require signer-side PQ crypto / OTP pads / key derivation the local
backend doesn't hold). The remote nsigner backend builds the correct
wire params and parses the result.

Also adds NOSTR_ERROR_NOT_SUPPORTED (-40) to nostr_common.h.

Tests: 2 new tests in nsigner_client_test.c — local-backend
NOT_SUPPORTED check for all 10 verbs, and a mock-transport test
verifying nostr_signer_sign emits the correct wire request. 8/8 pass.
2026-08-06 09:54:50 -04:00
Laan Tungir b235bd6585 Replace removed nostr_index selector with role+role_path
n_signer removed the bare nostr_index selector (error 2006) and index-on-
nostr-verbs (error 2007). The only accepted selector for nostr_* verbs is
now {"role","role_path"} sent together (2008/2009 if either is missing).

The remote signer backend was emitting {"nostr_index":N} or {"role"}
alone -- both now invalid. This commit:

- Replaces remote struct fields nostr_index/has_nostr_index with
  role_path[128]/has_role_path plus derive_index/has_derive_index
- Rewrites signer_remote_params_with_selector to emit both role and
  role_path in the options object
- Updates all three call sites (get_public_key, sign_event, encrypt_decrypt)
- Rewrites signer_remote_derive_hmac to emit {algorithm,index} using
  derive_index
- Adds nostr_signer_nsigner_set_role_path setter
- Repurposes nostr_signer_nsigner_set_nostr_index as a compatibility shim
  that expands N into role=main + role_path=m/44'/1237'/N'/0/0
- Updates nsigner_client_test to send and assert the role+role_path selector
- Updates NSIGNER_INTEGRATION.md (new section 2.1.1) and plan docs

Builds clean (38/39 tests; nip34_test failure is pre-existing/unrelated).
nsigner_client_test 6/6 pass, signer_modules_test 26/26 pass.
2026-08-06 09:42:40 -04:00
Laan Tungir feca911ac4 Fix NIP-34 tag format: use single multi-value tags for clone, relays, maintainers per NIP-34 spec v0.6.13 2026-08-04 09:06:37 -04:00
Laan Tungir f35b966fe9 Add NIP-34 git stuff implementation with event creation helpers for repository announcements, state, patches, PRs, issues, status, grasp lists, and nostr:// URL parsing v0.6.12 2026-08-02 15:43:58 -04:00
Laan Tungir 4a53455190 Fix TLS read buffer in ws client: buffer excess SSL_read bytes to prevent loss of multiple WebSocket frames in a single TLS record v0.6.11 2026-07-28 12:21:21 -04:00
Laan Tungir 61581afcc9 Increase receive timeout from 50ms to 1000ms in synchronous_query_relays_with_progress
The 50ms receive timeout was too short for relays that need time to
process a REQ query before responding. The pool's query_sync already
uses 1000ms. This matches that behavior to avoid premature timeouts.
2026-07-28 10:14:30 -04:00
Laan Tungir 36eb6afa72 Handle NOTICE and CLOSED messages in synchronous_query_relays_with_progress
Pass NOTICE and CLOSED message content to the callback so callers
can see what the relay actually said (e.g. auth-required, restricted,
rate-limited). Previously these messages were silently ignored.
2026-07-28 09:38:53 -04:00
Laan Tungir 160421c673 Increase receive buffer from 8KB to 256KB in synchronous_query/publish functions
The 8KB buffer was too small for large Nostr events (e.g. long-form
content in kind 30023). The pool's query_sync already uses 256KB.
This matches that size to avoid truncation when using the standalone
synchronous query functions for backfill.
2026-07-28 07:50:56 -04:00
Laan Tungir 024b490ac1 Add nostr_signer_derive_hmac() (HMAC-SHA256 via local + nsigner derive verb) and ttyUSB serial enumeration
Rescued from uncommitted work in sovereign_browser/nostr_core_lib:
- nostr_signer_derive_hmac(): deterministic MAC over caller data using the
  signer's secp256k1 private key. Local backend computes HMAC-SHA256 directly;
  remote nsigner backend calls the 'derive' verb (algorithm:'secp256k1').
- nsigner_transport_list_serial(): enumerate /dev/ttyUSB* (FTDI/CH340/CP210x/
  PL2303 USB-serial adapters) in addition to /dev/ttyACM* CDC-ACM devices.
- tests/nsigner_client_test.c: local derive_hmac reference-match test.
2026-07-28 06:45:05 -04:00
Laan Tungir 9240f44ea3 Release v0.6.10: n_signer qrexec transport, nostr_index selector, prefixed wire verbs, NIP-03 OTS upgrade v0.6.10 2026-07-28 06:31:59 -04:00
Laan Tungir 933cf03ce7 Migrate remote signer calls to prefixed n_signer verbs 2026-07-28 06:31:43 -04:00
Laan Tungir 27da465295 Fix qrexec transport reconnect: blocking waitpid for old child, sync nsigner_client.c with reconnect logic 2026-07-28 06:31:43 -04:00
Laan Tungir 6ebab823a8 Add qrexec transport, nostr_index selector, and index_not_allowed error code for n_signer client 2026-07-28 06:31:43 -04:00
Laan Tungir a3337e5207 Add nostr_bip39_get_wordlist() public accessor for BIP-39 wordlist 2026-07-28 06:31:43 -04:00
Laan Tungir 932c770f6f Fix NIP-03 timestamp upgrade: tree-walk pending attestations, correct PREPEND op composition, and verify Bitcoin attestation completion 2026-07-28 06:31:43 -04:00
Laan Tungir be3a32b488 Fix NIP-03 OpenTimestamps parsing, multi-calendar proofs, upgrades, tests, and CLI tooling 2026-07-28 06:31:43 -04:00
Laan Tungir 3236e02f41 chore: stop tracking compiled test binaries with missing blobs (tests/nip03_live_test, websocket_debug) 2026-07-28 06:31:32 -04:00
Laan Tungir b51bcb4943 Migrated n_signer verb names to nostr_ prefix 2026-07-20 18:34:00 -04:00
Laan Tungir af06f23939 Fix NIP-59 dynamic buffer sizing for NIP-17 gift wraps 2026-04-11 15:53:44 -04:00
Laan Tungir fc337cf921 Implemented cooldown period in relay connection to prevent flapping 2026-04-10 06:13:02 -04:00
Laan Tungir f478a780d7 Add per-relay EOSE timeout fallback and robust subscription EOSE completion 2026-04-07 07:41:50 -04:00
laantungir 2e7eacc02e Update README checklist with not-applicable NIP markers and legend 2026-03-22 11:53:37 -04:00
laantungir ec8eb5555b Implement and validate NIP-03 live OpenTimestamps flow with HTTP/base64 fixes 2026-03-22 11:50:19 -04:00
Your Name a3a68f0fde added blossom client functionality. Unified curl 2026-03-21 20:40:25 -04:00
Your Name 2fe36acde4 cashu token fixed 2026-03-21 09:14:02 -04:00
laantungir f470759b96 Fix cashuB byte-string token encoding and add live testnut redeem-regenerate cashuB integration coverage 2026-03-21 07:59:49 -04:00
laantungir fb3c9dbc76 Fix NUT-00 hash_to_curve domain separator and expand live NIP-60 swap roundtrip diagnostics/tests 2026-03-20 19:18:25 -04:00
laantungir 303013a518 Fix Cashu hash_to_curve to NUT-00 spec and align live helper for send-proof compatibility 2026-03-20 15:30:09 -04:00
laantungir f7e179dd85 Confirm live testnut-based outbound token generation test run and documentation update 2026-03-20 11:26:07 -04:00
laantungir a3f7a1bbfd Add cashu_encode_token with cashuA/cashuB formats and live encode-decode validation 2026-03-20 10:59:13 -04:00
laantungir a595747aff Add Cashu keyset endpoints support and per-amount unblinding with live checkstate validation 2026-03-20 10:32:43 -04:00
laantungir 39ebfcd90a Add live NIP-60 Cashu receive integration test using nofee.testnut mint 2026-03-20 10:23:21 -04:00
Your Name 63972d974d Preserve Cashu mint error JSON on non-2xx responses for downstream diagnostics 2026-03-20 09:48:03 -04:00
Your Name 13fd364ca3 Add Cashu blinding helpers and secp256k1 point ops 2026-03-19 18:45:17 -04:00
Your Name cb4ff93906 Add Cashu token decode support for cashuA and cashuB 2026-03-19 18:19:45 -04:00
Your Name 4d0d794a9a Added cashu functionality. 2026-03-19 14:52:03 -04:00
Your Name ae672b7047 Added cashu functionality. 2026-03-19 14:32:14 -04:00
Your Name 0a8a813fcf Added cashu functionality. 2026-03-19 14:30:44 -04:00
Your Name ea40aec6b8 Added cashu functionality. 2026-03-19 14:25:53 -04:00
laantungir 98cfd81b01 Release v0.5.0 2026-03-19 09:13:59 -04:00
laantungir d8d3f9b28c just want to increment 2026-03-19 09:09:59 -04:00
laantungir 669793dd67 just want to increment 2026-03-19 09:09:46 -04:00
laantungir e21c8eb5be nip60 2026-03-19 09:01:11 -04:00
Your Name 20006df228 fix relay pool sync query repeat behavior and add regression test 2026-03-16 05:27:23 -04:00
Your Name adc7aa9dcf Delegate nostr_core_lib logging via callback and integrate single-file didactyl logging 2026-03-13 13:57:20 -04:00
Your Name 1a549afa19 Various changes 2026-03-05 15:18:44 -04:00