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

Implement Revoked check for a key when signing manifest, schema, presentation request. #579

Merged
merged 9 commits into from
Jul 12, 2023

Conversation

vlad-tim
Copy link
Contributor

@vlad-tim vlad-tim commented Jul 7, 2023

Overview

This PR adds Revoked checks for a key when signing manifest, schema, presentation request. This is a follow-up to #546, in particular addresses this comment #546 (comment).

Description

It is related to #451. Previously in #546 revocation check was implemented for credential creation. This PR adds the check to all other relevant places. Please help verify that all applicable scenarios where revocation check is required are covered.

How Has This Been Tested?

Extended the existing auto-tests to cover the new code.

Checklist

Before submitting this PR, please make sure:

  • I have read the CONTRIBUTING document.
  • My code is consistent with the rest of the project
  • I have tagged the relevant reviewers and/or interested parties
  • I have updated the READMEs and other documentation of affected packages

References

See above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add a test for this changes as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -261,6 +261,11 @@ func TestCredentialRouter(t *testing.T) {
assert.Empty(tt, createdCred)
assert.Error(tt, err)
assert.ErrorContains(tt, err, "cannot use revoked key")

// create a schema with the revoked key, it fails
_, err = schemaService.CreateSchema(context.Background(), schema.CreateSchemaRequest{Issuer: controllerDID.DID.ID, Name: "schema (revoked key)", Schema: getEmailSchema(), FullyQualifiedVerificationMethodID: keyID})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the wrong file to test this in. Can you move to router/schema_test.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can. I put the test in this file because it seemed like a simplest way to test the change with minimal number of new lines (since the key revocation logic is already in place), and because schema creation was already being tested in this file anyways.

@codecov-commenter
Copy link

Codecov Report

Merging #579 (288b4a5) into main (e7d184d) will increase coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #579      +/-   ##
==========================================
+ Coverage   24.00%   24.08%   +0.08%     
==========================================
  Files          46       46              
  Lines        5312     5315       +3     
==========================================
+ Hits         1275     1280       +5     
+ Misses       3799     3796       -3     
- Partials      238      239       +1     
Impacted Files Coverage Δ
pkg/service/keystore/service.go 44.30% <100.00%> (+2.36%) ⬆️

@andresuribe87 andresuribe87 merged commit f1c6de7 into TBD54566975:main Jul 12, 2023
6 checks passed
@vlad-tim vlad-tim mentioned this pull request Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants