@estiva-app/protocol 0.18.0 → 0.20.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/CHANGELOG.md +106 -0
- package/dist/events.d.ts +40 -11
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +42 -11
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +36 -0
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +232 -2
- package/dist/media.js.map +1 -1
- package/package.json +1 -1
- package/src/events.ts +47 -16
- package/src/index.ts +3 -2
- package/src/media.ts +234 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,112 @@ Every entry answers the wire question explicitly, including when the answer is
|
|
|
4
4
|
nothing (ADR 0002 §4b). A change to the bytes an app publishes is a MAJOR — in
|
|
5
5
|
`0.x`, a MINOR — even when no TypeScript signature moved.
|
|
6
6
|
|
|
7
|
+
## 0.20.0 — 2026-09-11
|
|
8
|
+
|
|
9
|
+
**Wire behaviour: the shape of `kind:30840` changes, and nothing already
|
|
10
|
+
published can disagree** — production held zero of them when the shape changed
|
|
11
|
+
(measured 2026-09-10), and no consumer called the old builder.
|
|
12
|
+
|
|
13
|
+
- **New: `buildBareFile`, replacing `buildFile`.** `kind:30840` is now the
|
|
14
|
+
**bare file** — SPEC §6.7, decided in RFC 0.5 §10.7: a file no app owns,
|
|
15
|
+
which a Peek topic now is. Tag order is normative: `d`, `title`, `h`, then at
|
|
16
|
+
most one `a` naming the file it sits under, **of any kind**. `h` is required
|
|
17
|
+
by the builder even though the relay only says SHOULD, for the reason issues
|
|
18
|
+
already give: several apps write these and one forgetting it puts an
|
|
19
|
+
unreachable object in the shared space. Content is a §13.3 block document or
|
|
20
|
+
empty — not NIP-FC's component list, which blocks having ids (RIC-5) and
|
|
21
|
+
attachments being blocks (RFC 0.6 §3) made redundant.
|
|
22
|
+
- **Deprecated: `buildComponent`.** Nothing publishes or reads a `30841`; kept
|
|
23
|
+
until COM-3 decides whether the number is retired or repurposed.
|
|
24
|
+
- The `file` wire vector is re-recorded as `bare-file`, with the reason in its
|
|
25
|
+
note. This is the one case where re-recording is right: the guard exists to
|
|
26
|
+
catch an app's bytes *drifting*, and here no app had ever produced any.
|
|
27
|
+
|
|
28
|
+
## 0.19.0 — 2026-09-10
|
|
29
|
+
|
|
30
|
+
**Wire behaviour: the bytes an upload sends change.** `uploadBlob` now strips
|
|
31
|
+
an image's metadata before hashing it, so the blob's sha256 — and therefore the
|
|
32
|
+
`x` and `url` of the `imeta` that names it — differ from what the same file
|
|
33
|
+
would have produced in 0.18.0. Nothing already published can disagree, because
|
|
34
|
+
in 0.18.0 such an upload **failed**: the relay refused it. This turns a 422 into
|
|
35
|
+
a blob.
|
|
36
|
+
|
|
37
|
+
- **New: `canonicalizeImage`, and `uploadBlob` applies it by default.**
|
|
38
|
+
|
|
39
|
+
Buzz refuses media carrying metadata, structurally — `validate_image_metadata_free`
|
|
40
|
+
returns `MetadataForbidden` and the upload 422s with
|
|
41
|
+
`media contains metadata or a non-canonical metadata channel`. Its video path
|
|
42
|
+
names the piece that was missing: *"only the canonical primary stream produced
|
|
43
|
+
by the client sanitizer is permitted."* There was no client sanitizer, in
|
|
44
|
+
either app, so **an unmodified screenshot was refused every time** — capture
|
|
45
|
+
tools write a `pHYs` and a `tEXt` software tag, and neither is on Buzz's
|
|
46
|
+
rendering allowlist. `pHYs` is excluded deliberately; the relay's comment
|
|
47
|
+
calls arbitrary values an identity channel.
|
|
48
|
+
|
|
49
|
+
PNG: keeps the critical chunks and the eleven rendering ancillaries Buzz
|
|
50
|
+
allows, plus a single Buzz snapshot-manifest `tEXt` — stripping that would
|
|
51
|
+
leave a `.agent.png` that still looks like an image and silently no longer
|
|
52
|
+
carries its manifest. JPEG: keeps a canonical JFIF `APP0` and a 12-byte Adobe
|
|
53
|
+
`APP14`, drops `APP1`–`APP13` (EXIF lives in `APP1`), `APP15` and `COM`, and
|
|
54
|
+
truncates trailing bytes after `EOI`, which is where a metadata editor leaves
|
|
55
|
+
them.
|
|
56
|
+
|
|
57
|
+
**Chunks are dropped, never re-encoded.** A canvas round trip is the obvious
|
|
58
|
+
implementation and it does not work: the browser's encoder adds an ICC profile
|
|
59
|
+
back, which the relay refuses identically. Dropping is also lossless — every
|
|
60
|
+
chunk removed is ancillary by the format's own definition.
|
|
61
|
+
|
|
62
|
+
GIF and WebP pass through untouched. Their metadata is not a droppable chunk
|
|
63
|
+
(WebP records EXIF/ICC/XMP presence in `VP8X` flags that must stay consistent
|
|
64
|
+
with the chunks; GIF hides it in extension blocks) and a wrong rewrite makes a
|
|
65
|
+
corrupt image, which is worse than the refusal it replaces.
|
|
66
|
+
|
|
67
|
+
`canonicalize: false` opts out for a caller sending something it does not want
|
|
68
|
+
touched. It is not a way round a refusal — the relay's answer is the same.
|
|
69
|
+
|
|
70
|
+
## Backfill — 0.16.0 through 0.18.0
|
|
71
|
+
|
|
72
|
+
These three shipped without entries, which this file's own header forbids. The
|
|
73
|
+
omissions were mine. Recorded now rather than left as three published versions
|
|
74
|
+
whose wire question nobody answered. (`0.14.0` is still missing and is not mine
|
|
75
|
+
to reconstruct.)
|
|
76
|
+
|
|
77
|
+
## 0.18.0 — 2026-09-09
|
|
78
|
+
|
|
79
|
+
**Wire behaviour: unchanged in shape.** It adds a request an app did not make
|
|
80
|
+
before — `PUT /upload` — but nothing about a published event moves.
|
|
81
|
+
|
|
82
|
+
- **New: `uploadBlob`, `imetaFor`, `sha256Of`.** CON-12's write half. The
|
|
83
|
+
upload must land before the message that names it: ingest runs
|
|
84
|
+
`verify_imeta_blobs` and refuses a message whose blob it does not already
|
|
85
|
+
hold, so a dangling attachment cannot be published at all. `imetaFor` exists
|
|
86
|
+
because `m` and `x` must be the **relay's** answers about what it stored, not
|
|
87
|
+
the client's guess from a file extension — `validate_imeta_tags` compares them
|
|
88
|
+
and refuses with nothing to say which field was wrong.
|
|
89
|
+
|
|
90
|
+
## 0.17.0 — 2026-09-09
|
|
91
|
+
|
|
92
|
+
**Wire behaviour: unchanged.** Read-only; nothing is published.
|
|
93
|
+
|
|
94
|
+
- **New: `fetchBlob`, `sha256FromMediaUrl`.** Media GET is unconditionally
|
|
95
|
+
authenticated — `get_blob` calls `authenticate_media_read` before it touches
|
|
96
|
+
storage, and the `BUZZ_REQUIRE_MEDIA_GET_AUTH` flag that reads like an opt-in
|
|
97
|
+
is inert — so an `<img src>` answers 401 and every reader has to sign a `get`
|
|
98
|
+
authorization. Shared because both apps have the same problem with the same
|
|
99
|
+
relay, and one trap is genuinely surprising: **a thumbnail authorizes against
|
|
100
|
+
its parent hash**, since the relay splits `sha256_ext` on the first dot.
|
|
101
|
+
|
|
102
|
+
## 0.16.0 — 2026-09-08
|
|
103
|
+
|
|
104
|
+
**Wire behaviour: new.** Apps begin publishing an `imeta` tag on messages, and
|
|
105
|
+
signing a `kind:24242` that never existed here before.
|
|
106
|
+
|
|
107
|
+
- **New: `buildBlossomAuth`, `blossomAuthHeader`, `imetaTag`, `imetaOf`, `Imeta`.**
|
|
108
|
+
A `kind:24242` Blossom authorization (BUD-01/BUD-11) and the NIP-92 tag that
|
|
109
|
+
references a blob. Parsing lives here rather than in each app because the
|
|
110
|
+
relay refuses a malformed tag, and a second parser is a second set of refusals
|
|
111
|
+
to get wrong.
|
|
112
|
+
|
|
7
113
|
## 0.15.0 — 2026-09-07
|
|
8
114
|
|
|
9
115
|
**Wire behaviour: unchanged.** Nothing about what an app publishes moves, and
|
package/dist/events.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type BlockDocument } from './blocks.js';
|
|
1
2
|
/** A Nostr tag: an array of strings whose first element is the tag name. */
|
|
2
3
|
export type NostrTag = string[];
|
|
3
4
|
/** An event before signing. `pubkey` is 64-char lowercase hex. */
|
|
@@ -418,26 +419,54 @@ export interface Label {
|
|
|
418
419
|
value: string;
|
|
419
420
|
}
|
|
420
421
|
/**
|
|
421
|
-
* kind:30840
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
422
|
+
* kind:30840 — the bare file. SPEC §6.7, decided in RFC 0.5 §10.7.
|
|
423
|
+
*
|
|
424
|
+
* A file **no app owns**. A Peek topic is one; so is any subject nobody has
|
|
425
|
+
* built a specialized app for. Typed kinds — a project, an issue — add
|
|
426
|
+
* properties on top of this shape; the bare file adds none, and that absence is
|
|
427
|
+
* the point: its projection is built into `@estiva-app/interop` rather than
|
|
428
|
+
* published, so no `kind:31990` can claim it.
|
|
429
|
+
*
|
|
430
|
+
* **Tag order is normative** (SPEC §6.1 — it is part of the id preimage):
|
|
431
|
+
* `d`, `title`, `h`, then `a` if the file sits under another. The `h` is
|
|
432
|
+
* REQUIRED by SPEC even though the relay only says SHOULD: several apps write
|
|
433
|
+
* bare files, and one forgetting it would put an unreachable object in the
|
|
434
|
+
* shared space, which is the argument the relay already makes for issues.
|
|
435
|
+
*
|
|
436
|
+
* The parent may be of **any kind** — a project, an issue, another bare file,
|
|
437
|
+
* or a kind this package has never heard of. Re-parenting later is a `parent`
|
|
438
|
+
* change event (`kind:1851`), not a republish; the root tag seeds the value.
|
|
439
|
+
*
|
|
440
|
+
* `content` is a §13.3 block document, or empty. A topic that is only a
|
|
441
|
+
* conversation has nothing here; the day somebody types a brief at the top,
|
|
442
|
+
* this is where it goes, and nothing about the file "converts".
|
|
443
|
+
*
|
|
444
|
+
* This replaces the NIP-FC `buildFile`, whose component list was made
|
|
445
|
+
* redundant by blocks having ids (RIC-5) and attachments being blocks
|
|
446
|
+
* (RFC 0.6 §3). Zero NIP-FC files existed on production when the shape
|
|
447
|
+
* changed (measured 2026-09-10), and no consumer called the old builder.
|
|
425
448
|
*/
|
|
426
|
-
export declare function
|
|
427
|
-
/** Stable
|
|
449
|
+
export declare function buildBareFile(pubkey: string, createdAtMs: number, args: {
|
|
450
|
+
/** Stable id, an opaque uuid (RFC 0.4 §4.3). Never a slug. */
|
|
428
451
|
fileId: string;
|
|
429
452
|
title: string;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
453
|
+
/** The team's channel. Required — see above. */
|
|
454
|
+
channelUuid: string;
|
|
455
|
+
/** Address of the file this one sits under, of any kind. At most one. */
|
|
456
|
+
parent?: string;
|
|
457
|
+
/** The body, when there is one. Serialized with `serializeBlockDocument`. */
|
|
458
|
+
document?: BlockDocument;
|
|
435
459
|
}): UnsignedEvent;
|
|
436
460
|
/**
|
|
437
461
|
* kind:30841 Component — NIP-FC.
|
|
438
462
|
*
|
|
439
463
|
* `type` must be namespaced `<namespace>/<name>`. The protocol defines the
|
|
440
464
|
* container; the payload shape belongs to the type.
|
|
465
|
+
*
|
|
466
|
+
* @deprecated Nothing publishes one and nothing reads one: blocks carry their
|
|
467
|
+
* own ids (SPEC §13.3), attachments are blocks (RFC 0.6 §3), and the bare file
|
|
468
|
+
* above needs no component list. Kept until COM-3 decides whether `30841` is
|
|
469
|
+
* retired or repurposed; do not build on it.
|
|
441
470
|
*/
|
|
442
471
|
export declare function buildComponent(pubkey: string, createdAtMs: number, args: {
|
|
443
472
|
componentId: string;
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,aAAa,CAAA;AAExE,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAA;AAE/B,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,EAAE,CAAA;I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AAA;IAChB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAWhB"}
|
package/dist/events.js
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import { sha256 } from '@noble/hashes/sha256';
|
|
36
36
|
import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
|
|
37
|
+
import { serializeBlockDocument } from './blocks.js';
|
|
37
38
|
/**
|
|
38
39
|
* Buzz kind numbers used across the suite (crates/buzz-core/src/kind.rs).
|
|
39
40
|
*
|
|
@@ -573,28 +574,53 @@ export function buildResolution(pubkey, createdAtMs, args) {
|
|
|
573
574
|
};
|
|
574
575
|
}
|
|
575
576
|
/**
|
|
576
|
-
* kind:30840
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
577
|
+
* kind:30840 — the bare file. SPEC §6.7, decided in RFC 0.5 §10.7.
|
|
578
|
+
*
|
|
579
|
+
* A file **no app owns**. A Peek topic is one; so is any subject nobody has
|
|
580
|
+
* built a specialized app for. Typed kinds — a project, an issue — add
|
|
581
|
+
* properties on top of this shape; the bare file adds none, and that absence is
|
|
582
|
+
* the point: its projection is built into `@estiva-app/interop` rather than
|
|
583
|
+
* published, so no `kind:31990` can claim it.
|
|
584
|
+
*
|
|
585
|
+
* **Tag order is normative** (SPEC §6.1 — it is part of the id preimage):
|
|
586
|
+
* `d`, `title`, `h`, then `a` if the file sits under another. The `h` is
|
|
587
|
+
* REQUIRED by SPEC even though the relay only says SHOULD: several apps write
|
|
588
|
+
* bare files, and one forgetting it would put an unreachable object in the
|
|
589
|
+
* shared space, which is the argument the relay already makes for issues.
|
|
590
|
+
*
|
|
591
|
+
* The parent may be of **any kind** — a project, an issue, another bare file,
|
|
592
|
+
* or a kind this package has never heard of. Re-parenting later is a `parent`
|
|
593
|
+
* change event (`kind:1851`), not a republish; the root tag seeds the value.
|
|
594
|
+
*
|
|
595
|
+
* `content` is a §13.3 block document, or empty. A topic that is only a
|
|
596
|
+
* conversation has nothing here; the day somebody types a brief at the top,
|
|
597
|
+
* this is where it goes, and nothing about the file "converts".
|
|
598
|
+
*
|
|
599
|
+
* This replaces the NIP-FC `buildFile`, whose component list was made
|
|
600
|
+
* redundant by blocks having ids (RIC-5) and attachments being blocks
|
|
601
|
+
* (RFC 0.6 §3). Zero NIP-FC files existed on production when the shape
|
|
602
|
+
* changed (measured 2026-09-10), and no consumer called the old builder.
|
|
580
603
|
*/
|
|
581
|
-
export function
|
|
604
|
+
export function buildBareFile(pubkey, createdAtMs, args) {
|
|
582
605
|
assertHex64(pubkey, 'pubkey');
|
|
606
|
+
if (!args.channelUuid)
|
|
607
|
+
throw new Error('a bare file must name the team channel it lives in (h)');
|
|
608
|
+
if (args.parent !== undefined && !/^\d+:[0-9a-f]{64}:/.test(args.parent)) {
|
|
609
|
+
throw new Error(`parent must be an address "<kind>:<pubkey>:<d>", got "${args.parent}"`);
|
|
610
|
+
}
|
|
583
611
|
const tags = [
|
|
584
612
|
['d', args.fileId],
|
|
585
613
|
['title', args.title],
|
|
614
|
+
['h', args.channelUuid],
|
|
586
615
|
];
|
|
587
|
-
if (args.
|
|
588
|
-
tags.push(['
|
|
589
|
-
for (const d of args.componentDTags) {
|
|
590
|
-
tags.push(['a', addr(KIND.COMPONENT, pubkey, d)]);
|
|
591
|
-
}
|
|
616
|
+
if (args.parent)
|
|
617
|
+
tags.push(['a', args.parent]);
|
|
592
618
|
return {
|
|
593
619
|
pubkey,
|
|
594
620
|
created_at: toNostrSeconds(createdAtMs),
|
|
595
621
|
kind: KIND.FILE,
|
|
596
622
|
tags,
|
|
597
|
-
content: args.
|
|
623
|
+
content: args.document ? serializeBlockDocument(args.document) : '',
|
|
598
624
|
};
|
|
599
625
|
}
|
|
600
626
|
/**
|
|
@@ -602,6 +628,11 @@ export function buildFile(pubkey, createdAtMs, args) {
|
|
|
602
628
|
*
|
|
603
629
|
* `type` must be namespaced `<namespace>/<name>`. The protocol defines the
|
|
604
630
|
* container; the payload shape belongs to the type.
|
|
631
|
+
*
|
|
632
|
+
* @deprecated Nothing publishes one and nothing reads one: blocks carry their
|
|
633
|
+
* own ids (SPEC §13.3), attachments are blocks (RFC 0.6 §3), and the bare file
|
|
634
|
+
* above needs no component list. Kept until COM-3 decides whether `30841` is
|
|
635
|
+
* retired or repurposed; do not build on it.
|
|
605
636
|
*/
|
|
606
637
|
export function buildComponent(pubkey, createdAtMs, args) {
|
|
607
638
|
assertHex64(pubkey, 'pubkey');
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAoB7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,IAAI;IACpB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,IAAI;IACxB;;;;;;;;;;OAUG;IACH,SAAS,EAAE,IAAI;IACf;;;;;;;;OAQG;IACH,OAAO,EAAE,IAAI;IACb,wBAAwB;IACxB,SAAS,EAAE,IAAI;IACf;;;;;;;;;;;;;;OAcG;IACH,QAAQ,EAAE,KAAK;IACf,0EAA0E;IAC1E,IAAI,EAAE,KAAK;IACX,wBAAwB;IACxB,SAAS,EAAE,KAAK;IAChB;;;;;;;;OAQG;IACH,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB;;;;;;OAMG;IACH,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D,iEAAiE;IACjE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;QACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IAChD,CAAC;IACD,OAAO;QACL,MAAM;QACN,UAAU,EAAE,cAAc,CAAC,WAAW,CAAC;QACvC,IAAI,EAAE,IAAI,CAAC,SAAS;QACpB,IAAI;QACJ,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,UAAkB;IAC7C,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,CAAA;AACnC,CAAC;AAeD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAS3C;IACC,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;QACzD,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,IAAI,EAAE;YACJ,CAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC;SAC9B;QACD,OAAO,EAAE,EAAE;KACZ,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
/** Bumped by hand with the version in package.json — `test/version.test.ts`
|
|
47
47
|
* pins the two together. It exists so "the upgrade reached the app" can be
|
|
48
48
|
* checked by grepping a built bundle rather than by trusting a lockfile. */
|
|
49
|
-
export declare const PROTOCOL_VERSION = "0.
|
|
50
|
-
export { type NostrTag, type UnsignedEvent, type SignedEvent, type Profile, type ThreadRef, type ChannelVisibility, type ChannelKind, type MemberRole, type Label, type ResolutionAction, KIND, MAX_EMOJI_CHARS, MAX_MESSAGE_BYTES, MAX_MENTIONS, MAX_RATIONALE_BYTES, RELAY_AUTH_TOLERANCE_SECS, ASSERTION_SUBTYPE, computeEventId, toNostrSeconds, canonicalChannelName, threadTags, addr, relayAuthUrl, buildProfile, parseProfile, buildCreateChannel, buildDeleteChannel, buildEditChannelMetadata, buildAddMember, buildReaction, buildDeletion, buildEdit, buildMessage, buildResolution,
|
|
49
|
+
export declare const PROTOCOL_VERSION = "0.20.0";
|
|
50
|
+
export { type NostrTag, type UnsignedEvent, type SignedEvent, type Profile, type ThreadRef, type ChannelVisibility, type ChannelKind, type MemberRole, type Label, type ResolutionAction, KIND, MAX_EMOJI_CHARS, MAX_MESSAGE_BYTES, MAX_MENTIONS, MAX_RATIONALE_BYTES, RELAY_AUTH_TOLERANCE_SECS, ASSERTION_SUBTYPE, computeEventId, toNostrSeconds, canonicalChannelName, threadTags, addr, relayAuthUrl, buildProfile, parseProfile, buildCreateChannel, buildDeleteChannel, buildEditChannelMetadata, buildAddMember, buildReaction, buildDeletion, buildEdit, buildMessage, buildResolution, buildBareFile, buildComponent, buildHighlight, buildUnsignedRelayAuthEvent, } from './events.js';
|
|
51
51
|
export { type AddressPointer, type EventPointer, encodeNevent, decodeNevent, convertBits, bech32Encode, bech32Decode, encodeNaddr, decodeNaddr, pointerToAddress, addressToPointer, addrToNaddr, naddrToAddr, referenceToPointer, NADDR_RE, findNaddrs, stripNaddrs, encodeNpub, decodeNpub, NOSTR_URI_RE, findNostrUris, } from './nip19.js';
|
|
52
52
|
export { type AuthEventArgs, TIMESTAMP_TOLERANCE_SECS, normalizeUrl, buildUnsignedAuthEvent, base64, authorizationHeaderFor, authorizationHeader, } from './nip98.js';
|
|
53
53
|
export { type Signer, type SignerKind, publicKeyFromSecret, signEvent, secretKeySigner, } from './sign.js';
|
|
@@ -59,5 +59,5 @@ export { type Block, type BlockDocument, type KnownBlockType, KNOWN_BLOCK_TYPES,
|
|
|
59
59
|
export { type RenderInline, type RenderBlock, type RenderFormat, type ContentFormat, CONTENT_FORMAT_TAG, BLOCK_DOCUMENT_FORMAT, contentFormatOf, toRenderTree, renderTreeText, standaloneReference, referencesIn, } from './render.js';
|
|
60
60
|
export { markerTextToBlockDocument, blockDocumentToMarkerText, } from './bridge-content.js';
|
|
61
61
|
export { type BlockAnchor, BLOCK_ANCHOR_TAG, blockAnchorOf, resolveBlockAnchor, } from './anchors.js';
|
|
62
|
-
export { type BlossomVerb, type Imeta, BLOSSOM_AUTH_TTL_SECS, buildBlossomAuth, blossomAuthHeader, imetaTag, imetaOf, type BlobFetchLike, type BlobResponseLike, type FetchedBlob, sha256FromMediaUrl, fetchBlob, sha256Of, uploadBlob, imetaFor, type UploadedBlob, type BlobUploadFetchLike, } from './media.js';
|
|
62
|
+
export { type BlossomVerb, type Imeta, BLOSSOM_AUTH_TTL_SECS, buildBlossomAuth, blossomAuthHeader, imetaTag, imetaOf, type BlobFetchLike, type BlobResponseLike, type FetchedBlob, sha256FromMediaUrl, fetchBlob, sha256Of, uploadBlob, imetaFor, canonicalizeImage, type UploadedBlob, type BlobUploadFetchLike, } from './media.js';
|
|
63
63
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;4EAE4E;AAC5E,eAAO,MAAM,gBAAgB,WAAW,CAAA;AAExC,OAAO,EAEL,KAAK,QAAQ,EACb,KAA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BAAiB,GAClB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,KAAK,WAAW,EAChB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,GACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
/** Bumped by hand with the version in package.json — `test/version.test.ts`
|
|
47
47
|
* pins the two together. It exists so "the upgrade reached the app" can be
|
|
48
48
|
* checked by grepping a built bundle rather than by trusting a lockfile. */
|
|
49
|
-
export const PROTOCOL_VERSION = '0.
|
|
49
|
+
export const PROTOCOL_VERSION = '0.20.0';
|
|
50
50
|
export {
|
|
51
51
|
// constants
|
|
52
52
|
KIND, MAX_EMOJI_CHARS, MAX_MESSAGE_BYTES, MAX_MENTIONS, MAX_RATIONALE_BYTES, RELAY_AUTH_TOLERANCE_SECS, ASSERTION_SUBTYPE,
|
|
53
53
|
// the id preimage and the pieces that feed it
|
|
54
54
|
computeEventId, toNostrSeconds, canonicalChannelName, threadTags, addr, relayAuthUrl,
|
|
55
55
|
// builders
|
|
56
|
-
buildProfile, parseProfile, buildCreateChannel, buildDeleteChannel, buildEditChannelMetadata, buildAddMember, buildReaction, buildDeletion, buildEdit, buildMessage, buildResolution,
|
|
56
|
+
buildProfile, parseProfile, buildCreateChannel, buildDeleteChannel, buildEditChannelMetadata, buildAddMember, buildReaction, buildDeletion, buildEdit, buildMessage, buildResolution, buildBareFile, buildComponent, buildHighlight, buildUnsignedRelayAuthEvent, } from './events.js';
|
|
57
57
|
export { encodeNevent, decodeNevent, convertBits, bech32Encode, bech32Decode, encodeNaddr, decodeNaddr, pointerToAddress, addressToPointer, addrToNaddr, naddrToAddr, referenceToPointer, NADDR_RE, findNaddrs, stripNaddrs, encodeNpub, decodeNpub, NOSTR_URI_RE, findNostrUris, } from './nip19.js';
|
|
58
58
|
export { TIMESTAMP_TOLERANCE_SECS, normalizeUrl, buildUnsignedAuthEvent, base64, authorizationHeaderFor, authorizationHeader, } from './nip98.js';
|
|
59
59
|
export { publicKeyFromSecret, signEvent, secretKeySigner, } from './sign.js';
|
|
@@ -65,5 +65,5 @@ export { KNOWN_BLOCK_TYPES, BlockDocumentError, validateBlockDocument, parseBloc
|
|
|
65
65
|
export { CONTENT_FORMAT_TAG, BLOCK_DOCUMENT_FORMAT, contentFormatOf, toRenderTree, renderTreeText, standaloneReference, referencesIn, } from './render.js';
|
|
66
66
|
export { markerTextToBlockDocument, blockDocumentToMarkerText, } from './bridge-content.js';
|
|
67
67
|
export { BLOCK_ANCHOR_TAG, blockAnchorOf, resolveBlockAnchor, } from './anchors.js';
|
|
68
|
-
export { BLOSSOM_AUTH_TTL_SECS, buildBlossomAuth, blossomAuthHeader, imetaTag, imetaOf, sha256FromMediaUrl, fetchBlob, sha256Of, uploadBlob, imetaFor, } from './media.js';
|
|
68
|
+
export { BLOSSOM_AUTH_TTL_SECS, buildBlossomAuth, blossomAuthHeader, imetaTag, imetaOf, sha256FromMediaUrl, fetchBlob, sha256Of, uploadBlob, imetaFor, canonicalizeImage, } from './media.js';
|
|
69
69
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;4EAE4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AAExC,OAAO;AAYL,YAAY;AACZ,IAAI,EACJ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB;AACjB,8CAA8C;AAC9C,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,IAAI,EACJ,YAAY;AACZ,WAAW;AACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;4EAE4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AAExC,OAAO;AAYL,YAAY;AACZ,IAAI,EACJ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB;AACjB,8CAA8C;AAC9C,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,UAA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b,MAAM,aAAa,CAAA;AAEpB,OAAO,EAKL,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,gBAAgB,EAChB,aAAa,EACb,kBAAkB,GACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAGL,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EAIP,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,iBAAiB,GAGlB,MAAM,YAAY,CAAA"}
|
package/dist/media.d.ts
CHANGED
|
@@ -239,6 +239,8 @@ export declare function uploadBlob(args: {
|
|
|
239
239
|
sign: (unsigned: UnsignedEvent) => Promise<SignedEvent>;
|
|
240
240
|
pubkey: string;
|
|
241
241
|
transport?: BlobUploadFetchLike;
|
|
242
|
+
/** Skip {@link canonicalizeImage}. Default `true`; see the note below. */
|
|
243
|
+
canonicalize?: boolean;
|
|
242
244
|
}): Promise<UploadedBlob>;
|
|
243
245
|
/**
|
|
244
246
|
* An uploaded blob as the `imeta` that references it.
|
|
@@ -253,4 +255,38 @@ export declare function imetaFor(blob: UploadedBlob, extra?: {
|
|
|
253
255
|
alt?: string;
|
|
254
256
|
filename?: string;
|
|
255
257
|
}): Imeta;
|
|
258
|
+
/**
|
|
259
|
+
* Strip an image down to what the relay will store — SHA-25.
|
|
260
|
+
*
|
|
261
|
+
* Buzz refuses media carrying metadata, and refuses it *structurally* rather
|
|
262
|
+
* than by scrubbing it: `validate_image_metadata_free` returns
|
|
263
|
+
* `MetadataForbidden` and the whole upload 422s. Its video path names the piece
|
|
264
|
+
* that was missing — "only the canonical primary stream produced by the **client
|
|
265
|
+
* sanitizer** is permitted" — and until this there was no client sanitizer, in
|
|
266
|
+
* either app. An unmodified screenshot was refused, every time, because capture
|
|
267
|
+
* tools write `pHYs` and a `tEXt` software tag.
|
|
268
|
+
*
|
|
269
|
+
* ## Chunks are dropped, never re-encoded
|
|
270
|
+
*
|
|
271
|
+
* The obvious implementation is a canvas round trip, and it does not work: the
|
|
272
|
+
* browser's encoder **adds an ICC profile back**, which the relay refuses
|
|
273
|
+
* identically. Dropping chunks is also lossless — every chunk removed here is
|
|
274
|
+
* ancillary by the format's own definition — where a re-encode would quietly
|
|
275
|
+
* degrade a screenshot to make it acceptable.
|
|
276
|
+
*
|
|
277
|
+
* ## PNG and JPEG only
|
|
278
|
+
*
|
|
279
|
+
* GIF and WebP are accepted by the relay and are **passed through untouched**.
|
|
280
|
+
* Their metadata is not a droppable chunk: WebP records EXIF/ICC/XMP presence
|
|
281
|
+
* in `VP8X` flags that have to stay consistent with the chunks, and GIF hides
|
|
282
|
+
* it in extension blocks. Rewriting either wrongly produces a corrupt image,
|
|
283
|
+
* which is worse than the refusal it replaces — so they keep today's behaviour
|
|
284
|
+
* and the relay's own words. Screenshots are PNG or JPEG, which is the case
|
|
285
|
+
* that was actually costing anything.
|
|
286
|
+
*
|
|
287
|
+
* Throws on malformed input rather than returning the bytes unchanged: an image
|
|
288
|
+
* this cannot parse is one it cannot vouch for, and uploading it anyway would
|
|
289
|
+
* turn a clear failure here into an opaque 422 later.
|
|
290
|
+
*/
|
|
291
|
+
export declare function canonicalizeImage(bytes: ArrayBuffer | Uint8Array): Uint8Array;
|
|
256
292
|
//# sourceMappingURL=media.d.ts.map
|
package/dist/media.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAMvE,gEAAgE;AAChE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAA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.js
CHANGED
|
@@ -215,7 +215,35 @@ export function sha256Of(bytes) {
|
|
|
215
215
|
* Throws with the relay's own words. What that means is the caller's to decide.
|
|
216
216
|
*/
|
|
217
217
|
export async function uploadBlob(args) {
|
|
218
|
-
|
|
218
|
+
/*
|
|
219
|
+
Canonicalized first, and the hash taken after — SHA-25.
|
|
220
|
+
|
|
221
|
+
The relay refuses media carrying metadata, so an unmodified screenshot 422s:
|
|
222
|
+
capture tools write a `pHYs` and a `tEXt` software tag, and neither is on
|
|
223
|
+
Buzz's rendering allowlist. Doing it here rather than asking each caller to
|
|
224
|
+
remember means there is one place the relay's rule is understood, which is
|
|
225
|
+
the same argument that put `uploadBlob` in this package at all.
|
|
226
|
+
|
|
227
|
+
The order is forced. `x` in the authorization, `x-sha-256` on the PUT and
|
|
228
|
+
`x` in the `imeta` must all be the digest of the bytes the relay actually
|
|
229
|
+
stores, so hashing before stripping would name a blob that never existed.
|
|
230
|
+
|
|
231
|
+
`canonicalize: false` is for a caller that has already done it, or is
|
|
232
|
+
sending something this does not understand and does not want touched. It is
|
|
233
|
+
not a way round a refusal: the relay's answer does not change.
|
|
234
|
+
*/
|
|
235
|
+
const canonical = args.canonicalize === false
|
|
236
|
+
? args.bytes instanceof Uint8Array
|
|
237
|
+
? args.bytes
|
|
238
|
+
: new Uint8Array(args.bytes)
|
|
239
|
+
: canonicalizeImage(args.bytes);
|
|
240
|
+
/*
|
|
241
|
+
A standalone `ArrayBuffer`, because the transport's `body` is one and a
|
|
242
|
+
`Uint8Array` may be a window onto a larger buffer — sending `.buffer` would
|
|
243
|
+
upload whatever else is in it. One copy, against a network PUT.
|
|
244
|
+
*/
|
|
245
|
+
const payload = canonical.buffer.slice(canonical.byteOffset, canonical.byteOffset + canonical.byteLength);
|
|
246
|
+
const digest = sha256Of(payload);
|
|
219
247
|
const auth = await args.sign(buildBlossomAuth(args.pubkey, Date.now(), {
|
|
220
248
|
verb: 'upload',
|
|
221
249
|
sha256: digest,
|
|
@@ -230,7 +258,7 @@ export async function uploadBlob(args) {
|
|
|
230
258
|
'x-sha-256': digest,
|
|
231
259
|
'content-type': args.contentType || 'application/octet-stream',
|
|
232
260
|
},
|
|
233
|
-
body:
|
|
261
|
+
body: payload,
|
|
234
262
|
});
|
|
235
263
|
const body = await response.text();
|
|
236
264
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -278,4 +306,206 @@ export function imetaFor(blob, extra) {
|
|
|
278
306
|
filename: extra?.filename,
|
|
279
307
|
};
|
|
280
308
|
}
|
|
309
|
+
/* ────────────────────────────────────────────────────────────────────────────
|
|
310
|
+
Canonicalizing an image before it is uploaded — SHA-25
|
|
311
|
+
──────────────────────────────────────────────────────────────────────────── */
|
|
312
|
+
/**
|
|
313
|
+
* PNG ancillary chunks the relay treats as rendering rather than metadata.
|
|
314
|
+
*
|
|
315
|
+
* Exactly `known_rendering` in `buzz-media`'s `validate_png_metadata_free`.
|
|
316
|
+
* **`pHYs` is not on it**, deliberately: the relay's comment calls arbitrary
|
|
317
|
+
* values an identity channel, and nearly every screen-capture tool writes one.
|
|
318
|
+
* That single omission is why an ordinary screenshot is refused.
|
|
319
|
+
*/
|
|
320
|
+
const PNG_RENDERING_CHUNKS = new Set([
|
|
321
|
+
'cHRM', 'gAMA', 'sBIT', 'sRGB', 'bKGD', 'hIST', 'tRNS', 'sPLT', 'acTL', 'fcTL', 'fdAT',
|
|
322
|
+
]);
|
|
323
|
+
/**
|
|
324
|
+
* `tEXt` keywords the relay exempts — Buzz agent/team snapshot manifests.
|
|
325
|
+
*
|
|
326
|
+
* A deliberate product payload rather than metadata, so it is kept. Stripping
|
|
327
|
+
* it would leave a `.agent.png` that still looks like an image and silently no
|
|
328
|
+
* longer carries the thing it exists to carry, which is worse than a refusal.
|
|
329
|
+
*/
|
|
330
|
+
const PNG_SNAPSHOT_KEYWORDS = ['buzz_agent_snapshot', 'buzz_team_snapshot'];
|
|
331
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
332
|
+
/** A `tEXt` payload is `<keyword>\0<text>`. Only an allowlisted keyword survives. */
|
|
333
|
+
function isSnapshotText(payload) {
|
|
334
|
+
return PNG_SNAPSHOT_KEYWORDS.some((keyword) => {
|
|
335
|
+
if (payload.length <= keyword.length || payload[keyword.length] !== 0)
|
|
336
|
+
return false;
|
|
337
|
+
for (let i = 0; i < keyword.length; i++)
|
|
338
|
+
if (payload[i] !== keyword.charCodeAt(i))
|
|
339
|
+
return false;
|
|
340
|
+
return true;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function canonicalizePng(bytes) {
|
|
344
|
+
const kept = [new Uint8Array(PNG_SIGNATURE)];
|
|
345
|
+
let i = PNG_SIGNATURE.length;
|
|
346
|
+
let sawSnapshot = false;
|
|
347
|
+
let sawIend = false;
|
|
348
|
+
while (i < bytes.length) {
|
|
349
|
+
if (i + 12 > bytes.length)
|
|
350
|
+
throw new Error('malformed PNG: truncated chunk header');
|
|
351
|
+
const length = (bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3];
|
|
352
|
+
const type = String.fromCharCode(bytes[i + 4], bytes[i + 5], bytes[i + 6], bytes[i + 7]);
|
|
353
|
+
const end = i + 12 + length;
|
|
354
|
+
if (length < 0 || end > bytes.length)
|
|
355
|
+
throw new Error(`malformed PNG: truncated ${type} chunk`);
|
|
356
|
+
// Bit 5 of the first byte: lowercase means ancillary, and ancillary means
|
|
357
|
+
// droppable. Critical chunks are the image and are never touched.
|
|
358
|
+
const ancillary = (bytes[i + 4] & 0x20) !== 0;
|
|
359
|
+
let keep = !ancillary || PNG_RENDERING_CHUNKS.has(type);
|
|
360
|
+
if (type === 'tEXt') {
|
|
361
|
+
// One snapshot manifest survives; a second is a metadata channel again.
|
|
362
|
+
keep = !sawSnapshot && isSnapshotText(bytes.subarray(i + 8, end - 4));
|
|
363
|
+
if (keep)
|
|
364
|
+
sawSnapshot = true;
|
|
365
|
+
}
|
|
366
|
+
if (keep)
|
|
367
|
+
kept.push(bytes.subarray(i, end));
|
|
368
|
+
i = end;
|
|
369
|
+
if (type === 'IEND') {
|
|
370
|
+
sawIend = true;
|
|
371
|
+
break; // Anything after IEND is trailing data, which the relay refuses.
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (!sawIend)
|
|
375
|
+
throw new Error('malformed PNG: no IEND');
|
|
376
|
+
return concatBytes(kept);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* A JPEG segment the relay accepts.
|
|
380
|
+
*
|
|
381
|
+
* `APP0` and `APP14` are allowed only in their canonical colour-header forms —
|
|
382
|
+
* accepting an arbitrary payload under those markers would leave exactly the
|
|
383
|
+
* side channel the ban is for. `APP1`–`APP13`, `APP15` and `COM` are refused
|
|
384
|
+
* outright, and `APP1` is where EXIF lives.
|
|
385
|
+
*/
|
|
386
|
+
function keepJpegSegment(marker, payload) {
|
|
387
|
+
if (marker === 0xe0) {
|
|
388
|
+
const jfif = payload.length >= 14 && String.fromCharCode(...payload.subarray(0, 5)) === 'JFIF\0';
|
|
389
|
+
return jfif && payload.length === 14 + 3 * payload[12] * payload[13];
|
|
390
|
+
}
|
|
391
|
+
if (marker === 0xee) {
|
|
392
|
+
return payload.length === 12 && String.fromCharCode(...payload.subarray(0, 5)) === 'Adobe';
|
|
393
|
+
}
|
|
394
|
+
if ((marker >= 0xe1 && marker <= 0xed) || marker === 0xef || marker === 0xfe)
|
|
395
|
+
return false;
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
function canonicalizeJpeg(bytes) {
|
|
399
|
+
if (bytes[0] !== 0xff || bytes[1] !== 0xd8)
|
|
400
|
+
throw new Error('malformed JPEG: no SOI');
|
|
401
|
+
const kept = [new Uint8Array([0xff, 0xd8])];
|
|
402
|
+
let i = 2;
|
|
403
|
+
let inScan = false;
|
|
404
|
+
while (i < bytes.length) {
|
|
405
|
+
if (bytes[i] !== 0xff) {
|
|
406
|
+
// Entropy-coded data between SOS and the next marker. Copied verbatim —
|
|
407
|
+
// it is the image.
|
|
408
|
+
if (!inScan)
|
|
409
|
+
throw new Error('malformed JPEG: expected a marker');
|
|
410
|
+
const start = i;
|
|
411
|
+
while (i < bytes.length && bytes[i] !== 0xff)
|
|
412
|
+
i++;
|
|
413
|
+
kept.push(bytes.subarray(start, i));
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
// Fill bytes: any run of 0xFF before a marker. One is emitted.
|
|
417
|
+
while (i < bytes.length && bytes[i] === 0xff)
|
|
418
|
+
i++;
|
|
419
|
+
if (i >= bytes.length)
|
|
420
|
+
throw new Error('malformed JPEG: marker ran off the end');
|
|
421
|
+
const marker = bytes[i++];
|
|
422
|
+
// 0x00 is a stuffed byte inside the scan, not a marker; RSTn and TEM are
|
|
423
|
+
// standalone. All three are part of the image and carry no payload.
|
|
424
|
+
if ((inScan && marker === 0x00) || (marker >= 0xd0 && marker <= 0xd7) || marker === 0x01) {
|
|
425
|
+
kept.push(new Uint8Array([0xff, marker]));
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if (marker === 0xd9) {
|
|
429
|
+
// EOI. Stop here rather than copying on: the relay refuses trailing
|
|
430
|
+
// bytes after EOI, and that is where a stripped-EXIF editor leaves them.
|
|
431
|
+
kept.push(new Uint8Array([0xff, 0xd9]));
|
|
432
|
+
return concatBytes(kept);
|
|
433
|
+
}
|
|
434
|
+
if (marker === 0xd8)
|
|
435
|
+
throw new Error('malformed JPEG: a second SOI');
|
|
436
|
+
if (i + 2 > bytes.length)
|
|
437
|
+
throw new Error('malformed JPEG: truncated segment length');
|
|
438
|
+
const length = (bytes[i] << 8) | bytes[i + 1];
|
|
439
|
+
if (length < 2)
|
|
440
|
+
throw new Error('malformed JPEG: bad segment length');
|
|
441
|
+
const end = i + length;
|
|
442
|
+
if (end > bytes.length)
|
|
443
|
+
throw new Error('malformed JPEG: truncated segment');
|
|
444
|
+
if (keepJpegSegment(marker, bytes.subarray(i + 2, end))) {
|
|
445
|
+
kept.push(new Uint8Array([0xff, marker]), bytes.subarray(i, end));
|
|
446
|
+
}
|
|
447
|
+
i = end;
|
|
448
|
+
inScan = marker === 0xda;
|
|
449
|
+
}
|
|
450
|
+
throw new Error('malformed JPEG: no EOI');
|
|
451
|
+
}
|
|
452
|
+
function concatBytes(parts) {
|
|
453
|
+
let size = 0;
|
|
454
|
+
for (const part of parts)
|
|
455
|
+
size += part.length;
|
|
456
|
+
const out = new Uint8Array(size);
|
|
457
|
+
let at = 0;
|
|
458
|
+
for (const part of parts) {
|
|
459
|
+
out.set(part, at);
|
|
460
|
+
at += part.length;
|
|
461
|
+
}
|
|
462
|
+
return out;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Strip an image down to what the relay will store — SHA-25.
|
|
466
|
+
*
|
|
467
|
+
* Buzz refuses media carrying metadata, and refuses it *structurally* rather
|
|
468
|
+
* than by scrubbing it: `validate_image_metadata_free` returns
|
|
469
|
+
* `MetadataForbidden` and the whole upload 422s. Its video path names the piece
|
|
470
|
+
* that was missing — "only the canonical primary stream produced by the **client
|
|
471
|
+
* sanitizer** is permitted" — and until this there was no client sanitizer, in
|
|
472
|
+
* either app. An unmodified screenshot was refused, every time, because capture
|
|
473
|
+
* tools write `pHYs` and a `tEXt` software tag.
|
|
474
|
+
*
|
|
475
|
+
* ## Chunks are dropped, never re-encoded
|
|
476
|
+
*
|
|
477
|
+
* The obvious implementation is a canvas round trip, and it does not work: the
|
|
478
|
+
* browser's encoder **adds an ICC profile back**, which the relay refuses
|
|
479
|
+
* identically. Dropping chunks is also lossless — every chunk removed here is
|
|
480
|
+
* ancillary by the format's own definition — where a re-encode would quietly
|
|
481
|
+
* degrade a screenshot to make it acceptable.
|
|
482
|
+
*
|
|
483
|
+
* ## PNG and JPEG only
|
|
484
|
+
*
|
|
485
|
+
* GIF and WebP are accepted by the relay and are **passed through untouched**.
|
|
486
|
+
* Their metadata is not a droppable chunk: WebP records EXIF/ICC/XMP presence
|
|
487
|
+
* in `VP8X` flags that have to stay consistent with the chunks, and GIF hides
|
|
488
|
+
* it in extension blocks. Rewriting either wrongly produces a corrupt image,
|
|
489
|
+
* which is worse than the refusal it replaces — so they keep today's behaviour
|
|
490
|
+
* and the relay's own words. Screenshots are PNG or JPEG, which is the case
|
|
491
|
+
* that was actually costing anything.
|
|
492
|
+
*
|
|
493
|
+
* Throws on malformed input rather than returning the bytes unchanged: an image
|
|
494
|
+
* this cannot parse is one it cannot vouch for, and uploading it anyway would
|
|
495
|
+
* turn a clear failure here into an opaque 422 later.
|
|
496
|
+
*/
|
|
497
|
+
export function canonicalizeImage(bytes) {
|
|
498
|
+
const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
499
|
+
/*
|
|
500
|
+
Sniffed from the bytes, with no `contentType` argument at all. The MIME a
|
|
501
|
+
caller has is the browser's guess from a file extension — a `.png` that is
|
|
502
|
+
really a JPEG is ordinary — and this has the actual bytes in hand. Taking
|
|
503
|
+
the parameter would invite trusting it.
|
|
504
|
+
*/
|
|
505
|
+
if (PNG_SIGNATURE.every((byte, at) => view[at] === byte))
|
|
506
|
+
return canonicalizePng(view);
|
|
507
|
+
if (view[0] === 0xff && view[1] === 0xd8)
|
|
508
|
+
return canonicalizeJpeg(view);
|
|
509
|
+
return view;
|
|
510
|
+
}
|
|
281
511
|
//# sourceMappingURL=media.js.map
|
package/dist/media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAKhD,8EAA8E;AAC9E,MAAM,CAAC,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QACzB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QACjB,EAAE,IAAI,IAAI,CAAC,MAAM,CAAA;IACnB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA+B;IAC/D,MAAM,IAAI,GAAG,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;IACxE;;;;;MAKE;IACF,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;QAAE,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;IACtF,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACvE,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "The Estiva wire format: Buzz-shaped Nostr event builders, NIP-01 ids, NIP-19 naddr, NIP-98 HTTP auth, and the relay clients. Speaks the protocol; interprets nothing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/events.ts
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import { sha256 } from '@noble/hashes/sha256'
|
|
36
36
|
import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils'
|
|
37
|
+
import { type BlockDocument, serializeBlockDocument } from './blocks.js'
|
|
37
38
|
|
|
38
39
|
/** A Nostr tag: an array of strings whose first element is the tag name. */
|
|
39
40
|
export type NostrTag = string[]
|
|
@@ -726,40 +727,65 @@ export interface Label {
|
|
|
726
727
|
}
|
|
727
728
|
|
|
728
729
|
/**
|
|
729
|
-
* kind:30840
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
730
|
+
* kind:30840 — the bare file. SPEC §6.7, decided in RFC 0.5 §10.7.
|
|
731
|
+
*
|
|
732
|
+
* A file **no app owns**. A Peek topic is one; so is any subject nobody has
|
|
733
|
+
* built a specialized app for. Typed kinds — a project, an issue — add
|
|
734
|
+
* properties on top of this shape; the bare file adds none, and that absence is
|
|
735
|
+
* the point: its projection is built into `@estiva-app/interop` rather than
|
|
736
|
+
* published, so no `kind:31990` can claim it.
|
|
737
|
+
*
|
|
738
|
+
* **Tag order is normative** (SPEC §6.1 — it is part of the id preimage):
|
|
739
|
+
* `d`, `title`, `h`, then `a` if the file sits under another. The `h` is
|
|
740
|
+
* REQUIRED by SPEC even though the relay only says SHOULD: several apps write
|
|
741
|
+
* bare files, and one forgetting it would put an unreachable object in the
|
|
742
|
+
* shared space, which is the argument the relay already makes for issues.
|
|
743
|
+
*
|
|
744
|
+
* The parent may be of **any kind** — a project, an issue, another bare file,
|
|
745
|
+
* or a kind this package has never heard of. Re-parenting later is a `parent`
|
|
746
|
+
* change event (`kind:1851`), not a republish; the root tag seeds the value.
|
|
747
|
+
*
|
|
748
|
+
* `content` is a §13.3 block document, or empty. A topic that is only a
|
|
749
|
+
* conversation has nothing here; the day somebody types a brief at the top,
|
|
750
|
+
* this is where it goes, and nothing about the file "converts".
|
|
751
|
+
*
|
|
752
|
+
* This replaces the NIP-FC `buildFile`, whose component list was made
|
|
753
|
+
* redundant by blocks having ids (RIC-5) and attachments being blocks
|
|
754
|
+
* (RFC 0.6 §3). Zero NIP-FC files existed on production when the shape
|
|
755
|
+
* changed (measured 2026-09-10), and no consumer called the old builder.
|
|
733
756
|
*/
|
|
734
|
-
export function
|
|
757
|
+
export function buildBareFile(
|
|
735
758
|
pubkey: string,
|
|
736
759
|
createdAtMs: number,
|
|
737
760
|
args: {
|
|
738
|
-
/** Stable
|
|
761
|
+
/** Stable id, an opaque uuid (RFC 0.4 §4.3). Never a slug. */
|
|
739
762
|
fileId: string
|
|
740
763
|
title: string
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
764
|
+
/** The team's channel. Required — see above. */
|
|
765
|
+
channelUuid: string
|
|
766
|
+
/** Address of the file this one sits under, of any kind. At most one. */
|
|
767
|
+
parent?: string
|
|
768
|
+
/** The body, when there is one. Serialized with `serializeBlockDocument`. */
|
|
769
|
+
document?: BlockDocument
|
|
746
770
|
},
|
|
747
771
|
): UnsignedEvent {
|
|
748
772
|
assertHex64(pubkey, 'pubkey')
|
|
773
|
+
if (!args.channelUuid) throw new Error('a bare file must name the team channel it lives in (h)')
|
|
774
|
+
if (args.parent !== undefined && !/^\d+:[0-9a-f]{64}:/.test(args.parent)) {
|
|
775
|
+
throw new Error(`parent must be an address "<kind>:<pubkey>:<d>", got "${args.parent}"`)
|
|
776
|
+
}
|
|
749
777
|
const tags: NostrTag[] = [
|
|
750
778
|
['d', args.fileId],
|
|
751
779
|
['title', args.title],
|
|
780
|
+
['h', args.channelUuid],
|
|
752
781
|
]
|
|
753
|
-
if (args.
|
|
754
|
-
for (const d of args.componentDTags) {
|
|
755
|
-
tags.push(['a', addr(KIND.COMPONENT, pubkey, d)])
|
|
756
|
-
}
|
|
782
|
+
if (args.parent) tags.push(['a', args.parent])
|
|
757
783
|
return {
|
|
758
784
|
pubkey,
|
|
759
785
|
created_at: toNostrSeconds(createdAtMs),
|
|
760
786
|
kind: KIND.FILE,
|
|
761
787
|
tags,
|
|
762
|
-
content: args.
|
|
788
|
+
content: args.document ? serializeBlockDocument(args.document) : '',
|
|
763
789
|
}
|
|
764
790
|
}
|
|
765
791
|
|
|
@@ -768,6 +794,11 @@ export function buildFile(
|
|
|
768
794
|
*
|
|
769
795
|
* `type` must be namespaced `<namespace>/<name>`. The protocol defines the
|
|
770
796
|
* container; the payload shape belongs to the type.
|
|
797
|
+
*
|
|
798
|
+
* @deprecated Nothing publishes one and nothing reads one: blocks carry their
|
|
799
|
+
* own ids (SPEC §13.3), attachments are blocks (RFC 0.6 §3), and the bare file
|
|
800
|
+
* above needs no component list. Kept until COM-3 decides whether `30841` is
|
|
801
|
+
* retired or repurposed; do not build on it.
|
|
771
802
|
*/
|
|
772
803
|
export function buildComponent(
|
|
773
804
|
pubkey: string,
|
package/src/index.ts
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
/** Bumped by hand with the version in package.json — `test/version.test.ts`
|
|
48
48
|
* pins the two together. It exists so "the upgrade reached the app" can be
|
|
49
49
|
* checked by grepping a built bundle rather than by trusting a lockfile. */
|
|
50
|
-
export const PROTOCOL_VERSION = '0.
|
|
50
|
+
export const PROTOCOL_VERSION = '0.20.0'
|
|
51
51
|
|
|
52
52
|
export {
|
|
53
53
|
// types
|
|
@@ -88,7 +88,7 @@ export {
|
|
|
88
88
|
buildEdit,
|
|
89
89
|
buildMessage,
|
|
90
90
|
buildResolution,
|
|
91
|
-
|
|
91
|
+
buildBareFile,
|
|
92
92
|
buildComponent,
|
|
93
93
|
buildHighlight,
|
|
94
94
|
buildUnsignedRelayAuthEvent,
|
|
@@ -243,6 +243,7 @@ export {
|
|
|
243
243
|
sha256Of,
|
|
244
244
|
uploadBlob,
|
|
245
245
|
imetaFor,
|
|
246
|
+
canonicalizeImage,
|
|
246
247
|
type UploadedBlob,
|
|
247
248
|
type BlobUploadFetchLike,
|
|
248
249
|
} from './media.js'
|
package/src/media.ts
CHANGED
|
@@ -355,8 +355,42 @@ export async function uploadBlob(args: {
|
|
|
355
355
|
sign: (unsigned: UnsignedEvent) => Promise<SignedEvent>
|
|
356
356
|
pubkey: string
|
|
357
357
|
transport?: BlobUploadFetchLike
|
|
358
|
+
/** Skip {@link canonicalizeImage}. Default `true`; see the note below. */
|
|
359
|
+
canonicalize?: boolean
|
|
358
360
|
}): Promise<UploadedBlob> {
|
|
359
|
-
|
|
361
|
+
/*
|
|
362
|
+
Canonicalized first, and the hash taken after — SHA-25.
|
|
363
|
+
|
|
364
|
+
The relay refuses media carrying metadata, so an unmodified screenshot 422s:
|
|
365
|
+
capture tools write a `pHYs` and a `tEXt` software tag, and neither is on
|
|
366
|
+
Buzz's rendering allowlist. Doing it here rather than asking each caller to
|
|
367
|
+
remember means there is one place the relay's rule is understood, which is
|
|
368
|
+
the same argument that put `uploadBlob` in this package at all.
|
|
369
|
+
|
|
370
|
+
The order is forced. `x` in the authorization, `x-sha-256` on the PUT and
|
|
371
|
+
`x` in the `imeta` must all be the digest of the bytes the relay actually
|
|
372
|
+
stores, so hashing before stripping would name a blob that never existed.
|
|
373
|
+
|
|
374
|
+
`canonicalize: false` is for a caller that has already done it, or is
|
|
375
|
+
sending something this does not understand and does not want touched. It is
|
|
376
|
+
not a way round a refusal: the relay's answer does not change.
|
|
377
|
+
*/
|
|
378
|
+
const canonical =
|
|
379
|
+
args.canonicalize === false
|
|
380
|
+
? args.bytes instanceof Uint8Array
|
|
381
|
+
? args.bytes
|
|
382
|
+
: new Uint8Array(args.bytes)
|
|
383
|
+
: canonicalizeImage(args.bytes)
|
|
384
|
+
/*
|
|
385
|
+
A standalone `ArrayBuffer`, because the transport's `body` is one and a
|
|
386
|
+
`Uint8Array` may be a window onto a larger buffer — sending `.buffer` would
|
|
387
|
+
upload whatever else is in it. One copy, against a network PUT.
|
|
388
|
+
*/
|
|
389
|
+
const payload = canonical.buffer.slice(
|
|
390
|
+
canonical.byteOffset,
|
|
391
|
+
canonical.byteOffset + canonical.byteLength,
|
|
392
|
+
) as ArrayBuffer
|
|
393
|
+
const digest = sha256Of(payload)
|
|
360
394
|
const auth = await args.sign(
|
|
361
395
|
buildBlossomAuth(args.pubkey, Date.now(), {
|
|
362
396
|
verb: 'upload',
|
|
@@ -374,7 +408,7 @@ export async function uploadBlob(args: {
|
|
|
374
408
|
'x-sha-256': digest,
|
|
375
409
|
'content-type': args.contentType || 'application/octet-stream',
|
|
376
410
|
},
|
|
377
|
-
body:
|
|
411
|
+
body: payload,
|
|
378
412
|
})
|
|
379
413
|
|
|
380
414
|
const body = await response.text()
|
|
@@ -423,3 +457,201 @@ export function imetaFor(blob: UploadedBlob, extra?: { alt?: string; filename?:
|
|
|
423
457
|
filename: extra?.filename,
|
|
424
458
|
}
|
|
425
459
|
}
|
|
460
|
+
|
|
461
|
+
/* ────────────────────────────────────────────────────────────────────────────
|
|
462
|
+
Canonicalizing an image before it is uploaded — SHA-25
|
|
463
|
+
──────────────────────────────────────────────────────────────────────────── */
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* PNG ancillary chunks the relay treats as rendering rather than metadata.
|
|
467
|
+
*
|
|
468
|
+
* Exactly `known_rendering` in `buzz-media`'s `validate_png_metadata_free`.
|
|
469
|
+
* **`pHYs` is not on it**, deliberately: the relay's comment calls arbitrary
|
|
470
|
+
* values an identity channel, and nearly every screen-capture tool writes one.
|
|
471
|
+
* That single omission is why an ordinary screenshot is refused.
|
|
472
|
+
*/
|
|
473
|
+
const PNG_RENDERING_CHUNKS: ReadonlySet<string> = new Set([
|
|
474
|
+
'cHRM', 'gAMA', 'sBIT', 'sRGB', 'bKGD', 'hIST', 'tRNS', 'sPLT', 'acTL', 'fcTL', 'fdAT',
|
|
475
|
+
])
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* `tEXt` keywords the relay exempts — Buzz agent/team snapshot manifests.
|
|
479
|
+
*
|
|
480
|
+
* A deliberate product payload rather than metadata, so it is kept. Stripping
|
|
481
|
+
* it would leave a `.agent.png` that still looks like an image and silently no
|
|
482
|
+
* longer carries the thing it exists to carry, which is worse than a refusal.
|
|
483
|
+
*/
|
|
484
|
+
const PNG_SNAPSHOT_KEYWORDS = ['buzz_agent_snapshot', 'buzz_team_snapshot'] as const
|
|
485
|
+
|
|
486
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]
|
|
487
|
+
|
|
488
|
+
/** A `tEXt` payload is `<keyword>\0<text>`. Only an allowlisted keyword survives. */
|
|
489
|
+
function isSnapshotText(payload: Uint8Array): boolean {
|
|
490
|
+
return PNG_SNAPSHOT_KEYWORDS.some((keyword) => {
|
|
491
|
+
if (payload.length <= keyword.length || payload[keyword.length] !== 0) return false
|
|
492
|
+
for (let i = 0; i < keyword.length; i++) if (payload[i] !== keyword.charCodeAt(i)) return false
|
|
493
|
+
return true
|
|
494
|
+
})
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function canonicalizePng(bytes: Uint8Array): Uint8Array {
|
|
498
|
+
const kept: Uint8Array[] = [new Uint8Array(PNG_SIGNATURE)]
|
|
499
|
+
let i = PNG_SIGNATURE.length
|
|
500
|
+
let sawSnapshot = false
|
|
501
|
+
let sawIend = false
|
|
502
|
+
|
|
503
|
+
while (i < bytes.length) {
|
|
504
|
+
if (i + 12 > bytes.length) throw new Error('malformed PNG: truncated chunk header')
|
|
505
|
+
const length = (bytes[i] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3]
|
|
506
|
+
const type = String.fromCharCode(bytes[i + 4], bytes[i + 5], bytes[i + 6], bytes[i + 7])
|
|
507
|
+
const end = i + 12 + length
|
|
508
|
+
if (length < 0 || end > bytes.length) throw new Error(`malformed PNG: truncated ${type} chunk`)
|
|
509
|
+
|
|
510
|
+
// Bit 5 of the first byte: lowercase means ancillary, and ancillary means
|
|
511
|
+
// droppable. Critical chunks are the image and are never touched.
|
|
512
|
+
const ancillary = (bytes[i + 4] & 0x20) !== 0
|
|
513
|
+
let keep = !ancillary || PNG_RENDERING_CHUNKS.has(type)
|
|
514
|
+
if (type === 'tEXt') {
|
|
515
|
+
// One snapshot manifest survives; a second is a metadata channel again.
|
|
516
|
+
keep = !sawSnapshot && isSnapshotText(bytes.subarray(i + 8, end - 4))
|
|
517
|
+
if (keep) sawSnapshot = true
|
|
518
|
+
}
|
|
519
|
+
if (keep) kept.push(bytes.subarray(i, end))
|
|
520
|
+
|
|
521
|
+
i = end
|
|
522
|
+
if (type === 'IEND') {
|
|
523
|
+
sawIend = true
|
|
524
|
+
break // Anything after IEND is trailing data, which the relay refuses.
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (!sawIend) throw new Error('malformed PNG: no IEND')
|
|
528
|
+
return concatBytes(kept)
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* A JPEG segment the relay accepts.
|
|
533
|
+
*
|
|
534
|
+
* `APP0` and `APP14` are allowed only in their canonical colour-header forms —
|
|
535
|
+
* accepting an arbitrary payload under those markers would leave exactly the
|
|
536
|
+
* side channel the ban is for. `APP1`–`APP13`, `APP15` and `COM` are refused
|
|
537
|
+
* outright, and `APP1` is where EXIF lives.
|
|
538
|
+
*/
|
|
539
|
+
function keepJpegSegment(marker: number, payload: Uint8Array): boolean {
|
|
540
|
+
if (marker === 0xe0) {
|
|
541
|
+
const jfif = payload.length >= 14 && String.fromCharCode(...payload.subarray(0, 5)) === 'JFIF\0'
|
|
542
|
+
return jfif && payload.length === 14 + 3 * payload[12] * payload[13]
|
|
543
|
+
}
|
|
544
|
+
if (marker === 0xee) {
|
|
545
|
+
return payload.length === 12 && String.fromCharCode(...payload.subarray(0, 5)) === 'Adobe'
|
|
546
|
+
}
|
|
547
|
+
if ((marker >= 0xe1 && marker <= 0xed) || marker === 0xef || marker === 0xfe) return false
|
|
548
|
+
return true
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function canonicalizeJpeg(bytes: Uint8Array): Uint8Array {
|
|
552
|
+
if (bytes[0] !== 0xff || bytes[1] !== 0xd8) throw new Error('malformed JPEG: no SOI')
|
|
553
|
+
const kept: Uint8Array[] = [new Uint8Array([0xff, 0xd8])]
|
|
554
|
+
let i = 2
|
|
555
|
+
let inScan = false
|
|
556
|
+
|
|
557
|
+
while (i < bytes.length) {
|
|
558
|
+
if (bytes[i] !== 0xff) {
|
|
559
|
+
// Entropy-coded data between SOS and the next marker. Copied verbatim —
|
|
560
|
+
// it is the image.
|
|
561
|
+
if (!inScan) throw new Error('malformed JPEG: expected a marker')
|
|
562
|
+
const start = i
|
|
563
|
+
while (i < bytes.length && bytes[i] !== 0xff) i++
|
|
564
|
+
kept.push(bytes.subarray(start, i))
|
|
565
|
+
continue
|
|
566
|
+
}
|
|
567
|
+
// Fill bytes: any run of 0xFF before a marker. One is emitted.
|
|
568
|
+
while (i < bytes.length && bytes[i] === 0xff) i++
|
|
569
|
+
if (i >= bytes.length) throw new Error('malformed JPEG: marker ran off the end')
|
|
570
|
+
const marker = bytes[i++]
|
|
571
|
+
|
|
572
|
+
// 0x00 is a stuffed byte inside the scan, not a marker; RSTn and TEM are
|
|
573
|
+
// standalone. All three are part of the image and carry no payload.
|
|
574
|
+
if ((inScan && marker === 0x00) || (marker >= 0xd0 && marker <= 0xd7) || marker === 0x01) {
|
|
575
|
+
kept.push(new Uint8Array([0xff, marker]))
|
|
576
|
+
continue
|
|
577
|
+
}
|
|
578
|
+
if (marker === 0xd9) {
|
|
579
|
+
// EOI. Stop here rather than copying on: the relay refuses trailing
|
|
580
|
+
// bytes after EOI, and that is where a stripped-EXIF editor leaves them.
|
|
581
|
+
kept.push(new Uint8Array([0xff, 0xd9]))
|
|
582
|
+
return concatBytes(kept)
|
|
583
|
+
}
|
|
584
|
+
if (marker === 0xd8) throw new Error('malformed JPEG: a second SOI')
|
|
585
|
+
|
|
586
|
+
if (i + 2 > bytes.length) throw new Error('malformed JPEG: truncated segment length')
|
|
587
|
+
const length = (bytes[i] << 8) | bytes[i + 1]
|
|
588
|
+
if (length < 2) throw new Error('malformed JPEG: bad segment length')
|
|
589
|
+
const end = i + length
|
|
590
|
+
if (end > bytes.length) throw new Error('malformed JPEG: truncated segment')
|
|
591
|
+
|
|
592
|
+
if (keepJpegSegment(marker, bytes.subarray(i + 2, end))) {
|
|
593
|
+
kept.push(new Uint8Array([0xff, marker]), bytes.subarray(i, end))
|
|
594
|
+
}
|
|
595
|
+
i = end
|
|
596
|
+
inScan = marker === 0xda
|
|
597
|
+
}
|
|
598
|
+
throw new Error('malformed JPEG: no EOI')
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function concatBytes(parts: readonly Uint8Array[]): Uint8Array {
|
|
602
|
+
let size = 0
|
|
603
|
+
for (const part of parts) size += part.length
|
|
604
|
+
const out = new Uint8Array(size)
|
|
605
|
+
let at = 0
|
|
606
|
+
for (const part of parts) {
|
|
607
|
+
out.set(part, at)
|
|
608
|
+
at += part.length
|
|
609
|
+
}
|
|
610
|
+
return out
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Strip an image down to what the relay will store — SHA-25.
|
|
615
|
+
*
|
|
616
|
+
* Buzz refuses media carrying metadata, and refuses it *structurally* rather
|
|
617
|
+
* than by scrubbing it: `validate_image_metadata_free` returns
|
|
618
|
+
* `MetadataForbidden` and the whole upload 422s. Its video path names the piece
|
|
619
|
+
* that was missing — "only the canonical primary stream produced by the **client
|
|
620
|
+
* sanitizer** is permitted" — and until this there was no client sanitizer, in
|
|
621
|
+
* either app. An unmodified screenshot was refused, every time, because capture
|
|
622
|
+
* tools write `pHYs` and a `tEXt` software tag.
|
|
623
|
+
*
|
|
624
|
+
* ## Chunks are dropped, never re-encoded
|
|
625
|
+
*
|
|
626
|
+
* The obvious implementation is a canvas round trip, and it does not work: the
|
|
627
|
+
* browser's encoder **adds an ICC profile back**, which the relay refuses
|
|
628
|
+
* identically. Dropping chunks is also lossless — every chunk removed here is
|
|
629
|
+
* ancillary by the format's own definition — where a re-encode would quietly
|
|
630
|
+
* degrade a screenshot to make it acceptable.
|
|
631
|
+
*
|
|
632
|
+
* ## PNG and JPEG only
|
|
633
|
+
*
|
|
634
|
+
* GIF and WebP are accepted by the relay and are **passed through untouched**.
|
|
635
|
+
* Their metadata is not a droppable chunk: WebP records EXIF/ICC/XMP presence
|
|
636
|
+
* in `VP8X` flags that have to stay consistent with the chunks, and GIF hides
|
|
637
|
+
* it in extension blocks. Rewriting either wrongly produces a corrupt image,
|
|
638
|
+
* which is worse than the refusal it replaces — so they keep today's behaviour
|
|
639
|
+
* and the relay's own words. Screenshots are PNG or JPEG, which is the case
|
|
640
|
+
* that was actually costing anything.
|
|
641
|
+
*
|
|
642
|
+
* Throws on malformed input rather than returning the bytes unchanged: an image
|
|
643
|
+
* this cannot parse is one it cannot vouch for, and uploading it anyway would
|
|
644
|
+
* turn a clear failure here into an opaque 422 later.
|
|
645
|
+
*/
|
|
646
|
+
export function canonicalizeImage(bytes: ArrayBuffer | Uint8Array): Uint8Array {
|
|
647
|
+
const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)
|
|
648
|
+
/*
|
|
649
|
+
Sniffed from the bytes, with no `contentType` argument at all. The MIME a
|
|
650
|
+
caller has is the browser's guess from a file extension — a `.png` that is
|
|
651
|
+
really a JPEG is ordinary — and this has the actual bytes in hand. Taking
|
|
652
|
+
the parameter would invite trusting it.
|
|
653
|
+
*/
|
|
654
|
+
if (PNG_SIGNATURE.every((byte, at) => view[at] === byte)) return canonicalizePng(view)
|
|
655
|
+
if (view[0] === 0xff && view[1] === 0xd8) return canonicalizeJpeg(view)
|
|
656
|
+
return view
|
|
657
|
+
}
|