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

MIP - Programmable Envelopes #217

Open
robdefeo opened this issue Jul 19, 2019 · 3 comments
Open

MIP - Programmable Envelopes #217

robdefeo opened this issue Jul 19, 2019 · 3 comments
Assignees
Labels
mip Mailchain Improvement Proposal

Comments

@robdefeo
Copy link
Member

robdefeo commented Jul 19, 2019

Simple Summary

Allow creating transaction data in a more flexible and clear way. Using functions/structs linked to an ID to describe each payload type and its contents.

Abstract

To address different message requirements and payload handling options, this proposes introduction of a programmable envelope to 'enclose' a message. The envelope type defines the payload options.

This achieves a flexible and efficient means of sending message payload without introducing unnecessary complexity through many optional fields that would require complex documentation and a lousy developer experience.

Without this, forward and backward compatibility is possible but requires complex test cases and carries greater risks of fields conflicting.

Motivation (*optional)

Different types of messages SHOULD be supported on Mailchain, including but not limited to:

  • Private location, privately verifiable message contents
  • Private location, public verifiable message contents
  • Using full URL for message location
  • Using full Message Storage Identifier (see MIP - Message Store Identifier #215 ) for message location
  • Public (unencrypted) message, stored in txdata
  • Public (unencrypted) message location with public unencrypted message

Specification

  • ID to link to different envelope being used.
  • ID = 0x00 is reserved to identify unset value
  • ID = 0xFF and above is reserved to allow extensibility beyond 256 envelopes using the next byte to identify length.
  • Data should be able to validate if its contents are invalid Valid() error
  • Return URL encrypted or not URL(decrypter cipher.Decrypter) (*url.URL, error)
  • Return hash to ensure data has not been altered IntegrityHash(decrypter cipher.Decrypter) ([]byte, error)
  • Return hash to ensure contents has not been tampered ContentsHash(decrypter cipher.Decrypter) ([]byte, error)

Rationale

See abstract

Backwards Compatibility

This will allow backwards and forwards compatibility as long as the first byte identifies its envelope type and the interface is implemented

Related MIP

@tboeckmann
Copy link
Contributor

I edited the abstract... this is a great proposal.

Where are the IDs stored?

@robdefeo
Copy link
Member Author

Currently the ID's are stored in https://github.com/mailchain/mailchain/blob/master/internal/envelope/data.go now you mention it. I didn't give it much thought when creating it like this though. Any requirements you can think of around that?

@tboeckmann
Copy link
Contributor

Currently the ID's are stored in https://github.com/mailchain/mailchain/blob/master/internal/envelope/data.go now you mention it. I didn't give it much thought when creating it like this though. Any requirements you can think of around that?

I think a CSV in the repo is fine for now. Developers can create a pull request to suggest entries. Each envelope should have sufficient accompanying documentation.

@stale stale bot added the Stale label Nov 23, 2019
@mailchain mailchain deleted a comment from stale bot Nov 23, 2019
@stale stale bot removed the Stale label Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mip Mailchain Improvement Proposal
Projects
None yet
Development

No branches or pull requests

2 participants