feature: dynamic secret/keys via secretOrKeyProvider #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfils the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behaviour?
There is no way to assign a secret dynamically.
Related to issue number: #26
What is the new behaviour?
With
secretOrKeyProvider
you can assign a secret or public/private key for each sign/verify request separately.Does this PR introduce a breaking change?
This PR introduces a
breakingchange howsecretOrPrivateKey
is assigned. Before, on the verification step the private Key was used whenpublicKey
was not assigned due tosecretOrPrivateKey
function. Setting the secret or private/public key is now explicit. The following options set the secret now by priority:secretOrKeyProvider
secret
publicKey
andprivateKey
Edit:
secretOrKey
was re-added to smoothen out the upgrading process and takes precedence over the listed options above. With a deprecation warning and added tests this should be enough I hope.Other information
I'm currently in the process of adding tests to this module. However, suggestions, critique or discussions are welcome. My time is quite limited but I'm happy to help and answer questions.This is my first contribution to open source :) quite exciting tbh.