iotaledger / iotaledger/identity
[Task] Test functionality introduced in #1148 more thoroughly.
- Dominant language
- Rust
- Stars
- 346
- Forks
- 100
- Avg merge
- 13h 41m
- Merged PRs (30d)
- 2
Description
## Description
The JWT-based `CredentialValidator` in #1148 needs more tests. Currently the `validate` method has only been tested with the default options (in `identity_storage`) and most of the single purpose methods that have been ported from the old validator have not been tested at all.
I would suggest to:
1. Introduce some more unit tests in the module itself. Note that since it allows users to pass a custom `JwsSignatureVerifier` signature verification can easily be mocked and it will be easy to test all the other (composed) functionality.
2. Extensively test signature verification in `identity_storage` using the `JwkStorageDocumentExt` trait to produce signatures.
3. If official test vectors exist for the `VC-JWT` test suite it would be ideal to port those as well.
Furthermore it would also be good to test `JwkStorageDocumentExt::sign_bytes` and `CoreDocument::verify_jws` with more configuration options and make sure that the errors are also exercised in tests.
## Motivation
The functionality we ship should be thoroughly tested.
## Resources
Follow up task of #1148 and sub-task of #1103.
## To-do list
Create a task-specific to-do list. Please link PRs that match the TODO list item behind the item after it has been submitted.
- [ ] Item one
- [ ] Item two
- [ ] Item three
## Change checklist
Add an `x` to the boxes that are relevant to your changes, and delete any items that are not.
- [ ] The feature or fix is implemented in Rust and across all bindings whereas possible.
- [ ] The feature or fix has sufficient testing coverage
- [ ] All tests and examples build and run locally as expected
- [ ] Every piece of code has been document according to the documentation guidelines.
- [ ] If conceptual documentation (mdbook) and examples highlighting the feature exist, they are properly updated.
- [ ] If the feature is not currently documented, a documentation task Issue has been opened to address this.
Contributor guide
Research direction
Start by locating the CredentialValidator tests and the identity_storage tests, then inspect JwkStorageDocumentExt::sign_bytes and CoreDocument::verify_jws. Add coverage for custom JwsSignatureVerifier behavior, configuration variants, error paths, and available VC-JWT vectors; done means the requested validation and signing paths are exercised by passing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- security, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100