idb.mx raw
1 //:build !wasm
2
3 package idb
4
5 // IndexedDB jsbridge - purpose-built event and DM storage.
6 // The JS runtime handles all IndexedDB internals (schema, cursors, indices).
7
8 // SetEncKey sets the 32-byte encryption key (hex encoded) for DM at-rest encryption.
9 func SetEncKey(hexKey string) { panic("jsbridge") }
10
11 // Open opens/creates the database. Calls fn when ready.
12 func Open(fn func()) { panic("jsbridge") }
13
14 // SaveEvent saves a Nostr event (JSON string). Calls fn with true if new.
15 func SaveEvent(eventJSON string, fn func(bool)) { panic("jsbridge") }
16
17 // QueryEvents queries events matching a filter (JSON string).
18 // Calls fn with a JSON array of matching events.
19 func QueryEvents(filterJSON string, fn func(string)) { panic("jsbridge") }
20
21 // SaveDM saves a DM record (JSON string).
22 // Calls fn with result: "saved", "duplicate", or "upgraded".
23 func SaveDM(dmJSON string, fn func(string)) { panic("jsbridge") }
24
25 // QueryDMs queries DMs for a peer pubkey.
26 // until is Unix timestamp or 0 for no upper bound.
27 // Calls fn with a JSON array of DM records.
28 func QueryDMs(peer string, limit int, until int64, fn func(string)) { panic("jsbridge") }
29
30 // GetConversationList returns all DM conversations.
31 // Calls fn with a JSON array of conversation summaries.
32 func GetConversationList(fn func(string)) { panic("jsbridge") }
33
34 // ClearDMsByPeer deletes all DM records for a given peer pubkey.
35 // Calls fn when complete.
36 func ClearDMsByPeer(peer string, fn func()) { panic("jsbridge") }
37
38 // SetVersion sets the expected app version for epoch checks.
39 // On Open, if stored version != this version, all data stores are flushed.
40 func SetVersion(v string) { panic("jsbridge") }
41
42 // MLS storage - group states and key pair package.
43 func MlsSaveGroup(groupIDHex, stateBase64 string, fn func()) { panic("jsbridge") }
44 func MlsLoadGroup(groupIDHex string, fn func(string)) { panic("jsbridge") }
45 func MlsListGroups(fn func(string)) { panic("jsbridge") }
46 func MlsSaveKPP(kppBase64 string, fn func()) { panic("jsbridge") }
47 func MlsLoadKPP(fn func(string)) { panic("jsbridge") }
48
49 // KV storage - simple key-value stores (profiles, settings, cache).
50 func KVGet(store, key string, fn func(string)) { panic("jsbridge") }
51 func KVPut(store, key, value string) { panic("jsbridge") }
52 func KVGetAll(store string, each func(string, string), done func()) { panic("jsbridge") }
53