@alexdevco/passport 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,9 +27,9 @@ class RS256Strategy {
|
|
|
27
27
|
return { valid: false, reason: 'Invalid format' };
|
|
28
28
|
const [header64, payload64, mac] = parts;
|
|
29
29
|
const serialized = (0, utils_1.serialize)([header64, payload64], RS256Strategy.INTERNAL_SEPARATOR);
|
|
30
|
-
const
|
|
30
|
+
const signatureBuffer = Buffer.from(mac, 'base64url');
|
|
31
31
|
const verify = (0, crypto_1.createVerify)(RS256Strategy.JWT_ALG).update(serialized);
|
|
32
|
-
if (!verify.verify(this.PUBLIC_KEY,
|
|
32
|
+
if (!verify.verify(this.PUBLIC_KEY, signatureBuffer))
|
|
33
33
|
return { valid: false, reason: 'Invalid signature' };
|
|
34
34
|
const parsed = JSON.parse((0, utils_1.base64UrlDecode)(payload64));
|
|
35
35
|
if (!(0, utils_1.isPayload)(parsed))
|
|
@@ -45,7 +45,7 @@ class RS256Strategy {
|
|
|
45
45
|
const sign = (0, crypto_1.createSign)(RS256Strategy.JWT_ALG)
|
|
46
46
|
.update(data)
|
|
47
47
|
.sign(this.SECRET_KEY);
|
|
48
|
-
return
|
|
48
|
+
return sign.toString('base64url');
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.RS256Strategy = RS256Strategy;
|