Skip to content

feat: Allow private/public key to be override when signing/verifying - #410

Merged
kamilmysliwiec merged 3 commits into
nestjs:masterfrom
maitrungduc1410:master
Nov 4, 2020
Merged

feat: Allow private/public key to be override when signing/verifying#410
kamilmysliwiec merged 3 commits into
nestjs:masterfrom
maitrungduc1410:master

Conversation

@maitrungduc1410

Copy link
Copy Markdown
Contributor

This allows you to pass the privateKey property in the options of sign, signAsync and publicKey in the verify, verifyAsync. It does not override a secretOrKeyProvider though only the privateKey and publicKey passed into the JwtModule.

Resolves #302

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Currently there's no way to override privateKey and publicKey passed in from the module. This makes it difficult in case of we want to use multiple keys to sign and verify JWT token. Example: in a multi-tenant app, each tenant will have its own private/public key to sign its user's token.

Issue Number: 320

What is the new behavior?

It's now possible to override privateKey and publicKey from the module when signing/verifying token.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

This allows you to pass the `privateKey` property in the options of sign, signAsync and `publicKey` in the verify, verifyAsync. It does not override a secretOrKeyProvider though only the `privateKey` and `publicKey` passed into the JwtModule.

Resolves [#302](#302)
Comment thread README.md Outdated
Comment thread README.md Outdated
@kamilmysliwiec
kamilmysliwiec merged commit 64d08da into nestjs:master Nov 4, 2020
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.

Override module options

2 participants