diff --git a/extensions/lawful-basis.md b/extensions/lawful-basis.md index 4d4fec5..355333f 100644 --- a/extensions/lawful-basis.md +++ b/extensions/lawful-basis.md @@ -115,7 +115,7 @@ Section 6 tells readers what to do before acting on a vCon: ## Python -The [`vcon`](https://pypi.org/project/vcon/) library (1.0.5) builds this attachment and fills in `purpose`, `encoding`, `party`, `mediatype` and `start`. Version 1.0 and later target core-05: `Vcon.build_new()` sets `"vcon": "0.5.0"`, and the attachment is scoped to a session with `session_index` rather than to a dialog. With only `dialog_index` the helper logs a warning and writes a dialog-only scope, as in the core-04 form described above; with neither, it uses the vCon's only session or raises `ValueError`. The helper adds `lawful_basis` to `extensions`, which `is_valid()` requires. Proof mechanisms must be `ProofMechanism` objects, not dicts. +The [`vcon`](https://pypi.org/project/vcon/) library (1.0.6) builds this attachment and fills in `purpose`, `encoding`, `party`, `mediatype` and `start`. Version 1.0 and later target core-05: `Vcon.build_new()` sets `"vcon": "0.5.0"`, and the attachment is scoped to a session with `session_index` rather than to a dialog. With only `dialog_index` the helper logs a warning and writes a dialog-only scope, as in the core-04 form described above; with neither, it uses the vCon's only session or raises `ValueError`. The helper adds `lawful_basis` to `extensions`, which `is_valid()` requires. Proof mechanisms must be `ProofMechanism` objects, not dicts. Since 1.0.4, `Vcon.is_valid()` also checks the body of every `purpose: "lawful_basis"` attachment, including one written by hand with `add_attachment()`: `lawful_basis`, `expiration` (which may be `null`) and `purpose_grants` are required, and each grant and proof mechanism is checked. A `proof_type`, hash algorithm or canonicalization method outside the values the draft lists is a warning from `get_validation_warnings()`, not an error, because the draft's lists are open. For core-04 output (`"0.4.0"`, `dialog` scope), stay on `vcon` 0.10.x. diff --git a/extensions/wtf-transcription.md b/extensions/wtf-transcription.md index 0453a6a..ac76a12 100644 --- a/extensions/wtf-transcription.md +++ b/extensions/wtf-transcription.md @@ -114,7 +114,7 @@ All confidence values are normalized to the range 0 to 1 (Section 8.1). ## Python -Build the analysis entry with the [`vcon`](https://pypi.org/project/vcon/) library. The example uses `vcon` 1.0.5, which writes core-05 (`"vcon": "0.5.0"`), so the recording dialog sits in a session. `add_wtf_transcription_analysis()` writes the entry this draft defines: `type: "wtf_transcription"`, `encoding: "json"`, the WTF document as the `body` value, `vendor` and `product` from `metadata["provider"]` and `metadata["model"]`, and the draft URL in `schema`. It also adds `wtf_transcription` to `extensions`. +Build the analysis entry with the [`vcon`](https://pypi.org/project/vcon/) library. The example uses `vcon` 1.0.6, which writes core-05 (`"vcon": "0.5.0"`), so the recording dialog sits in a session. `add_wtf_transcription_analysis()` writes the entry this draft defines: `type: "wtf_transcription"`, `encoding: "json"`, the WTF document as the `body` value, `vendor` and `product` from `metadata["provider"]` and `metadata["model"]`, and the draft URL in `schema`. It also adds `wtf_transcription` to `extensions`. ```python from vcon import Dialog, Session, Vcon @@ -126,7 +126,7 @@ v.add_party(Party(tel="+15551230002", name="Bob")) v.add_session(Session(start="2026-10-06T14:00:00Z", parties=[0, 1])) v.add_dialog(Dialog(type="recording", start="2026-10-06T14:00:00Z", parties=[0, 1], url="https://example.com/call.wav", mediatype="audio/x-wav", - # placeholder hash; a url needs a content_hash + # placeholder hash; set content_hash when you have the bytes content_hash="sha512-GLy6IPaIUM1GqzZqfIPZlWjaDsNgNvZM0iCONNThnH0a75fhUM6cYzLZ5GynSURREvZwmOh54-2lRRieyj82UQ"), session=0) diff --git a/helps-and-hacks/coding-prompt-cheat-sheet.md b/helps-and-hacks/coding-prompt-cheat-sheet.md index b6925cf..a076314 100644 --- a/helps-and-hacks/coding-prompt-cheat-sheet.md +++ b/helps-and-hacks/coding-prompt-cheat-sheet.md @@ -221,7 +221,7 @@ The [`vcon`](../vcon-library/README.md) library 0.10.x does most of this for cor * `redacted` and `amended` are mutually exclusive. * Every index must point at an existing array element. -* `url` always comes with `content_hash`. +* `url` comes with `content_hash` whenever you have the bytes. `redacted` and `amended` always need it. On a dialog, attachment or analysis whose URL has no stable bytes to hash (a YouTube page, audio behind a login), the WG direction on core issue #40 allows leaving it out (accepted by `vcon` 1.0.6); never invent a hash. * `incomplete` dialogs need `disposition`; `recording-set` dialogs need `recordings`. * Every attachment has `start`, `party` and `dialog`; every analysis has `vendor`. * A reader that finds an unsupported name in `critical` rejects the vCon. diff --git a/vcon-adapters/llm-guide-creating-vcon-adapters.md b/vcon-adapters/llm-guide-creating-vcon-adapters.md index 938f105..7d9c8fa 100644 --- a/vcon-adapters/llm-guide-creating-vcon-adapters.md +++ b/vcon-adapters/llm-guide-creating-vcon-adapters.md @@ -16,7 +16,7 @@ Paste this page into a model's context to generate adapter code. It holds the gr * With `encoding="json"`, `body` is the JSON value itself, never a `json.dumps()` string. Readers accept both; use `json_body()`. * Attachments use `purpose`, never `type`, and carry `start`, `party`, `dialog`. A body carries `mediatype` and `encoding`. * Analysis uses `schema`, never `schema_version`, and requires `vendor`. Transcripts go in `analysis[]` with `type: "wtf_transcription"`. -* External media needs both `url` and `content_hash`, formatted `sha512-`. +* External media needs both `url` and `content_hash`, formatted `sha512-`, when the adapter has the bytes. Leave the hash out only for a URL with no stable bytes to hash (see the [checklist](spec-compliance-checklist.md#external-media)); never invent one. * Field names: `critical` (not `must_support`), `amended` (not `appended`), `mediatype` (not `mimetype`). Do not emit `did` on parties. * Timestamps are ISO 8601 with a timezone. List every extension used in `extensions[]`. * Build through helpers. Hand-set only `subject` and `extensions`. diff --git a/vcon-adapters/spec-compliance-checklist.md b/vcon-adapters/spec-compliance-checklist.md index efcc62f..3b46f32 100644 --- a/vcon-adapters/spec-compliance-checklist.md +++ b/vcon-adapters/spec-compliance-checklist.md @@ -44,7 +44,7 @@ Build through the `vcon` library helpers (`add_party`, `add_dialog`, `add_attach ## External media -* [ ] A dialog that points at media has both `url` and `content_hash` +* [ ] A dialog that points at media has both `url` and `content_hash`. The exception is a URL with no stable bytes to hash, such as a streaming page or audio behind a login: the working group's direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40) allows a `url` without a `content_hash` there (accepted by `vcon` 1.0.6; the draft text still says MUST). An adapter that downloads the recording has the bytes, so it hashes them. Never invent a hash * [ ] `content_hash` is `sha512-`, not hex, not padded base64, not SHA-256 * [ ] `mediatype` is set diff --git a/vcon-library/README.md b/vcon-library/README.md index 7de639e..a4e20d3 100644 --- a/vcon-library/README.md +++ b/vcon-library/README.md @@ -1,5 +1,5 @@ --- -description: Where to start with the Python vCon library, version 1.0.5 on core-05. +description: Where to start with the Python vCon library, version 1.0.6 on core-05. icon: plug --- @@ -7,13 +7,13 @@ icon: plug ## vCon Python Library -> **Current version:** `vcon` **1.0.5** · `pip install vcon` · [GitHub: vcon-dev/vcon-lib](https://github.com/vcon-dev/vcon-lib) · Targets [`draft-ietf-vcon-vcon-core-05`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/), syntax `"0.5.0"` · Reads and migrates `"0.4.0"` · Python 3.12 or later. +> **Current version:** `vcon` **1.0.6** · `pip install vcon` · [GitHub: vcon-dev/vcon-lib](https://github.com/vcon-dev/vcon-lib) · Targets [`draft-ietf-vcon-vcon-core-05`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/), syntax `"0.5.0"` · Reads and migrates `"0.4.0"` · Python 3.12 or later. ### About the library The `vcon` package builds, reads, validates, signs and serializes vCons in Python. A vCon is a JSON container for one conversation: its parties, sessions, dialogs (text, recordings, images), events such as joins and transfers, attachments, and analysis such as transcripts or sentiment. The library covers the core-05 object model and two extensions, [Lawful Basis](../extensions/lawful-basis.md) and [WTF transcription](../extensions/wtf-transcription.md). -Version 1.0.0 is a breaking release. Code written for 0.10.0 and core-04 needs changes: dialogs belong to sessions, `party_history` and transfer dialogs became events, and attachments need a `dialog` or `session`. Version 1.0.4 makes `is_valid()` check content hash syntax and lawful basis bodies, keeps `created_at` as written, fixes the video helpers (`vcon[video]`), moves JWS to joserfc, and deprecates `add_wtf_transcription_attachment()`. The [quickstart](quickstart.md#release-notes) lists the changes. +Version 1.0.0 is a breaking release. Code written for 0.10.0 and core-04 needs changes: dialogs belong to sessions, `party_history` and transfer dialogs became events, and attachments need a `dialog` or `session`. Version 1.0.4 makes `is_valid()` check content hash syntax and lawful basis bodies, keeps `created_at` as written, fixes the video helpers (`vcon[video]`), moves JWS to joserfc, and deprecates `add_wtf_transcription_attachment()`. Version 1.0.6 allows a `url` without a `content_hash` on a dialog, attachment or analysis entry, for URLs whose bytes cannot be obtained stably (a YouTube page, audio behind a login), following the working group's direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40). The [quickstart](quickstart.md#release-notes) lists the changes. ### Features diff --git a/vcon-library/library-api-reference.md b/vcon-library/library-api-reference.md index 0466091..34639ee 100644 --- a/vcon-library/library-api-reference.md +++ b/vcon-library/library-api-reference.md @@ -6,7 +6,7 @@ description: Signatures, return types and working examples for every public clas ## vCon Library API Reference -Reference for `vcon` **1.0.5**, which implements [`draft-ietf-vcon-vcon-core-05`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/) (`"vcon": "0.5.0"`) and reads and migrates 0.4.0. The [quickstart](quickstart.md) has release notes and known limits. What each field means, and when it is required, is in the [field reference](../vcons/field-reference.md); that page describes core-04 (`"0.4.0"`), while the library writes core-05. +Reference for `vcon` **1.0.6**, which implements [`draft-ietf-vcon-vcon-core-05`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/) (`"vcon": "0.5.0"`) and reads and migrates 0.4.0. The [quickstart](quickstart.md) has release notes and known limits. What each field means, and when it is required, is in the [field reference](../vcons/field-reference.md); that page describes core-04 (`"0.4.0"`), while the library writes core-05. ### Installation @@ -86,7 +86,9 @@ The library logs through `logging.getLogger(__name__)` in each module and does n `is_valid()` checks required fields; that `vcon`, when present, is `"0.5.0"`; that a session exists when there is dialog or events; every party, dialog, session, attachment and analysis index; the event parameter table; that attachments have `party` and `dialog` or `session`; that `redacted_from` and `amended_from` are not both present; that `extensions` lists every extension in use and every `critical` entry; that a dialog or attachment with inline content has a `mediatype`; that every `__REDACTED_REF_#` has a `redacted_strings` entry; that `created_at` is ISO 8601; that every `content_hash` (dialog, attachment, analysis, `redacted_from`, `amended_from`) is `-`, with an 86-character digest for `sha512` and 43 for `sha256`, so hex and padded digests fail; and that every `purpose: "lawful_basis"` attachment body has `lawful_basis`, `expiration` and `purpose_grants` and well-formed grants and proof mechanisms. -`get_validation_warnings()` reports a dialog that no session lists, a session without `start` or `parties`, a `url` without a `content_hash` (an `is_valid()` error from 1.1), an `encoding: "json"` body that is a serialized JSON string, and lawful basis proof types, hash algorithms or canonicalization methods the draft does not define. +`get_validation_warnings()` reports a dialog that no session lists, a session without `start` or `parties`, an `encoding: "json"` body that is a serialized JSON string, and lawful basis proof types, hash algorithms or canonicalization methods the draft does not define. + +A `url` without a `content_hash` on a dialog, attachment or analysis entry is neither an error nor a warning from 1.0.6 (1.0.4 and 1.0.5 warned), because a producer cannot always get stable bytes for the URL, such as a YouTube page or audio behind a login. This follows the working group's 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. Set `content_hash` whenever you have the bytes. `redacted_from` and `amended_from` with a `url` still need a `content_hash` (an `is_valid()` error), and an attachment needs `body` and `encoding`, or `url`. `PERMITTED_JWS_ALGORITHMS` in `vcon.vcon` lists `RS256`, `RS384`, `RS512`, `PS256`, `PS384`, `PS512`, `ES256`, `ES384`, `ES512` and `EdDSA`. `AlgorithmNotPermittedError` is a `ValueError`. @@ -108,7 +110,7 @@ ref = Dialog(type="recording", start=now, parties=[0], mediatype="audio/x-wav", url="https://example.com/call.wav") # placeholder URL, no content_hash draft = Vcon(vcon.to_dict()) draft.add_dialog(ref, session=0) -print(draft.is_valid()[0], draft.get_validation_warnings()[0][:40]) # True Dialog at index 1 has a url but no conte +print(draft.is_valid(), draft.get_validation_warnings()) # (True, []) [] ref.content_hash = "sha512-" + "ab" * 64 # hex, not base64url draft.vcon_dict["dialog"][1] = ref.to_dict() print(draft.is_valid()[1][0][:46]) # Dialog at index 1 has an invalid content_hash diff --git a/vcon-library/quickstart.md b/vcon-library/quickstart.md index d114b68..6f49309 100644 --- a/vcon-library/quickstart.md +++ b/vcon-library/quickstart.md @@ -6,7 +6,7 @@ description: Install the Python vCon library and build, save, load, sign and val ## vCon Library -`vcon` 1.0.5 on PyPI. It targets [`draft-ietf-vcon-vcon-core-05`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/) and writes `"vcon": "0.5.0"`. It reads 0.4.0 and 0.5.0 and migrates 0.4.0 on load. Python 3.12 or later. +`vcon` 1.0.6 on PyPI. It targets [`draft-ietf-vcon-vcon-core-05`](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/) and writes `"vcon": "0.5.0"`. It reads 0.4.0 and 0.5.0 and migrates 0.4.0 on load. Python 3.12 or later. ```bash pip install vcon @@ -184,7 +184,7 @@ print(vcon.is_valid()) # (True, []) print(vcon.get_validation_warnings()) # [] ``` -A dialog or attachment with a `url` needs a `content_hash` (core-05 section 2.4). In 1.0.x a `url` without one is a warning from `get_validation_warnings()`; it will be an `is_valid()` error in 1.1. +Set `content_hash` with a `url` whenever you have the bytes (`compute_content_hash()`, or `add_external_data()`). From 1.0.6 a `url` without a `content_hash` is allowed on a dialog, attachment or analysis entry, because a producer cannot always get stable bytes for the URL (a YouTube page returns different HTML on each fetch; some audio sits behind a login). This follows the working group's direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40); the core-05 text (section 2.4) still says MUST until the WG revises it. There is no marker field. `redacted_from` and `amended_from` with a `url` still need a `content_hash`, and a malformed `content_hash` is still an `is_valid()` error. Dialog types are `recording`, `text` and `incomplete`. `Dialog(type="audio")` and `Dialog(type="video")` still work but warn and build a `recording`. `transfer` and `recording-set` dialogs are gone: `Dialog(party_history=...)`, `originator=`, `transferee=` and the other transfer parameters raise `ValueError`, and `add_transfer_dialog()` raises `NotImplementedError`. An `Event` checks the per-type parameter table when built, so `Event(type="join", time=now, party=0)` raises `ValueError` for the missing `sessions`. `add_incomplete_dialog()` writes no `body`; `details` goes to `metadata["details"]`. @@ -367,6 +367,11 @@ A signed 0.4.0 vCon is not migrated on load, because migrating drops the signatu ### Release notes +**1.0.6** changes: + +* A `url` without a `content_hash` is allowed on a dialog, attachment or analysis entry, because a producer cannot always get stable bytes for the URL (a streaming page such as YouTube, audio behind a login). This follows the working group's direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40); core-05 itself still says MUST. 1.0.4 and 1.0.5 reported it as a warning and said it would become an `is_valid()` error in 1.1; that plan is dropped, and `get_validation_warnings()` no longer reports it. An attachment needs `body` and `encoding`, or `url` (it used to need `url` and `content_hash`). +* Unchanged: a malformed `content_hash` is still an `is_valid()` error, and `redacted_from` and `amended_from` with a `url` still need a `content_hash`. + **1.0.5** fixes: * `is_valid()` no longer raises on a malformed `lawful_basis` body (a 1.0.4 regression): a non-string or offset-less `expiration`, a non-object grant, proof mechanism, `content_hash` or `registry`, or a non-string `lawful_basis` are reported as errors. A timestamp with no offset is read as UTC. @@ -385,7 +390,7 @@ A signed 0.4.0 vCon is not migrated on load, because migrating drops the signatu **1.0.4** changes: * JWS uses joserfc instead of `authlib.jose`, so `import vcon` no longer prints a deprecation warning. Signatures interoperate with 1.0.3 in both directions, and `sign()` and `verify()` also accept EC and Ed25519 keys. -* `get_validation_warnings()` reports a `url` without a `content_hash` (an `is_valid()` error from 1.1) and an `encoding: "json"` body that is a serialized JSON string. +* `get_validation_warnings()` reports a `url` without a `content_hash` (no longer reported from 1.0.6) and an `encoding: "json"` body that is a serialized JSON string. * `add_tag()` takes `party` (default 0) and raises `ValueError` for an index that does not exist. On a vCon with no parties it warns (`DeprecationWarning`) and will raise in 1.1. * `add_wtf_transcription_attachment()` is deprecated. Use `add_wtf_transcription_analysis()`. @@ -415,11 +420,10 @@ A signed 0.4.0 vCon is not migrated on load, because migrating drops the signatu **0.9.5** content hashes use the spec form `sha512-`, and `compute_content_hash` and `parse_content_hash_algorithm` were added. Old unprefixed SHA-256 hashes still verify. **0.9.6** security: `requests` bump. **0.9.3** fixed `add_tag()` defaults. **0.9.2** `build_new()` emitted `"vcon": "0.4.0"` and `add_wtf_transcription_analysis()` was added. -### Known limits in 1.0.5 +### Known limits in 1.0.6 * `subject` has no setter. * `add_wtf_transcription_attachment()` is deprecated but still writes WTF to `attachments[]`, and `is_valid()` does not flag it. Use `add_wtf_transcription_analysis()`. -* A `url` without a `content_hash` passes `is_valid()` and is only a warning until 1.1. * `add_tag()` on a vCon with no parties writes a party index that does not exist (with a `DeprecationWarning`) until 1.1. * `Dialog.VALID_TYPES` still lists `audio` and `video`, which are accepted for backward compatibility and written as `recording`. diff --git a/vcon-library/vcon-library-guide-for-llms.md b/vcon-library/vcon-library-guide-for-llms.md index f6cbe7e..f2ff5a3 100644 --- a/vcon-library/vcon-library-guide-for-llms.md +++ b/vcon-library/vcon-library-guide-for-llms.md @@ -4,7 +4,7 @@ description: A compact, self-contained reference for language models that write # 📜 vCon Library Guide for LLMs -Reference for models that generate code with the `vcon` Python library, version 1.0.5, which implements `draft-ietf-vcon-vcon-core-05` (`"vcon": "0.5.0"`). Every code block below was run against `vcon==1.0.5`. For field semantics see the [field reference](../vcons/field-reference.md), which describes core-04; where it differs, the rules on this page are what the library writes. For the full method list see the [API reference](library-api-reference.md). +Reference for models that generate code with the `vcon` Python library, version 1.0.6, which implements `draft-ietf-vcon-vcon-core-05` (`"vcon": "0.5.0"`). Every code block below was run against `vcon==1.0.6`. For field semantics see the [field reference](../vcons/field-reference.md), which describes core-04; where it differs, the rules on this page are what the library writes. For the full method list see the [API reference](library-api-reference.md). ### Rules for generated code @@ -17,7 +17,7 @@ Reference for models that generate code with the `vcon` Python library, version 7. Attachments take `purpose=` and need `party` plus `dialog` or `session`. Pass `session=` explicitly when the vCon has more than one session. Analysis takes `type=`, `vendor=` and optional `dialog=`, `sessions=`, all keyword-only. 8. The lawful basis attachment uses `purpose: "lawful_basis"`. Build it with `vcon.add_lawful_basis_attachment(..., party_index=..., session_index=...)`, never by hand, and add one to every complete vCon you create. 9. A `json`-encoded `body` is the JSON value itself (dict, list, string), not `json.dumps(...)`. Read any entry with `Vcon.decoded_body(entry)`. -10. `content_hash` is `sha512-` plus unpadded base64url (86 characters). Create it with `compute_content_hash(data)` or `Dialog.calculate_content_hash()`; never write a hex digest, a padded value or a shortened placeholder, because `is_valid()` rejects them. Every dialog or attachment with a `url` needs a `content_hash` (a warning now, an `is_valid()` error from 1.1). +10. `content_hash` is `sha512-` plus unpadded base64url (86 characters). Create it with `compute_content_hash(data)` or `Dialog.calculate_content_hash()`; never write a hex digest, a padded value or a shortened placeholder, because `is_valid()` rejects them. Set `content_hash` with a `url` whenever you have the bytes. It may be left out on a dialog, attachment or analysis entry only when you cannot get stable bytes for the URL, such as a YouTube page or audio behind a login (allowed from 1.0.6, following the WG direction on core issue #40; core-05 text still says MUST). Never invent a hash. `redacted_from` and `amended_from` with a `url` always need one. 11. Put WTF transcripts in `analysis[]` with `add_wtf_transcription_analysis()`, not in `attachments[]`. `add_wtf_transcription_attachment()` is deprecated. 12. Give every dialog with a `body` a `mediatype`; `is_valid()` fails without one. 13. `Vcon` is not a dict. There is no `vcon.get(...)` and no `vcon["parties"]`. Use properties (`vcon.parties`, `vcon.sessions`, `vcon.events`) or `vcon.to_dict()` or `vcon.vcon_dict`. @@ -79,7 +79,7 @@ from vcon import Event, SessionReference vcon.add_dialog(Dialog( type="recording", start=now, parties=[0, 1], - url="https://example.com/recording.wav", # placeholder URL and hash; a url needs a content_hash + url="https://example.com/recording.wav", # placeholder URL and hash; set content_hash when you have the bytes content_hash="sha512-GLy6IPaIUM1GqzZqfIPZlWjaDsNgNvZM0iCONNThnH0a75fhUM6cYzLZ5GynSURREvZwmOh54-2lRRieyj82UQ", mediatype="audio/x-wav", duration=62.5, ), session=0) @@ -291,7 +291,7 @@ for call in ( * Invalid dialog `type`, removed dialog parameter, `disposition`, `encoding`, event parameters, attachment scope or lawful basis type raises `ValueError`. `AlgorithmNotPermittedError` and `MigrationError` are `ValueError` subclasses. * `add_transfer_dialog()` raises `NotImplementedError`. * A missing file raises `FileNotFoundError`; malformed JSON raises `json.JSONDecodeError`. -* `is_valid()` returns problems as strings and does not raise, including for an invalid `created_at`. `get_validation_warnings()` returns SHOULD-level findings, a `url` without a `content_hash`, and a `json` body that is a serialized JSON string. +* `is_valid()` returns problems as strings and does not raise, including for an invalid `created_at`. `get_validation_warnings()` returns SHOULD-level findings and a `json` body that is a serialized JSON string. * `add_tag(..., party=n)` with an index that does not exist raises `ValueError`. * `sign()` and `verify()` take `cryptography` RSA, EC or Ed25519 key objects (joserfc). `import vcon` prints no warnings. * `add_party()` needs a `Party`, not a dict (`AttributeError`). @@ -320,7 +320,8 @@ for call in ( | WTF in `attachments[]` | `add_wtf_transcription_analysis()` | | `Metadata(audio_quality=...)` | `Quality(audio_quality=...)` | | `sha256` hash without prefix, a hex digest, or `"sha512-abc"` | `sha512-` from `compute_content_hash()` | -| `url=...` with no `content_hash` | `url=...` plus `content_hash=` | +| `url=...` with no `content_hash` when you have the file | `url=...` plus `content_hash=compute_content_hash(data)` (leave it out only when stable bytes cannot be obtained) | +| A made-up `content_hash` for a URL you could not fetch | No `content_hash` (allowed on dialog, attachment and analysis from 1.0.6) | | `add_wtf_transcription_attachment(...)` | `add_wtf_transcription_analysis(...)` | | `add_tag(...)` before any party | `add_party(...)`, then `add_tag(...)` | | `sign(key, alg="none")` | `sign(key)` (RS256) | diff --git a/vcons/concepts.md b/vcons/concepts.md index aa1a22e..9ef1f09 100644 --- a/vcons/concepts.md +++ b/vcons/concepts.md @@ -30,7 +30,7 @@ An entry in `attachments` for material supplied alongside the conversation rathe ## Inline and external content -Dialog, analysis and attachment entries hold content one of two ways. Inline content sits in `body` with an `encoding`: `none` for plain text, `base64url` for binary, `json` for a JSON value. External content is referenced by an HTTPS `url` with a `content_hash` (`sha512-` followed by the Base64url digest), so a reader can tell whether the file changed. A `mediatype` gives the content's media type. +Dialog, analysis and attachment entries hold content one of two ways. Inline content sits in `body` with an `encoding`: `none` for plain text, `base64url` for binary, `json` for a JSON value. External content is referenced by an HTTPS `url` with a `content_hash` (`sha512-` followed by the Base64url digest), so a reader can tell whether the file changed. Set the hash whenever the producer has the bytes. When it cannot get stable bytes for the URL, such as a YouTube page that returns different HTML on each fetch or audio behind a login, the working group's direction on [core issue #40](https://github.com/ietf-wg-vcon/draft-ietf-vcon-vcon-core/issues/40) allows a dialog, analysis or attachment `url` without a `content_hash`, and the [`vcon`](../vcon-library/README.md) library accepts it from 1.0.6. The core-05 text still says MUST until the WG revises it, and `redacted_from` and `amended_from` with a `url` always need the hash. A `mediatype` gives the content's media type. ## Extension