agent-protocols 0.10.0 → 0.11.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.
@@ -0,0 +1,369 @@
1
+ // Generated from docs/protocols/agent-mail/1.0.schema.json; keep byte-for-byte equivalent as JSON.
2
+ export const MAIL_SCHEMA = {
3
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4
+ $id: "https://agent-protocols.dev/schemas/agent-mail/1.0.schema.json",
5
+ title: "Agent Mail Protocol 1.0",
6
+ description: "Structural definitions; signed objects and packets are closed, while Identity list/discovery extensions are retained. Strict I-JSON, Unicode scalar validity, canonical JCS, parsed URL origins, Ed25519 signatures, HPKE and all-zero X25519 checks, byte lengths, cross-field equality, lifetime bounds, reply binding, authorization, and stateful lifecycle requirements need semantic validation; passing this schema is not protocol conformance. Select a named definition for HTTP response objects.",
7
+ oneOf: [
8
+ {
9
+ $ref: "#/$defs/envelope",
10
+ },
11
+ {
12
+ $ref: "#/$defs/packet",
13
+ },
14
+ ],
15
+ $defs: {
16
+ agentId: {
17
+ type: "string",
18
+ pattern: "^did:agent:[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$(?![\\s\\S])",
19
+ },
20
+ hash32: {
21
+ type: "string",
22
+ pattern: "^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$(?![\\s\\S])",
23
+ },
24
+ id16: {
25
+ type: "string",
26
+ pattern: "^[A-Za-z0-9_-]{21}[AQgw]$(?![\\s\\S])",
27
+ },
28
+ signature: {
29
+ type: "string",
30
+ pattern: "^[A-Za-z0-9_-]{85}[AQgw]$(?![\\s\\S])",
31
+ },
32
+ base64url: {
33
+ type: "string",
34
+ pattern: "^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-][AQgw]|[A-Za-z0-9_-]{2}[AEIMQUYcgkosw048])?$(?![\\s\\S])",
35
+ },
36
+ timestampMs: {
37
+ type: "integer",
38
+ minimum: 0,
39
+ maximum: 9007199254740991,
40
+ },
41
+ positiveSafeInteger: {
42
+ type: "integer",
43
+ minimum: 1,
44
+ maximum: 9007199254740991,
45
+ },
46
+ httpsOrigin: {
47
+ type: "string",
48
+ pattern: "^https://[^/?#@\\s]+$(?![\\s\\S])",
49
+ not: {
50
+ pattern: ":443$(?![\\s\\S])",
51
+ },
52
+ description: "Approximate syntax only. Identity canonical HTTPS origin parsing and serialization are a semantic requirement.",
53
+ },
54
+ mailboxCardPayload: {
55
+ type: "object",
56
+ required: [
57
+ "mailbox_id",
58
+ "expires_at",
59
+ "receive_until",
60
+ "public_key",
61
+ "routes",
62
+ "max_packet_bytes",
63
+ ],
64
+ properties: {
65
+ mailbox_id: {
66
+ $ref: "#/$defs/id16",
67
+ },
68
+ expires_at: {
69
+ $ref: "#/$defs/timestampMs",
70
+ },
71
+ receive_until: {
72
+ $ref: "#/$defs/timestampMs",
73
+ },
74
+ public_key: {
75
+ $ref: "#/$defs/hash32",
76
+ },
77
+ routes: {
78
+ type: "array",
79
+ items: {
80
+ $ref: "#/$defs/httpsOrigin",
81
+ },
82
+ minItems: 0,
83
+ maxItems: 8,
84
+ uniqueItems: true,
85
+ },
86
+ max_packet_bytes: {
87
+ type: "integer",
88
+ minimum: 4096,
89
+ maximum: 1048576,
90
+ },
91
+ },
92
+ additionalProperties: false,
93
+ },
94
+ part: {
95
+ type: "object",
96
+ required: ["media_type", "data"],
97
+ properties: {
98
+ media_type: {
99
+ type: "string",
100
+ maxLength: 127,
101
+ pattern: "^[a-z0-9][a-z0-9!#$&^_.+\\-]*/[a-z0-9][a-z0-9!#$&^_.+\\-]*$(?![\\s\\S])",
102
+ },
103
+ data: {
104
+ $ref: "#/$defs/base64url",
105
+ },
106
+ name: {
107
+ type: "string",
108
+ minLength: 1,
109
+ maxLength: 255,
110
+ },
111
+ },
112
+ additionalProperties: false,
113
+ },
114
+ messagePayload: {
115
+ type: "object",
116
+ required: ["to", "expires_at", "thread_id", "parts"],
117
+ properties: {
118
+ to: {
119
+ $ref: "#/$defs/agentId",
120
+ },
121
+ expires_at: {
122
+ $ref: "#/$defs/timestampMs",
123
+ },
124
+ thread_id: {
125
+ $ref: "#/$defs/id16",
126
+ },
127
+ parts: {
128
+ type: "array",
129
+ items: {
130
+ $ref: "#/$defs/part",
131
+ },
132
+ minItems: 1,
133
+ maxItems: 32,
134
+ },
135
+ subject: {
136
+ type: "string",
137
+ maxLength: 1024,
138
+ },
139
+ in_reply_to: {
140
+ $ref: "#/$defs/hash32",
141
+ },
142
+ reply_card: {
143
+ $ref: "#/$defs/mailboxCardEnvelope",
144
+ },
145
+ },
146
+ additionalProperties: false,
147
+ },
148
+ mailboxCardEvent: {
149
+ type: "object",
150
+ required: ["protocol", "type", "actor", "created_at", "nonce", "payload"],
151
+ properties: {
152
+ protocol: {
153
+ const: "agent-mail/1.0",
154
+ },
155
+ type: {
156
+ const: "mailbox.publish",
157
+ },
158
+ actor: {
159
+ $ref: "#/$defs/agentId",
160
+ },
161
+ created_at: {
162
+ $ref: "#/$defs/timestampMs",
163
+ },
164
+ nonce: {
165
+ $ref: "#/$defs/positiveSafeInteger",
166
+ },
167
+ payload: {
168
+ $ref: "#/$defs/mailboxCardPayload",
169
+ },
170
+ },
171
+ additionalProperties: false,
172
+ },
173
+ mailboxCardEnvelope: {
174
+ type: "object",
175
+ required: ["event", "hash", "signature"],
176
+ properties: {
177
+ event: {
178
+ $ref: "#/$defs/mailboxCardEvent",
179
+ },
180
+ hash: {
181
+ $ref: "#/$defs/hash32",
182
+ },
183
+ signature: {
184
+ $ref: "#/$defs/signature",
185
+ },
186
+ },
187
+ additionalProperties: false,
188
+ },
189
+ messageEvent: {
190
+ type: "object",
191
+ required: ["protocol", "type", "actor", "created_at", "nonce", "payload"],
192
+ properties: {
193
+ protocol: {
194
+ const: "agent-mail/1.0",
195
+ },
196
+ type: {
197
+ const: "mail.message",
198
+ },
199
+ actor: {
200
+ $ref: "#/$defs/agentId",
201
+ },
202
+ created_at: {
203
+ $ref: "#/$defs/timestampMs",
204
+ },
205
+ nonce: {
206
+ $ref: "#/$defs/positiveSafeInteger",
207
+ },
208
+ payload: {
209
+ $ref: "#/$defs/messagePayload",
210
+ },
211
+ },
212
+ additionalProperties: false,
213
+ },
214
+ messageEnvelope: {
215
+ type: "object",
216
+ required: ["event", "hash", "signature"],
217
+ properties: {
218
+ event: {
219
+ $ref: "#/$defs/messageEvent",
220
+ },
221
+ hash: {
222
+ $ref: "#/$defs/hash32",
223
+ },
224
+ signature: {
225
+ $ref: "#/$defs/signature",
226
+ },
227
+ },
228
+ additionalProperties: false,
229
+ },
230
+ envelope: {
231
+ oneOf: [
232
+ {
233
+ $ref: "#/$defs/mailboxCardEnvelope",
234
+ },
235
+ {
236
+ $ref: "#/$defs/messageEnvelope",
237
+ },
238
+ ],
239
+ },
240
+ packetHeader: {
241
+ type: "object",
242
+ required: ["protocol", "mailbox_id", "card_hash", "expires_at"],
243
+ properties: {
244
+ protocol: {
245
+ const: "agent-mail/1.0",
246
+ },
247
+ mailbox_id: {
248
+ $ref: "#/$defs/id16",
249
+ },
250
+ card_hash: {
251
+ $ref: "#/$defs/hash32",
252
+ },
253
+ expires_at: {
254
+ $ref: "#/$defs/timestampMs",
255
+ },
256
+ },
257
+ additionalProperties: false,
258
+ },
259
+ packet: {
260
+ type: "object",
261
+ required: ["header", "enc", "ciphertext"],
262
+ properties: {
263
+ header: {
264
+ $ref: "#/$defs/packetHeader",
265
+ },
266
+ enc: {
267
+ $ref: "#/$defs/hash32",
268
+ },
269
+ ciphertext: {
270
+ allOf: [
271
+ {
272
+ $ref: "#/$defs/base64url",
273
+ },
274
+ ],
275
+ minLength: 1387,
276
+ maxLength: 1048576,
277
+ description: "Decoded length must be >= 1040 and 16 modulo 1024. Total JCS(packet) length must fit the card and protocol limits; these are semantic checks.",
278
+ },
279
+ },
280
+ additionalProperties: false,
281
+ },
282
+ cardAcceptedRecord: {
283
+ type: "object",
284
+ required: ["envelope", "accepted_at"],
285
+ properties: {
286
+ envelope: {
287
+ $ref: "#/$defs/mailboxCardEnvelope",
288
+ },
289
+ accepted_at: {
290
+ $ref: "#/$defs/timestampMs",
291
+ },
292
+ },
293
+ additionalProperties: false,
294
+ },
295
+ deliveryResult: {
296
+ type: "object",
297
+ required: ["packet_id", "accepted_at"],
298
+ properties: {
299
+ packet_id: {
300
+ $ref: "#/$defs/hash32",
301
+ },
302
+ accepted_at: {
303
+ $ref: "#/$defs/timestampMs",
304
+ },
305
+ },
306
+ additionalProperties: false,
307
+ },
308
+ packetRecord: {
309
+ type: "object",
310
+ required: ["packet_id", "packet", "accepted_at", "seq"],
311
+ properties: {
312
+ packet_id: {
313
+ $ref: "#/$defs/hash32",
314
+ },
315
+ packet: {
316
+ $ref: "#/$defs/packet",
317
+ },
318
+ accepted_at: {
319
+ $ref: "#/$defs/timestampMs",
320
+ },
321
+ seq: {
322
+ $ref: "#/$defs/positiveSafeInteger",
323
+ },
324
+ },
325
+ additionalProperties: false,
326
+ },
327
+ packetList: {
328
+ type: "object",
329
+ required: ["result"],
330
+ properties: {
331
+ result: {
332
+ type: "array",
333
+ items: {
334
+ $ref: "#/$defs/packetRecord",
335
+ },
336
+ minItems: 0,
337
+ maxItems: 1000,
338
+ },
339
+ next_cursor: {
340
+ type: "string",
341
+ minLength: 1,
342
+ },
343
+ },
344
+ additionalProperties: true,
345
+ },
346
+ discoveryDocument: {
347
+ type: "object",
348
+ required: ["protocol", "service"],
349
+ properties: {
350
+ protocol: {
351
+ const: "agent-mail/1.0",
352
+ },
353
+ service: {
354
+ $ref: "#/$defs/httpsOrigin",
355
+ },
356
+ features: {
357
+ type: "array",
358
+ items: {
359
+ type: "string",
360
+ },
361
+ uniqueItems: true,
362
+ },
363
+ },
364
+ additionalProperties: true,
365
+ description: "Mail defines no endpoint names; delivery paths are fixed at each card route. Other members are inert extensions.",
366
+ },
367
+ },
368
+ };
369
+ //# sourceMappingURL=mail-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-schema.js","sourceRoot":"","sources":["../src/m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;YACD,oBAAoB,EAAE,KAAK;SAC5B;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,QAAQ,CAAC;YACpB,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACL,IAAI,EAAE,sBAAsB;qBAC7B;oBACD,QAAQ,EAAE,CAAC;oBACX,QAAQ,EAAE,IAAI;iBACf;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,CAAC;iBACb;aACF;YACD,oBAAoB,EAAE,IAAI;SAC3B;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;YACjC,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,KAAK,EAAE,gBAAgB;iBACxB;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,qBAAqB;iBAC5B;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;qBACf;oBACD,WAAW,EAAE,IAAI;iBAClB;aACF;YACD,oBAAoB,EAAE,IAAI;YAC1B,WAAW,EACT,kHAAkH;SACrH;KACF;CACO,CAAC"}
package/dist/mail.d.ts ADDED
@@ -0,0 +1,232 @@
1
+ import { type NonceStore, type Event, type Envelope, type AcceptedRecord, type ListResponse } from "./identity.js";
2
+ export { MAIL_SCHEMA } from "./mail-schema.js";
3
+ export declare const MAIL_PROTOCOL = "agent-mail/1.0";
4
+ export declare const MAIL_MAX_TTL_MS: number;
5
+ export declare const MAIL_FUTURE_SKEW_MS = 300000;
6
+ export declare const MAIL_MAX_PACKET_BYTES = 1048576;
7
+ export interface MailboxCardPayload {
8
+ mailbox_id: string;
9
+ expires_at: number;
10
+ receive_until: number;
11
+ public_key: string;
12
+ routes: string[];
13
+ max_packet_bytes: number;
14
+ }
15
+ export type MailboxCard = Envelope<MailboxCardPayload>;
16
+ export interface MailPart {
17
+ media_type: string;
18
+ data: string;
19
+ name?: string;
20
+ }
21
+ export interface MailMessagePayload {
22
+ to: string;
23
+ expires_at: number;
24
+ thread_id: string;
25
+ parts: MailPart[];
26
+ subject?: string;
27
+ in_reply_to?: string;
28
+ reply_card?: MailboxCard;
29
+ }
30
+ export type MailLetter = Envelope<MailMessagePayload>;
31
+ export interface MailPacketHeader {
32
+ protocol: typeof MAIL_PROTOCOL;
33
+ mailbox_id: string;
34
+ card_hash: string;
35
+ expires_at: number;
36
+ }
37
+ export interface MailPacket {
38
+ header: MailPacketHeader;
39
+ enc: string;
40
+ ciphertext: string;
41
+ }
42
+ export interface MailDeliveryResult {
43
+ packet_id: string;
44
+ accepted_at: number;
45
+ }
46
+ export interface MailPacketRecord extends MailDeliveryResult {
47
+ packet: MailPacket;
48
+ seq: number;
49
+ }
50
+ export interface MailDiscovery {
51
+ protocol: typeof MAIL_PROTOCOL;
52
+ service: string;
53
+ features?: string[];
54
+ [key: string]: unknown;
55
+ }
56
+ export type MailCardRecord = AcceptedRecord<MailboxCardPayload>;
57
+ export type MailPacketList = ListResponse<MailPacketRecord> & {
58
+ [key: string]: unknown;
59
+ };
60
+ /** Canonical, strict I-JSON bytes. This never silently drops undefined members. */
61
+ export declare function mailCanonicalBytes(value: unknown): Uint8Array;
62
+ export declare function validateMailSchema(value: unknown, definition?: string): void;
63
+ export declare function decodeMailBytes(value: string, length?: number): Uint8Array;
64
+ export declare function newMailId(): string;
65
+ /** A parsed mailbox address (Mail Section 3.3). `routes` is empty for the stable form. */
66
+ export interface MailAddress {
67
+ owner: string;
68
+ mailbox_id: string;
69
+ routes: string[];
70
+ }
71
+ /** Parse `did:agent:<key>/mail/<mailbox_id>[?route=<origin>...]`. */
72
+ export declare function parseMailAddress(value: unknown): MailAddress;
73
+ /** Format the stable address, or a contact address when routes are given. */
74
+ export declare function formatMailAddress(owner: string, mailboxId: string, routes?: string[]): string;
75
+ export declare function mailTextPart(text: string, name?: string): MailPart;
76
+ /** Returns inert text only; does not render markup or perform network/file actions. */
77
+ export declare function mailPartText(part: MailPart): string;
78
+ /** Historical verification: shape, signature, owner, intrinsic times, routes, and key. */
79
+ export declare function validateMailboxCard(card: unknown, owner?: string): asserts card is MailboxCard;
80
+ /** A card usable for new encryption: not future-dated, open (non-empty routes), unexpired. */
81
+ export declare function validateMailSenderCard(card: unknown, owner: string, now?: number): asserts card is MailboxCard;
82
+ /** Historical verification of a signed letter; never advances live nonce state. */
83
+ export declare function validateMailLetter(letter: unknown): asserts letter is MailLetter;
84
+ export declare function mailboxPublishEvent(actor: string, createdAt: number, nonce: number, payload: MailboxCardPayload): Event<MailboxCardPayload>;
85
+ export declare function mailMessageEvent(actor: string, createdAt: number, nonce: number, payload: MailMessagePayload): Event<MailMessagePayload>;
86
+ /** Bind a reply to a known parent: participants, parent letter ID, and thread. */
87
+ export declare function validateMailReply(reply: MailLetter, parent: MailLetter): void;
88
+ export declare function validateMailPacket(packet: unknown, expectedId?: string): asserts packet is MailPacket;
89
+ export declare function mailPacketId(packet: MailPacket): string;
90
+ export declare function frameMailBytes(bytes: Uint8Array): Uint8Array;
91
+ export declare function unframeMailLetter(frame: Uint8Array): MailLetter;
92
+ /** Independent raw X25519 secret. Never derive this from an Identity signing key. */
93
+ export declare class MailEncryptionKey {
94
+ private secret;
95
+ private destroyed;
96
+ private constructor();
97
+ static generate(): MailEncryptionKey;
98
+ static fromBytes(secret: Uint8Array): MailEncryptionKey;
99
+ publicKey(): string;
100
+ /** Sensitive backup material: store only in an owner-controlled encrypted key store. */
101
+ exportSecret(): Uint8Array;
102
+ destroy(): void;
103
+ }
104
+ /** Stateless encryption with fresh HPKE randomness. Pin the card with MailCardCache first. */
105
+ export declare function sealMailPacket(letter: MailLetter, card: MailboxCard, now?: number): Promise<MailPacket>;
106
+ /** Verify/decrypt a queued letter; expiration of new acceptance is checked by MailInbox. */
107
+ export declare function openMailPacket(packet: MailPacket, card: MailboxCard, key: MailEncryptionKey, owner: string, now?: number, expectedId?: string): Promise<MailLetter>;
108
+ export interface MailCardCacheSnapshot {
109
+ version: 1;
110
+ pins: MailboxCard[];
111
+ }
112
+ /**
113
+ * Sender-side card pins: the greatest-nonce card seen per (owner, mailbox),
114
+ * including closed or expired cards. Persist the snapshot after every observe,
115
+ * even one that throws because the new pin is unusable.
116
+ */
117
+ export declare class MailCardCache {
118
+ private readonly pins;
119
+ constructor(snapshot?: MailCardCacheSnapshot);
120
+ private id;
121
+ snapshot(): MailCardCacheSnapshot;
122
+ /** Pin a verified card, then (by default) require that it is usable for new encryption. */
123
+ observe(card: MailboxCard, owner: string, now?: number, requireUsable?: boolean): MailboxCard;
124
+ /** Drop pins old enough that every earlier card of the mailbox has expired. */
125
+ prune(now?: number): void;
126
+ seal(letter: MailLetter, card: MailboxCard, now?: number): Promise<MailPacket>;
127
+ }
128
+ export interface MailKeyringSnapshot {
129
+ version: 1;
130
+ owner: string;
131
+ entries: {
132
+ card: MailboxCard;
133
+ secret: string;
134
+ }[];
135
+ }
136
+ /** Retained verified cards and their secrets, looked up by card hash until receive_until. */
137
+ export declare class MailKeyring {
138
+ readonly owner: string;
139
+ private readonly entries;
140
+ constructor(owner: string);
141
+ add(card: MailboxCard, key: MailEncryptionKey): void;
142
+ /** Sensitive snapshot, including raw encryption secrets. Protect it separately from logs and application data. */
143
+ exportSnapshot(): MailKeyringSnapshot;
144
+ static restore(snapshot: MailKeyringSnapshot): MailKeyring;
145
+ prune(now?: number): void;
146
+ open(packet: MailPacket, now?: number, expectedId?: string): Promise<MailLetter>;
147
+ }
148
+ export interface MailInboxSnapshot {
149
+ version: 1;
150
+ owner: string;
151
+ /** Accepted letter IDs and their signed expirations. */
152
+ accepted: [string, number][];
153
+ }
154
+ /**
155
+ * Cross-route letter deduplication. The application stores accepted letters;
156
+ * persist the snapshot with them before deleting relay copies or acting.
157
+ */
158
+ export declare class MailInbox {
159
+ readonly keyring: MailKeyring;
160
+ private readonly accepted;
161
+ constructor(keyring: MailKeyring, snapshot?: MailInboxSnapshot);
162
+ snapshot(): MailInboxSnapshot;
163
+ has(letterId: string): boolean;
164
+ accept(packet: MailPacket, now?: number, expectedId?: string): Promise<{
165
+ kind: "accepted" | "duplicate";
166
+ letter: MailLetter;
167
+ }>;
168
+ /** Forget letters whose signed expiration has passed; they can no longer be newly accepted. */
169
+ prune(now?: number): void;
170
+ }
171
+ export declare function validateMailDiscovery(value: unknown, service: string): asserts value is MailDiscovery;
172
+ /** Identity request JWT for this relay origin whose subject is the mailbox owner. */
173
+ export declare function validateMailOwnerJwt(token: string, service: string, owner: string, now?: number): void;
174
+ export declare function validateMailCardRecord(value: unknown, owner?: string, mailboxId?: string, hash?: string): asserts value is MailCardRecord;
175
+ export declare function validateMailDeliveryResult(value: unknown, packet?: MailPacket): asserts value is MailDeliveryResult;
176
+ export declare function validateMailPacketRecord(value: unknown, mailboxId?: string): asserts value is MailPacketRecord;
177
+ export declare function validateMailPacketList(value: unknown, mailboxId: string, limit?: number): asserts value is MailPacketList;
178
+ export interface MailRelaySnapshot {
179
+ version: 1;
180
+ origin: string;
181
+ mailboxes: {
182
+ current: MailCardRecord;
183
+ last_seq: number;
184
+ packets: MailPacketRecord[];
185
+ tombstones: {
186
+ packet_id: string;
187
+ accepted_at: number;
188
+ expires_at: number;
189
+ }[];
190
+ }[];
191
+ }
192
+ export interface MailRelayOptions {
193
+ clock?: () => number;
194
+ /** Service-wide Identity nonce cache, shared with other live-write protocols at this origin. */
195
+ nonceStore?: NonceStore;
196
+ /** Per-mailbox limits on retained packets. */
197
+ maxPackets?: number;
198
+ maxBytes?: number;
199
+ snapshot?: MailRelaySnapshot;
200
+ }
201
+ /**
202
+ * Synchronous process-local relay model. All validation precedes mutation;
203
+ * persist the snapshot atomically before emitting a successful HTTP response.
204
+ * The short-lived nonce cache is not part of the snapshot.
205
+ */
206
+ export declare class MailRelayStore {
207
+ readonly origin: string;
208
+ private readonly boxes;
209
+ private readonly nonces;
210
+ private readonly clock;
211
+ private readonly maxPackets;
212
+ private readonly maxBytes;
213
+ constructor(origin: string, options?: MailRelayOptions);
214
+ snapshot(): MailRelaySnapshot;
215
+ discovery(): MailDiscovery;
216
+ publish(card: MailboxCard, now?: number): MailCardRecord;
217
+ card(mailboxId: string): MailCardRecord;
218
+ publishJson(text: string, now?: number): MailCardRecord;
219
+ deliverJson(mailboxId: string, text: string, now?: number): MailDeliveryResult;
220
+ deliver(mailboxId: string, packet: MailPacket, now?: number): MailDeliveryResult;
221
+ private ownerBox;
222
+ list(mailboxId: string, jwt: string, options?: {
223
+ limit?: number;
224
+ cursor?: string;
225
+ now?: number;
226
+ }): MailPacketList;
227
+ delete(mailboxId: string, packetId: string, jwt: string, now?: number): void;
228
+ /** Drop expired packets and tombstones, then forget mailboxes whose current card's `receive_until` passed. */
229
+ prune(now?: number): void;
230
+ private dropExpired;
231
+ }
232
+ //# sourceMappingURL=mail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../src/mail.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAgB,CAAC;AAC7C,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAC1C,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAC7C,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,MA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