Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions patches/fast-jwt@6.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/src/crypto.js b/src/crypto.js
index 3896ada0c606beb9f9b77faa5831114a12a2214a..1581ea805d0845b6336f1d1481de8b05d603afb9 100644
--- a/src/crypto.js
+++ b/src/crypto.js
@@ -124,14 +124,15 @@ function performDetectPrivateKeyAlgorithm(key) {
}

function performDetectPublicKeyAlgorithms(key) {
- const publicKeyPemMatch = key.match(publicKeyPemMatcher)
+ const normalizedKey = key.trimStart()
+ const publicKeyPemMatch = normalizedKey.match(publicKeyPemMatcher)

- if (key.match(privateKeyPemMatcher)) {
+ if (normalizedKey.match(privateKeyPemMatcher)) {
throw new TokenError(TokenError.codes.invalidKey, 'Private keys are not supported for verifying.')
} else if (publicKeyPemMatch && publicKeyPemMatch[1] === 'RSA') {
// pkcs1 format - Can only be RSA key
return rsaAlgorithms
- } else if (!publicKeyPemMatch && !key.includes(publicKeyX509CertMatcher)) {
+ } else if (!publicKeyPemMatch && !normalizedKey.includes(publicKeyX509CertMatcher)) {
// Not a PEM, assume a plain secret
return hsAlgorithms
}
9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
packages:
- "apps/*"
- "packages/*"
- "services/*"
- "modules/*"
- "factory/*"
- apps/*
- packages/*
- services/*
- modules/*
- factory/*

patchedDependencies:
fast-jwt@6.1.0: patches/fast-jwt@6.1.0.patch
Loading