From a493d914199da3e77bdbc48ba03d35ebcf638c6b Mon Sep 17 00:00:00 2001 From: Thomas Howe Date: Fri, 20 Nov 2026 18:50:24 -0500 Subject: [PATCH] docs(vcon-js): url without content_hash allowed on vcon-js main (core issue #40) --- vcon-js-library/README.md | 2 +- vcon-js-library/api-reference.md | 2 ++ vcon-js-library/llm-guide.md | 4 ++-- vcon-js-library/quickstart.md | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/vcon-js-library/README.md b/vcon-js-library/README.md index 0348451..a1407ec 100644 --- a/vcon-js-library/README.md +++ b/vcon-js-library/README.md @@ -23,7 +23,7 @@ Both libraries write the same JSON structure and each reads the other's output. * Classes: `Vcon`, `Party`, `Dialog`, `Attachment`, `PartyHistory`. `Analysis` is a type, passed as a plain object to `addAnalysis`. * Current core-draft surface: `recording-set` dialogs (`recordings`, `recording_set`), analysis `attachment` reference with `dialog` optional, party `type`, `org`, `dept`, and a typed `provenance` parameter on dialog and analysis. * Spec-correct names: `amended`, `critical`, `purpose` on attachments, `mediatype`. `vcon: "0.4.0"` is set for you. -* Inline and external content: `body` plus `encoding`, or `url` plus `content_hash` (format `sha512-`, checked by `validate()`). +* Inline and external content: `body` plus `encoding`, or `url` plus `content_hash` (format `sha512-`, checked by `validate()`). 0.5.2 requires the `content_hash` with a `url`. vcon-js `main` (the upcoming 1.0.0, not yet on npm) allows a `url` without one on dialog, attachment, and analysis, following the WG direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40), and still rejects a malformed hash. * `addAnalysis` accepts an object or array body, serializes it to a string, and sets `encoding: "json"`. * Tags through `addTag`, `getTag`, and the `tags` getter, stored as one `purpose: "tags"` attachment with `start` set. * Declared extensions through `addExtension`, `addCriticalExtension`, `hasExtension`, `isCriticalExtension`. diff --git a/vcon-js-library/api-reference.md b/vcon-js-library/api-reference.md index f61b007..08d469c 100644 --- a/vcon-js-library/api-reference.md +++ b/vcon-js-library/api-reference.md @@ -148,6 +148,8 @@ Methods: `addInlineData(body, mediatype, { encoding?, filename? })`, `addExterna `validate()` requires `purpose`, rejects both `body` and `url`, and requires a `sha512-` `content_hash` when `url` is set. +On vcon-js `main` (the upcoming 1.0.0, not yet on npm), `Dialog.validate()` and `Attachment.validate()` no longer require `content_hash` with a `url`, following the WG direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40); a `content_hash` that is present must still be well formed. The vCon-level validator on `main` reports an attachment with neither inline content nor a `url` as `Attachment at index {i} must include body+encoding or url.` + Note that `Vcon.addAttachment` copies the attachment's `toDict()` into the vCon. Calling `addInlineData` or `addExternalData` on the returned instance afterwards does not change the vCon. Set content on an `Attachment` before adding it, or pass it in `params`. ### Lawful basis attachment diff --git a/vcon-js-library/llm-guide.md b/vcon-js-library/llm-guide.md index 35a61c3..6caddd9 100644 --- a/vcon-js-library/llm-guide.md +++ b/vcon-js-library/llm-guide.md @@ -19,7 +19,7 @@ Output that breaks these is not a valid vCon. 3. **Attachments use `purpose`.** There is no `type` field on attachments, including the lawful basis attachment: `purpose: 'lawful_basis'`. Always pass `start`; the core schema requires it and `addAttachment` does not fill it in. 4. **Analysis requires `vendor`.** Use `schema` to name the body format. Never write `schema_version`. 5. **Structured bodies.** Pass objects and arrays as the value. `addAnalysis` serializes an object or array body to a string and sets `encoding: 'json'` for you. `addAttachment` stores the body as given, so pass `encoding: 'json'` with an object body. -6. **External media needs `url` and `content_hash`.** The hash is `sha512-` of the file bytes. Compute it with `createHash('sha512').update(bytes).digest('base64url')` from `node:crypto`. Never write a placeholder hash into output. +6. **External media: `url`, plus `content_hash` when you have the bytes.** The hash is `sha512-` of the file bytes. Compute it with `createHash('sha512').update(bytes).digest('base64url')` from `node:crypto`. If you cannot get stable bytes (a streaming-service page, audio behind a login), leave `content_hash` out; never write a placeholder hash into output. In 0.5.2, `Dialog.validate()` and `Attachment.validate()` reject a `url` without `content_hash`. vcon-js `main` (the upcoming 1.0.0, not yet on npm) allows it on dialog, attachment, and analysis, following the WG direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40); the core-05 text still says MUST until the WG revises it. A malformed `content_hash` is always an error, and `redacted_from` / `amended_from` with a `url` still need one. 7. **Timestamps are RFC 3339 with timezone.** Use `new Date().toISOString()` or an explicit offset. 8. **Do not emit empty `group: []` or `redacted: {}`.** 9. **Transcripts are analysis**, not attachments. Use `type: 'wtf_transcription'` for the WTF extension. @@ -119,7 +119,7 @@ console.log(vcon.toJson()); * `vcon.addAttachment({ type: 'transcript', ... })`. Transcripts live in `analysis[]`. Use `addAnalysis`. * `appended: {...}` or `must_support: [...]`. Use `amended` and `critical[]`. * `start: '2026-05-18 14:00:00'` with no timezone. Use `.toISOString()`. -* External media without `content_hash`, or with a made-up hash. +* External media with a made-up `content_hash`. Compute it from the bytes or leave it out (0.5.2's `validate()` still rejects a `url` without one). * Importing `Signature` or calling a signing method. Removed in 0.5.2. * Mutating an `Attachment` after `vcon.addAttachment(att)` and expecting the vCon to change. The vCon holds a copy. diff --git a/vcon-js-library/quickstart.md b/vcon-js-library/quickstart.md index 4edec78..c8e8986 100644 --- a/vcon-js-library/quickstart.md +++ b/vcon-js-library/quickstart.md @@ -45,6 +45,8 @@ vcon.addDialog(chat); Keep audio and video out of the JSON. Reference it with `url` and a `content_hash` of the form `sha512-`. `addExternalData(url, mediatype, { filename, content_hash })` sets all three and clears any inline body. +In 0.5.2, `validate()` rejects a `url` without a `content_hash`. vcon-js `main` (the upcoming 1.0.0, not yet on npm) allows a `url` without one on dialogs, attachments, and analysis, for media whose stable bytes you can't get, following the WG direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40). A malformed `content_hash` is still an error. + ```typescript import { createHash } from 'node:crypto';