-
Notifications
You must be signed in to change notification settings - Fork 379
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
- Client
- Server
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 | ||
``` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
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