@truto/truto-jsonata 1.0.41 → 1.0.42

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.
@@ -68208,11 +68208,14 @@ function assertObjectPayload(payload) {
68208
68208
  throw new Error("Payload must be a non-null object");
68209
68209
  }
68210
68210
  }
68211
- var signJwt = async (payload, key, signOptions, protectHeaders) => {
68211
+ var signJwt = async (payload, key, protectHeaders = {}, signOptions) => {
68212
68212
  assertObjectPayload(payload);
68213
68213
  try {
68214
68214
  const secret = isString_default(key) ? new TextEncoder().encode(key) : key;
68215
- const jwtBuilder = new SignJWT(payload).setProtectedHeader({ alg: "HS256", typ: "JWT", ...protectHeaders });
68215
+ if (!protectHeaders.alg) {
68216
+ throw new Error("Algorithm (alg) must be provided in protectHeaders");
68217
+ }
68218
+ const jwtBuilder = new SignJWT(payload).setProtectedHeader({ ...protectHeaders, typ: "JWT" });
68216
68219
  return await jwtBuilder.sign(secret, signOptions);
68217
68220
  } catch (error) {
68218
68221
  throw new Error(`JWT signing failed: ${error?.message || String(error)}`);
@@ -68324,4 +68327,4 @@ export {
68324
68327
  trutoJsonata as default
68325
68328
  };
68326
68329
 
68327
- //# debugId=5835659C2F99AEBC64756E2164756E21
68330
+ //# debugId=661B1D665A8FA77664756E2164756E21