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

[RFC] Maskbook Post Binary Payload Format v1 #329

Closed
neruthes opened this issue Oct 28, 2019 · 15 comments
Closed

[RFC] Maskbook Post Binary Payload Format v1 #329

neruthes opened this issue Oct 28, 2019 · 15 comments

Comments

@neruthes
Copy link
Contributor

neruthes commented Oct 28, 2019

Metadata

Field Value
Manifest Meta/Article-3
Purpose Documentation
Feedback deadline 2019-12-13 12:00:00 UTC
Explicitly designated reviewers ...

Abstract

Maskbook Post Bitstream Payload Format is designed to provide a compact method to convey post payloads over size-sensitive transportation infrastructures, especially image steganography.

Structure

The structure of a post payload consists of 11 major parts:

Section Name Length Description
Magic Header 18 B 31 AB 24 6E 8A 24 FC 49 DC AF 2A 6D 79 DF 8F A2 CB 7F, which will become Maskbook/Encrypted+Post/ after Base64 encoding
Version 2 B UInt16, starting from 0x0000
Blob Positions 10 B Array<UInt16>[5]
PostIV 16 B IV of AES, working as PostUUID
Public Share 1 B Bool, 0x00 or 0x01
Cipher Message Dynamic Blob
Self-Recipient Key Hint Dynamic Blob (PostKey, ECDH-encrypted to the author)
List of Receiving Groups Dynamic Array<String>.join(0x7C7C)
Extension Data Public Dynamic Serialized Object, UTF-8
Extension Data Private Dynamic Serialized Object, UTF-8, AES-encrypted with PostKey and PostIV
Checksum 32 B Blob (SHA2-256 hash)

Sections

Blob Positions

This part consists of 5 numbers (UInt16), which respectively indicate the length of the sections since Cipher Message.

This is designed to optimize for using Blob.prototype.slice to select the respective parts without reading through the whole blob.

PostIV

// TODO

Cipher Message

// TODO

Self-Recipient Key Hint

// TODO

List of Receiving Groups

// TODO

Extension Data Public

This is a serialized JSON object. Reserved for further definition.

Extension Data Private

This is an AES-encrypted blob of a serialized JSON object. Reserved for further definition.

Checksum

The SHA2-256 hash of all bytes afore.

@neruthes
Copy link
Contributor Author

It is possible that @guanbinrui may want to employ this format for #316.

@Jack-Works
Copy link
Member

do we realy need to make a binary format by ourself?

@Tedko
Copy link
Member

Tedko commented Nov 15, 2019 via email

@neruthes
Copy link
Contributor Author

Trivialization can be harmful. Now on Twitter we have the #198 format, and on Facebook we have the original payload. Headers, encoding methods, and separators all differ. If we adopt a binary version, we will only need to implement network-specific interfaces, instead of network-specific payloads.

@neruthes
Copy link
Contributor Author

This RFC will open for a longer period of time as we work closely on other components.

The discussion here is not blocking #373. The discussion here is not making amendments to #198.

@neruthes
Copy link
Contributor Author

This RFC will open for a longer period of time as we work closely on other components.

The discussion here is not blocking #373. The discussion here is not making amendments to #198.

If #373 and #198 are subject to amendments, they will be updated independently.

@neruthes neruthes changed the title [RFC] Maskbook Post Bitstream Payload Format [RFC] Maskbook Post Binary Payload Format v1 Dec 4, 2019
@neruthes
Copy link
Contributor Author

neruthes commented Dec 9, 2019

Update:

This RFC should draw to conclusion on 2019-12-13.

@Tedko
Copy link
Member

Tedko commented Dec 9, 2019

Love to hear opinions from @Jack-Works . But pls don't prioritize this for now.

Remember #410 is much more important for our growth. Prioritize that RFC pls

@Jack-Works
Copy link
Member

There are many binary JSON format like http://bsonspec.org/ and it will be easier to encode/decode by format like bson

@neruthes
Copy link
Contributor Author

Love to hear opinions from @Jack-Works . But pls don't prioritize this for now.

Remember #410 is much more important for our growth. Prioritize that RFC pls

Without a new payload format, Red Packet feature will become a giant historic burden.

@neruthes
Copy link
Contributor Author

There are many binary JSON format like http://bsonspec.org/ and it will be easier to encode/decode by format like bson

I proposed using JSON-based format in the past and the feedbacks were pure negation.

We may change to Base64-encoded BSON under #225.

@yisiliu
Copy link
Member

yisiliu commented Dec 10, 2019

bson is good enough

@neruthes
Copy link
Contributor Author

I will start updating this to a BSON-based format today.

@Jack-Works
Copy link
Member

I will start updating this to a BSON-based format today.

We can send our JSON format to bson library and it becomes binary! 🧙‍♂️

@neruthes
Copy link
Contributor Author

neruthes commented Dec 10, 2019

This RFC is dismissed because we will introduce a new format upon #502, after #502 is ratified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants