@estiva-app/protocol 0.15.0 → 0.17.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/dist/events.d.ts +8 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +8 -0
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/media.d.ts +174 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +185 -0
- package/dist/media.js.map +1 -0
- package/package.json +1 -1
- package/src/events.ts +8 -0
- package/src/index.ts +15 -1
- package/src/media.ts +276 -0
package/dist/events.d.ts
CHANGED
|
@@ -85,6 +85,14 @@ export declare const KIND: {
|
|
|
85
85
|
*/
|
|
86
86
|
readonly RELAY_AUTH: 22242;
|
|
87
87
|
readonly HTTP_AUTH: 27235;
|
|
88
|
+
/**
|
|
89
|
+
* Blossom authorization (BUD-01/BUD-11) — `HTTP_AUTH` for blobs.
|
|
90
|
+
*
|
|
91
|
+
* Never stored and never published: it is signed, carried in an
|
|
92
|
+
* `Authorization: Nostr <base64url(event)>` header, and read once. See
|
|
93
|
+
* `media.ts`, which builds it and the `imeta` tag that references the blob.
|
|
94
|
+
*/
|
|
95
|
+
readonly BLOSSOM_AUTH: 24242;
|
|
88
96
|
/**
|
|
89
97
|
* Buzz's message edit (`KIND_STREAM_MESSAGE_EDIT`) — RFC 0.4 §7.2.1.
|
|
90
98
|
*
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAqCA,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;IA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C9D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;CACjB,GACA,aAAa,CA0Bf;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAeD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAA;IAChB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAWhB"}
|
package/dist/events.js
CHANGED
|
@@ -106,6 +106,14 @@ export const KIND = {
|
|
|
106
106
|
*/
|
|
107
107
|
RELAY_AUTH: 22242,
|
|
108
108
|
HTTP_AUTH: 27235,
|
|
109
|
+
/**
|
|
110
|
+
* Blossom authorization (BUD-01/BUD-11) — `HTTP_AUTH` for blobs.
|
|
111
|
+
*
|
|
112
|
+
* Never stored and never published: it is signed, carried in an
|
|
113
|
+
* `Authorization: Nostr <base64url(event)>` header, and read once. See
|
|
114
|
+
* `media.ts`, which builds it and the `imeta` tag that references the blob.
|
|
115
|
+
*/
|
|
116
|
+
BLOSSOM_AUTH: 24242,
|
|
109
117
|
/**
|
|
110
118
|
* Buzz's message edit (`KIND_STREAM_MESSAGE_EDIT`) — RFC 0.4 §7.2.1.
|
|
111
119
|
*
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;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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,7 +46,7 @@
|
|
|
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.
|
|
49
|
+
export declare const PROTOCOL_VERSION = "0.17.0";
|
|
50
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, buildFile, 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';
|
|
@@ -59,4 +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, } from './media.js';
|
|
62
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,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,gBAAgB,EAErB,IAAI,EACJ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EAEjB,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K,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,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"}
|
|
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,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAA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AAW,EAChB,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
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.17.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,
|
|
@@ -65,4 +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, } from './media.js';
|
|
68
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,i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.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blobs — Blossom authorization and the `imeta` tag that references one.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this is here and not in an app
|
|
5
|
+
*
|
|
6
|
+
* A message's attachment has to be readable by an app that did not post it,
|
|
7
|
+
* which is the whole of CON-12: Peek stored files in Convex, so every other
|
|
8
|
+
* reader saw a message with nothing on it. The wire form is Buzz's own — a
|
|
9
|
+
* content-addressed blob plus an `imeta` tag — and two apps writing that by
|
|
10
|
+
* hand is exactly the drift SHA-3 spent 5,400 lines removing.
|
|
11
|
+
*
|
|
12
|
+
* Nothing here talks to the network. These are the bytes; the fetching belongs
|
|
13
|
+
* to whoever holds a token.
|
|
14
|
+
*/
|
|
15
|
+
import type { NostrTag, SignedEvent, UnsignedEvent } from './events.js';
|
|
16
|
+
/** What a Blossom authorization permits. One verb per event. */
|
|
17
|
+
export type BlossomVerb = 'upload' | 'get' | 'list' | 'delete';
|
|
18
|
+
/** How long an authorization stays valid unless the caller says otherwise. */
|
|
19
|
+
export declare const BLOSSOM_AUTH_TTL_SECS = 300;
|
|
20
|
+
/**
|
|
21
|
+
* A `kind:24242` Blossom authorization — BUD-01/BUD-11.
|
|
22
|
+
*
|
|
23
|
+
* **It is `27235` for blobs.** Never stored and never published: signed, put in
|
|
24
|
+
* an `Authorization: Nostr <base64url(event)>` header, read once and discarded.
|
|
25
|
+
* `buildUnsignedAuthEvent` is its NIP-98 sibling and the same shape of thing.
|
|
26
|
+
*
|
|
27
|
+
* The relay verifies more of this than is obvious, and each of these is a
|
|
28
|
+
* refusal rather than a default (`verify_blossom_auth_event_for_verb`):
|
|
29
|
+
*
|
|
30
|
+
* - **`content` must be non-empty.** BUD-11 calls it a human-readable string,
|
|
31
|
+
* and an empty one is rejected — the easiest of these to omit, because
|
|
32
|
+
* nothing reads it.
|
|
33
|
+
* - **`t` must match the verb being attempted**, so an upload token cannot
|
|
34
|
+
* fetch and a fetch token cannot upload.
|
|
35
|
+
* - **`expiration` is required and must be in the future.**
|
|
36
|
+
* - **`created_at` must sit inside the window**: no more than 5 s ahead of the
|
|
37
|
+
* relay's clock, and no older than its `max_age` (3600 s for a GET).
|
|
38
|
+
* - **`x` must include the blob's sha256** for an upload — BUD-11 §6 asks that
|
|
39
|
+
* *at least one* `x` matches, which is why this takes one and emits one.
|
|
40
|
+
*
|
|
41
|
+
* `server` is optional and omitted by default. The relay accepts a token with
|
|
42
|
+
* no `server` tag; one that carries a *mismatched* host is refused, so a caller
|
|
43
|
+
* that cannot be sure of the canonical host is safer leaving it out.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildBlossomAuth(pubkey: string, createdAtMs: number, args: {
|
|
46
|
+
verb: BlossomVerb;
|
|
47
|
+
/** The blob, lowercase hex. */
|
|
48
|
+
sha256: string;
|
|
49
|
+
/** Human-readable, and **required** — the relay refuses an empty one. */
|
|
50
|
+
reason?: string;
|
|
51
|
+
/** Seconds from now. Defaults to {@link BLOSSOM_AUTH_TTL_SECS}. */
|
|
52
|
+
ttlSecs?: number;
|
|
53
|
+
/** The relay's host, when the caller knows it canonically. */
|
|
54
|
+
server?: string;
|
|
55
|
+
}): UnsignedEvent;
|
|
56
|
+
/**
|
|
57
|
+
* The header a Blossom request carries: `Nostr <base64(signed event JSON)>`.
|
|
58
|
+
*
|
|
59
|
+
* **The same encoding NIP-98 uses**, and deliberately the same function. BUD-01
|
|
60
|
+
* specifies base64url-without-padding, so a first version of this hand-rolled
|
|
61
|
+
* one — but the relay decodes `URL_SAFE_NO_PAD` and **falls back to `STANDARD`**
|
|
62
|
+
* (`extract_blossom_auth`), so the encoder already in this package is accepted
|
|
63
|
+
* as-is. One encoder, already covered by the NIP-98 tests, rather than a second
|
|
64
|
+
* that differs only in its edge cases.
|
|
65
|
+
*/
|
|
66
|
+
export declare function blossomAuthHeader(signed: SignedEvent): string;
|
|
67
|
+
/** What a message says about one attached blob. */
|
|
68
|
+
export interface Imeta {
|
|
69
|
+
/** The relay-local path, e.g. `/media/<sha256>.jpg`. */
|
|
70
|
+
url: string;
|
|
71
|
+
/** MIME type. */
|
|
72
|
+
m: string;
|
|
73
|
+
/** sha256, lowercase hex — the blob's identity. */
|
|
74
|
+
x: string;
|
|
75
|
+
/** Bytes. */
|
|
76
|
+
size: number;
|
|
77
|
+
/** `<width>x<height>`, where the app knows it. */
|
|
78
|
+
dim?: string;
|
|
79
|
+
/** Alt text. */
|
|
80
|
+
alt?: string;
|
|
81
|
+
/** The relay's generated thumbnail path, `<sha256>.thumb.jpg`. */
|
|
82
|
+
thumb?: string;
|
|
83
|
+
/** The name a person gave it. Display only — storage is content-addressed. */
|
|
84
|
+
filename?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* One `imeta` tag — NIP-92, as Buzz validates it.
|
|
88
|
+
*
|
|
89
|
+
* Emitted as `["imeta", "url …", "m …", …]`: space-separated key/value pairs
|
|
90
|
+
* inside a single tag, not one tag per field.
|
|
91
|
+
*
|
|
92
|
+
* The relay's allowlist is `url m x size dim blurhash alt thumb fallback
|
|
93
|
+
* duration bitrate image filename`, each at most once, and it checks two things
|
|
94
|
+
* this cannot: that `url` is a **local** `/media/` path, and — through
|
|
95
|
+
* `verify_imeta_blobs` — that **the blob is already stored**. So the upload has
|
|
96
|
+
* to land before the message that names it, and a dangling reference cannot be
|
|
97
|
+
* published at all.
|
|
98
|
+
*/
|
|
99
|
+
export declare function imetaTag(meta: Imeta): NostrTag;
|
|
100
|
+
/**
|
|
101
|
+
* Read the `imeta` tags off an event.
|
|
102
|
+
*
|
|
103
|
+
* The reader's half, and the reason this file is shared: Ship has to draw what
|
|
104
|
+
* Peek attached without re-deriving the format. Anything missing the four
|
|
105
|
+
* required fields is skipped rather than half-rendered — a tag the relay would
|
|
106
|
+
* not have accepted is not one to guess at.
|
|
107
|
+
*/
|
|
108
|
+
export declare function imetaOf(event: {
|
|
109
|
+
tags: NostrTag[];
|
|
110
|
+
}): Imeta[];
|
|
111
|
+
/**
|
|
112
|
+
* The sha256 a media path names.
|
|
113
|
+
*
|
|
114
|
+
* `/media/<sha256>.<ext>` and `/media/<sha256>.thumb.jpg` both answer the same
|
|
115
|
+
* hash — the thumbnail is a derivative of its parent, and an authorization is
|
|
116
|
+
* issued against the parent. Returns undefined for anything that is not
|
|
117
|
+
* media-shaped, so a caller cannot accidentally sign for a path it misread.
|
|
118
|
+
*/
|
|
119
|
+
export declare function sha256FromMediaUrl(url: string): string | undefined;
|
|
120
|
+
/** A response carrying bytes. Narrower than `Response`, so no DOM lib is needed. */
|
|
121
|
+
export interface BlobResponseLike {
|
|
122
|
+
status: number;
|
|
123
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
124
|
+
text(): Promise<string>;
|
|
125
|
+
headers: {
|
|
126
|
+
get(name: string): string | null;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A transport that can return bytes.
|
|
131
|
+
*
|
|
132
|
+
* Separate from {@link FetchLike}, which `Relay` uses: that one sends a string
|
|
133
|
+
* body and reads a string back, which is right for `POST /query` and cannot
|
|
134
|
+
* express a binary GET. Widening it would change `Relay`'s contract for every
|
|
135
|
+
* caller to serve this one.
|
|
136
|
+
*/
|
|
137
|
+
export type BlobFetchLike = (url: string, init: {
|
|
138
|
+
method: string;
|
|
139
|
+
headers: Record<string, string>;
|
|
140
|
+
}) => Promise<BlobResponseLike>;
|
|
141
|
+
/** What came back, and what it is. */
|
|
142
|
+
export interface FetchedBlob {
|
|
143
|
+
bytes: ArrayBuffer;
|
|
144
|
+
/** The relay's stored MIME, which is authoritative over anything a tag said. */
|
|
145
|
+
contentType: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Fetch a blob the relay is holding — CON-12's read half.
|
|
149
|
+
*
|
|
150
|
+
* **An `<img src>` cannot do this**, which is the whole reason this exists.
|
|
151
|
+
* Media GET is unconditionally authenticated on the deployed relay: the
|
|
152
|
+
* `BUZZ_REQUIRE_MEDIA_GET_AUTH` flag reads like an opt-in and is inert, and a
|
|
153
|
+
* GET with no header answers 401 rather than 404 (probed 2026-09-08). So every
|
|
154
|
+
* reader — Peek showing its own attachment, Ship showing Peek's — has to sign a
|
|
155
|
+
* `get` authorization, fetch, and turn the bytes into something renderable.
|
|
156
|
+
*
|
|
157
|
+
* Shared because both apps need exactly this and neither should re-derive it:
|
|
158
|
+
* the hash the authorization must name is inside the path, the verb has to be
|
|
159
|
+
* `get` rather than `upload`, and getting either wrong fails as a 401 that
|
|
160
|
+
* looks like a session problem.
|
|
161
|
+
*
|
|
162
|
+
* Returns the bytes rather than an object URL: `URL.createObjectURL` is a DOM
|
|
163
|
+
* API and its lifetime belongs to whoever will revoke it.
|
|
164
|
+
*/
|
|
165
|
+
export declare function fetchBlob(args: {
|
|
166
|
+
/** The relay origin, used when `url` is a bare `/media/…` path. */
|
|
167
|
+
relayUrl: string;
|
|
168
|
+
/** `/media/<sha256>.<ext>`, or the absolute form of the same. */
|
|
169
|
+
url: string;
|
|
170
|
+
sign: (unsigned: UnsignedEvent) => Promise<SignedEvent>;
|
|
171
|
+
pubkey: string;
|
|
172
|
+
transport?: BlobFetchLike;
|
|
173
|
+
}): Promise<FetchedBlob>;
|
|
174
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +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;AAIvE,gEAAgE;AAChE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE9D,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,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IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IACvB,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAC9C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KACtD,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAK9B,sCAAsC;AACtC,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAA;IAClB,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAA;IAChB,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,aAAa,CAAA;CAC1B,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBvB"}
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { KIND, toNostrSeconds } from './events.js';
|
|
2
|
+
import { authorizationHeaderFor } from './nip98.js';
|
|
3
|
+
/** How long an authorization stays valid unless the caller says otherwise. */
|
|
4
|
+
export const BLOSSOM_AUTH_TTL_SECS = 300;
|
|
5
|
+
/**
|
|
6
|
+
* A `kind:24242` Blossom authorization — BUD-01/BUD-11.
|
|
7
|
+
*
|
|
8
|
+
* **It is `27235` for blobs.** Never stored and never published: signed, put in
|
|
9
|
+
* an `Authorization: Nostr <base64url(event)>` header, read once and discarded.
|
|
10
|
+
* `buildUnsignedAuthEvent` is its NIP-98 sibling and the same shape of thing.
|
|
11
|
+
*
|
|
12
|
+
* The relay verifies more of this than is obvious, and each of these is a
|
|
13
|
+
* refusal rather than a default (`verify_blossom_auth_event_for_verb`):
|
|
14
|
+
*
|
|
15
|
+
* - **`content` must be non-empty.** BUD-11 calls it a human-readable string,
|
|
16
|
+
* and an empty one is rejected — the easiest of these to omit, because
|
|
17
|
+
* nothing reads it.
|
|
18
|
+
* - **`t` must match the verb being attempted**, so an upload token cannot
|
|
19
|
+
* fetch and a fetch token cannot upload.
|
|
20
|
+
* - **`expiration` is required and must be in the future.**
|
|
21
|
+
* - **`created_at` must sit inside the window**: no more than 5 s ahead of the
|
|
22
|
+
* relay's clock, and no older than its `max_age` (3600 s for a GET).
|
|
23
|
+
* - **`x` must include the blob's sha256** for an upload — BUD-11 §6 asks that
|
|
24
|
+
* *at least one* `x` matches, which is why this takes one and emits one.
|
|
25
|
+
*
|
|
26
|
+
* `server` is optional and omitted by default. The relay accepts a token with
|
|
27
|
+
* no `server` tag; one that carries a *mismatched* host is refused, so a caller
|
|
28
|
+
* that cannot be sure of the canonical host is safer leaving it out.
|
|
29
|
+
*/
|
|
30
|
+
export function buildBlossomAuth(pubkey, createdAtMs, args) {
|
|
31
|
+
if (!/^[0-9a-f]{64}$/.test(args.sha256)) {
|
|
32
|
+
throw new Error('sha256 must be 64 lowercase hex characters');
|
|
33
|
+
}
|
|
34
|
+
const createdAt = toNostrSeconds(createdAtMs);
|
|
35
|
+
const tags = [
|
|
36
|
+
['t', args.verb],
|
|
37
|
+
['x', args.sha256],
|
|
38
|
+
['expiration', String(createdAt + (args.ttlSecs ?? BLOSSOM_AUTH_TTL_SECS))],
|
|
39
|
+
];
|
|
40
|
+
if (args.server)
|
|
41
|
+
tags.push(['server', args.server]);
|
|
42
|
+
return {
|
|
43
|
+
pubkey,
|
|
44
|
+
created_at: createdAt,
|
|
45
|
+
kind: KIND.BLOSSOM_AUTH,
|
|
46
|
+
tags,
|
|
47
|
+
// Defaulted rather than left to the caller: an empty content is a refusal,
|
|
48
|
+
// and the failure reads as a signature problem rather than a missing field.
|
|
49
|
+
content: args.reason?.trim() || `${args.verb} blob`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The header a Blossom request carries: `Nostr <base64(signed event JSON)>`.
|
|
54
|
+
*
|
|
55
|
+
* **The same encoding NIP-98 uses**, and deliberately the same function. BUD-01
|
|
56
|
+
* specifies base64url-without-padding, so a first version of this hand-rolled
|
|
57
|
+
* one — but the relay decodes `URL_SAFE_NO_PAD` and **falls back to `STANDARD`**
|
|
58
|
+
* (`extract_blossom_auth`), so the encoder already in this package is accepted
|
|
59
|
+
* as-is. One encoder, already covered by the NIP-98 tests, rather than a second
|
|
60
|
+
* that differs only in its edge cases.
|
|
61
|
+
*/
|
|
62
|
+
export function blossomAuthHeader(signed) {
|
|
63
|
+
return authorizationHeaderFor(signed);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* One `imeta` tag — NIP-92, as Buzz validates it.
|
|
67
|
+
*
|
|
68
|
+
* Emitted as `["imeta", "url …", "m …", …]`: space-separated key/value pairs
|
|
69
|
+
* inside a single tag, not one tag per field.
|
|
70
|
+
*
|
|
71
|
+
* The relay's allowlist is `url m x size dim blurhash alt thumb fallback
|
|
72
|
+
* duration bitrate image filename`, each at most once, and it checks two things
|
|
73
|
+
* this cannot: that `url` is a **local** `/media/` path, and — through
|
|
74
|
+
* `verify_imeta_blobs` — that **the blob is already stored**. So the upload has
|
|
75
|
+
* to land before the message that names it, and a dangling reference cannot be
|
|
76
|
+
* published at all.
|
|
77
|
+
*/
|
|
78
|
+
export function imetaTag(meta) {
|
|
79
|
+
const parts = [`url ${meta.url}`, `m ${meta.m}`, `x ${meta.x}`, `size ${meta.size}`];
|
|
80
|
+
if (meta.dim)
|
|
81
|
+
parts.push(`dim ${meta.dim}`);
|
|
82
|
+
if (meta.alt)
|
|
83
|
+
parts.push(`alt ${meta.alt}`);
|
|
84
|
+
if (meta.thumb)
|
|
85
|
+
parts.push(`thumb ${meta.thumb}`);
|
|
86
|
+
if (meta.filename)
|
|
87
|
+
parts.push(`filename ${meta.filename}`);
|
|
88
|
+
return ['imeta', ...parts];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Read the `imeta` tags off an event.
|
|
92
|
+
*
|
|
93
|
+
* The reader's half, and the reason this file is shared: Ship has to draw what
|
|
94
|
+
* Peek attached without re-deriving the format. Anything missing the four
|
|
95
|
+
* required fields is skipped rather than half-rendered — a tag the relay would
|
|
96
|
+
* not have accepted is not one to guess at.
|
|
97
|
+
*/
|
|
98
|
+
export function imetaOf(event) {
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const tag of event.tags) {
|
|
101
|
+
if (tag[0] !== 'imeta')
|
|
102
|
+
continue;
|
|
103
|
+
const fields = {};
|
|
104
|
+
for (const part of tag.slice(1)) {
|
|
105
|
+
const space = part.indexOf(' ');
|
|
106
|
+
if (space <= 0)
|
|
107
|
+
continue;
|
|
108
|
+
const key = part.slice(0, space);
|
|
109
|
+
// First wins: the relay rejects duplicates, so a second is a malformed
|
|
110
|
+
// event rather than an override.
|
|
111
|
+
if (!(key in fields))
|
|
112
|
+
fields[key] = part.slice(space + 1);
|
|
113
|
+
}
|
|
114
|
+
const size = Number.parseInt(fields.size ?? '', 10);
|
|
115
|
+
if (!fields.url || !fields.m || !fields.x || !Number.isFinite(size))
|
|
116
|
+
continue;
|
|
117
|
+
out.push({
|
|
118
|
+
url: fields.url,
|
|
119
|
+
m: fields.m,
|
|
120
|
+
x: fields.x,
|
|
121
|
+
size,
|
|
122
|
+
dim: fields.dim,
|
|
123
|
+
alt: fields.alt,
|
|
124
|
+
thumb: fields.thumb,
|
|
125
|
+
filename: fields.filename,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The sha256 a media path names.
|
|
132
|
+
*
|
|
133
|
+
* `/media/<sha256>.<ext>` and `/media/<sha256>.thumb.jpg` both answer the same
|
|
134
|
+
* hash — the thumbnail is a derivative of its parent, and an authorization is
|
|
135
|
+
* issued against the parent. Returns undefined for anything that is not
|
|
136
|
+
* media-shaped, so a caller cannot accidentally sign for a path it misread.
|
|
137
|
+
*/
|
|
138
|
+
export function sha256FromMediaUrl(url) {
|
|
139
|
+
const afterMedia = url.split('/media/')[1];
|
|
140
|
+
if (afterMedia === undefined)
|
|
141
|
+
return undefined;
|
|
142
|
+
const hash = afterMedia.split('.')[0];
|
|
143
|
+
return /^[0-9a-f]{64}$/.test(hash) ? hash : undefined;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Fetch a blob the relay is holding — CON-12's read half.
|
|
147
|
+
*
|
|
148
|
+
* **An `<img src>` cannot do this**, which is the whole reason this exists.
|
|
149
|
+
* Media GET is unconditionally authenticated on the deployed relay: the
|
|
150
|
+
* `BUZZ_REQUIRE_MEDIA_GET_AUTH` flag reads like an opt-in and is inert, and a
|
|
151
|
+
* GET with no header answers 401 rather than 404 (probed 2026-09-08). So every
|
|
152
|
+
* reader — Peek showing its own attachment, Ship showing Peek's — has to sign a
|
|
153
|
+
* `get` authorization, fetch, and turn the bytes into something renderable.
|
|
154
|
+
*
|
|
155
|
+
* Shared because both apps need exactly this and neither should re-derive it:
|
|
156
|
+
* the hash the authorization must name is inside the path, the verb has to be
|
|
157
|
+
* `get` rather than `upload`, and getting either wrong fails as a 401 that
|
|
158
|
+
* looks like a session problem.
|
|
159
|
+
*
|
|
160
|
+
* Returns the bytes rather than an object URL: `URL.createObjectURL` is a DOM
|
|
161
|
+
* API and its lifetime belongs to whoever will revoke it.
|
|
162
|
+
*/
|
|
163
|
+
export async function fetchBlob(args) {
|
|
164
|
+
const sha256 = sha256FromMediaUrl(args.url);
|
|
165
|
+
if (!sha256)
|
|
166
|
+
throw new Error(`not a media url: ${args.url}`);
|
|
167
|
+
const auth = await args.sign(buildBlossomAuth(args.pubkey, Date.now(), { verb: 'get', sha256, reason: 'Read attachment' }));
|
|
168
|
+
const absolute = args.url.startsWith('http')
|
|
169
|
+
? args.url
|
|
170
|
+
: `${args.relayUrl.replace(/\/+$/, '')}${args.url.startsWith('/') ? '' : '/'}${args.url}`;
|
|
171
|
+
const send = args.transport ?? fetch;
|
|
172
|
+
const response = await send(absolute, {
|
|
173
|
+
method: 'GET',
|
|
174
|
+
headers: { authorization: blossomAuthHeader(auth) },
|
|
175
|
+
});
|
|
176
|
+
if (response.status < 200 || response.status >= 300) {
|
|
177
|
+
const detail = await response.text().catch(() => '');
|
|
178
|
+
throw new Error(`blob read failed: ${response.status} ${detail.slice(0, 200)}`);
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
bytes: await response.arrayBuffer(),
|
|
182
|
+
contentType: response.headers.get('content-type') ?? 'application/octet-stream',
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +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;AAKnD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,WAAmB,EACnB,IAUC;IAED,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAC/D,CAAC;IACD,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAA;IAC7C,MAAM,IAAI,GAAe;QACvB,CAAC,GAAG,EAAE,I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AAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAE3F,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAA;IACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACpC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE;KACpD,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;QACpD,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;IACjF,CAAC;IACD,OAAO;QACL,KAAK,EAAE,MAAM,QAAQ,CAAC,WAAW,EAAE;QACnC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,0BAA0B;KAChF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.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
|
@@ -125,6 +125,14 @@ export const KIND = {
|
|
|
125
125
|
*/
|
|
126
126
|
RELAY_AUTH: 22242,
|
|
127
127
|
HTTP_AUTH: 27235,
|
|
128
|
+
/**
|
|
129
|
+
* Blossom authorization (BUD-01/BUD-11) — `HTTP_AUTH` for blobs.
|
|
130
|
+
*
|
|
131
|
+
* Never stored and never published: it is signed, carried in an
|
|
132
|
+
* `Authorization: Nostr <base64url(event)>` header, and read once. See
|
|
133
|
+
* `media.ts`, which builds it and the `imeta` tag that references the blob.
|
|
134
|
+
*/
|
|
135
|
+
BLOSSOM_AUTH: 24242,
|
|
128
136
|
/**
|
|
129
137
|
* Buzz's message edit (`KIND_STREAM_MESSAGE_EDIT`) — RFC 0.4 §7.2.1.
|
|
130
138
|
*
|
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.17.0'
|
|
51
51
|
|
|
52
52
|
export {
|
|
53
53
|
// types
|
|
@@ -227,3 +227,17 @@ export {
|
|
|
227
227
|
blockAnchorOf,
|
|
228
228
|
resolveBlockAnchor,
|
|
229
229
|
} from './anchors.js'
|
|
230
|
+
export {
|
|
231
|
+
type BlossomVerb,
|
|
232
|
+
type Imeta,
|
|
233
|
+
BLOSSOM_AUTH_TTL_SECS,
|
|
234
|
+
buildBlossomAuth,
|
|
235
|
+
blossomAuthHeader,
|
|
236
|
+
imetaTag,
|
|
237
|
+
imetaOf,
|
|
238
|
+
type BlobFetchLike,
|
|
239
|
+
type BlobResponseLike,
|
|
240
|
+
type FetchedBlob,
|
|
241
|
+
sha256FromMediaUrl,
|
|
242
|
+
fetchBlob,
|
|
243
|
+
} from './media.js'
|
package/src/media.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blobs — Blossom authorization and the `imeta` tag that references one.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this is here and not in an app
|
|
5
|
+
*
|
|
6
|
+
* A message's attachment has to be readable by an app that did not post it,
|
|
7
|
+
* which is the whole of CON-12: Peek stored files in Convex, so every other
|
|
8
|
+
* reader saw a message with nothing on it. The wire form is Buzz's own — a
|
|
9
|
+
* content-addressed blob plus an `imeta` tag — and two apps writing that by
|
|
10
|
+
* hand is exactly the drift SHA-3 spent 5,400 lines removing.
|
|
11
|
+
*
|
|
12
|
+
* Nothing here talks to the network. These are the bytes; the fetching belongs
|
|
13
|
+
* to whoever holds a token.
|
|
14
|
+
*/
|
|
15
|
+
import type { NostrTag, SignedEvent, UnsignedEvent } from './events.js'
|
|
16
|
+
import { KIND, toNostrSeconds } from './events.js'
|
|
17
|
+
import { authorizationHeaderFor } from './nip98.js'
|
|
18
|
+
|
|
19
|
+
/** What a Blossom authorization permits. One verb per event. */
|
|
20
|
+
export type BlossomVerb = 'upload' | 'get' | 'list' | 'delete'
|
|
21
|
+
|
|
22
|
+
/** How long an authorization stays valid unless the caller says otherwise. */
|
|
23
|
+
export const BLOSSOM_AUTH_TTL_SECS = 300
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A `kind:24242` Blossom authorization — BUD-01/BUD-11.
|
|
27
|
+
*
|
|
28
|
+
* **It is `27235` for blobs.** Never stored and never published: signed, put in
|
|
29
|
+
* an `Authorization: Nostr <base64url(event)>` header, read once and discarded.
|
|
30
|
+
* `buildUnsignedAuthEvent` is its NIP-98 sibling and the same shape of thing.
|
|
31
|
+
*
|
|
32
|
+
* The relay verifies more of this than is obvious, and each of these is a
|
|
33
|
+
* refusal rather than a default (`verify_blossom_auth_event_for_verb`):
|
|
34
|
+
*
|
|
35
|
+
* - **`content` must be non-empty.** BUD-11 calls it a human-readable string,
|
|
36
|
+
* and an empty one is rejected — the easiest of these to omit, because
|
|
37
|
+
* nothing reads it.
|
|
38
|
+
* - **`t` must match the verb being attempted**, so an upload token cannot
|
|
39
|
+
* fetch and a fetch token cannot upload.
|
|
40
|
+
* - **`expiration` is required and must be in the future.**
|
|
41
|
+
* - **`created_at` must sit inside the window**: no more than 5 s ahead of the
|
|
42
|
+
* relay's clock, and no older than its `max_age` (3600 s for a GET).
|
|
43
|
+
* - **`x` must include the blob's sha256** for an upload — BUD-11 §6 asks that
|
|
44
|
+
* *at least one* `x` matches, which is why this takes one and emits one.
|
|
45
|
+
*
|
|
46
|
+
* `server` is optional and omitted by default. The relay accepts a token with
|
|
47
|
+
* no `server` tag; one that carries a *mismatched* host is refused, so a caller
|
|
48
|
+
* that cannot be sure of the canonical host is safer leaving it out.
|
|
49
|
+
*/
|
|
50
|
+
export function buildBlossomAuth(
|
|
51
|
+
pubkey: string,
|
|
52
|
+
createdAtMs: number,
|
|
53
|
+
args: {
|
|
54
|
+
verb: BlossomVerb
|
|
55
|
+
/** The blob, lowercase hex. */
|
|
56
|
+
sha256: string
|
|
57
|
+
/** Human-readable, and **required** — the relay refuses an empty one. */
|
|
58
|
+
reason?: string
|
|
59
|
+
/** Seconds from now. Defaults to {@link BLOSSOM_AUTH_TTL_SECS}. */
|
|
60
|
+
ttlSecs?: number
|
|
61
|
+
/** The relay's host, when the caller knows it canonically. */
|
|
62
|
+
server?: string
|
|
63
|
+
},
|
|
64
|
+
): UnsignedEvent {
|
|
65
|
+
if (!/^[0-9a-f]{64}$/.test(args.sha256)) {
|
|
66
|
+
throw new Error('sha256 must be 64 lowercase hex characters')
|
|
67
|
+
}
|
|
68
|
+
const createdAt = toNostrSeconds(createdAtMs)
|
|
69
|
+
const tags: NostrTag[] = [
|
|
70
|
+
['t', args.verb],
|
|
71
|
+
['x', args.sha256],
|
|
72
|
+
['expiration', String(createdAt + (args.ttlSecs ?? BLOSSOM_AUTH_TTL_SECS))],
|
|
73
|
+
]
|
|
74
|
+
if (args.server) tags.push(['server', args.server])
|
|
75
|
+
return {
|
|
76
|
+
pubkey,
|
|
77
|
+
created_at: createdAt,
|
|
78
|
+
kind: KIND.BLOSSOM_AUTH,
|
|
79
|
+
tags,
|
|
80
|
+
// Defaulted rather than left to the caller: an empty content is a refusal,
|
|
81
|
+
// and the failure reads as a signature problem rather than a missing field.
|
|
82
|
+
content: args.reason?.trim() || `${args.verb} blob`,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The header a Blossom request carries: `Nostr <base64(signed event JSON)>`.
|
|
88
|
+
*
|
|
89
|
+
* **The same encoding NIP-98 uses**, and deliberately the same function. BUD-01
|
|
90
|
+
* specifies base64url-without-padding, so a first version of this hand-rolled
|
|
91
|
+
* one — but the relay decodes `URL_SAFE_NO_PAD` and **falls back to `STANDARD`**
|
|
92
|
+
* (`extract_blossom_auth`), so the encoder already in this package is accepted
|
|
93
|
+
* as-is. One encoder, already covered by the NIP-98 tests, rather than a second
|
|
94
|
+
* that differs only in its edge cases.
|
|
95
|
+
*/
|
|
96
|
+
export function blossomAuthHeader(signed: SignedEvent): string {
|
|
97
|
+
return authorizationHeaderFor(signed)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** What a message says about one attached blob. */
|
|
101
|
+
export interface Imeta {
|
|
102
|
+
/** The relay-local path, e.g. `/media/<sha256>.jpg`. */
|
|
103
|
+
url: string
|
|
104
|
+
/** MIME type. */
|
|
105
|
+
m: string
|
|
106
|
+
/** sha256, lowercase hex — the blob's identity. */
|
|
107
|
+
x: string
|
|
108
|
+
/** Bytes. */
|
|
109
|
+
size: number
|
|
110
|
+
/** `<width>x<height>`, where the app knows it. */
|
|
111
|
+
dim?: string
|
|
112
|
+
/** Alt text. */
|
|
113
|
+
alt?: string
|
|
114
|
+
/** The relay's generated thumbnail path, `<sha256>.thumb.jpg`. */
|
|
115
|
+
thumb?: string
|
|
116
|
+
/** The name a person gave it. Display only — storage is content-addressed. */
|
|
117
|
+
filename?: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* One `imeta` tag — NIP-92, as Buzz validates it.
|
|
122
|
+
*
|
|
123
|
+
* Emitted as `["imeta", "url …", "m …", …]`: space-separated key/value pairs
|
|
124
|
+
* inside a single tag, not one tag per field.
|
|
125
|
+
*
|
|
126
|
+
* The relay's allowlist is `url m x size dim blurhash alt thumb fallback
|
|
127
|
+
* duration bitrate image filename`, each at most once, and it checks two things
|
|
128
|
+
* this cannot: that `url` is a **local** `/media/` path, and — through
|
|
129
|
+
* `verify_imeta_blobs` — that **the blob is already stored**. So the upload has
|
|
130
|
+
* to land before the message that names it, and a dangling reference cannot be
|
|
131
|
+
* published at all.
|
|
132
|
+
*/
|
|
133
|
+
export function imetaTag(meta: Imeta): NostrTag {
|
|
134
|
+
const parts = [`url ${meta.url}`, `m ${meta.m}`, `x ${meta.x}`, `size ${meta.size}`]
|
|
135
|
+
if (meta.dim) parts.push(`dim ${meta.dim}`)
|
|
136
|
+
if (meta.alt) parts.push(`alt ${meta.alt}`)
|
|
137
|
+
if (meta.thumb) parts.push(`thumb ${meta.thumb}`)
|
|
138
|
+
if (meta.filename) parts.push(`filename ${meta.filename}`)
|
|
139
|
+
return ['imeta', ...parts]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Read the `imeta` tags off an event.
|
|
144
|
+
*
|
|
145
|
+
* The reader's half, and the reason this file is shared: Ship has to draw what
|
|
146
|
+
* Peek attached without re-deriving the format. Anything missing the four
|
|
147
|
+
* required fields is skipped rather than half-rendered — a tag the relay would
|
|
148
|
+
* not have accepted is not one to guess at.
|
|
149
|
+
*/
|
|
150
|
+
export function imetaOf(event: { tags: NostrTag[] }): Imeta[] {
|
|
151
|
+
const out: Imeta[] = []
|
|
152
|
+
for (const tag of event.tags) {
|
|
153
|
+
if (tag[0] !== 'imeta') continue
|
|
154
|
+
const fields: Record<string, string> = {}
|
|
155
|
+
for (const part of tag.slice(1)) {
|
|
156
|
+
const space = part.indexOf(' ')
|
|
157
|
+
if (space <= 0) continue
|
|
158
|
+
const key = part.slice(0, space)
|
|
159
|
+
// First wins: the relay rejects duplicates, so a second is a malformed
|
|
160
|
+
// event rather than an override.
|
|
161
|
+
if (!(key in fields)) fields[key] = part.slice(space + 1)
|
|
162
|
+
}
|
|
163
|
+
const size = Number.parseInt(fields.size ?? '', 10)
|
|
164
|
+
if (!fields.url || !fields.m || !fields.x || !Number.isFinite(size)) continue
|
|
165
|
+
out.push({
|
|
166
|
+
url: fields.url,
|
|
167
|
+
m: fields.m,
|
|
168
|
+
x: fields.x,
|
|
169
|
+
size,
|
|
170
|
+
dim: fields.dim,
|
|
171
|
+
alt: fields.alt,
|
|
172
|
+
thumb: fields.thumb,
|
|
173
|
+
filename: fields.filename,
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
return out
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The sha256 a media path names.
|
|
181
|
+
*
|
|
182
|
+
* `/media/<sha256>.<ext>` and `/media/<sha256>.thumb.jpg` both answer the same
|
|
183
|
+
* hash — the thumbnail is a derivative of its parent, and an authorization is
|
|
184
|
+
* issued against the parent. Returns undefined for anything that is not
|
|
185
|
+
* media-shaped, so a caller cannot accidentally sign for a path it misread.
|
|
186
|
+
*/
|
|
187
|
+
export function sha256FromMediaUrl(url: string): string | undefined {
|
|
188
|
+
const afterMedia = url.split('/media/')[1]
|
|
189
|
+
if (afterMedia === undefined) return undefined
|
|
190
|
+
const hash = afterMedia.split('.')[0]
|
|
191
|
+
return /^[0-9a-f]{64}$/.test(hash) ? hash : undefined
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** A response carrying bytes. Narrower than `Response`, so no DOM lib is needed. */
|
|
195
|
+
export interface BlobResponseLike {
|
|
196
|
+
status: number
|
|
197
|
+
arrayBuffer(): Promise<ArrayBuffer>
|
|
198
|
+
text(): Promise<string>
|
|
199
|
+
headers: { get(name: string): string | null }
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* A transport that can return bytes.
|
|
204
|
+
*
|
|
205
|
+
* Separate from {@link FetchLike}, which `Relay` uses: that one sends a string
|
|
206
|
+
* body and reads a string back, which is right for `POST /query` and cannot
|
|
207
|
+
* express a binary GET. Widening it would change `Relay`'s contract for every
|
|
208
|
+
* caller to serve this one.
|
|
209
|
+
*/
|
|
210
|
+
export type BlobFetchLike = (
|
|
211
|
+
url: string,
|
|
212
|
+
init: { method: string; headers: Record<string, string> },
|
|
213
|
+
) => Promise<BlobResponseLike>
|
|
214
|
+
|
|
215
|
+
/** See {@link BlobFetchLike}. Read inside the function, so importing touches no global. */
|
|
216
|
+
declare const fetch: BlobFetchLike
|
|
217
|
+
|
|
218
|
+
/** What came back, and what it is. */
|
|
219
|
+
export interface FetchedBlob {
|
|
220
|
+
bytes: ArrayBuffer
|
|
221
|
+
/** The relay's stored MIME, which is authoritative over anything a tag said. */
|
|
222
|
+
contentType: string
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Fetch a blob the relay is holding — CON-12's read half.
|
|
227
|
+
*
|
|
228
|
+
* **An `<img src>` cannot do this**, which is the whole reason this exists.
|
|
229
|
+
* Media GET is unconditionally authenticated on the deployed relay: the
|
|
230
|
+
* `BUZZ_REQUIRE_MEDIA_GET_AUTH` flag reads like an opt-in and is inert, and a
|
|
231
|
+
* GET with no header answers 401 rather than 404 (probed 2026-09-08). So every
|
|
232
|
+
* reader — Peek showing its own attachment, Ship showing Peek's — has to sign a
|
|
233
|
+
* `get` authorization, fetch, and turn the bytes into something renderable.
|
|
234
|
+
*
|
|
235
|
+
* Shared because both apps need exactly this and neither should re-derive it:
|
|
236
|
+
* the hash the authorization must name is inside the path, the verb has to be
|
|
237
|
+
* `get` rather than `upload`, and getting either wrong fails as a 401 that
|
|
238
|
+
* looks like a session problem.
|
|
239
|
+
*
|
|
240
|
+
* Returns the bytes rather than an object URL: `URL.createObjectURL` is a DOM
|
|
241
|
+
* API and its lifetime belongs to whoever will revoke it.
|
|
242
|
+
*/
|
|
243
|
+
export async function fetchBlob(args: {
|
|
244
|
+
/** The relay origin, used when `url` is a bare `/media/…` path. */
|
|
245
|
+
relayUrl: string
|
|
246
|
+
/** `/media/<sha256>.<ext>`, or the absolute form of the same. */
|
|
247
|
+
url: string
|
|
248
|
+
sign: (unsigned: UnsignedEvent) => Promise<SignedEvent>
|
|
249
|
+
pubkey: string
|
|
250
|
+
transport?: BlobFetchLike
|
|
251
|
+
}): Promise<FetchedBlob> {
|
|
252
|
+
const sha256 = sha256FromMediaUrl(args.url)
|
|
253
|
+
if (!sha256) throw new Error(`not a media url: ${args.url}`)
|
|
254
|
+
|
|
255
|
+
const auth = await args.sign(
|
|
256
|
+
buildBlossomAuth(args.pubkey, Date.now(), { verb: 'get', sha256, reason: 'Read attachment' }),
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
const absolute = args.url.startsWith('http')
|
|
260
|
+
? args.url
|
|
261
|
+
: `${args.relayUrl.replace(/\/+$/, '')}${args.url.startsWith('/') ? '' : '/'}${args.url}`
|
|
262
|
+
|
|
263
|
+
const send = args.transport ?? fetch
|
|
264
|
+
const response = await send(absolute, {
|
|
265
|
+
method: 'GET',
|
|
266
|
+
headers: { authorization: blossomAuthHeader(auth) },
|
|
267
|
+
})
|
|
268
|
+
if (response.status < 200 || response.status >= 300) {
|
|
269
|
+
const detail = await response.text().catch(() => '')
|
|
270
|
+
throw new Error(`blob read failed: ${response.status} ${detail.slice(0, 200)}`)
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
bytes: await response.arrayBuffer(),
|
|
274
|
+
contentType: response.headers.get('content-type') ?? 'application/octet-stream',
|
|
275
|
+
}
|
|
276
|
+
}
|