Implement @lamassu/nostr-client package

Core Nostr client library for ATM communication:

- Identity management (generateIdentity, load from nsec/hex)
- NIP-44 encryption/decryption for sensitive data
- Event creation utilities (machine status, transactions, auth)
- NostrClient class with relay management
- NIP-42 authentication support for private relays
- Automatic reconnection with exponential backoff
- Subscription management

Types for ATM-specific events:
- Kind 30078: Machine status (replaceable)
- Kind 30079: Transaction records (replaceable)
- Kind 21001-21003: CLINK protocol events
- Kind 22242: NIP-42 auth

Includes unit tests for identity, encryption, and events.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-01-23 05:46:18 -05:00
commit f4cd45c81c
15 changed files with 1144 additions and 1 deletions

3
.gitignore vendored
View file

@ -48,3 +48,6 @@ coverage/
# Pre-commit (auto-generated by devenv)
.pre-commit-config.yaml
# External dependencies (cloned for docker)
Lightning.Pub/