Replies: 10 comments 32 replies
-
I've very supportive of this as a broad direction 👍 It could also help potentially converge a bunch of the related specs. Plus having first-class support for lookup in a CAR file would be pretty great. I'm no fan of JWTs; they were chosen to build on top of because they're familiar to most web devs, and thus could drive adoption / lower barriers. (Strictly speaking, we don't need the JOSE header at all, for example) My main open question relates to serialization being another degree of freedom. Especially when UCANs may be valid between multiple, non-coordinating applications, you can get into a situation where some of your witnesses are in different formats, and their witnesses can also be in more formats. You can end up in a situation where you need to ask an issuer for a UCAN in a particular format so that you can access another service that doesn't support your serialization format. Degrees of freedom:
Options0. JWT EverywhereContinue to use JWT everywhere and give up on other use cases. I don't love this one, but 🤷♀️ we're still moving the needle 1. Switch to an Efficient SerializationDrop JWT and define a very tight serialization format in CBOR/PB/Avro/etc. The JWT strategy has been successful in overcoming objections in many conversations, so this may be counterproductive (I could be wrong). 2. Closed-System UCANsPer @Gozala
Make JWT the "official" inter-operation format as the lowest common denominator (like how RSA gets used as the most common crypto for many handshakes). In closed systems, you can use whatever serialization that you like, but talking across applications you must switch to JWT (or some other common format that would be defined in the spec). 3. Codec ShortlistWe pick some number of "officially" supported codecs that we expect everyone to implement. This is a higher burden on implementer, but easier on users. 4. Codec FreedomUse whatever codec you want! If the recipient can't read one, then your validation fails. You need to talk to the service to accept your format, or ask for your token to be reissued (may be recursive in the chain). 5. AutocodecAs part of other work, the idea of an Autocodec for arbitrary IPLD has been proposed. This is essentially referencing a Wasm module in the header that says how to deserialize the token into a common format. As @matheus23 pointed out in a side conversation, Autocodec big hammer for this problem unless it's broadly available. |
Beta Was this translation helpful? Give feedback.
-
@Gozala I converted this to a discussion. I haven't used this feature much before, so we can convert back if needed. I anticipate that this will become a longer thread, so having more tools for long form can't hurt. |
Beta Was this translation helpful? Give feedback.
-
To clarify, are the constraints in question to do with minimizing the data on the wire and scanning time? If so, there may be a middle ground between using JSON + JWT everywhere, and switching to a compact binary serialization format. For example, an encoding that offers dual-format interoperability, like UBJSON, would preserve the simplicity and familiarity benefits of JSON encoded JWT, while supporting both JSON and binary encodings of the token using the same schema. There's still implementation overhead in terms of supporting UBJSON, but since the format maps 1:1 with JSON, the risk of divergence between both representations is minimized. Since parsing the format is trivial, there's also a clear path toward supporting it with an autocodec down the road. UBJSON hasn't seen much adoption, so I mainly bring it up as an example, but it seems like an elegant approach to driving adoption without completely closing the door on performance, and without taking on the complexity of similar formats like BSON. The idea also has precedent at Amazon, through their ION project, which offers a similar dual-format approach to UBJSON, albeit with more complexity than is introduced by UBJSON. The 1:1 mapping between JSON and UBJSON also means that it's viable for use in closed-systems without introducing much maintenance overhead and without changing the specification: the same schema can be used for both internal communication of binary encoded UCANs, and JSON encoded UCANs that are shared with external systems. |
Beta Was this translation helpful? Give feedback.
-
One possibility would be something between Closed-System UCANs and Codec Shortlist. Require JWT and one other codec that is more efficient, and require conversion utilities between the two. Other codecs would be permissible in closed systems. This approach would keep the familiarity of JWT and provide a more efficient option. It would also maintain interoperability between implementations. @QuinnWilton's suggestion would do all of that in one format, which would be great if that works! |
Beta Was this translation helpful? Give feedback.
-
@walkah brings up a good point: how much more efficient do we think we can make these for the libp2p/IPNS use case? The heaviest part is signatures if you're stuck using RSA. At what size/performance improvement do we think it's worth the tradeoff against familiarity |
Beta Was this translation helpful? Give feedback.
-
I'm thinking something between (3) Codec Shortlist and (4) Codec Freedom: An optional spec addition that describes a more compact encoding. |
Beta Was this translation helpful? Give feedback.
-
I really like idea of canonical IR representation. That way UCAN library could parse / serialize between JWT <-> IR. Any other system could implement own parser / serializer for IR and interop with JWTs via standard UCAN library. As long as verification / derivation happen on IR I think marketing aspect will remain intact and it would also enable domain specific UCAN transportation. New cool compact representation could also be developed separately and maybe added to standard UCAN library given enough demand. |
Beta Was this translation helpful? Give feedback.
-
I just want to stress that new better and more compact representation is not a motivation. Motivation is an ability to choose encoding and transport that would make most sense in specific domain. To that end I would really like if UCANs were not tied to any encoding, and were more agnostic of what is inlined vs referenced as per #19 (reply in thread) That is to allow client to decide what needs to be transported and what can be omitted given the recipient without invalidating tokens. As far as I understand things are pretty tightly coupled right now, even to a JSON serializer (which as far as can recall can produce different results based on order in which fields were set). |
Beta Was this translation helpful? Give feedback.
-
Okay some clarity from a call with @Gozala and a few others today (Irakli, feel free to tag them here if appropriate). The short version is that JWT is actually fine at the spec level. To make this JSON also tends to have extremely good/fast codecs and wide support, so compute performance is less likely a major tardeoff here. Will think on this more, but I think that it's a great direction! 🚀 |
Beta Was this translation helpful? Give feedback.
-
For what it's worth I've implemented dag-ucan which uses DAG-CBOR as a primary encoding, which is more compact and has a better hash consistency than a secondary RAW JWT encoding (basically currently specified representation). This way primary representation is transport agnostic and can be formatted into valid JWT UCAN. Since not all UCANs will have a valid DAG-CBOR representation secondary RAW representation is used when parsing such UCANs or linking to them. I think this provides a reasonable path for migration to transport / format agnostic UCANs that can have more compact representation, while retaining interop with UCANs that do not opt in. |
Beta Was this translation helpful? Give feedback.
-
I'll provide more details later, but here are some quotes from my comments elsewhere
Beta Was this translation helpful? Give feedback.
All reactions