feat(media): a local library of uploads — media ls with names, media link; canonical grant encoding

The relay never knows names and a link is printed once, so a lost link
made an owned film unreachable. media put now appends each upload and its
grant to $XDG_CONFIG_HOME/shade/media-library.jsonl (0600, one JSON line
per change: concurrent uploads cannot lose entries, a torn line costs only
itself). media ls names uploads from it; media link <name|id> prints the
link again; media rm forgets it.

encodeGrant now writes meta in canonical (validateMeta) order, so one
grant is always one link; media.json vectors regenerated (album and
subtitle vectors only), Kotlin 82/0.

Verified: 82 TS tests (library: fold, find, 0600, torn line, 200
concurrent appends, stable encoding); CLI put → ls → link gives back the
identical link.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-18 22:08:22 +02:00
parent d784e47ab3
commit 01f8471fb5
8 changed files with 269 additions and 25 deletions

View File

@@ -29,6 +29,7 @@ decided: "2026-10-18 — Cardwell: neste steg er Shade-streaming av tekst, video
- [x] Android live: `LiveWatcher` + `ShadeLiveDataSource` (WebM/fMP4 i ExoPlayer, sen innstigning, hull, tidslinje fra 0), demo-appen spiller live video og følger loggkanaler
- [x] Undertekster: `Film.no.srt` ved siden av filmen forsegles og følger filmen i dens meta; `<track>` i nettleseren (språkvalg, SRT→VTT), ExoPlayer på Android, `media get` skriver dem tilbake
- [x] `media put --web`: HEVC/AC3/DTS-filmer (som Chromium nekter) konverteres før forsegling, innebygde tekstundertekster blir spor; advarsel uten flagget
- [x] Lokalt bibliotek: `media ls` med navn, `media link <navn>` gir lenken igjen; kanonisk grant-koding (én grant = én lenke)
## Neste
- Kjør `:shade-media-demo` på dev-telefonen (RFCN504DWJF var ikke tilkoblet 2026-10-18)

View File

@@ -56,6 +56,10 @@ New package **`@shade/media`** — see `docs/media.md`.
is copied, the rest becomes H.264/AAC, embedded text subtitles become
subtitle tracks, all in one ffmpeg pass. Without the flag, `put` warns
when ffprobe sees streams browsers will not play.
- **Library.** `media put` records each upload and its grant in
`$XDG_CONFIG_HOME/shade/media-library.jsonl` (0600, append-only); `media
ls` shows names, `media link <name|id>` prints a link again. Grants now
encode their meta canonically, so one grant is always one link.
- **Kotlin.** `no.zyon.shade.media`: SMF1 reader and sealer, grants, live
subscriber and publisher — byte-for-byte against `test-vectors/media.json`.
`:shade-android-media` plays sealed files in Media3/ExoPlayer

View File

@@ -62,6 +62,13 @@ The owner key (who may upload, delete and open live channels) is created the fir
time it is needed, under `$XDG_CONFIG_HOME/shade/media-owner.key` (mode 0600).
`shade media whoami` prints its public half.
The relay knows ids and sizes, never names, and a link is printed once. So `media put`
also writes every upload, with its grant, to `$XDG_CONFIG_HOME/shade/media-library.jsonl`
(mode 0600: a grant is a key). `shade media ls` names your uploads from it, and
`shade media link <name or id>` prints a link again. The file is append-only, one JSON
line per change, so two uploads at once cannot lose each other's entries. A grant
always encodes to the same link: its meta is written in canonical order.
### In the Shade container
```

View File

@@ -32,6 +32,7 @@ import type { MediaMeta } from './sealed.js';
import { MediaSplitter } from './splitter.js';
import { SUBTITLE_EXTENSIONS, subtitleFor, subtitlesOf, withSubtitles } from './subtitles.js';
import { prepareForWeb, webIssues } from './web-prep.js';
import { MediaLibrary } from './library.js';
import type { SubtitleTrack } from './subtitles.js';
import type { LiveContainer } from './splitter.js';
@@ -145,7 +146,7 @@ async function mediaServe(flags: Flags): Promise<number> {
async function mediaPut(pos: string[], flags: Flags): Promise<number> {
if (pos.length === 0) throw new UsageError('usage: shade media put <file|dir>… --server URL [--album T]');
const server = need(flags, 'server', 'SHADE_MEDIA_SERVER');
const client = new MediaClient(server, await loadOwnerKey());
const ctx: PutCtx = { client: new MediaClient(server, await loadOwnerKey()), server, library: await openLibrary() };
const started = Date.now();
const albumTitle = str(flags, 'album');
const oneDir = pos.length === 1 && (await stat(pos[0]!)).isDirectory();
@@ -153,15 +154,15 @@ async function mediaPut(pos: string[], flags: Flags): Promise<number> {
if (pos.length === 1 && !oneDir && albumTitle === undefined) {
const name = str(flags, 'name');
const mime = str(flags, 'mime');
grant = await putFile(client, pos[0]!, flags, { ...(name !== undefined ? { name } : {}), ...(mime !== undefined ? { mime } : {}) });
grant = await putFile(ctx, pos[0]!, flags, { ...(name !== undefined ? { name } : {}), ...(mime !== undefined ? { mime } : {}) });
} else if (oneDir) {
// The directory is the album (`--album` renames it), not an album inside one.
grant = await putPath(client, pos[0]!, flags, albumTitle);
grant = await putPath(ctx, pos[0]!, flags, albumTitle);
} else {
const items: Grant[] = [];
for (const p of pos) items.push(await putPath(client, p, flags));
for (const p of pos) items.push(await putPath(ctx, p, flags));
const title = albumTitle ?? 'Album';
grant = await client.uploadAlbum({ title, items }, putOpts(flags));
grant = await putAlbum(ctx, title, items, flags);
err(`album "${title}": ${items.length} item(s)`);
}
err(`done in ${((Date.now() - started) / 1000).toFixed(1)} s`);
@@ -169,31 +170,47 @@ async function mediaPut(pos: string[], flags: Flags): Promise<number> {
return 0;
}
interface PutCtx {
client: MediaClient;
server: string;
library: MediaLibrary;
}
async function putAlbum(ctx: PutCtx, title: string, items: Grant[], flags: Flags): Promise<MediaGrant> {
const grant = await ctx.client.uploadAlbum({ title, items }, putOpts(flags));
await ctx.library.add(ctx.server, grant, 0);
return grant;
}
export function openLibrary(path = join(configDir(), 'media-library.jsonl')): Promise<MediaLibrary> {
return MediaLibrary.open(path);
}
const naturally = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
/** A file, or a directory as an album of its (non-hidden) entries. */
async function putPath(client: MediaClient, path: string, flags: Flags, titled?: string): Promise<MediaGrant> {
if (!(await stat(path)).isDirectory()) return putFile(client, path, flags);
async function putPath(ctx: PutCtx, path: string, flags: Flags, titled?: string): Promise<MediaGrant> {
if (!(await stat(path)).isDirectory()) return putFile(ctx, path, flags);
const all = (await readdir(path)).filter((n) => !n.startsWith('.')).sort(naturally.compare);
// Subtitles next to a video travel inside it, not as items of their own.
const videos = all.filter((n) => guessMime(n)?.startsWith('video/')).map((n) => n.slice(0, -extname(n).length));
const names = all.filter((n) => !videos.some((v) => subtitleFor(v, n) !== null));
const items: Grant[] = [];
for (const n of names) items.push(await putPath(client, join(path, n), flags));
for (const n of names) items.push(await putPath(ctx, join(path, n), flags));
const title = titled ?? basename(path.replace(/\/+$/, ''));
err(`album "${title}": ${items.length} item(s)`);
return client.uploadAlbum({ title, items }, putOpts(flags));
return putAlbum(ctx, title, items, flags);
}
/** Seal and upload `Film.srt`, `Film.no.srt`, `Film.en.vtt` … found next to `Film.mkv`. */
async function putSubtitles(client: MediaClient, video: string, flags: Flags): Promise<SubtitleTrack[]> {
async function putSubtitles(ctx: PutCtx, video: string, flags: Flags): Promise<SubtitleTrack[]> {
const base = basename(video).slice(0, -extname(video).length);
const siblings = (await readdir(dirname(video))).sort(naturally.compare);
const tracks: SubtitleTrack[] = [];
for (const n of siblings) {
const lang = subtitleFor(base, n);
if (lang === null) continue;
const grant = await putFile(client, join(dirname(video), n), flags);
const grant = await putFile(ctx, join(dirname(video), n), flags);
tracks.push(lang === '' ? { grant } : { grant, lang });
err(` subtitles: ${n}${lang ? ` (${lang})` : ''}`);
}
@@ -205,7 +222,7 @@ function putOpts(flags: Flags): { readToken?: null } {
}
/** `as` overrides name and type — only for the one file named on the command line. */
async function putFile(client: MediaClient, file: string, flags: Flags, as: { name?: string; mime?: string } = {}): Promise<MediaGrant> {
async function putFile(ctx: PutCtx, file: string, flags: Flags, as: { name?: string; mime?: string } = {}): Promise<MediaGrant> {
let meta: MediaMeta = { name: as.name ?? basename(file) };
const mime = as.mime ?? guessMime(file);
if (mime !== undefined) meta.mime = mime;
@@ -213,7 +230,7 @@ async function putFile(client: MediaClient, file: string, flags: Flags, as: { na
let work: string | null = null;
try {
if (mime?.startsWith('video/')) {
const tracks = await putSubtitles(client, file, flags);
const tracks = await putSubtitles(ctx, file, flags);
if (flags.web === true) {
// Re-encode only what browsers cannot play; pull text subtitles out as tracks.
work = await mkdtemp(join(tmpdir(), 'shade-web-'));
@@ -223,7 +240,7 @@ async function putFile(client: MediaClient, file: string, flags: Flags, as: { na
meta = { name: as.name ?? `${stem}.mp4`, mime: prep.mime };
for (const sub of prep.subtitles) {
const name = `${stem}${sub.lang !== undefined ? `.${sub.lang}` : ''}.srt`;
const grant = await putFile(client, sub.path, flags, { name, mime: 'text/plain; charset=utf-8' });
const grant = await putFile(ctx, sub.path, flags, { name, mime: 'text/plain; charset=utf-8' });
tracks.push({ grant, ...(sub.lang !== undefined ? { lang: sub.lang } : {}), ...(sub.title !== undefined ? { label: sub.title } : {}) });
}
} else {
@@ -239,7 +256,9 @@ async function putFile(client: MediaClient, file: string, flags: Flags, as: { na
try {
err(`sealing ${meta.name ?? basename(file)} (${(size / 1048576).toFixed(1)} MiB)…`);
const result = await sealFile(source, tmp, { meta });
return await client.putSealed(result, Bun.file(tmp), { meta, ...putOpts(flags) });
const grant = await ctx.client.putSealed(result, Bun.file(tmp), { meta, ...putOpts(flags) });
await ctx.library.add(ctx.server, grant, result.sealedSize);
return grant;
} finally {
await rm(tmp, { force: true });
}
@@ -355,14 +374,35 @@ export function safeName(name: string | undefined, fallback: string): string {
return clean.length > 0 ? clean : fallback;
}
/** Your uploads on a relay, named from this machine's library where it knows them. */
async function mediaLs(flags: Flags): Promise<number> {
const server = need(flags, 'server', 'SHADE_MEDIA_SERVER');
const res = await new MediaClient(server, await loadOwnerKey()).list();
for (const i of res.items) out(`${i.id} ${(i.size / 1048576).toFixed(1).padStart(9)} MiB ${new Date(i.createdAt).toISOString()}`);
const [res, library] = await Promise.all([new MediaClient(server, await loadOwnerKey()).list(), openLibrary()]);
for (const i of res.items) {
const e = library.get(i.id);
const name = e === undefined ? '(not in this machine\'s library)' : `${e.name ?? '(no name)'}${e.mime === ALBUM_MIME ? '/' : ''}`;
out(`${i.id} ${(i.size / 1048576).toFixed(1).padStart(9)} MiB ${new Date(i.createdAt).toISOString().slice(0, 16).replace('T', ' ')} ${name}`);
}
err(`${res.items.length} item(s), ${(res.usage / 1048576).toFixed(1)} MiB`);
return 0;
}
/** `media link <name|id-prefix>`: the watch links of matching uploads, from the library. */
async function mediaLink(pos: string[]): Promise<number> {
const query = pos.join(' ').trim();
if (query === '') throw new UsageError('usage: shade media link <name or id prefix>');
const hits = (await openLibrary()).find(query);
if (hits.length === 0) {
err(`nothing in this machine's library matches "${query}"`);
return 1;
}
for (const e of hits) {
if (hits.length > 1) err(`${e.name ?? e.id}${e.mime === ALBUM_MIME ? '/' : ''}`);
out(watchLink(e.server, e.grant));
}
return 0;
}
async function mediaRm(pos: string[], flags: Flags): Promise<number> {
const server = need(flags, 'server', 'SHADE_MEDIA_SERVER');
const target = pos[0];
@@ -375,6 +415,8 @@ async function mediaRm(pos: string[], flags: Flags): Promise<number> {
id = g.mediaId;
}
const ok = await new MediaClient(server, await loadOwnerKey()).delete(id);
const library = await openLibrary();
if (library.get(toHex(id)) !== undefined) await library.remove(toHex(id));
err(ok ? 'deleted' : 'not found (or not yours)');
return ok ? 0 : 1;
}
@@ -562,7 +604,8 @@ export const MEDIA_HELP = `
embedded text subtitles → subtitle tracks.
media get <link> [-o file|dir|-]
Download and decrypt a sealed file (an album: a directory)
media ls --server URL Your uploads on that server
media ls --server URL Your uploads on that server, named from this machine's library
media link <name|id> Print the watch link of an upload again (from the library)
media rm <link|id> --server URL
live text --server URL [--name N] [--channel file.json]
Publish stdin as a live log (tail -f app.log | shade live text …)
@@ -593,6 +636,8 @@ export async function runMediaCli(group: 'media' | 'live', argv: string[]): Prom
return await mediaGet(pos, flags);
case 'ls':
return await mediaLs(flags);
case 'link':
return await mediaLink(pos);
case 'rm':
return await mediaRm(pos, flags);
}

View File

@@ -81,7 +81,11 @@ export function mediaKeysOf(g: MediaGrant): MediaKeys {
return { mediaId: g.mediaId, mediaKey: g.mediaKey, rootDigest: g.rootDigest };
}
/** Wire JSON: binary fields as base64url, the digest as hex (it is a hash, and greppable). */
/**
* Wire JSON: binary fields as base64url, the digest as hex (it is a hash, and
* greppable). The meta is written in its canonical order, so a grant always
* encodes to the same link, however its meta object was built.
*/
export function encodeGrant(g: Grant): string {
if (g.kind === MEDIA_GRANT_KIND) {
return JSON.stringify({
@@ -91,7 +95,7 @@ export function encodeGrant(g: Grant): string {
root: toHex(g.rootDigest),
...(g.url !== undefined ? { url: g.url } : {}),
...(g.readToken !== undefined ? { token: toB64u(g.readToken) } : {}),
...(g.meta !== undefined ? { meta: g.meta } : {}),
...(g.meta !== undefined ? { meta: validateMeta(g.meta) } : {}),
});
}
return JSON.stringify({
@@ -105,7 +109,7 @@ export function encodeGrant(g: Grant): string {
...(g.channelSecret !== undefined ? { channelSecret: toB64u(g.channelSecret) } : {}),
...(g.url !== undefined ? { url: g.url } : {}),
...(g.readToken !== undefined ? { token: toB64u(g.readToken) } : {}),
...(g.meta !== undefined ? { meta: g.meta } : {}),
...(g.meta !== undefined ? { meta: validateMeta(g.meta) } : {}),
});
}

View File

@@ -0,0 +1,112 @@
/**
* This machine's record of what it uploaded: names and links.
*
* The relay knows ids and sizes, never names, and a link is only printed
* once. Lose the link and a film you own is unreachable. So every upload is
* written down here, with its grant, under `$XDG_CONFIG_HOME/shade/` beside
* the owner key, mode 0600: a grant is a key.
*
* Format: one JSON object per line, appended (`{"op":"add",…}`,
* `{"op":"rm","id":…}`). Appends of a line are atomic on a local disk, so two
* `shade media put` running at once cannot lose each other's entries, and no
* lock is needed. Reading folds the lines; a damaged line is skipped.
*/
import { appendFile, mkdir, readFile } from 'node:fs/promises';
import { dirname } from 'node:path';
import { toHex } from './bytes.js';
import { encodeGrant, parseGrant } from './grant.js';
import type { MediaGrant } from './grant.js';
export interface LibraryEntry {
/** Lowercase hex media id. */
id: string;
/** Relay base URL it was uploaded to. */
server: string;
name?: string;
mime?: string;
/** Sealed bytes on the relay. */
size: number;
createdAt: number;
grant: MediaGrant;
}
export class MediaLibrary {
private constructor(
readonly path: string,
private readonly byId: Map<string, LibraryEntry>,
) {}
static async open(path: string): Promise<MediaLibrary> {
const byId = new Map<string, LibraryEntry>();
let text = '';
try {
text = await readFile(path, 'utf8');
} catch (e) {
if ((e as NodeJS.ErrnoException).code !== 'ENOENT') throw e;
}
for (const line of text.split('\n')) {
if (line.trim() === '') continue;
try {
const o = JSON.parse(line) as Record<string, unknown>;
if (o.op === 'rm' && typeof o.id === 'string') {
byId.delete(o.id);
} else if (o.op === 'add' && typeof o.id === 'string' && typeof o.server === 'string') {
const grant = parseGrant(JSON.stringify(o.grant));
if (grant.kind !== 'shade.media-grant/v1') continue;
byId.set(o.id, {
id: o.id,
server: o.server,
...(typeof o.name === 'string' ? { name: o.name } : {}),
...(typeof o.mime === 'string' ? { mime: o.mime } : {}),
size: typeof o.size === 'number' ? o.size : 0,
createdAt: typeof o.createdAt === 'number' ? o.createdAt : 0,
grant,
});
}
} catch {
// A torn or hand-edited line costs that entry, not the library.
}
}
return new MediaLibrary(path, byId);
}
entries(): LibraryEntry[] {
return [...this.byId.values()].sort((a, b) => b.createdAt - a.createdAt);
}
get(id: string): LibraryEntry | undefined {
return this.byId.get(id);
}
/** Entries whose id starts with `query`, or whose name contains it (any case). */
find(query: string): LibraryEntry[] {
const q = query.toLowerCase();
return this.entries().filter((e) => e.id.startsWith(q) || (e.name ?? '').toLowerCase().includes(q));
}
async add(server: string, grant: MediaGrant, size: number): Promise<LibraryEntry> {
const entry: LibraryEntry = {
id: toHex(grant.mediaId),
server: server.replace(/\/$/, ''),
...(grant.meta?.name !== undefined ? { name: grant.meta.name } : {}),
...(grant.meta?.mime !== undefined ? { mime: grant.meta.mime } : {}),
size,
createdAt: Date.now(),
grant,
};
await this.append({ op: 'add', ...entry, grant: JSON.parse(encodeGrant(grant)) as unknown });
this.byId.set(entry.id, entry);
return entry;
}
async remove(id: string): Promise<void> {
await this.append({ op: 'rm', id });
this.byId.delete(id);
}
private async append(o: unknown): Promise<void> {
await mkdir(dirname(this.path), { recursive: true, mode: 0o700 });
await appendFile(this.path, `${JSON.stringify(o)}\n`, { mode: 0o600 });
}
}

View File

@@ -0,0 +1,71 @@
import { describe, test, expect, afterAll } from 'bun:test';
import { appendFile, mkdtemp, rm, stat } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { MediaLibrary } from '../src/library.js';
import { encodeGrant, parseGrant } from '../src/index.js';
import type { MediaGrant } from '../src/index.js';
const dirs: string[] = [];
afterAll(async () => {
for (const d of dirs) await rm(d, { recursive: true, force: true });
});
async function libPath(): Promise<string> {
const d = await mkdtemp(join(tmpdir(), 'shade-lib-'));
dirs.push(d);
return join(d, 'nested', 'media-library.jsonl');
}
const grant = (n: number, name: string): MediaGrant => ({
kind: 'shade.media-grant/v1',
mediaId: new Uint8Array(16).fill(n),
mediaKey: new Uint8Array(32).fill(n),
rootDigest: new Uint8Array(32).fill(n),
url: `https://relay.example/v1/media/${n}`,
readToken: new Uint8Array(32).fill(n + 1),
meta: { name, mime: 'video/mp4' },
});
describe('media library', () => {
test('records uploads with their grants, finds them by name or id, forgets removals', async () => {
const path = await libPath();
const lib = await MediaLibrary.open(path);
await lib.add('https://relay.example/', grant(1, 'Sesong 1 — Episode 2.mkv'), 100);
await lib.add('https://relay.example', grant(2, 'Ferie.jpg'), 50);
await lib.add('https://relay.example', grant(3, 'Episode 10.mkv'), 70);
await lib.remove('02'.repeat(16));
const again = await MediaLibrary.open(path);
expect(again.entries().map((e) => e.name).sort()).toEqual(['Episode 10.mkv', 'Sesong 1 — Episode 2.mkv']);
expect(again.find('episode').length).toBe(2);
expect(again.find('sesong 1')[0]!.grant).toEqual(grant(1, 'Sesong 1 — Episode 2.mkv'));
expect(again.find('0303')[0]!.name).toBe('Episode 10.mkv');
expect(again.get('01'.repeat(16))!.server).toBe('https://relay.example');
// Grants are keys: the file is the owner's alone.
expect((await stat(path)).mode & 0o777).toBe(0o600);
});
test('a torn line costs that entry only', async () => {
const path = await libPath();
const lib = await MediaLibrary.open(path);
await lib.add('https://r', grant(1, 'a'), 1);
await appendFile(path, '{"op":"add","id":"x","serv');
await appendFile(path, '\n');
await lib.add('https://r', grant(2, 'b'), 1);
expect((await MediaLibrary.open(path)).entries().map((e) => e.name).sort()).toEqual(['a', 'b']);
});
test('writers at the same time do not lose each other\'s entries', async () => {
const path = await libPath();
const libs = await Promise.all(Array.from({ length: 8 }, () => MediaLibrary.open(path)));
await Promise.all(libs.flatMap((l, i) => Array.from({ length: 25 }, (_, j) => l.add('https://r', grant(i * 25 + j, `f${i}-${j}`), 1))));
expect((await MediaLibrary.open(path)).entries().length).toBe(200);
});
test('a grant encodes to the same link after a round trip, whatever its meta key order', () => {
const a = grant(7, 'x.mkv');
const b: MediaGrant = { ...a, meta: { mime: 'video/mp4', name: 'x.mkv' } };
expect(encodeGrant(a)).toBe(encodeGrant(b));
expect(encodeGrant(parseGrant(encodeGrant(a)))).toBe(encodeGrant(a));
});
});

View File

@@ -137,13 +137,13 @@
},
{
"description": "live grant: wire JSON of a link grant (base64url fields, from: now at seq 0)",
"json": "{\"kind\":\"shade.live-grant/v1\",\"channelId\":\"EBESExQVFhcYGRobHB0eHw\",\"signingKey\":\"JUO5L_EJVRFHatyDadtt3JM2ZaEZeN2hQE7hBmypVZ0\",\"epoch\":0,\"seq\":0,\"chainKey\":\"E6_jBkmqrEm5L2k4DEJCZf4Sw-pHpHVbBu8X2ROtkVs\",\"stickyKey\":\"5Ej5ayGHESce-3SHm4PaGvZrzkWDAEiGSyZ25yiwk_s\",\"channelSecret\":\"gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp8\",\"url\":\"wss://relay.example/v1/live/EBESExQVFhcYGRobHB0eHw\",\"token\":\"VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU\",\"meta\":{\"name\":\"kanal\",\"mime\":\"text/plain\"}}"
"json": "{\"kind\":\"shade.live-grant/v1\",\"channelId\":\"EBESExQVFhcYGRobHB0eHw\",\"signingKey\":\"JUO5L_EJVRFHatyDadtt3JM2ZaEZeN2hQE7hBmypVZ0\",\"epoch\":0,\"seq\":0,\"chainKey\":\"E6_jBkmqrEm5L2k4DEJCZf4Sw-pHpHVbBu8X2ROtkVs\",\"stickyKey\":\"5Ej5ayGHESce-3SHm4PaGvZrzkWDAEiGSyZ25yiwk_s\",\"channelSecret\":\"gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp8\",\"url\":\"wss://relay.example/v1/live/EBESExQVFhcYGRobHB0eHw\",\"token\":\"VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU\",\"meta\":{\"mime\":\"text/plain\",\"name\":\"kanal\"}}"
},
{
"description": "album: sealed shade.album/v1 holding a media grant, a nested album and a live link grant",
"sealed": "cd6f802752a18e84202f631e652a5652c8657b42715d8acc387a5ed39df3ea319df8a9f1d0180e15f6b4cb6e3f055cad44702a97a04b591f702ab3112a1ac78a8869aff0c92f49989f7a03c878043f0b770420264708e212c41ef4fbd9ab7dc9f215783c2db8d8964eb6b9b9047c436ee7091d5a0d86b4fc13ded73abfee300a34a2afa5bf6fd68682b1053abeccb4eb48b446cd9fdefc5f7a6f3aa4bac533085cf47d5b6ba89376ded9d64dddcd8e67fec6d661978a6961b4d708489a5329d02ca49362f0fc27d28789652c2626eae7bd90a96ec9b7074101a6727f7c09eed3af0a909df555251a8ceb6a240cc8accd2c73cb7510a87731e537b55c42c9210cdb175bd826890a138f4297a70e57cb7672bec0cc1fb926418eca82060f3457b3fcd7128e553d6bc3fdf08c9e2b644d5db0643b9760d53e5046b3e9fcd5b38cdb24a946b15ba73403156b0f53b9472b8688f5dd76e0c31667b5f1a7b82180c522ff60f38f09d6d7e15618e2ea15f84409254d83d8f0bf499020f68de5b2d0bb51893a641b5b3bf05a06f5effda1e04f3c8d5fa0c6f94a5ee672bc94856717443bd31ec860037eb4f8fd530079abafe2380903fd2e9b190d10f58770d0c50d87bfaa36aa4df7399f98f82e6dac1cd29da23e16d6097e86abf6c682c507d4adc15462b28c9d51d90b4ca173da7ce63f9f083cbdd5f06488f849dc0f6e76a4ed17ae3609a65ed4b46ce55f04aee3e1349db0a88d90bcfd0916a9a1e946ba5c0e242cf3599967a5b4411d7824e862df19802b3af43b9d635d5e61577d605fbfc5205f857c438be313513da59a006507509853db012ca58d670ebaf2b563284c5e07b1b4b4393edf8c84419db3696183777a623feabd05934bd9e549d8b9edaba68a0ad5bcd18f9e2d8c2ec5626c34854d8c738584cbcc55574c929583eb4a47d8790f0420703c0dcf205047cc5e278c91ba7c35c4b90764b8e782e8bb04436415b663fd19d161747e58b08c2abca8e1a66a019ebd0e613fad4ab93557b0360bcac26d3453fd216c7c7431f7e185e2ebfee4c38959c912e7fb1d16968a2edce04c8495e6ef2d187a3fe6162cbda091dc30370058136c1d55c037621af1b50ebb8a140c9c14e82e94e9db2a9fc7e5020ab61757888611a573b3bb9cca044787c9a919a7f27a05bbd20bad9ad595ef2a708efcb00c3f4e32acd36dbac35f816627e9571be709a2a1cd32418934682d0dac1db1c3ae906b9d1f5f6322e3171ffe088ec556d13327448ccfafbf1de1fdfaaa3315647707e10494b78a3c5dcde7b05c6bcb41e17cc8b5969af54773a0ac576540b8701edd8c80e3c96669f4bc1929e0ec075a7de30edad9d2db01391a318dd84ddd0777a5faa1dd1f78a8028313810ca87122d6c0674cdef4fc343a917c73e2a527c5d0db58e6b8dfeb7afa3e8a642b9fa856f4c4333f19de6cef9e30be95f8d38d15150c1420ec4cd1b3c275e50b857e82614f19a7926760175f6f831c03997eef3ccb6ac4fc37ebb2d2f24666f8802b62b97e80188ab942cb23b2d55060084e0f798d5544b21e9356234e8137a1a9cbdda77904f6f8837cc4a1042bb06ea7eb2a29cb8451048bc73206bc3d683d37f05d68b7d3932b467f532f06d7c6c7b291b9aa0678c8e8d0c757a7683ce7f464026f9b02b5c30cce6e9d5594c556f55ad635427bca8568d935712a474e4166e811f57e6bab914f428bbbd7a8c0e0f98c2ac41fdbc1d3212ef004949fecdf176392cc83c6e5b1d2ef14de7765bf296da9cb45f3f3b78f964c37915ff92ead13c0019551451ab0114628c73ebe62cd81e401920068dace7bb2ffa0f319a8b1ea583cb8fb94734519759f85d30957d70ed51be32b74a343983e99b9902c1ecd53cc708e534d4631010000000000100000000000000004b30000005ca0a1a2a3a4a5a6a7a8a9aaabacadaeaf0000000000000000000000000000000000000000534d4631",
"rootDigest": "3f2aed0d1c8919eaeffef9e1d68425d1037ecddac2ba7862b3f492202d99aa02",
"plaintext": "{\"kind\":\"shade.album/v1\",\"title\":\"Sesong 1 — «Vinter»\",\"items\":[{\"kind\":\"shade.media-grant/v1\",\"mediaId\":\"EREREREREREREREREREREQ\",\"key\":\"IiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiI\",\"root\":\"3333333333333333333333333333333333333333333333333333333333333333\",\"url\":\"https://relay.example/v1/media/11111111111111111111111111111111\",\"meta\":{\"name\":\"Episode 1.mkv\",\"mime\":\"video/x-matroska\"}},{\"kind\":\"shade.media-grant/v1\",\"mediaId\":\"RERERERERERERERERERERA\",\"key\":\"IiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiI\",\"root\":\"3333333333333333333333333333333333333333333333333333333333333333\",\"url\":\"https://relay.example/v1/media/11111111111111111111111111111111\",\"meta\":{\"mime\":\"application/vnd.shade.album+json\",\"name\":\"Ekstra\"}},{\"kind\":\"shade.live-grant/v1\",\"channelId\":\"EBESExQVFhcYGRobHB0eHw\",\"signingKey\":\"JUO5L_EJVRFHatyDadtt3JM2ZaEZeN2hQE7hBmypVZ0\",\"epoch\":0,\"seq\":0,\"chainKey\":\"E6_jBkmqrEm5L2k4DEJCZf4Sw-pHpHVbBu8X2ROtkVs\",\"stickyKey\":\"5Ej5ayGHESce-3SHm4PaGvZrzkWDAEiGSyZ25yiwk_s\",\"channelSecret\":\"gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp8\",\"url\":\"wss://relay.example/v1/live/EBESExQVFhcYGRobHB0eHw\",\"token\":\"VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU\",\"meta\":{\"name\":\"kanal\",\"mime\":\"text/plain\"}}]}",
"sealed": "cd6f802752a18e84202f631e652a5652c8657b42715d8acc387a5ed39df3ea319df8a9f1d0180e15f6b4cb6e3f055cad44702a97a04b591f702ab3112a1ac78a8869aff0c92f49989f7a03c878043f0b770420264708e212c41ef4fbd9ab7dc9f215783c2db8d8964eb6b9b9047c436ee7091d5a0d86b4fc13ded73abfee300a34a2afa5bf6fd68682b1053abeccb4eb48b446cd9fdefc5f7a6f3aa4bac533085cf47d5b6ba89376ded9d64dddcd8e67fec6d661978a6961b4d708489a5329d02ca49362f0fc27d28789652c2626eae7bd90a96ec9b7074101a6727f7c09eed3af0a909df555251a8ceb6a240cc8accd2c73cb7510a87731e537b55c42c9210cdb175bd826890a138f4297a70e57cb7672bec0cc1fb926418eca82060f3457b3fcd7128e553d6bc3fdf08c9e2b644d5db0643b9760d53e5046b3e9fcd5b38cdb24a946b15ba73403156b0f53b9472b8688f5dd76e0c01e67b5f1a7b81299c834ff2bee825599cef84f49a5a95abd0b02661ac48ca3f9698f66fdcfecb684f810973a731b5b3bf05a06f5effda1e04f3c8d5fa0c6f94a5ee672bc94856717443bd31ec860037eb4f8fd530079abafe2380903fd2e9b190d10f58770d0c50d87bfaa36aa4df7399f98f82e6dac1cd29da23e16d6097e86abf6c682c507d4adc15462b28c9d51d90b4ca173da7ce63f9f083cbdd5f06488f849dc0f6e76a4ed17ae3609a65ed4b46ce55f04aee3e1349db0a88d90bcfd0916a9a1e946ba5c0e242cf3599967a5b4411d7824e862df19802b3af43b9d635d5e61577d605fbfc5205f857c438be313513da59a006507509853db012ca58d670ebaf2b563284c5e07b1b4b4393edf8c84419db3696183777a623feabd05934bd9e549d8b9edaba68a0ad5bcd18f9e2d8c2ec5626c34854d8c738584cbcc55574c929583eb4a47d8790f0420703c0dcf205047cc5e278c91ba7c35c4b90764b8e782e8bb04436415b663fd19d161747e58b08c2abca8e1a66a019ebd0e613fad4ab93557b0360bcac26d3453fd216c7c7431f7e185e2ebfee4c38959c912e7fb1d16968a2edce04c8495e6ef2d187a3fe6162cbda091dc30370058136c1d55c037621af1b50ebb8a140c9c14e82e94e9db2a9fc7e5020ab61757888611a573b3bb9cca044787c9a919a7f27a05bbd20bad9ad595ef2a708efcb00c3f4e32acd36dbac35f816627e9571be709a2a1cd32418934682d0dac1db1c3ae906b9d1f5f6322e3171ffe088ec556d13327448ccfafbf1de1fdfaaa3315647707e10494b78a3c5dcde7b05c6bcb41e17cc8b5969af54773a0ac576540b8701edd8c80e3c96669f4bc1929e0ec075a7de30edad9d2db01391a318dd84ddd0777a5faa1dd1f78a8028313810ca87122d6c0674cdef4fc343a917c73e2a527c5d0db58e6b8dfeb7afa3e8a642b9fa856f4c4333f19de6cef9e30be95f8d38d15150c1420ec4cd1b3c275e50b857e82614f19a7926760175f6f831c03997eef3ccb6ac4fc37ebb2d2f24666f8802b62b97e80188ab942cb23b2d55060084e0f798d5544b21e9356234e8137a1a9cbdda77904f6f8837cc4a1042bb06ea7eb2a29cb8451048bc73206bc3d683d37f05d68b7d3932b467f532f06d7c6c7b291baa20678c8e8d0d853b17d7fb5b4270668d44bb5974fd76ec71b99de5bfa52d435427bca857e4438daec907f51953b65fa1bf691684f428bbbd7a8c0e0f98c2ac41fdbc1d3212ef004949fecdf176392cc83c6e5b1d2ef14de7765bf296da9cb45f3f3b78f964c37915ff92ead13c0019551451ab0114628c73ebe62cd81e401920068dace7bb2ffa0f319a8b1ea583cb8cf1a99fd9d7fd84d79807e5b20bd6d436f9f900e05dc80f61823c627ea18dee7534d4631010000000000100000000000000004b30000005ca0a1a2a3a4a5a6a7a8a9aaabacadaeaf0000000000000000000000000000000000000000534d4631",
"rootDigest": "95b752136e10fbfb5f2f5ded5d9f49a7e8b2938e3d8c9b4185a795b36b061d9f",
"plaintext": "{\"kind\":\"shade.album/v1\",\"title\":\"Sesong 1 — «Vinter»\",\"items\":[{\"kind\":\"shade.media-grant/v1\",\"mediaId\":\"EREREREREREREREREREREQ\",\"key\":\"IiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiI\",\"root\":\"3333333333333333333333333333333333333333333333333333333333333333\",\"url\":\"https://relay.example/v1/media/11111111111111111111111111111111\",\"meta\":{\"mime\":\"video/x-matroska\",\"name\":\"Episode 1.mkv\"}},{\"kind\":\"shade.media-grant/v1\",\"mediaId\":\"RERERERERERERERERERERA\",\"key\":\"IiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiI\",\"root\":\"3333333333333333333333333333333333333333333333333333333333333333\",\"url\":\"https://relay.example/v1/media/11111111111111111111111111111111\",\"meta\":{\"mime\":\"application/vnd.shade.album+json\",\"name\":\"Ekstra\"}},{\"kind\":\"shade.live-grant/v1\",\"channelId\":\"EBESExQVFhcYGRobHB0eHw\",\"signingKey\":\"JUO5L_EJVRFHatyDadtt3JM2ZaEZeN2hQE7hBmypVZ0\",\"epoch\":0,\"seq\":0,\"chainKey\":\"E6_jBkmqrEm5L2k4DEJCZf4Sw-pHpHVbBu8X2ROtkVs\",\"stickyKey\":\"5Ej5ayGHESce-3SHm4PaGvZrzkWDAEiGSyZ25yiwk_s\",\"channelSecret\":\"gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp8\",\"url\":\"wss://relay.example/v1/live/EBESExQVFhcYGRobHB0eHw\",\"token\":\"VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU\",\"meta\":{\"mime\":\"text/plain\",\"name\":\"kanal\"}}]}",
"title": "Sesong 1 — «Vinter»",
"itemKinds": [
"shade.media-grant/v1",