-
Notifications
You must be signed in to change notification settings - Fork 0
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
Outstanding incompatibilities between UCAN x CACAO data models #2
Comments
I would expect that
There is a
This does not exist in UCANs, but perhaps we could create an optional field for it if it's important in CACAO use cases. That said it would be good to provide some context how is this used and what's the purpose.
There is an
Same as
I have no idea what those are, could you please provide some context for us ?
I believe that maps to capabilities in UCANs that live under However unlike CACAO, in UCANs it's resource+action you can perform with it. More specifically resource will be in I'm not sure what makes sense for CACAO here. I think
I imagine one could map time to Int and back to make this work, but if there is a reason this won't work please tell us why ?
No idea is that every DID can be represented via last Commonly used DIDs could be further optimized by allocating varint for them like we do with bunch of did:key variants. This way implementation can start simply with
That is a good point. In fact I'm not even sure what Fission's wallet auth demo signed JWT payload or a some other encoding of the payload. I think we could either:
@expede do you have thoughts or opinions on this ? I personally think that we're making much bigger deal of what we're signing that it's odd to be. If there is a canonical way by which we can derive payload from the data model we could not have to care about this too much. That said ideally we won't have too many of the variants and both JWT and IPLD representation should be able to support both.
I would really love if we could simply have single schema so we could all benefit from the tools we build. Otherwise I fear we'll end up with second class support across UCAN x CACAO worlds.
I definitely want to break out 2.5 into it's own varsig spec (because multisig means different thing), but it had been not the highest priority for me. I'm sure it will happen sooner or later. As of 2.1 it did came up as well. I'd +1 that effort, that said I really don't have energy to drive did in multiformats effort as I fear it's a lot of work and constantly moving target. Perhaps in year or two it would be far more clear cut. Not to discourage anyone from going after this sooner however. |
To keep things simple I'm going to copy and paste schema from that the gist here
I feel like this does not really address differences. Specifically it is not clear how e.g. how one would validate
I'm totally lost what Perhaps there is good rational for doing it this way, but it would help to share it so we could compare pros and cons. On related note I have also considered using DKIM model as a proof, however decided against it in favor of |
Overal I am under impression that if we could work out following differences we could simply converge onto one schema:
|
Ok, this turned out into a rather long response. I think it addresses most of the comments above.
Not sure if that would work
Ok, would work 👍
Unfortunately converting back and forth between unix timestamps and ISO dates is not trivial. We initially wanted to do this but when @ukstv investigated it turned out to be next to impossible (timezones, leap seconds, etc makes it very difficult) (note that the conversion need to be deterministic and precise for it to work)
These are strings, please see the SIWE spec
Imo,
Imo it would be great if we could deduce the canonicalization strategy from
Opened #3 for this. Fyi, the DID Core spec is final now so should not be a moving target.
Well you need to verify it using the SIWE ABNF + eip191
This is a good point. I guess the main problem is that SIWE doesn't have the concept of a
This is not very viable at all. This is the reason SIWE exists in the first place. Add to that the complexity of doing such a thing over many different blockchain ecosystems. Too many actors to coordinate to be even close to feasible
Again, I think we can figure out canonicalization based on |
From the link @oed posted https://docs.login.xyz/general-information/siwe-overview/eip-4361
I have no strong feeling about this. I think it could go either inside facts or maybe we could add optional field in UCANs that would serve the same purpose. @expede do you have opinions on this ?
I would strongly suggest sticking it into
Can you propose something that would work ? No matter what we do CACAO <-> UCAN would have to deal with the fact that UCANs have a
Would be cool, but there is only so many balls one can joggle. I would prefer to focus on CACAO x UCAN interop increasing scope of this will only make it harder to achieve.
I'd rather do it with
👍 I was referring to all the DID methods out there, because it would be hard to define enum for all of them while it's constantly changing.
I think we talk past each other here. What I mean is following:
I'm actually not sure how does I am under impression that you just link to the EthNFT URI in resources, is that accurate ? This is somewhat different how, at least I, would express things in UCAN tokens. I would still have claimed specific capability in form of
In other words I do clam ability to perform an action on some resource, and provide evidence that I'm allowed to do it. I suspect this to emerge as a more general patter with various types of evidence supporting a claim. Let me know if |
@oed I am under impression that you are trying to make SIWE be a data model. What I'm suggesting however to think of both JWT and SIWE as a format into which our IR could be serialized into and deserialized from. I feel that would be a more effective path forward with much less complexity than it is to try and fit variable data models into one. That way:
|
Note that right now we are sort of treating UCAN as the data model in ucan-ipld. I think your statement above makes sense, but I see no reason why the IPLD data model should lean more in the direction of either SIWE or UCAN?
How about something like this?
This would allow us to more easily map ReCap to this structure as well.
If we want to do it with
So SIWE doesn't really say anything about what you use the resources for. The only way you could really represent something like 1 or 2 above is to use ReCap. I also want to make clear that CACAO is not meant as anything else than an IPLD representation of some object capability. SIWE is the first use case for CACAO.
the EthNFT use case is just something I came up with on the spot. I think your idea of using a It seems like the biggest open question still here is how to deal with that the date formats are incompatible. I don't have a good answer for this. |
@oed I haven't had a chance to go through the points above in detail yet, but some stray thoughts from thinking about my PR that expand a bit on what @Gozala said in a few places above: What is the purpose of CACAO? I think I had it wrong in my mind. It's actually a container format to help distinguish between types, not a compatibility layer. You still need to build standards for ReCap <> UCAN <> SIWx <> zcap-ld <> EthNFT <> etc. It may be more valuable for the UCAN project to focus on UCAN <> SIWx for example, and then let CACAO wrap those for CASA purposes. Does that make sense? I have a pretty packed schedule the next few days, but will try to go through @Gozala's points above in more detail. |
@expede I think that's mostly right. I see CACAO to be equivalent to ucan-ipld if we get this right! ReCap <> UCAN is a separate issue, but I would love to see that happen. EthNFT (or EthDAO etc.) can be covered by |
@oed okay awesome that we're aligned there / my mental picture has caught up :) Trying to get all of these formats into a single body reminds me a bit of the XKCD comic: If there's good reason to pass around UCANs and others as CACAOs, I wonder if it makes more sense to treat the CACAO wrapper as signalling and let the bodies vary. Otherwise we're going to end up with the lowest common denominator across all capability types. As a quick first pass: // Pseudocode
interface Common {
// The absolute *minimal* required fields for interop
iss: DID
aud: DID
exp: Timestamp
// ...a handful of others...
}
enum Payload {
siwx: Common & SIWx,
ucan: Common & UCAN, // ucan-ipld as it exists today
recap: Common & ReCap,
zcap: Common & ZCap,
// ...
}
interface Header {
t CacaoKind
}
interface Cacao {
h: Header
p: Payload
s: Signature
} Which from re-reading the CACAO spec may extend nicely to, since the Something that we learned recently in UCAN is that we can treat different serializations (EIP-191, SIWx, Passkeys, etc) as signature types, which is the only place where this actually matters (so that we can validate the signature). This means we "only" need to define a SIWx-to-UCAN spec, and we'd get CACAO "for free".
In light of this, is there any disadvantage to not wanting to represent UCAN as a CACAO, and only ever going the other direction (CACAO to UCAN)?
I wonder if I can simplify the approach taken so far in this repo — @oed you'll know better than me! What if CACAO was treated as a target Another challenge is that UCAN has strictly more information than a CACAO in its capabilities. Restricting to CACAO -> UCAN again makes this clean because we can cast CACAOs abilities to an implicit Thoughts? 🙏 |
This is the original intention behind CACAO. Although, ucan-ipld has a lot of improvements over it, with regards to how DIDs and signatures are represented.
Lifting the TZ info to a separate property was something that @ukstv explored and it proved not really to be workable. His notes:
Given the conversation we had during the CASA call and the new varsig spec you are working on (roughly
However, if we can align ReCap + UCAN capabilities as per eth magicians thread, we could also include more params:
|
One minor note on the timestamp format thing-- the VC-WG at W3C has been debating this back and forth for years, for example, in this thread and many others. It might be worth checking in with the VC-JWT "work item" (the subset of that WG trying to iterate more on the JWT sections of the spec, with a particular emphasis on how to deterministically on the roundtrip between essentially LD-flavored data model and JWT, including on this exact point about timestamps). if i cross paths with anyone active there this week i'll ask for more bibliography or secret tribal knowledge on the timestamp roundtrip issue |
In SIWx/CACAO we use rfc3999 timestamps to maximise the human readability while still maintaining machine readability. IMO it is enough that both formats (UCAN and SIWx) use timestamps which can be compared (e.g. by conversion to unix time, assuming any edge cases are papered-over by a reasonable allowance for clock skew upon verification), even if they are not of the same format in the token literals. Most relevant I think is compatibility between the ReCap and UCAN The biggest open question for me is where to fit the IMO it would be best to define a CACAO type specific to ReCap which renders the |
Something like this I guess? {
"example.resource.1": {
"crud/read": {
"prf": "QmABCDEF"
},
"crud/update": {
"prf": "Qm12345"
}
}
} |
Wait, why is there a need to include Imo, in ReCap we can just put {
"tar": {
"example.resource.1": {
"crud/read": {}
}
},
"prf": ["QmABCDEF"]
} |
That was just me sketching out the suggestion. This is an idea for layout that has come up UCAN before. The main upside is that it's really clear which proof is intended for what. The downsides include:
We chose to keep |
Exactly, I was just saying that it makes sense to put |
Yup, we're on the same page! Just explaining the reasoning for the thread :) |
Going back to the top
This could be held in the
I think that this could also go into the facts. Semantic question: what's the difference between a
@Gozala you'd lose the timezone information, so it's lossy. UCAN also doesn't have centiseconds We can map UCAN -> SIWE timestamps trivially (treat them as GMT). We can go strictly the other way as well (SIWE -> UCAN). We can't round trip SIWE -> UCAN -> SIWE. Some options:
|
|
after closer reading of eip5573 I see that it includes an
becomes:
This is sort of assuming that there will not be duplicate keys within a single recap object, and there are probably edge cases from merging other fields from recap |
@chunningham this is just an example, not a recommendation afaik. I'd really prefer if we can converge on the same representation in UCAN I'm also advocating for the introduction of |
We should always be able to reconstruct the SIWE from the signature.
We can. I should flag my bias that I have an intuition that using In the spec, we say that
This is the idea that we riffed about on the CASA call: a multiformat for serialization + signature. I agree that it's not general enough here, though, because it's specifically the data that's not in a JWT. It's more general than UCAN/SIWE, but also we probably don't want to shove random data in the signature for converting between specific formats. An example of a place where we've been playing with this pattern: in our early Passkey explorations, we can get a deterministic FIDO, but it may have a counter. You can't validate the signature without that counter. If we interpret it as part of the signature (just like the magic bytes in EIP-191), this signature is now portable. |
Why is
To me your example of encoding extra data as part of the signature is very different! To me adding data to the varsig seems off. The only real data it should encode is the bytes of the signature itself and which algos to use to verify the signature. |
argument could be made that alg includes canonicalization so instead of one variant tag we could have one, but it is also true that having multiple codes for same signing alg would be kind of odd. for what it’s worth we’ve also allocated one umbrella code for all sigs so we could iterate on this under it. |
Ok so here’s one thing to consider, I would like to be able to format all UCANs as JWTs not just some. And unless I’m overlooking something that would require folding canonicalization into signature algorithm, because that’s only way I think JWT will allow us to do it. Alternatively we could define varsig + canonicalization as some algorithmic for JWTs. I’m not all that familiar with JWT side of things and would defer to @expede to guide us to what would be most adequate approach. That said we could still map to |
I'm afraid we could get a silly amount of codes to register with this approach. |
I don't disagree. It is worth noting that a lot of other communities have standardized things like RS256 rather than the equivalent object Probably worth saying out loud: part of the reason why we're (potentially) specifying a new form here is because (AFAIK) there's no equivalent like JWK/JWS that includes canonicalization/payload encoding information, since that's usually at a different layer. @oed it's probably worth asking: you have more experience with these forms that I do: is there such a field, or is it usually left for a different layer? |
also: https://github.com/ChainAgnostic/varsig/ Repo name subject to change, but this is a neutral place for UCAN, CACAO, ReCap and others to explore the idea :) |
I can't really say I have the most complete view here, but some observations. ld-proofs use a |
I think I have shifted my position in favor of I believe capturing data encoding in signature is a great way to address all the above Moving this into ChainAgnostic/varsig#3 |
I had a good chat with @oed last week about desire to reconcile data model differences so we could have a single IPLD schema as opposed to a bridge between two. @oed looked at UCAN-IPLD spec shared some impressions that I'd like to surface here so we could collectively work out solutions to:
The text was updated successfully, but these errors were encountered: