@payello-module/jwt 0.1.2 → 0.1.4
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.
- package/dist/JWT.js +3 -3
- package/package.json +1 -1
package/dist/JWT.js
CHANGED
@@ -49,17 +49,17 @@ export class JWT {
|
|
49
49
|
if (bits.length !== 3) {
|
50
50
|
throw new JwtError(`Invalid number of parts in JWT string. Expected 3 but got ${bits.length}`);
|
51
51
|
}
|
52
|
-
const header = JSON.parse(bits[0]);
|
52
|
+
const header = JSON.parse(atob(bits[0]));
|
53
53
|
if (!header || !header.typ || header.typ !== "JWT") {
|
54
54
|
throw new JwtError("Header invalid or type is not JWT");
|
55
55
|
}
|
56
|
-
const payload = JSON.parse(bits[1]);
|
56
|
+
const payload = JSON.parse(atob(bits[1]));
|
57
57
|
if (!payload || !payload.jti) {
|
58
58
|
throw new JwtError("Payload invalid or missing jti value");
|
59
59
|
}
|
60
60
|
// Validates the present of required properties in the payload.
|
61
61
|
const requiredProps = opts.requiredProps || ["jti", "iss", "iat"];
|
62
|
-
for (const prop
|
62
|
+
for (const prop of requiredProps) {
|
63
63
|
if (!payload[prop]) {
|
64
64
|
throw new JwtError(`Payload missing ${prop} value`);
|
65
65
|
}
|