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

Add helpers to return the kms from an uri #351

Merged
merged 2 commits into from
Oct 24, 2023
Merged

Conversation

maraino
Copy link
Contributor

@maraino maraino commented Oct 24, 2023

Description

This commit introduces the helper kms.TypeOf, which returns the type of a URI. It also normalizes the type when necessary.

It also adds a commit to be able to validate JWKs that use an OpaqueSigner.

This commit introduces the helper kms.TypeOf that returns the type of an
uri. It also normalizes the type when neceesary.
Comment on lines +16 to +21
registry.Store(t.normalize(), fn)
}

// LoadKeyManagerNewFunc returns the function initialize a KayManager.
func LoadKeyManagerNewFunc(t Type) (KeyManagerNewFunc, bool) {
v, ok := registry.Load(t)
v, ok := registry.Load(t.normalize())
Copy link
Member

Choose a reason for hiding this comment

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

Have a slight preference for doing the t.normalize() inside of .Load and .Store instead of the method call here, but not a blocker.

Comment on lines +165 to 171
case OpaqueSigner:
for _, alg := range k.Algs() {
if jwk.Algorithm == string(alg) {
return nil
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I assume the default errctx value is sufficient for this case?

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, that was the idea.

@maraino maraino merged commit b267fc9 into master Oct 24, 2023
14 checks passed
@maraino maraino deleted the mariano/kms-helpers branch October 24, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants