Repository navigation
Add JSONEnvelope, a versioned digest-checked envelope over JCS - #99
Merged
Merged
Conversation
Format version 1 is one RFC 8785 canonical object with digest, format, formatVersion, payload, type and version. The digest is the SHA-256 of the payload's canonical bytes; decoding verifies marker, fields and digest and reports JSONEnvelopeFailure for invalid or damaged envelopes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
1.10 exact interchange, last piece:
JSONEnvelope, a versioned record of one payload in RFC 8785 canonical bytes. The maintainer chose the digest design on 15 November 2026.Wire format (version 1, fixed)
{"digest":"sha256:87245ae1c062ec8fd5e2ab1ac60fbc44f6822d6176fe850381db1fd6e97c7810","format":"swift-json-envelope","formatVersion":1,"payload":{"id":7,"state":"done"},"type":"mcp.task","version":3}digest:sha256:plus the lowercase hex SHA-256 of the canonical payload. Equal payloads have equal digests, so the digest can serve as a content address.type: non-empty, at most 256 UTF-8 bytes.version: 1 … 2^53 − 1.API (JSON core)
JSONEnvelope(type:version:payload:).encode(options:)/encodeWithReport→JSONEnvelopeEncoding { data, digest }.JSONEnvelope.decode(_:options:)/decodeWithReport: accepts any strict spelling and verifies the marker, member set,formatVersion, fields and digest.JSONEnvelopeFailure(invalidFormat,unsupportedFormatVersion,invalidType,invalidVersion,invalidDigest,digestMismatch) for well-formed values that are not valid envelopes. No case carries input text. Syntax, resource and number failures stayJSONFailure. I used a separate error type so the publicJSONFailure.Codeenum gains no cases.JSONEnvelopeOptions: limits and the canonicalNumberPolicy. The default.preservingrefuses numbers binary64 cannot spell exactly;.roundingmust be used on both sides..conversionfailures, so cancellation and resource failures propagate.Docs and tooling
VersionedEnvelopes.md, linked from the JSON landing page.Tests
hashlibover the RFC 8785 payload bytes, including non-ASCII keys and1e+21.Qualification (local)
Toolchain: Apple Swift 6.4.2 (swiftlang-6.4.2.1.9), macOS 27.3. Source:
22f4383onb3eef29.python3 Scripts/ci.py --lane docs: exit 0, 4/4 commands passedpython3 Scripts/ci.py --lane native: exit 0, 62/62 commands passed, 0 failedNo tag, release or publication follows from this PR.
🤖 Generated with Claude Code