diff options
| author | Your Name <you@example.com> | 2026-05-16 23:55:05 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-16 23:55:05 +0530 |
| commit | 4c47ae188b288e7d24bd9566ab3e6a6805d9484f (patch) | |
| tree | 33b74b2090b4f3b7597841734a56a4006a86d73f /main/nostr_event.h | |
| parent | 133e40c82afb4d7659758b1fa57925ac57af4621 (diff) | |
Phase 3: Nostr identity derivation + wifistr service discovery
- Add identity.c/h: HMAC-SHA512 derivation from nsec → npub, STA/AP MAC, SSID, AP IP
- Add nostr_event.c/h: NIP-01 event serialization + Schnorr signing (BIP-340)
- Add geohash.c/h: lat/lon to geohash encoding
- Add wifistr.c/h: kind 38787 event builder + WebSocket publish to Nostr relays
- Update config.c/h: nsec-based identity, Nostr relay/geo config, remove static SSID/IP
- Replace custom mbedTLS wallet with nucula library (libsecp256k1)
- Remove wallet.c/h, wallet_persist.c/h (replaced by nucula_lib component)
- Verified on Board A: derived SSID, captive portal, payment, wallet, wifistr publish
Diffstat (limited to 'main/nostr_event.h')
| -rw-r--r-- | main/nostr_event.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/main/nostr_event.h b/main/nostr_event.h new file mode 100644 index 0000000..ce15900 --- /dev/null +++ b/main/nostr_event.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef NOSTR_EVENT_H | ||
| 2 | #define NOSTR_EVENT_H | ||
| 3 | |||
| 4 | #include "esp_err.h" | ||
| 5 | #include <stdint.h> | ||
| 6 | #include <stddef.h> | ||
| 7 | |||
| 8 | typedef struct { | ||
| 9 | char pubkey[65]; | ||
| 10 | uint64_t created_at; | ||
| 11 | int kind; | ||
| 12 | const char *tags_json; | ||
| 13 | const char *content; | ||
| 14 | char id[65]; | ||
| 15 | char sig[129]; | ||
| 16 | } nostr_event_t; | ||
| 17 | |||
| 18 | esp_err_t nostr_event_init(nostr_event_t *event, const char *npub_hex, | ||
| 19 | int kind, const char *tags_json, const char *content); | ||
| 20 | |||
| 21 | esp_err_t nostr_event_sign(nostr_event_t *event, const uint8_t nsec[32]); | ||
| 22 | |||
| 23 | esp_err_t nostr_event_to_json(const nostr_event_t *event, char *buf, size_t buf_len); | ||
| 24 | |||
| 25 | #endif | ||