Commit Graph
55 Commits
Author SHA1 Message Date
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 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 2026-08-02 15:43:58 -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 933cf03ce7 Migrate remote signer calls to prefixed n_signer verbs 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
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
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 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
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
laantungir 23e68bdc83 Add NIP-42 auth support to relay pool with verbose auth diagnostics test and docs updates 2026-03-01 08:49:55 -04:00
laantungir 4dc753cdcc Implement NIP-46 remote signing API, tests/example, build integration, and refresh README docs 2026-02-28 09:53:35 -04:00
laantungir f3068f82f3 Rollback of nip44 changes, and added ability to modify timestamps in giftwraps. 2025-10-27 13:16:06 -04:00
Your Name a8dc2ed046 Add configurable timestamp randomization for NIP-59 gift wraps 2025-10-27 12:57:25 -04:00
laantungir 9a3965243c Revert NIP-44 to spec compliance (65535 bytes), keep NIP-04 at 1MB 2025-10-27 12:51:50 -04:00
laantungir 23c2a58c2b Upgrade nip4 and nip44 to be able to handle 1MB payloads. 2025-10-24 18:56:30 -04:00
laantungir 45fb6d061d Adding async publish to relay pool 2025-10-09 09:19:11 -04:00
laantungir 499accf440 Implement NIP-21: nostr: URI scheme with full support for note, nprofile, nevent, and naddr URIs including TLV encoding/decoding and comprehensive test suite 2025-10-03 06:10:56 -04:00
laantungir 6b95ad37c5 nip 17, and 59 2025-10-03 04:25:10 -04:00
laantungir 54a6044083 Add enhanced subscription functionality with EOSE result modes 2025-10-02 15:00:50 -04:00
laantungir 0f897ab1b3 Getting the relay pool up to speed 2025-10-02 11:51:41 -04:00
laantungir eb7a9e6098 Add NIP-42 implementation and local updates
- Added NIP-42 authentication implementation (nip042.c, nip042.h)
- Added NIP-42 test suite (nip42_test.c, nip42_test)
- Updated common core files for NIP-42 support
- Updated build script
- Rebuilt test binaries
2025-09-07 13:04:53 -04:00
laantungir 55e2a9c68e nip13 validation added 2025-09-05 13:42:03 -04:00
laantungir 33129d82fd remove exposed .h crypto headers 2025-09-02 12:36:52 -04:00
laantungir c0d095e57b Streaming sha256 2025-08-19 11:24:48 -04:00
laantungir 77d92dbcf9 Nostr note validation added to nip01 2025-08-19 06:59:04 -04:00
laantungir 1da4f6751e clean up 2025-08-17 14:14:52 -04:00
laantungir 3ebfdc06c0 Fixed bug in nip44.c, was an error in ecdh_shared_secret. Added comments 2025-08-17 11:29:07 -04:00
laantungir d8b342ca3f Fixed error in nip04 implementation. Now working 2025-08-17 10:42:38 -04:00
laantungir df23fd618a comparison test for debugging 2025-08-16 17:48:02 -04:00
laantungir 711a7cc15c feat: migrate to system dependencies from static linking
BREAKING CHANGE: Library now requires system-installed dependencies

Major Changes:
- Convert secp256k1 from bundled static lib to system dependency
- Convert OpenSSL from bundled static lib to system dependency
- Convert curl from bundled static lib to system dependency
- Update build.sh with pkg-config detection and fallback logic
- Remove all static library extraction/building logic
- Update README.md with new dependency requirements and installation

Build System:
- Add detect_system_secp256k1() with pkg-config support
- Add detect_system_openssl() with pkg-config support
- Add detect_system_curl() with pkg-config support
- Remove secp256k1 building/extraction from ar archive
- Update CFLAGS and LIBS to use system library variables
- Clear error messages for missing dependencies with install commands

Documentation:
- Add system dependency installation for Ubuntu/Debian/CentOS/macOS
- Update all compile/link examples to include -lssl -lcrypto -lcurl -lsecp256k1
- Remove references to 'self-contained' and 'no external dependencies'
- Update integration examples throughout README

Benefits:
- Smaller library size (only internal code bundled)
- Automatic security updates via system package manager
- Standard Linux library distribution pattern
- Reduced build complexity
- Better system integration with pkg-config

Required Installation:
Ubuntu/Debian: sudo apt install libssl-dev libcurl4-openssl-dev libsecp256k1-dev
CentOS/RHEL: sudo yum install openssl-devel libcurl-devel libsecp256k1-devel
macOS: brew install openssl curl secp256k1
2025-08-16 13:59:29 -04:00
laantungir 40dd3aa20b Updated build.sh to build curl, openssl, and 256k1 if needed 2025-08-16 10:26:39 -04:00
laantungir 9fd4c61df7 Working in the mines 2025-08-16 08:51:04 -04:00
laantungir 76e883fad4 Refactor and consolidate test suite
- Moved old tests from tests/old/ to main tests/ directory
- Renamed nostr_test_bip32.c to bip32_test.c for consistency
- Renamed nostr_crypto_test.c to crypto_test.c for consistency
- Renamed wss_test.c and moved from old directory
- Fixed unused variable warning in bip32_test.c
- Updated build system and workspace rules
- Cleaned up old compiled test executables
- Updated nostr_common.h and core_relays.c
- Removed obsolete nostr_core.h.old backup file

This consolidates all active tests into the main directory and removes
outdated test files while maintaining a clean, organized structure.
2025-08-16 08:38:41 -04:00
laantungir c3a9482882 Completed refactoring to separate nip files, and updating build.sh 2025-08-16 07:42:48 -04:00
laantungir 8ed9262c65 Last version before deleting Makefile and CmakeLists.txt 2025-08-15 16:32:59 -04:00
laantungir c569c0c346 Improved POW 2025-08-15 07:47:16 -04:00
laantungir 3d2537603c . 2025-08-14 19:15:55 -04:00
laantungir 2637378bf0 clean up versioning 2025-08-14 16:26:37 -04:00
laantungir c109c93382 Initial template structure from nostr_core_lib
- Complete C library template with OpenSSL-based crypto
- Comprehensive build system (Makefile, build.sh)
- Example code and test suite
- Documentation and usage guides
- Cross-platform compatibility (x64/ARM64)
- Production-ready structure for C library projects
2025-08-14 15:10:59 -04:00