chirli 0.1.0 → 0.2.0
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/ARCHITECTURE.md +18 -20
- package/CONTRIBUTING.md +7 -3
- package/README.md +63 -55
- package/SECURITY.md +11 -11
- package/dist/allowlist.d.ts +3 -0
- package/dist/allowlist.js +9 -0
- package/dist/announcements.d.ts +4 -4
- package/dist/announcements.js +66 -34
- package/dist/attachments.d.ts +43 -0
- package/dist/attachments.js +340 -0
- package/dist/blossom.d.ts +2 -2
- package/dist/blossom.js +120 -66
- package/dist/bot-handlers.d.ts +9 -18
- package/dist/bot-handlers.js +125 -66
- package/dist/bot.d.ts +17 -20
- package/dist/bot.js +150 -55
- package/dist/client.d.ts +43 -39
- package/dist/client.js +476 -290
- package/dist/command-discovery.d.ts +2 -2
- package/dist/command-discovery.js +16 -7
- package/dist/command-schema.d.ts +2 -2
- package/dist/command-schema.js +62 -31
- package/dist/commands.d.ts +7 -6
- package/dist/commands.js +116 -51
- package/dist/defaults.js +13 -6
- package/dist/errors.d.ts +12 -12
- package/dist/errors.js +55 -18
- package/dist/inbox.d.ts +9 -7
- package/dist/inbox.js +107 -62
- package/dist/index.d.ts +25 -24
- package/dist/index.js +11 -11
- package/dist/key-sync.d.ts +4 -4
- package/dist/key-sync.js +88 -50
- package/dist/keys.d.ts +7 -6
- package/dist/keys.js +187 -93
- package/dist/message-storage-sqlite.d.ts +1 -1
- package/dist/message-storage-sqlite.js +32 -27
- package/dist/message-storage.d.ts +2 -2
- package/dist/messaging-metadata.d.ts +4 -4
- package/dist/messaging-metadata.js +73 -46
- package/dist/metadata.d.ts +3 -3
- package/dist/metadata.js +29 -15
- package/dist/modes.d.ts +7 -7
- package/dist/modes.js +53 -24
- package/dist/nip4e-compat.d.ts +2 -2
- package/dist/nip4e-compat.js +2 -2
- package/dist/nipcd.d.ts +14 -14
- package/dist/nipcd.js +225 -126
- package/dist/protocol.d.ts +7 -6
- package/dist/protocol.js +101 -54
- package/dist/public-inbox.d.ts +17 -15
- package/dist/public-inbox.js +129 -138
- package/dist/public-thread.d.ts +7 -4
- package/dist/public-thread.js +205 -88
- package/dist/relay-pool.d.ts +5 -5
- package/dist/relay-pool.js +172 -67
- package/dist/relay-roles.js +22 -13
- package/dist/relay.d.ts +11 -11
- package/dist/relay.js +194 -100
- package/dist/request-timing.d.ts +2 -2
- package/dist/request-timing.js +19 -7
- package/dist/session.js +7 -5
- package/dist/signer.d.ts +1 -1
- package/dist/signers/bunker-relays.d.ts +2 -2
- package/dist/signers/bunker-relays.js +16 -13
- package/dist/signers/bunker.d.ts +2 -2
- package/dist/signers/bunker.js +57 -37
- package/dist/signers/nsec.d.ts +2 -2
- package/dist/signers/nsec.js +8 -8
- package/dist/signers.d.ts +8 -8
- package/dist/signers.js +25 -18
- package/dist/storage-sqlite.d.ts +3 -1
- package/dist/storage-sqlite.js +110 -58
- package/dist/storage.d.ts +10 -6
- package/dist/store.d.ts +12 -8
- package/dist/store.js +156 -78
- package/docs/ACCESS.md +14 -25
- package/docs/API.md +125 -79
- package/docs/KEYS.md +3 -3
- package/docs/NIP-CD.md +29 -19
- package/docs/PUBLIC.md +33 -23
- package/docs/RECOVERY.md +7 -5
- package/docs/RELAYS.md +6 -6
- package/docs/SESSIONS.md +25 -21
- package/docs/SIGNERS.md +5 -3
- package/docs/STORAGE.md +15 -15
- package/docs/TUTORIAL.md +42 -39
- package/package.json +1 -37
- package/dist/inbound-policy.d.ts +0 -4
- package/dist/inbound-policy.js +0 -9
package/dist/storage-sqlite.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DatabaseSync } from
|
|
2
|
-
import { openSync, closeSync } from
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import { openSync, closeSync } from "node:fs";
|
|
3
3
|
/** Indexed relational storage. Query planning stays in the database. */
|
|
4
4
|
export class SQLiteStorage {
|
|
5
5
|
db;
|
|
6
|
-
constructor(path =
|
|
7
|
-
if (path !==
|
|
8
|
-
closeSync(openSync(path,
|
|
6
|
+
constructor(path = "psstpsst.sqlite") {
|
|
7
|
+
if (path !== ":memory:")
|
|
8
|
+
closeSync(openSync(path, "a", 0o600));
|
|
9
9
|
this.db = new DatabaseSync(path);
|
|
10
10
|
this.db.exec(`PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; PRAGMA busy_timeout=5000;
|
|
11
11
|
CREATE TABLE IF NOT EXISTS messages(account TEXT,id TEXT,peer TEXT,time INTEGER,payload TEXT,state TEXT,PRIMARY KEY(account,id));
|
|
@@ -13,6 +13,8 @@ export class SQLiteStorage {
|
|
|
13
13
|
CREATE INDEX IF NOT EXISTS message_list ON messages(account,time ASC,id ASC);
|
|
14
14
|
CREATE INDEX IF NOT EXISTS message_state ON messages(account,state,time ASC,id ASC);
|
|
15
15
|
CREATE INDEX IF NOT EXISTS message_unfinished ON messages(account,time ASC,id DESC) WHERE state IN ('pending','processing','failed');
|
|
16
|
+
CREATE TABLE IF NOT EXISTS dm_activations(pubkey TEXT PRIMARY KEY, activated_at INTEGER NOT NULL) WITHOUT ROWID;
|
|
17
|
+
CREATE TABLE IF NOT EXISTS input_claims(account TEXT,id TEXT,PRIMARY KEY(account,id)) WITHOUT ROWID;
|
|
16
18
|
CREATE TABLE IF NOT EXISTS outbox(account TEXT,id TEXT,payload TEXT,state TEXT,PRIMARY KEY(account,id));
|
|
17
19
|
CREATE INDEX IF NOT EXISTS outbox_state ON outbox(account,state,id);
|
|
18
20
|
CREATE TABLE IF NOT EXISTS evidence(account TEXT,peer TEXT,key TEXT,time INTEGER,id TEXT,PRIMARY KEY(account,peer));
|
|
@@ -23,147 +25,197 @@ export class SQLiteStorage {
|
|
|
23
25
|
}
|
|
24
26
|
/** Remove a committed handoff only after the message backend has durably accepted it. */
|
|
25
27
|
discardStagedMessage(account, id) {
|
|
26
|
-
this.db
|
|
28
|
+
this.db
|
|
29
|
+
.prepare("DELETE FROM messages WHERE account=? AND id=?")
|
|
30
|
+
.run(account, id);
|
|
27
31
|
}
|
|
28
32
|
insert(account, value) {
|
|
29
33
|
const row = value.record;
|
|
30
|
-
if (value.collection ===
|
|
34
|
+
if (value.collection === "messages") {
|
|
31
35
|
const message = value.record;
|
|
32
|
-
return this.db
|
|
33
|
-
.
|
|
36
|
+
return (this.db
|
|
37
|
+
.prepare("INSERT OR IGNORE INTO messages VALUES(?,?,?,?,?,?)")
|
|
38
|
+
.run(account, message.id, message.peer, message.time, message.payload, message.state).changes === 1);
|
|
34
39
|
}
|
|
35
|
-
if (value.collection !==
|
|
36
|
-
throw new TypeError(
|
|
37
|
-
return this.db
|
|
38
|
-
.
|
|
40
|
+
if (value.collection !== "outbox")
|
|
41
|
+
throw new TypeError("Invalid storage collection");
|
|
42
|
+
return (this.db
|
|
43
|
+
.prepare("INSERT OR IGNORE INTO outbox VALUES(?,?,?,?)")
|
|
44
|
+
.run(account, row.id, row.payload, row.state).changes === 1);
|
|
45
|
+
}
|
|
46
|
+
ensureDmActivation(pubkey, proposedAt) {
|
|
47
|
+
this.db
|
|
48
|
+
.prepare("INSERT OR IGNORE INTO dm_activations(pubkey, activated_at) VALUES(?,?)")
|
|
49
|
+
.run(pubkey, proposedAt);
|
|
50
|
+
return this.db
|
|
51
|
+
.prepare("SELECT activated_at FROM dm_activations WHERE pubkey=?")
|
|
52
|
+
.get(pubkey).activated_at;
|
|
53
|
+
}
|
|
54
|
+
claimInput(account, id) {
|
|
55
|
+
return (this.db
|
|
56
|
+
.prepare("INSERT OR IGNORE INTO input_claims(account,id) VALUES(?,?)")
|
|
57
|
+
.run(account, id).changes === 1);
|
|
39
58
|
}
|
|
40
59
|
queryMessages(account, query = {}) {
|
|
41
|
-
const timeOrder = query.order?.time ??
|
|
42
|
-
const idOrder = query.order?.id ??
|
|
43
|
-
if (![
|
|
44
|
-
|
|
60
|
+
const timeOrder = query.order?.time ?? "asc";
|
|
61
|
+
const idOrder = query.order?.id ?? "asc";
|
|
62
|
+
if (!["asc", "desc"].includes(timeOrder) ||
|
|
63
|
+
!["asc", "desc"].includes(idOrder)) {
|
|
64
|
+
throw new TypeError("Invalid message query ordering");
|
|
45
65
|
}
|
|
46
|
-
const where = [
|
|
66
|
+
const where = ["account=?"];
|
|
47
67
|
const parameters = [account];
|
|
48
68
|
if (query.id !== undefined) {
|
|
49
|
-
where.push(
|
|
69
|
+
where.push("id=?");
|
|
50
70
|
parameters.push(query.id);
|
|
51
71
|
}
|
|
52
72
|
if (query.peer !== undefined) {
|
|
53
|
-
where.push(
|
|
73
|
+
where.push("peer=?");
|
|
54
74
|
parameters.push(query.peer);
|
|
55
75
|
}
|
|
56
76
|
if (query.states) {
|
|
57
77
|
if (!query.states.length)
|
|
58
78
|
return [];
|
|
59
79
|
const states = [...new Set(query.states)];
|
|
60
|
-
if (!states.every(state => [
|
|
61
|
-
throw new TypeError(
|
|
62
|
-
if (states.length === 3 && !states.includes(
|
|
80
|
+
if (!states.every((state) => ["pending", "processing", "failed", "done"].includes(state)))
|
|
81
|
+
throw new TypeError("Invalid message query state");
|
|
82
|
+
if (states.length === 3 && !states.includes("done")) {
|
|
63
83
|
// Match the unfinished-work partial index without scanning completed history.
|
|
64
84
|
where.push("state IN ('pending','processing','failed')");
|
|
65
85
|
}
|
|
66
86
|
else {
|
|
67
|
-
where.push(`state IN (${states.map(() =>
|
|
87
|
+
where.push(`state IN (${states.map(() => "?").join(",")})`);
|
|
68
88
|
parameters.push(...states);
|
|
69
89
|
}
|
|
70
90
|
}
|
|
71
91
|
if (query.cursor) {
|
|
72
|
-
const timeComparison = timeOrder ===
|
|
73
|
-
const idComparison = idOrder ===
|
|
92
|
+
const timeComparison = timeOrder === "asc" ? ">" : "<";
|
|
93
|
+
const idComparison = idOrder === "asc" ? ">" : "<";
|
|
74
94
|
// The outer range condition lets SQLite seek to the cursor in the ordering index.
|
|
75
95
|
where.push(`time ${timeComparison}= ? AND (time ${timeComparison} ? OR (time=? AND id ${idComparison} ?))`);
|
|
76
96
|
parameters.push(query.cursor.time, query.cursor.time, query.cursor.time, query.cursor.id);
|
|
77
97
|
}
|
|
78
|
-
let sql = `SELECT id,peer,time,payload,state FROM messages WHERE ${where.join(
|
|
98
|
+
let sql = `SELECT id,peer,time,payload,state FROM messages WHERE ${where.join(" AND ")} ORDER BY time ${timeOrder},id ${idOrder}`;
|
|
79
99
|
if (query.limit !== undefined) {
|
|
80
100
|
if (!Number.isSafeInteger(query.limit) || query.limit < 0)
|
|
81
|
-
throw new TypeError(
|
|
82
|
-
sql +=
|
|
101
|
+
throw new TypeError("Invalid query limit");
|
|
102
|
+
sql += " LIMIT ?";
|
|
83
103
|
parameters.push(query.limit);
|
|
84
104
|
}
|
|
85
|
-
return this.db
|
|
105
|
+
return this.db
|
|
106
|
+
.prepare(sql)
|
|
107
|
+
.all(...parameters);
|
|
86
108
|
}
|
|
87
109
|
queryOutbox(account, query = {}) {
|
|
88
|
-
const where = [
|
|
110
|
+
const where = ["account=?"];
|
|
89
111
|
const parameters = [account];
|
|
90
112
|
if (query.id !== undefined) {
|
|
91
|
-
where.push(
|
|
113
|
+
where.push("id=?");
|
|
92
114
|
parameters.push(query.id);
|
|
93
115
|
}
|
|
94
116
|
if (query.state !== undefined) {
|
|
95
|
-
where.push(
|
|
117
|
+
where.push("state=?");
|
|
96
118
|
parameters.push(query.state);
|
|
97
119
|
}
|
|
98
|
-
let sql = `SELECT id,payload,state FROM outbox WHERE ${where.join(
|
|
120
|
+
let sql = `SELECT id,payload,state FROM outbox WHERE ${where.join(" AND ")} ORDER BY id ASC`;
|
|
99
121
|
if (query.limit !== undefined) {
|
|
100
122
|
if (!Number.isSafeInteger(query.limit) || query.limit < 0)
|
|
101
|
-
throw new TypeError(
|
|
102
|
-
sql +=
|
|
123
|
+
throw new TypeError("Invalid query limit");
|
|
124
|
+
sql += " LIMIT ?";
|
|
103
125
|
parameters.push(query.limit);
|
|
104
126
|
}
|
|
105
127
|
return this.db.prepare(sql).all(...parameters);
|
|
106
128
|
}
|
|
107
129
|
updateMessageState(account, id, state) {
|
|
108
|
-
if (![
|
|
109
|
-
throw new TypeError(
|
|
110
|
-
this.db
|
|
130
|
+
if (!["pending", "processing", "failed", "done"].includes(state))
|
|
131
|
+
throw new TypeError("Invalid message state");
|
|
132
|
+
this.db
|
|
133
|
+
.prepare("UPDATE messages SET state=? WHERE account=? AND id=?")
|
|
134
|
+
.run(state, account, id);
|
|
111
135
|
}
|
|
112
136
|
updateOutboxState(account, id, state) {
|
|
113
|
-
if (![
|
|
114
|
-
throw new TypeError(
|
|
115
|
-
this.db
|
|
137
|
+
if (!["pending", "relay-accepted"].includes(state))
|
|
138
|
+
throw new TypeError("Invalid outbox state");
|
|
139
|
+
this.db
|
|
140
|
+
.prepare("UPDATE outbox SET state=? WHERE account=? AND id=?")
|
|
141
|
+
.run(state, account, id);
|
|
116
142
|
}
|
|
117
143
|
getEvidence(a, p) {
|
|
118
|
-
return this.db
|
|
144
|
+
return this.db
|
|
145
|
+
.prepare("SELECT key,time,id FROM evidence WHERE account=? AND peer=?")
|
|
146
|
+
.get(a, p);
|
|
119
147
|
}
|
|
120
148
|
setEvidence(a, p, r) {
|
|
121
|
-
this.db
|
|
149
|
+
this.db
|
|
150
|
+
.prepare("INSERT INTO evidence VALUES(?,?,?,?,?) ON CONFLICT(account,peer) DO UPDATE SET key=excluded.key,time=excluded.time,id=excluded.id")
|
|
151
|
+
.run(a, p, r.key, r.time, r.id);
|
|
122
152
|
}
|
|
123
153
|
getDeclaration(a, p) {
|
|
124
|
-
const row = this.db
|
|
154
|
+
const row = this.db
|
|
155
|
+
.prepare("SELECT time,id,payload FROM peer_declarations WHERE account=? AND peer=?")
|
|
156
|
+
.get(a, p);
|
|
125
157
|
return row?.payload ? row : undefined;
|
|
126
158
|
}
|
|
127
159
|
setDeclaration(a, p, r) {
|
|
128
|
-
this.db
|
|
160
|
+
this.db
|
|
161
|
+
.prepare("INSERT INTO peer_declarations(account,peer,time,id,payload) VALUES(?,?,?,?,?) ON CONFLICT(account,peer) DO UPDATE SET time=excluded.time,id=excluded.id,payload=excluded.payload")
|
|
162
|
+
.run(a, p, r.time, r.id, r.payload);
|
|
129
163
|
}
|
|
130
164
|
markSplitPeer(a, p) {
|
|
131
|
-
this.db
|
|
165
|
+
this.db
|
|
166
|
+
.prepare("INSERT INTO peer_declarations(account,peer,split_seen) VALUES(?,?,1) ON CONFLICT(account,peer) DO UPDATE SET split_seen=1")
|
|
167
|
+
.run(a, p);
|
|
132
168
|
}
|
|
133
169
|
isSplitPeer(a, p) {
|
|
134
|
-
return this.db
|
|
170
|
+
return (this.db
|
|
171
|
+
.prepare("SELECT split_seen FROM peer_declarations WHERE account=? AND peer=?")
|
|
172
|
+
.get(a, p)?.split_seen === 1);
|
|
135
173
|
}
|
|
136
174
|
getSession(a, p) {
|
|
137
|
-
return this.db
|
|
175
|
+
return this.db
|
|
176
|
+
.prepare("SELECT payload FROM sessions WHERE account=? AND peer=?")
|
|
177
|
+
.get(a, p)?.payload;
|
|
138
178
|
}
|
|
139
179
|
setSession(a, p, payload) {
|
|
140
|
-
this.db
|
|
180
|
+
this.db
|
|
181
|
+
.prepare("INSERT INTO sessions VALUES(?,?,?) ON CONFLICT(account,peer) DO UPDATE SET payload=excluded.payload")
|
|
182
|
+
.run(a, p, payload);
|
|
141
183
|
}
|
|
142
184
|
getCheckpoint(a, r) {
|
|
143
|
-
return this.db
|
|
185
|
+
return this.db
|
|
186
|
+
.prepare("SELECT through FROM relay_checkpoints WHERE account=? AND relay=?")
|
|
187
|
+
.get(a, r)?.through;
|
|
144
188
|
}
|
|
145
189
|
setCheckpoint(a, r, t) {
|
|
146
|
-
this.db
|
|
190
|
+
this.db
|
|
191
|
+
.prepare("INSERT INTO relay_checkpoints VALUES(?,?,?) ON CONFLICT(account,relay) DO UPDATE SET through=excluded.through")
|
|
192
|
+
.run(a, r, t);
|
|
147
193
|
}
|
|
148
194
|
getKeyring(i) {
|
|
149
|
-
return this.db
|
|
195
|
+
return this.db
|
|
196
|
+
.prepare("SELECT payload FROM encryption_keyrings WHERE identity=?")
|
|
197
|
+
.get(i)?.payload;
|
|
150
198
|
}
|
|
151
199
|
setKeyring(i, p) {
|
|
152
|
-
this.db
|
|
200
|
+
this.db
|
|
201
|
+
.prepare("INSERT INTO encryption_keyrings VALUES(?,?) ON CONFLICT(identity) DO UPDATE SET payload=excluded.payload")
|
|
202
|
+
.run(i, p);
|
|
153
203
|
}
|
|
154
204
|
transaction(run) {
|
|
155
|
-
this.db.exec(
|
|
205
|
+
this.db.exec("BEGIN");
|
|
156
206
|
try {
|
|
157
207
|
run();
|
|
158
|
-
this.db.exec(
|
|
208
|
+
this.db.exec("COMMIT");
|
|
159
209
|
}
|
|
160
210
|
catch (error) {
|
|
161
211
|
try {
|
|
162
|
-
this.db.exec(
|
|
212
|
+
this.db.exec("ROLLBACK");
|
|
163
213
|
}
|
|
164
214
|
catch { }
|
|
165
215
|
throw error;
|
|
166
216
|
}
|
|
167
217
|
}
|
|
168
|
-
close() {
|
|
218
|
+
close() {
|
|
219
|
+
this.db.close();
|
|
220
|
+
}
|
|
169
221
|
}
|
package/dist/storage.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
export type StoragePayload = string & {
|
|
3
3
|
readonly __chirliPayload: unique symbol;
|
|
4
4
|
};
|
|
5
|
-
export type MessageState =
|
|
6
|
-
export type OutboxState =
|
|
5
|
+
export type MessageState = "pending" | "processing" | "failed" | "done";
|
|
6
|
+
export type OutboxState = "pending" | "relay-accepted";
|
|
7
7
|
export interface StoredMessage {
|
|
8
8
|
id: string;
|
|
9
9
|
peer: string;
|
|
@@ -17,10 +17,10 @@ export interface StoredOutbox {
|
|
|
17
17
|
state: OutboxState;
|
|
18
18
|
}
|
|
19
19
|
export type StorageRecord = {
|
|
20
|
-
collection:
|
|
20
|
+
collection: "messages";
|
|
21
21
|
record: StoredMessage;
|
|
22
22
|
} | {
|
|
23
|
-
collection:
|
|
23
|
+
collection: "outbox";
|
|
24
24
|
record: StoredOutbox;
|
|
25
25
|
};
|
|
26
26
|
export interface KeyEvidence {
|
|
@@ -43,8 +43,8 @@ export interface MessageQuery {
|
|
|
43
43
|
peer?: string;
|
|
44
44
|
states?: readonly MessageState[];
|
|
45
45
|
order?: {
|
|
46
|
-
time:
|
|
47
|
-
id:
|
|
46
|
+
time: "asc" | "desc";
|
|
47
|
+
id: "asc" | "desc";
|
|
48
48
|
};
|
|
49
49
|
cursor?: MessagePosition;
|
|
50
50
|
limit?: number;
|
|
@@ -60,6 +60,10 @@ export interface OutboxQuery {
|
|
|
60
60
|
export interface StorageAdapter {
|
|
61
61
|
/** Insert once by account + ID. Return false for an existing record without changing it. */
|
|
62
62
|
insert(account: string, value: StorageRecord): boolean;
|
|
63
|
+
/** Claim a canonical input ID within the account scope before application dispatch. */
|
|
64
|
+
claimInput(account: string, id: string): boolean;
|
|
65
|
+
/** Persist the first DM activation for an account identity, independent of mode. */
|
|
66
|
+
ensureDmActivation(pubkey: string, proposedAt: number): number;
|
|
63
67
|
queryMessages(account: string, query?: MessageQuery): StoredMessage[];
|
|
64
68
|
queryOutbox(account: string, query?: OutboxQuery): StoredOutbox[];
|
|
65
69
|
updateMessageState(account: string, id: string, state: MessageState): void;
|
package/dist/store.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import type { Event } from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
1
|
+
import type { Event } from "nostr-tools";
|
|
2
|
+
import type { FileAttachment } from "./attachments.js";
|
|
3
|
+
import { type Rumor } from "./protocol.js";
|
|
4
|
+
import type { StorageAdapter, MessageState } from "./storage.js";
|
|
5
|
+
import type { MessageStorage } from "./message-storage.js";
|
|
5
6
|
export interface Message {
|
|
6
7
|
id: string;
|
|
7
8
|
sender: string;
|
|
8
9
|
conversation: string;
|
|
9
10
|
text: string;
|
|
10
11
|
timestamp: number;
|
|
11
|
-
source:
|
|
12
|
-
direction:
|
|
12
|
+
source: "live" | "history";
|
|
13
|
+
direction: "incoming" | "outgoing";
|
|
13
14
|
rumor: Rumor;
|
|
15
|
+
file?: FileAttachment;
|
|
14
16
|
relay?: string;
|
|
15
|
-
/** ID of the
|
|
17
|
+
/** ID of the private parent referenced in the encrypted message. */
|
|
16
18
|
replyTo?: string;
|
|
17
19
|
}
|
|
18
20
|
export interface HistoryPage {
|
|
19
21
|
messages: Message[];
|
|
20
22
|
nextCursor?: string;
|
|
21
|
-
coverage:
|
|
23
|
+
coverage: "local-only";
|
|
22
24
|
complete: false;
|
|
23
25
|
}
|
|
24
26
|
export interface MessageListOptions {
|
|
@@ -48,6 +50,8 @@ export declare class Store {
|
|
|
48
50
|
private decode;
|
|
49
51
|
private decodeMessage;
|
|
50
52
|
insert(m: Message, state?: MessageState): boolean;
|
|
53
|
+
ensureDmActivation(pubkey: string, proposedAt: number): number;
|
|
54
|
+
claimInput(id: string): boolean;
|
|
51
55
|
private queryMessages;
|
|
52
56
|
state(id: string, state: MessageState): void;
|
|
53
57
|
pending(): Message[];
|