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

feat: add basic dag-jose jws and jwe fixtures #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Sep 6, 2021

Just basic JWS, and asymmetric and symmetric JWE blocks. Currently not working in Go, they don't round-trip properly:

--- FAIL: TestCodecs (0.02s)
    --- FAIL: TestCodecs/jwe-asymmetric (0.00s)
        codecs_test.go:48: [decode(dag-json)->encode(dag-jose)] generated CID (bagcqceraqfknq7xaemcihmq2albau32ttrutxnco7xeoik6mlejismmvw5zq) does not match expected (bagcqcera5kpstysqmmu5yvksmxg6ysp637ftwcff5z73xxa5uhunxgc3lznq)
    --- FAIL: TestCodecs/jwe-symmetric (0.00s)
        codecs_test.go:48: [decode(dag-cbor)->encode(dag-jose)] generated CID (bagcqceraxazmu67crshzqdeg3kwnfschs25epy5sbtqtjre2qw3d62kzplva) does not match expected (bagcqcerak7dgsag7xah7cnizkrywzkiebppa2ok26sfdlukg4o5slxvtuvja)
    --- FAIL: TestCodecs/jws (0.00s)
        codecs_test.go:48: [decode(dag-json)->encode(dag-jose)] generated CID (bagcqceraxvt5izt4sz7kjfrm42dxrutp6ijywgsacllkznzekmfojypkvfea) does not match expected (bagcqcera4mw52i4e522qxcvfl5kdtyopy76tyharfrnvaxhpth5yj2d6qzlq)

First guess is a map sorting issue. Used version of go-dag-jose here is probably relying on the go-ipld-prime dag-cbor that doesn't sort map keys consistently.

/cc @oed @warpfork

@smrz2001
Copy link

smrz2001 commented Nov 12, 2021

Hey @rvagg, I'm super close to getting my final go-dag-jose PR up and am testing with your new fixtures.

With bagcqceraxvt5izt4sz7kjfrm42dxrutp6ijywgsacllkznzekmfojypkvfea.dag-jose, for example, my hex editor shows me that the encoding is 0x71 (dag-cbor), which could be one of the reasons that the test is failing.

Am I missing something here?

Also, looks like the expected and generated CIDs are switched in the log 😅

image

@smrz2001
Copy link

smrz2001 commented Nov 14, 2021

You know what, scratch that @rvagg. I figured it out!

I was dumb and looking at the encoding of the link and payload fields, which obviously has nothing to do with the encoding of the parent structure.

@rvagg
Copy link
Member Author

rvagg commented Nov 15, 2021

Sweet, good to hear we're getting close - btw I'm not claiming that these are the absolutely correct reference, but they are according to the current js-dag-jose. Perhaps you'll discover some problems that need to be fixed over there while you have your head in here. So while it'll be great to get to green here, correctness of the current fixtures isn't a given (yet).

Happy to take changes to this branch if you want to open a PR - additional fixtures or changes to what's in here.

@oed
Copy link

oed commented Nov 15, 2021

Afaik js-dag-jose should be correct according to the spec.

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

Successfully merging this pull request may close these issues.

None yet

3 participants