tauri-plugin-nostrnative 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +106 -0
- package/dist-js/index.cjs +288 -0
- package/dist-js/index.d.ts +105 -0
- package/dist-js/index.js +253 -0
- package/package.json +38 -0
- package/permissions/autogenerated/commands/blossom_get_blob.toml +13 -0
- package/permissions/autogenerated/commands/blossom_mirror.toml +13 -0
- package/permissions/autogenerated/commands/blossom_upload.toml +13 -0
- package/permissions/autogenerated/commands/blossom_upload_content.toml +13 -0
- package/permissions/autogenerated/commands/create_discovery_event.toml +13 -0
- package/permissions/autogenerated/commands/decrypt_discovery_event.toml +13 -0
- package/permissions/autogenerated/commands/decrypt_pns_event.toml +13 -0
- package/permissions/autogenerated/commands/delete_calendar.toml +13 -0
- package/permissions/autogenerated/commands/delete_calendar_event.toml +13 -0
- package/permissions/autogenerated/commands/delete_chat_messages.toml +13 -0
- package/permissions/autogenerated/commands/derive_pns_keys.toml +13 -0
- package/permissions/autogenerated/commands/fetch_bookmarks.toml +13 -0
- package/permissions/autogenerated/commands/fetch_calendar_events.toml +13 -0
- package/permissions/autogenerated/commands/fetch_calendars.toml +13 -0
- package/permissions/autogenerated/commands/fetch_contact_list.toml +13 -0
- package/permissions/autogenerated/commands/fetch_discovery_events.toml +13 -0
- package/permissions/autogenerated/commands/fetch_event_details.toml +13 -0
- package/permissions/autogenerated/commands/fetch_pns_events.toml +13 -0
- package/permissions/autogenerated/commands/fetch_profiles.toml +13 -0
- package/permissions/autogenerated/commands/fetch_received_rsvps.toml +13 -0
- package/permissions/autogenerated/commands/fetch_rsvps.toml +13 -0
- package/permissions/autogenerated/commands/fetch_user_rsvps.toml +13 -0
- package/permissions/autogenerated/commands/generate_new_nsec.toml +13 -0
- package/permissions/autogenerated/commands/parse_pubkey.toml +13 -0
- package/permissions/autogenerated/commands/publish_batch_calendar_events.toml +13 -0
- package/permissions/autogenerated/commands/publish_calendar.toml +13 -0
- package/permissions/autogenerated/commands/publish_calendar_event.toml +13 -0
- package/permissions/autogenerated/commands/publish_chat_message.toml +13 -0
- package/permissions/autogenerated/commands/publish_rsvp.toml +13 -0
- package/permissions/autogenerated/commands/remove_bookmark.toml +13 -0
- package/permissions/autogenerated/commands/save_bookmark.toml +13 -0
- package/permissions/autogenerated/commands/send_direct_message.toml +13 -0
- package/permissions/autogenerated/commands/update_contact_list.toml +13 -0
- package/permissions/autogenerated/commands/verify_nsec.toml +13 -0
- package/permissions/autogenerated/reference.md +934 -0
- package/permissions/default.toml +38 -0
- package/permissions/schemas/schema.json +714 -0
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# tauri-plugin-nostrnative
|
|
2
|
+
|
|
3
|
+
A modular, high-performance Nostr library and Tauri plugin for Rust and JavaScript. Designed to be clean, easy to integrate, and highly customizable through feature flags.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Modular Design:** Only include the components you need (Calendar, Bookmarks, Blossom, etc.).
|
|
8
|
+
- **Tauri Integration:** First-class support for Tauri v2 with a seamless plugin system and typed frontend bindings.
|
|
9
|
+
- **Async-First:** Built on `tokio` and `nostr-sdk` for efficient network operations.
|
|
10
|
+
- **Comprehensive NIP Support:** Includes implementations for NIP-01, NIP-44 (Encryption), NIP-46 (Nostr Connect), NIP-51 (Bookmarks), NIP-52 (Calendar), and more.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### Rust (Backend)
|
|
15
|
+
|
|
16
|
+
Add `tauri-plugin-nostrnative` to your `src-tauri/Cargo.toml`:
|
|
17
|
+
|
|
18
|
+
```toml
|
|
19
|
+
[dependencies]
|
|
20
|
+
# Use specific features to keep your binary small
|
|
21
|
+
tauri-plugin-nostrnative = { path = "../../nostrnative", features = ["calendar", "bookmarks", "tauri-plugin"] }
|
|
22
|
+
|
|
23
|
+
# Or enable everything
|
|
24
|
+
# tauri-plugin-nostrnative = { path = "../../nostrnative", features = ["full", "tauri-plugin"] }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### JavaScript (Frontend)
|
|
28
|
+
|
|
29
|
+
Install the plugin bindings in your Tauri app's frontend directory:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install tauri-plugin-nostrnative
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Setup in Tauri
|
|
36
|
+
|
|
37
|
+
### 1. Register the Plugin
|
|
38
|
+
|
|
39
|
+
In your `src-tauri/src/lib.rs` (or `main.rs`), initialize the plugin:
|
|
40
|
+
|
|
41
|
+
```rust
|
|
42
|
+
pub fn run() {
|
|
43
|
+
tauri::Builder::default()
|
|
44
|
+
.plugin(tauri_plugin_nostrnative::init()) // Initialize the plugin
|
|
45
|
+
.run(tauri::generate_context!())
|
|
46
|
+
.expect("error while running tauri application");
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Use the JavaScript API
|
|
51
|
+
|
|
52
|
+
Import the typed bindings in your frontend code:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import * as nostr from 'tauri-plugin-nostrnative';
|
|
56
|
+
|
|
57
|
+
// Examples
|
|
58
|
+
const nsec = await nostr.generateNewNsec();
|
|
59
|
+
const pubkey = await nostr.parsePubkey(somePubkey);
|
|
60
|
+
|
|
61
|
+
const events = await nostr.fetchCalendarEvents(pubkey, ["wss://relay.damus.io"], {
|
|
62
|
+
rangeStart: Math.floor(Date.now() / 1000)
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Available Features
|
|
67
|
+
|
|
68
|
+
| Feature | Description |
|
|
69
|
+
| -------------- | ----------------------------------------------------------- |
|
|
70
|
+
| `keys` | Basic key management (generate, parse, verify). |
|
|
71
|
+
| `calendar` | Calendar events (NIP-52) and RSVPs. |
|
|
72
|
+
| `profile` | User profiles (NIP-01) and contact lists (NIP-02). |
|
|
73
|
+
| `messages` | Direct messages (NIP-44). |
|
|
74
|
+
| `bookmarks` | Public and private bookmarks (NIP-51). |
|
|
75
|
+
| `blossom` | Blob Storage Server Operations (mirror, upload, get). |
|
|
76
|
+
| `chat` | Advanced chat functionality with PNS key derivation. |
|
|
77
|
+
| `tauri-plugin` | Exports all enabled features as Tauri commands. |
|
|
78
|
+
| `full` | Enables all functional features (excluding `tauri-plugin`). |
|
|
79
|
+
|
|
80
|
+
## Standalone Library Usage
|
|
81
|
+
|
|
82
|
+
You can also use the core logic directly in any Rust project:
|
|
83
|
+
|
|
84
|
+
```rust
|
|
85
|
+
use tauri_plugin_nostrnative::calendar::fetch_calendar_events_core;
|
|
86
|
+
|
|
87
|
+
#[tokio::main]
|
|
88
|
+
async fn main() {
|
|
89
|
+
let relays = vec!["wss://relay.damus.io".to_string()];
|
|
90
|
+
let events = fetch_calendar_events_core(
|
|
91
|
+
"your_pubkey",
|
|
92
|
+
None, // nsec
|
|
93
|
+
&relays,
|
|
94
|
+
None, // start
|
|
95
|
+
None, // end
|
|
96
|
+
None, // authors
|
|
97
|
+
None // client_nsec
|
|
98
|
+
).await;
|
|
99
|
+
|
|
100
|
+
println!("Fetched events: {:?}", events);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Permissions
|
|
105
|
+
|
|
106
|
+
This plugin includes a set of default permissions. Check the `permissions/` directory for details on how to configure access to specific Nostr commands in your Tauri application.
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@tauri-apps/api/core');
|
|
4
|
+
|
|
5
|
+
// Keys
|
|
6
|
+
async function generateNewNsec() {
|
|
7
|
+
return await core.invoke('plugin:nostrnative|generate_new_nsec');
|
|
8
|
+
}
|
|
9
|
+
async function parsePubkey(pubkey) {
|
|
10
|
+
return await core.invoke('plugin:nostrnative|parse_pubkey', { pubkey });
|
|
11
|
+
}
|
|
12
|
+
async function verifyNsec(nsec) {
|
|
13
|
+
return await core.invoke('plugin:nostrnative|verify_nsec', { nsec });
|
|
14
|
+
}
|
|
15
|
+
// Calendar
|
|
16
|
+
async function fetchCalendarEvents(pubkey, relays, options) {
|
|
17
|
+
return await core.invoke('plugin:nostrnative|fetch_calendar_events', {
|
|
18
|
+
pubkey,
|
|
19
|
+
nsec: options?.nsec,
|
|
20
|
+
relays,
|
|
21
|
+
rangeStart: options?.rangeStart,
|
|
22
|
+
rangeEnd: options?.rangeEnd,
|
|
23
|
+
authors: options?.authors,
|
|
24
|
+
clientNsec: options?.clientNsec
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function publishBatchCalendarEvents(nsec, relays, events, clientNsec) {
|
|
28
|
+
return await core.invoke('plugin:nostrnative|publish_batch_calendar_events', {
|
|
29
|
+
nsec,
|
|
30
|
+
relays,
|
|
31
|
+
events,
|
|
32
|
+
clientNsec
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async function publishCalendarEvent(nsec, relays, eventData, clientNsec) {
|
|
36
|
+
return await core.invoke('plugin:nostrnative|publish_calendar_event', {
|
|
37
|
+
nsec,
|
|
38
|
+
relays,
|
|
39
|
+
eventData,
|
|
40
|
+
clientNsec
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async function deleteCalendarEvent(nsec, relays, eventIds, clientNsec) {
|
|
44
|
+
return await core.invoke('plugin:nostrnative|delete_calendar_event', {
|
|
45
|
+
nsec,
|
|
46
|
+
relays,
|
|
47
|
+
eventIds,
|
|
48
|
+
clientNsec
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async function fetchCalendars(pubkey, relays) {
|
|
52
|
+
return await core.invoke('plugin:nostrnative|fetch_calendars', {
|
|
53
|
+
pubkey,
|
|
54
|
+
relays
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function publishCalendar(nsec, relays, calendar, clientNsec) {
|
|
58
|
+
return await core.invoke('plugin:nostrnative|publish_calendar', {
|
|
59
|
+
nsec,
|
|
60
|
+
relays,
|
|
61
|
+
calendar,
|
|
62
|
+
clientNsec
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async function deleteCalendar(nsec, relays, identifier, clientNsec) {
|
|
66
|
+
return await core.invoke('plugin:nostrnative|delete_calendar', {
|
|
67
|
+
nsec,
|
|
68
|
+
relays,
|
|
69
|
+
identifier,
|
|
70
|
+
clientNsec
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// RSVP
|
|
74
|
+
async function fetchRsvps(eventCoordinate, relays) {
|
|
75
|
+
return await core.invoke('plugin:nostrnative|fetch_rsvps', {
|
|
76
|
+
eventCoordinate,
|
|
77
|
+
relays
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async function fetchUserRsvps(pubkey, relays) {
|
|
81
|
+
return await core.invoke('plugin:nostrnative|fetch_user_rsvps', {
|
|
82
|
+
pubkey,
|
|
83
|
+
relays
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async function fetchReceivedRsvps(pubkey, relays) {
|
|
87
|
+
return await core.invoke('plugin:nostrnative|fetch_received_rsvps', {
|
|
88
|
+
pubkey,
|
|
89
|
+
relays
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async function publishRsvp(nsec, relays, eventCoordinate, status, eventAuthor, clientNsec) {
|
|
93
|
+
return await core.invoke('plugin:nostrnative|publish_rsvp', {
|
|
94
|
+
nsec,
|
|
95
|
+
relays,
|
|
96
|
+
eventCoordinate,
|
|
97
|
+
status,
|
|
98
|
+
eventAuthor,
|
|
99
|
+
clientNsec
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Profile
|
|
103
|
+
async function fetchProfiles(pubkeys, relays) {
|
|
104
|
+
return await core.invoke('plugin:nostrnative|fetch_profiles', { pubkeys, relays });
|
|
105
|
+
}
|
|
106
|
+
async function fetchContactList(pubkey, relays) {
|
|
107
|
+
return await core.invoke('plugin:nostrnative|fetch_contact_list', {
|
|
108
|
+
pubkey,
|
|
109
|
+
relays
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async function updateContactList(nsec, relays, contacts, clientNsec) {
|
|
113
|
+
return await core.invoke('plugin:nostrnative|update_contact_list', {
|
|
114
|
+
nsec,
|
|
115
|
+
relays,
|
|
116
|
+
contacts,
|
|
117
|
+
clientNsec
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Messages
|
|
121
|
+
async function sendDirectMessage(nsec, receiverPubkey, message, relays, clientNsec) {
|
|
122
|
+
return await core.invoke('plugin:nostrnative|send_direct_message', {
|
|
123
|
+
nsec,
|
|
124
|
+
receiverPubkey,
|
|
125
|
+
message,
|
|
126
|
+
relays,
|
|
127
|
+
clientNsec
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Bookmarks
|
|
131
|
+
async function fetchBookmarks(pubkey, relays, nsec, clientNsec) {
|
|
132
|
+
return await core.invoke('plugin:nostrnative|fetch_bookmarks', {
|
|
133
|
+
pubkey,
|
|
134
|
+
nsec,
|
|
135
|
+
relays,
|
|
136
|
+
clientNsec
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async function fetchEventDetails(identifiers, relays) {
|
|
140
|
+
return await core.invoke('plugin:nostrnative|fetch_event_details', {
|
|
141
|
+
identifiers,
|
|
142
|
+
relays
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async function saveBookmark(nsec, relays, eventId, source, clientNsec) {
|
|
146
|
+
return await core.invoke('plugin:nostrnative|save_bookmark', {
|
|
147
|
+
nsec,
|
|
148
|
+
relays,
|
|
149
|
+
eventId,
|
|
150
|
+
source,
|
|
151
|
+
clientNsec
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async function removeBookmark(nsec, relays, eventId, source, clientNsec) {
|
|
155
|
+
return await core.invoke('plugin:nostrnative|remove_bookmark', {
|
|
156
|
+
nsec,
|
|
157
|
+
relays,
|
|
158
|
+
eventId,
|
|
159
|
+
source,
|
|
160
|
+
clientNsec
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
// Blossom
|
|
164
|
+
async function blossomMirror(serverUrl, nsec, url, clientNsec) {
|
|
165
|
+
return await core.invoke('plugin:nostrnative|blossom_mirror', {
|
|
166
|
+
serverUrl,
|
|
167
|
+
nsec,
|
|
168
|
+
url,
|
|
169
|
+
clientNsec
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
async function blossomUpload(serverUrl, nsec, filePath, clientNsec) {
|
|
173
|
+
return await core.invoke('plugin:nostrnative|blossom_upload', {
|
|
174
|
+
serverUrl,
|
|
175
|
+
nsec,
|
|
176
|
+
filePath,
|
|
177
|
+
clientNsec
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async function blossomUploadContent(serverUrl, nsec, content, filename, mediaType, clientNsec) {
|
|
181
|
+
return await core.invoke('plugin:nostrnative|blossom_upload_content', {
|
|
182
|
+
serverUrl,
|
|
183
|
+
nsec,
|
|
184
|
+
content,
|
|
185
|
+
filename,
|
|
186
|
+
mediaType,
|
|
187
|
+
clientNsec
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
async function blossomGetBlob(serverUrl, hash) {
|
|
191
|
+
return await core.invoke('plugin:nostrnative|blossom_get_blob', {
|
|
192
|
+
serverUrl,
|
|
193
|
+
hash
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
// Chat
|
|
197
|
+
async function derivePnsKeys(deviceKeyHex) {
|
|
198
|
+
return await core.invoke('plugin:nostrnative|derive_pns_keys', {
|
|
199
|
+
deviceKeyHex
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
async function createDiscoveryEvent(nsec, deviceKeyToStore, relays, clientNsec) {
|
|
203
|
+
return await core.invoke('plugin:nostrnative|create_discovery_event', {
|
|
204
|
+
nsec,
|
|
205
|
+
deviceKeyToStore,
|
|
206
|
+
relays,
|
|
207
|
+
clientNsec
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
async function decryptDiscoveryEvent(nsec, content, clientNsec) {
|
|
211
|
+
return await core.invoke('plugin:nostrnative|decrypt_discovery_event', {
|
|
212
|
+
nsec,
|
|
213
|
+
content,
|
|
214
|
+
clientNsec
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
async function publishChatMessage(pnsNsec, mainPubkey, msg, relays, clientNsec) {
|
|
218
|
+
return await core.invoke('plugin:nostrnative|publish_chat_message', {
|
|
219
|
+
pnsNsec,
|
|
220
|
+
mainPubkey,
|
|
221
|
+
msg,
|
|
222
|
+
relays,
|
|
223
|
+
clientNsec
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
async function decryptPnsEvent(pnsNsec, content, clientNsec) {
|
|
227
|
+
return await core.invoke('plugin:nostrnative|decrypt_pns_event', {
|
|
228
|
+
pnsNsec,
|
|
229
|
+
content,
|
|
230
|
+
clientNsec
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
async function fetchPnsEvents(pnsPubkey, relays, eventId) {
|
|
234
|
+
return await core.invoke('plugin:nostrnative|fetch_pns_events', {
|
|
235
|
+
pnsPubkey,
|
|
236
|
+
relays,
|
|
237
|
+
eventId
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function deleteChatMessages(pnsNsec, relays, eventIds, clientNsec) {
|
|
241
|
+
return await core.invoke('plugin:nostrnative|delete_chat_messages', {
|
|
242
|
+
pnsNsec,
|
|
243
|
+
relays,
|
|
244
|
+
eventIds,
|
|
245
|
+
clientNsec
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
async function fetchDiscoveryEvents(pubkey, relays) {
|
|
249
|
+
return await core.invoke('plugin:nostrnative|fetch_discovery_events', {
|
|
250
|
+
pubkey,
|
|
251
|
+
relays
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
exports.blossomGetBlob = blossomGetBlob;
|
|
256
|
+
exports.blossomMirror = blossomMirror;
|
|
257
|
+
exports.blossomUpload = blossomUpload;
|
|
258
|
+
exports.blossomUploadContent = blossomUploadContent;
|
|
259
|
+
exports.createDiscoveryEvent = createDiscoveryEvent;
|
|
260
|
+
exports.decryptDiscoveryEvent = decryptDiscoveryEvent;
|
|
261
|
+
exports.decryptPnsEvent = decryptPnsEvent;
|
|
262
|
+
exports.deleteCalendar = deleteCalendar;
|
|
263
|
+
exports.deleteCalendarEvent = deleteCalendarEvent;
|
|
264
|
+
exports.deleteChatMessages = deleteChatMessages;
|
|
265
|
+
exports.derivePnsKeys = derivePnsKeys;
|
|
266
|
+
exports.fetchBookmarks = fetchBookmarks;
|
|
267
|
+
exports.fetchCalendarEvents = fetchCalendarEvents;
|
|
268
|
+
exports.fetchCalendars = fetchCalendars;
|
|
269
|
+
exports.fetchContactList = fetchContactList;
|
|
270
|
+
exports.fetchDiscoveryEvents = fetchDiscoveryEvents;
|
|
271
|
+
exports.fetchEventDetails = fetchEventDetails;
|
|
272
|
+
exports.fetchPnsEvents = fetchPnsEvents;
|
|
273
|
+
exports.fetchProfiles = fetchProfiles;
|
|
274
|
+
exports.fetchReceivedRsvps = fetchReceivedRsvps;
|
|
275
|
+
exports.fetchRsvps = fetchRsvps;
|
|
276
|
+
exports.fetchUserRsvps = fetchUserRsvps;
|
|
277
|
+
exports.generateNewNsec = generateNewNsec;
|
|
278
|
+
exports.parsePubkey = parsePubkey;
|
|
279
|
+
exports.publishBatchCalendarEvents = publishBatchCalendarEvents;
|
|
280
|
+
exports.publishCalendar = publishCalendar;
|
|
281
|
+
exports.publishCalendarEvent = publishCalendarEvent;
|
|
282
|
+
exports.publishChatMessage = publishChatMessage;
|
|
283
|
+
exports.publishRsvp = publishRsvp;
|
|
284
|
+
exports.removeBookmark = removeBookmark;
|
|
285
|
+
exports.saveBookmark = saveBookmark;
|
|
286
|
+
exports.sendDirectMessage = sendDirectMessage;
|
|
287
|
+
exports.updateContactList = updateContactList;
|
|
288
|
+
exports.verifyNsec = verifyNsec;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export interface CalendarEventRequest {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
start: number;
|
|
5
|
+
end?: number;
|
|
6
|
+
location?: string;
|
|
7
|
+
is_all_day: boolean;
|
|
8
|
+
identifier: string;
|
|
9
|
+
reminder_minutes?: number;
|
|
10
|
+
old_event_id?: string;
|
|
11
|
+
calendar_id?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
p_tags?: string[];
|
|
14
|
+
is_private?: boolean;
|
|
15
|
+
parent?: string;
|
|
16
|
+
freq?: string;
|
|
17
|
+
until?: number;
|
|
18
|
+
use_different_timestamp?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CalendarRequest {
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
identifier: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Contact {
|
|
26
|
+
pubkey: string;
|
|
27
|
+
alias?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface UserProfile {
|
|
30
|
+
pubkey: string;
|
|
31
|
+
name?: string | null;
|
|
32
|
+
display_name?: string | null;
|
|
33
|
+
about?: string | null;
|
|
34
|
+
picture?: string | null;
|
|
35
|
+
banner?: string | null;
|
|
36
|
+
website?: string | null;
|
|
37
|
+
nip05?: string | null;
|
|
38
|
+
}
|
|
39
|
+
export type BookmarkSource = 'public' | 'private' | 'website';
|
|
40
|
+
export interface EventResponse {
|
|
41
|
+
id: string;
|
|
42
|
+
pubkey: string;
|
|
43
|
+
created_at: number;
|
|
44
|
+
kind: number;
|
|
45
|
+
tags: string[][];
|
|
46
|
+
content: string;
|
|
47
|
+
is_private: boolean;
|
|
48
|
+
bech32?: string;
|
|
49
|
+
private_tags?: string[][];
|
|
50
|
+
source?: BookmarkSource;
|
|
51
|
+
}
|
|
52
|
+
export interface ChatMessageRequest {
|
|
53
|
+
content: string;
|
|
54
|
+
conversation_id: string;
|
|
55
|
+
role: string;
|
|
56
|
+
client: string;
|
|
57
|
+
reply_to?: string;
|
|
58
|
+
event_id?: string;
|
|
59
|
+
context_ids?: string[];
|
|
60
|
+
blob_hashes?: string[];
|
|
61
|
+
}
|
|
62
|
+
export interface PnsDerivedKeys {
|
|
63
|
+
public_key: string;
|
|
64
|
+
secret_key: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function generateNewNsec(): Promise<string>;
|
|
67
|
+
export declare function parsePubkey(pubkey: string): Promise<string>;
|
|
68
|
+
export declare function verifyNsec(nsec: string): Promise<string>;
|
|
69
|
+
export declare function fetchCalendarEvents(pubkey: string, relays: string[], options?: {
|
|
70
|
+
nsec?: string;
|
|
71
|
+
rangeStart?: number;
|
|
72
|
+
rangeEnd?: number;
|
|
73
|
+
authors?: string[];
|
|
74
|
+
clientNsec?: string;
|
|
75
|
+
}): Promise<EventResponse[]>;
|
|
76
|
+
export declare function publishBatchCalendarEvents(nsec: string, relays: string[], events: CalendarEventRequest[], clientNsec?: string): Promise<string[]>;
|
|
77
|
+
export declare function publishCalendarEvent(nsec: string, relays: string[], eventData: CalendarEventRequest, clientNsec?: string): Promise<string>;
|
|
78
|
+
export declare function deleteCalendarEvent(nsec: string, relays: string[], eventIds: string[], clientNsec?: string): Promise<string>;
|
|
79
|
+
export declare function fetchCalendars(pubkey: string, relays: string[]): Promise<EventResponse[]>;
|
|
80
|
+
export declare function publishCalendar(nsec: string, relays: string[], calendar: CalendarRequest, clientNsec?: string): Promise<string>;
|
|
81
|
+
export declare function deleteCalendar(nsec: string, relays: string[], identifier: string, clientNsec?: string): Promise<string>;
|
|
82
|
+
export declare function fetchRsvps(eventCoordinate: string, relays: string[]): Promise<EventResponse[]>;
|
|
83
|
+
export declare function fetchUserRsvps(pubkey: string, relays: string[]): Promise<EventResponse[]>;
|
|
84
|
+
export declare function fetchReceivedRsvps(pubkey: string, relays: string[]): Promise<EventResponse[]>;
|
|
85
|
+
export declare function publishRsvp(nsec: string, relays: string[], eventCoordinate: string, status: string, eventAuthor?: string, clientNsec?: string): Promise<string>;
|
|
86
|
+
export declare function fetchProfiles(pubkeys: string[], relays: string[]): Promise<UserProfile[]>;
|
|
87
|
+
export declare function fetchContactList(pubkey: string, relays: string[]): Promise<Contact[]>;
|
|
88
|
+
export declare function updateContactList(nsec: string, relays: string[], contacts: Contact[], clientNsec?: string): Promise<string>;
|
|
89
|
+
export declare function sendDirectMessage(nsec: string, receiverPubkey: string, message: string, relays: string[], clientNsec?: string): Promise<string>;
|
|
90
|
+
export declare function fetchBookmarks(pubkey: string, relays: string[], nsec?: string, clientNsec?: string): Promise<EventResponse[]>;
|
|
91
|
+
export declare function fetchEventDetails(identifiers: string[], relays: string[]): Promise<EventResponse[]>;
|
|
92
|
+
export declare function saveBookmark(nsec: string, relays: string[], eventId: string, source: BookmarkSource, clientNsec?: string): Promise<string>;
|
|
93
|
+
export declare function removeBookmark(nsec: string, relays: string[], eventId: string, source: BookmarkSource, clientNsec?: string): Promise<string>;
|
|
94
|
+
export declare function blossomMirror(serverUrl: string, nsec: string, url: string, clientNsec?: string): Promise<string>;
|
|
95
|
+
export declare function blossomUpload(serverUrl: string, nsec: string, filePath: string, clientNsec?: string): Promise<string>;
|
|
96
|
+
export declare function blossomUploadContent(serverUrl: string, nsec: string, content: string, filename?: string, mediaType?: string, clientNsec?: string): Promise<string>;
|
|
97
|
+
export declare function blossomGetBlob(serverUrl: string, hash: string): Promise<number[]>;
|
|
98
|
+
export declare function derivePnsKeys(deviceKeyHex: string): Promise<PnsDerivedKeys>;
|
|
99
|
+
export declare function createDiscoveryEvent(nsec: string, deviceKeyToStore: string, relays: string[], clientNsec?: string): Promise<string>;
|
|
100
|
+
export declare function decryptDiscoveryEvent(nsec: string, content: string, clientNsec?: string): Promise<string>;
|
|
101
|
+
export declare function publishChatMessage(pnsNsec: string, mainPubkey: string, msg: ChatMessageRequest, relays: string[], clientNsec?: string): Promise<string>;
|
|
102
|
+
export declare function decryptPnsEvent(pnsNsec: string, content: string, clientNsec?: string): Promise<any>;
|
|
103
|
+
export declare function fetchPnsEvents(pnsPubkey: string, relays: string[], eventId?: string): Promise<EventResponse[]>;
|
|
104
|
+
export declare function deleteChatMessages(pnsNsec: string, relays: string[], eventIds: string[], clientNsec?: string): Promise<string>;
|
|
105
|
+
export declare function fetchDiscoveryEvents(pubkey: string, relays: string[]): Promise<EventResponse[]>;
|