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

include dilithium; clean up key types and related methods #370

Merged
merged 2 commits into from
May 5, 2023

Conversation

decentralgabe
Copy link
Member

No description provided.

@codecov-commenter
Copy link

Codecov Report

Merging #370 (4ef552f) into main (9a70a02) will increase coverage by 0.02%.
The diff coverage is 86.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
+ Coverage   59.28%   59.30%   +0.02%     
==========================================
  Files          56       55       -1     
  Lines        6847     6840       -7     
==========================================
- Hits         4059     4056       -3     
+ Misses       2076     2074       -2     
+ Partials      712      710       -2     
Impacted Files Coverage Δ
crypto/jwx/jws_dilithium.go 81.08% <ø> (ø)
crypto/models.go 16.67% <50.00%> (+6.67%) ⬆️
crypto/keys.go 84.19% <85.83%> (-1.65%) ⬇️
crypto/jwx/jwk.go 55.94% <100.00%> (ø)

Copy link
Contributor

@andresuribe87 andresuribe87 left a comment

Choose a reason for hiding this comment

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

Sweet. Small readability suggestion.

Comment on lines 141 to 182
t.Run("Able to generate dilithium key pairs for each mode", func(tt *testing.T) {
tests := []struct {
name string
m dilithium.Mode
wantErr bool
}{
{
"mode2",
dilithium.Mode2,
false,
},
{
"mode3",
dilithium.Mode3,
false,
},
{
"mode5",
dilithium.Mode5,
false,
},
{
"bad",
nil,
true,
},
}
for _, test := range tests {
tt.Run(test.name, func(ttt *testing.T) {
pk, sk, err := GenerateDilithiumKeyPair(test.m)
if test.wantErr {
assert.Error(ttt, err)
assert.Nil(ttt, pk)
assert.Nil(ttt, sk)
} else {
assert.NoError(ttt, err)
assert.NotNil(ttt, pk)
assert.NotNil(ttt, sk)
}
})
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: minimize branching logic inside tests. In this case I suggest separating the error case behavior into a separate test. It would make things more readable.

@decentralgabe decentralgabe merged commit d231d5b into main May 5, 2023
@decentralgabe decentralgabe deleted the support-experimental-keys branch May 5, 2023 20:00
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.

None yet

3 participants