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

Construct JWKs generically from public and private keys #204

Merged
merged 4 commits into from
Sep 20, 2022

Conversation

decentralgabe
Copy link
Member

@decentralgabe decentralgabe commented Sep 20, 2022

Prereq for TBD54566975/ssi-service#105

Mostly shuffling things around to further decouple data integrity suites from JWKs.

@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2022

Codecov Report

Merging #204 (a22d2f9) into main (fb824f9) will increase coverage by 0.57%.
The diff coverage is 74.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #204      +/-   ##
==========================================
+ Coverage   57.25%   57.81%   +0.57%     
==========================================
  Files          32       32              
  Lines        3726     3840     +114     
==========================================
+ Hits         2133     2220      +87     
- Misses       1236     1252      +16     
- Partials      357      368      +11     
Impacted Files Coverage Δ
cryptosuite/jsonwebkey2020.go 47.06% <42.22%> (-14.81%) ⬇️
crypto/jwk.go 79.53% <81.55%> (+79.53%) ⬆️
did/key.go 67.27% <100.00%> (ø)

Copy link
Contributor

@nitro-neal nitro-neal left a comment

Choose a reason for hiding this comment

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

looks good, JWK is prime time

}

// PrivateKeyToPrivateKeyJWK converts a private key to a PrivateKeyJWK
func PrivateKeyToPrivateKeyJWK(key crypto.PrivateKey) (*PublicKeyJWK, *PrivateKeyJWK, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:
Have you thought about making the JWKFromRSAPrivateKey functions private? It will be a lot less functions for a user to deal with and just have the global function available to them

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, let me change this. can always make them public later if needed

@decentralgabe decentralgabe merged commit cbf6b46 into main Sep 20, 2022
@decentralgabe decentralgabe deleted the construct-jwks-generically-from-private-ose-110 branch September 20, 2022 15:40
@andorsk
Copy link
Contributor

andorsk commented Sep 22, 2022

@decentralgabe just used this today. Thanks. really helpful

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.

4 participants