-
Notifications
You must be signed in to change notification settings - Fork 11
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
want encoder and decoder methods #4
Comments
Do I understand correctly that given that this |
This is not really correct. If the data is decoded using dag-cbor payload, signature, protected would be byte arrays, we want them to be base64url strings. |
I think that might be specific to the javascript implementation no? In this This is in line with the spec which specifies that the underlying |
I don't think that's right. I think the |
When you say The reasoning behind the current architecture is that at some point we have to |
Ok, I'm probably missing something here. Let me retrace my steps and instead check if the following assumption correct? Put data into the dag
Get data from the dag
Alright, from writing this out it's clear I'm definitely missing parts of what's going on there! Does the |
Ah I see what you're getting at. I think there's a slight confusion because the In the This is possibly made clearer by examining the type Encoder func(datamodel.Node, io.Writer) error There is no parameter there to specify the codec (unlike in the Note also that Now, I think what you are expecting to happen is that the user posts a general If this is the case then I understand why it is desirable. It would be nice for Unfortunately the This is a little ad-hoc in my opinion, we're effectively hacking around the fact
|
That would suggest that just using the Even if that does the trick I wonder if it's worth having an |
I had thought that the serial content for dag-jose was going to be dag-cbor, yes...? To try to briefly re-ground this in definitions: the serial encoding a codec uses could be anything, but the one hard line is that if we're going to call it a "codec", then it must define a mapping from the serial form to a data model form, and back again. So it needs to pick a serial form. If there's going to be a cbor-ish version and a json-ish version, we would need to reserve two separate multicodecs for that. So I think for now we probably want to say that dag-jose has a cborish encoding, and move on with that. (The fact that it would seem easy to define how these JOSE features work in a serial-format-agnostic way is why I tried to steer the conversation in the direction of ADLs instead of codecs way back at the beginning of this work -- but I guess that ship has largely sailed now. Ah well.) Go-ipfs's APIs with their IIUC, to use dag-jose, one would use IIUC, to pipe data in most directly, without transcoding, one would want to say Incidentally, IIUC, the I don't think there's a requirement that any possible pair of codec names has to be valid for We can hammer all of this stuff out in exact detail with PRs in go-ipfs where we wire up this repo as a plugin, get the encode and decode functions into go-ipfs's multicodec registries, and can then test it end-to-end (probably using "sharness" tests) with all sorts of variations of args that do transcoding. I think I'd advise that we get some serial fixtures that make sense to us just out of the encode and decode functions alone, first, though -- clearer to do that and make sure it's well-defined in isolation. |
The difference between |
It would be nice to have this code export some functions called
Encode
andDecode
that match https://pkg.go.dev/github.com/ipld/[email protected]/codec#Encoder and https://pkg.go.dev/github.com/ipld/[email protected]/codec#Decoder.This would be a prerequisite for getting this to land as a plugin in go-ipfs, because there, things need to conform to those function interfaces so they can be put in a registry map keyed by their multicodec indicator code. (The git plugin is an example of what gets wired up: https://github.com/ipfs/go-ipfs/blob/ae09459e3926d687599638abdb379e8627b53509/plugin/plugins/git/git.go#L40-L41 )
I think the StoreJOSE and LoadJOSE functions are probably close, so all the right logic exists somewhere, but the interfaces don't quite line up.
The text was updated successfully, but these errors were encountered: