Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vcon-js-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<base64url>`, checked by `validate()`).
* Inline and external content: `body` plus `encoding`, or `url` plus `content_hash` (format `sha512-<base64url>`, 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`.
Expand Down
2 changes: 2 additions & 0 deletions vcon-js-library/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ Methods: `addInlineData(body, mediatype, { encoding?, filename? })`, `addExterna

`validate()` requires `purpose`, rejects both `body` and `url`, and requires a `sha512-<base64url>` `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
Expand Down
4 changes: 2 additions & 2 deletions vcon-js-library/llm-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<base64url>` 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-<base64url>` 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.
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions vcon-js-library/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-<base64url>`. `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';

Expand Down
Loading