Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4224: CBOR Serialization #4224

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

MSC4224: CBOR Serialization #4224

wants to merge 4 commits into from

Conversation

Saiv46
Copy link

@Saiv46 Saiv46 commented Nov 6, 2024

Rendered

Yes, this is basically #3079 but only CBOR part of it, "one bite at a time" and such.

This MSC is written as an individual FOSS contributor. (Disclosure as by matrix-org/matrix-spec#1700)

Signed-off-by: Alexander Ivanov saiv46.dev@gmail.com

@Saiv46 Saiv46 changed the title WIP: CBOR Serialization MSC4224: CBOR Serialization Nov 6, 2024
@turt2live turt2live added proposal A matrix spec change proposal s2s Server-to-Server API (federation) needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Nov 6, 2024
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also sign off on your changes so we can eventually put this on a track to acceptance.

proposals/4224-cbor-serialization.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client
  • Server

@turt2live turt2live added client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff and removed s2s Server-to-Server API (federation) labels Nov 6, 2024
Comment on lines +35 to +46
of binary data, such as public keys or signatures. Given that unlike JSON, CBOR
can safely represent raw binary data, all binary data MUST be encoded and
represented as binary strings with tag 22, as described in RFC 8949 [Section
3.4.5.2](https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.5.2). Tagging
is required for compatibility with generic CBOR-to-JSON converters.

Example object would be encoded like this:
```
D6 # tag(22)
50 # bytes(16)
03082C12C0053C1EC80BD712ACED1E0A # "AwgsEsAFPB7IC9cSrO0eCg" in base64
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the goal is to minimize the space taken by the content, why use base64 instead of raw binary data? It can be trivially base64-encoded during the conversion to json.

Copy link
Author

@Saiv46 Saiv46 Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using tag 22, generic converters can determine that raw bytes supposed to be encoded in base64 in JSON. We DON'T encode to base64, for a reason you mentioned.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err, it seems that I misread the snippet, my bad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants