unjwt 0.5.6 → 0.5.7
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/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { i as utils } from './shared/unjwt.BHpknTpg.mjs';
|
|
2
2
|
export { j as jwe } from './shared/unjwt.B2olxeGL.mjs';
|
|
3
3
|
export { j as jwk } from './shared/unjwt.DRUXIabl.mjs';
|
|
4
|
-
export { j as jws } from './shared/unjwt.
|
|
4
|
+
export { j as jws } from './shared/unjwt.DqUOpdA-.mjs';
|
|
5
5
|
import './shared/unjwt.Ca03jPX3.mjs';
|
package/dist/jws.mjs
CHANGED
|
@@ -30,10 +30,7 @@ async function sign(payload, key, options = {}) {
|
|
|
30
30
|
let computedPayload = void 0;
|
|
31
31
|
if (options.expiresIn !== void 0 && protectedHeader.typ === "JWT" && typeof payload === "object" && !(payload instanceof Uint8Array) && !payload.exp) {
|
|
32
32
|
computedPayload = { ...payload };
|
|
33
|
-
const
|
|
34
|
-
(options.currentDate ?? /* @__PURE__ */ new Date()).getTime() / 1e3
|
|
35
|
-
);
|
|
36
|
-
const iat = typeof payload.iat === "number" ? payload.iat : currentTime;
|
|
33
|
+
const iat = typeof payload.iat === "number" ? payload.iat : Math.round((options.currentDate ?? /* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
37
34
|
computedPayload.iat = iat;
|
|
38
35
|
computedPayload.exp = iat + options.expiresIn;
|
|
39
36
|
}
|
|
@@ -173,7 +170,7 @@ async function verify(jws, key, options = {}) {
|
|
|
173
170
|
);
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
|
-
if (payload && typeof payload === "object" && !options.forceUint8Array) {
|
|
173
|
+
if (payload && typeof payload === "object" && protectedHeader.typ === "JWT" && !options.forceUint8Array) {
|
|
177
174
|
const jwtClaims = payload;
|
|
178
175
|
const clockTolerance = options.clockTolerance ?? 0;
|
|
179
176
|
const currentTime = Math.round(
|