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

new message-base description. #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TelegramSam
Copy link

No description provided.

TelegramSam and others added 2 commits April 28, 2018 08:49
fixed a typo; readability formatting; changed single quote mark to double (to be consistent with JSON spec, JWT spec, and this repo)
Example:
```JSON
{
"@type": "example.com/basemessage",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe @type should be registered as a "public claim name" https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.2?

### Applicable JWT attributes

* **"iss"** (Issuer) - from DID
* **"sub"** (Subject)
Copy link
Contributor

Choose a reason for hiding this comment

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

JWT presents itself as "a compact, URL-safe means of representing claims to be transferred between two parties." For that reason, it makes sense that it has these common "claim names". However, these claim names assume the signing algorithm is a very simple one, like RSA, DSA, or ECDSA. More advanced ZK signing algorithms are clearly not contemplated. The JWT spec has one paragraph on privacy, and it has two options (1) encryption, and (2) don't include information. Correlation privacy isn't mentioned.

If we say we're using JWT, it will be understood that we're using it for claims exchange, which we can't. We can use JWS and JWE as "dumb" wrappers, but the main purpose of JWT will be lost on Sovrin. We could take the portions of JWT that don't hurt correlation privacy and use just those, but I suspect others in the SSI ecosystem will want to use "iss", "sub", etc.


Each message should have a type, specified by the top level @type attribute. The attribute value should be a URI that uniquely identifies the message type, and should be resolvable into a resource (ie, webpage) with details for message type use.

Each type indicates a particular version and format.
Copy link
Contributor

Choose a reason for hiding this comment

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

By format, do you mean JSON or YAML or MsgPack? I don't think we want to bind a type to a format do we. We'd end up with a cartesian product of two different concerns. Format can be handled generically and at a different layer than the domain-specific logic in a message handler.

Copy link
Author

Choose a reason for hiding this comment

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

I mean the contents of the message attributes. At this point, the outer envelope would be a consistent format: json, encoded with whatever we decide should be standard.


```JSON
{
"@type": "example.com/examplemessage/v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be flexible enough to reference a web address as well as a blockchain schema address. Perhaps this should be a URI with a couple of examples, one web, and one blockchain?


## Message Encoding

Messages can arrive encoded and packaged in several different formats as described here. It is up to the agent to decide if and how to handle these various forms depending on the security requirements and considering the required uses.
Copy link
Contributor

Choose a reason for hiding this comment

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

How does the agent know the encoding and formatting? How does the agent know when it gets a blob of bits, what it is?

### Full Encryption
Messages will full encryption are packaged as described in this document.
### Common Crypto
Messages are encrypted or signed using only commonly available crypto libraries. The security may not be as good as Full Encryption, but allows integration with limited systems. This serves both Enterprise Integration and advanced IOT applications.
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean by "Full Encryption"? Is libsodium considered a commonly available crypto library?

### Topical Messages
Messages are usually part of interactions.

> TODO: How does this fit in with the JWT headers?
Copy link
Contributor

Choose a reason for hiding this comment

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

Because JWT is designed for claims, and is not a general message protocol, it's "sub" (subject) claim identifies who/what the claim is about. When the message isn't a claim, but a typed message in a protocol, then the topic makes more sense. The closest thing to JWT of a topic is the "jti" (JWT ID). Perhaps the "jti" could be co-opted for the tid, mid, and lmid, like this:

"jti": { "tid": "1", "mid": "1", "ptid": null, "lmid": 0}

or in a more compact way like this:

"jti": "1;1;;0"


## Base Envelope

The base message format is a JWT Payload. All JWT standard attributes are reserved. Additional attributes to messages are included based on the type specified. (See Message Types.)
Copy link
Contributor

Choose a reason for hiding this comment

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

I've been thinking about this a bit... The more I think, the more I'm concerned about JWT for a generic message system. I think it's fine for claims and claim sets (in use cases where correlation isn't an issue), because that's what it was designed for.

I see two different (orthogonal?) needs: (1) a general purpose message packaging protocol with types, wrapping, encryption, authentication, sub-protocol support (topics, sequencing, nesting) etc., and (2) a schema and standard for credentials (claims). JWT is the latter, with some encryption and signing on top.

I think a messaging protocol that is "inspired by JWT" is more of what we need for general purpose messaging. Just thinking out loud...

Copy link
Author

Choose a reason for hiding this comment

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

This is what I like too, and how I suspect we will land. "Inspired by JWT" is good language. Another benefit of naming it something else is that we can avoid the confusion between JWT as claim transfer and JWT as message format.

Copy link
Author

Choose a reason for hiding this comment

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

This is our opportunity to steer things here. If we can decide what we like about JWTs and what we don't, future conversations will be much easier and much more fruitful.

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

Successfully merging this pull request may close these issues.

2 participants