-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add UCAN v0.8 Test Fixtures #37
Conversation
Hey @appcypher. Thanks for adding these test fixtures! They are looking great and are much appreciated. 🙏 One detail that should be changed is the |
tests/0.8.1/valid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Delegated UCAN can have multiple valid proofs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you think about rephrasing this comment to "Delegated UCAN is valid with multiple valid proofs"? This would strengthen the idea that a UCAN can have multiple proofs and is valid because of the capabilities granted by each of those proofs.
tests/0.8.1/valid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "UCAN attenuation is valid syntax", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"UCAN attenuation
ishas valid syntax"
Typo. Has, not is.
tests/0.8.1/valid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Payload `nbf` is valid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test redundant with "UCAN is ready to be used"? If we are testing the same thing, we should only keep one.
tests/0.8.1/valid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Payload `exp` is valid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be testing the same thing as "UCAN has not expired".
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "UCAN header section is missing or invalid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to say "UCAN header section is missing" and add a separate test case for an invalid header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got further down into the invalid cases, and I noticed there are cases of headers with fields missing. That's what I would consider and "invalid" header. No need to add more test cases (same goes for payload comment below, but we could use a garbage signature test case.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for having it as missing or invalid
here is because it can be non-trivial to detect that it is actually missing. For example, the header may in fact not be missing but malformed maybe by having some additional non-compliant fields or missing some compliant fields. Or the header could be in an unexpected position. If it just says missing
then we are forcing the implementer to detect all of those cases.
I can reword it as malformed
if that is okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Reading through the example, it was trivial to see that the header was missing, but testing for it would be challenging. Renaming to malformed
sounds good to me. 👍
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "UCAN payload section is missing or invalid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate cases for missing and invalid might be good here as well.
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "UCAN signature is missing or invalid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate cases for missing and invalid might be good here too.
} | ||
}, | ||
{ | ||
"comment": "Witnesses expire before the delegated UCAN", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expiration times for the delegate and witness are 5435042552
. Did you mean edit the witness forward in time for this test case?
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Witness issuer audience did does not align with delegated issuer did", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be easier to distinguish the decentralized identifiers in this comment if we change "did" to "DID".
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Witness does not exist", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment could be made more specific by mentioning proof schemes. One possibility would be "Witness referenced in prf scheme does not exist".
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Payload `exp` field should be a did:key string", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Payload
exp
field should be adid:key stringnumber"
The test is right, but the comment is incorrect.
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Payload `prf` field should be an array of string", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Payload
prf
field should be an array ofstringstrings"
Typo. Strings, not string.
tests/0.8.1/invalid.json
Outdated
} | ||
}, | ||
{ | ||
"comment": "Payload `prf` field should be an array of string", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Payload prf field should be an array of
stringstrings"
Typo. Strings, not string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
de16f9d
to
73324f8
Compare
Fixed @bgins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@appcypher |
@expede None and done |
73324f8
to
e13c7dc
Compare
Fixes #7
PR adds test fixtures for complying with UCAN v0.8.
While working on this I used a utility other people might find useful when working with UCAN fixtures in the future.
https://github.com/fission-suite/ucan-fixture-gen
Reviews welcome.