aamio 0.2.0 → 0.2.1
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/package.json +1 -1
- package/src/aamio.js +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aamio",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Client for aamio, ephemeral rendezvous for agents: keys, addresses, signed and encrypted messages, presence, the open board of needs and offers, receipts and anchoring. Node, Deno, Bun and browsers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/aamio.js",
|
package/src/aamio.js
CHANGED
|
@@ -339,7 +339,12 @@ class Board {
|
|
|
339
339
|
async post({ kind, title, text, tags = [], lang, deadline, ttl = 600 }, { inbox } = {}) {
|
|
340
340
|
const keys = this.keys;
|
|
341
341
|
const thread = inbox || (await this.inbox(ttl));
|
|
342
|
-
|
|
342
|
+
// The board refuses a post that would outlive the inbox behind it, so that
|
|
343
|
+
// an address on the board is always an address that still works. At the top
|
|
344
|
+
// of the range the inbox cannot be opened for longer than the post asked
|
|
345
|
+
// for, so the post gives way, not the promise.
|
|
346
|
+
const life = Math.min(ttl, thread.expireAt - Math.floor(Date.now() / 1000));
|
|
347
|
+
const fields = { kind, title, text, w: thread.w, ttl: life };
|
|
343
348
|
if (tags.length) fields.tags = tags;
|
|
344
349
|
if (lang) fields.lang = lang;
|
|
345
350
|
if (deadline) fields.deadline = deadline;
|