@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.
package/dist/cjs/index.cjs
CHANGED
|
@@ -68250,11 +68250,14 @@ function assertObjectPayload(payload) {
|
|
|
68250
68250
|
throw new Error("Payload must be a non-null object");
|
|
68251
68251
|
}
|
|
68252
68252
|
}
|
|
68253
|
-
var signJwt = async (payload, key,
|
|
68253
|
+
var signJwt = async (payload, key, protectHeaders = {}, signOptions) => {
|
|
68254
68254
|
assertObjectPayload(payload);
|
|
68255
68255
|
try {
|
|
68256
68256
|
const secret = isString_default(key) ? new TextEncoder().encode(key) : key;
|
|
68257
|
-
|
|
68257
|
+
if (!protectHeaders.alg) {
|
|
68258
|
+
throw new Error("Algorithm (alg) must be provided in protectHeaders");
|
|
68259
|
+
}
|
|
68260
|
+
const jwtBuilder = new SignJWT(payload).setProtectedHeader({ ...protectHeaders, typ: "JWT" });
|
|
68258
68261
|
return await jwtBuilder.sign(secret, signOptions);
|
|
68259
68262
|
} catch (error) {
|
|
68260
68263
|
throw new Error(`JWT signing failed: ${error?.message || String(error)}`);
|
|
@@ -68363,4 +68366,4 @@ function trutoJsonata(expression) {
|
|
|
68363
68366
|
return registerJsonataExtensions(import_jsonata.default(expression));
|
|
68364
68367
|
}
|
|
68365
68368
|
|
|
68366
|
-
//# debugId=
|
|
68369
|
+
//# debugId=5286879905448D8364756E2164756E21
|