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] Maskwork General Payload Exchange Format (v1.0.0.0) #225

Closed
neruthes opened this issue Sep 25, 2019 · 7 comments
Closed

[RFC] Maskwork General Payload Exchange Format (v1.0.0.0) #225

neruthes opened this issue Sep 25, 2019 · 7 comments

Comments

@neruthes
Copy link
Contributor

neruthes commented Sep 25, 2019

Metadata

Field Value
Manifest Meta/Article-3
Purpose Data Exchange Format
Feedback deadline ...
Explicitly designated reviewers ...
Later Updated By #502

Preface

  • Unless otherwise specified, all UUID should be hyphenated and uppercase, like D2A028D2-DF0E-46F9-B56E-18B5E798B2C3.

Background

We have been working a lot with payloads, including Friendship Certificate, UserGroup Membership Certificate, and #222.

Now we need an extensible payload exchange format to enhance the abstraction.

Criteria

  • Never rely on CRLF.
  • Never rely on %20.
  • Never rely on \s.
  • As human-readable as possible.
  • Forward compatibility.
  • Have funny memes.

Payload Structure

{
    "Meta": {
        "PayloadSpec": "DeadSeaOldScroll",
        "Version": 1
    },
    "Content": {
        "_": {
            // Content here
        }
    },
    "Signature": {
        "_": {
            // Signature here
        }
    }
}

It is basically JSON. CRLF, %20, and \s are allowed but not recommended.

Meta, Content, and Signature are basic nodes. Additional nodes may be used for other purposes.

Content Structure

Use _ attribute to refer to child nodes. For forward compatibility, use additional attributes.

Mandatory Starting Nodes

App, AppVersion, and Time are mandatory.

"Content": {
    "_": {
        "AppLabel": "{{ App label [natural language or UUIDv4] }}",
        "AppVersion": 1, // Integer
        "Time":  1569374955715 // UNIX timestamp millisecond (UTC)
    }
}

Application-Specific Data

Take the example for Sisterhood Membership Certificate. The the payload should look like:

{
    "Meta": {
        "PayloadSpec": "DeadSeaOldScroll",
        "Version": 1
    },
    "Content": {
        "_": {
            "AppLabel": "Maskwork--SisterhoodMembershipCertificate",
            "AppVersion": 1,
            "Time": 1569374955715,
            "MisakanetID": {
                "_": "JQKSLxSwquW+9YBAoS53ns6fuPwOjFyspngZ63ZxnU3Gs93D5cUtWocgkMlhleEx0yKZ1e45U2zp57SUgCJd1w==",
                "encoding": "base-64"
            },
            "InviterPublicKeyFingerprint": {
                "_": "A76160D5D9E2AC2A9FEB2B958594AC9E11F1F381",
                "hash": "SHA-1",
                "encoding": "hex"
            },
            "InviterPublicKey": {
                "_": "ArxApPYD24e+RjrKyYMpG/2QemXLfxsISb+aFFbltJ1f",
                "encoding": "base-64"
            },
            "InviteeAutobiography": {
                "_": {
                    "Meta": {
                        "PayloadSpec": "DeadSeaOldScroll",
                        "Version": 1
                    },
                    "Content": {
                        "_": {
                            "AppLabel": "Maskwork--DeviceAutobiography",
                            "AppVersion": 1,
                            "Time": 1569374955715,
                            "PublicKeyFingerprint": {
                                "_": "BCD1FF19582A9B8D5CE9CB780E18C651318756B6",
                                "hash": "SHA-1",
                                "encoding": "hex"
                            },
                            "PublicKey": {
                                "_": "ArxApPYD24e+RjrKyYMpG/2QemXLfxsISb+aFFbltJ1f",
                                "encoding": "base-64"
                            },
                            "DeviceName": "Nietzsche"
                        }
                    },
                    "Signature": {
                        "_": {
                            "BaseSig": {
                                "_": "WFceyl2VOyvyeaqkTodUI1XulcXQkRVQvh3U65vvMUuRq2ln9ozlECaZYLkKq9HHWKucm9sc2e52y32I1Foikg==",
                                "encoding": "base-64"
                            }
                        }
                    }
                }
            },
            "InviterTrustChain": "I AM YOUR FATHER"
        }
    },
    "Signature": {
        "_": {
            "BaseSig": {
                "_": "WFceyl2VOyvyeaqkTodUI1XulcXQkRVQvh3U65vvMUuRq2ln9ozlECaZYLkKq9HHWKucm9sc2e52y32I1Foikg==",
                "encoding": "base-64"
            }
        }
    }
}

Signature

BaseSig

BaseSig is the basic signature. Additional nodes may be used for other purposes.

Input for BaseSig should always be the serialized string of Content._ node.

To be continued...

@neruthes
Copy link
Contributor Author

neruthes commented Dec 9, 2019

Expedited ratification requested.

@neruthes
Copy link
Contributor Author

neruthes commented Dec 9, 2019

Ratified.

@neruthes neruthes closed this as completed Dec 9, 2019
@Jack-Works
Copy link
Member

I have to say you're using JSON like XML(the _ as children design). And why we need a signature field?

@neruthes
Copy link
Contributor Author

I have to say you're using JSON like XML(the _ as children design). And why we need a signature field?

@Jack-Works
Copy link
Member

I have to say you're using JSON like XML(the _ as children design). And why we need a signature field?

Yeah and in those issues, there are no explanations about why do we need a signature

@Jack-Works
Copy link
Member

an alternative format. with minimal restrict on the format:

{
    "_meta_": {
        "version": 1,
        "type": "the type of this object",
        // add signature etc here
    },
    // Content here
}

@neruthes
Copy link
Contributor Author

This RFC is suspended from being used in implementations. Use #502 instead, 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

3 participants