1
0

add options.header

This commit is contained in:
2024-10-03 19:25:22 +02:00
parent 9a68f6fdad
commit c7ce8686d3
2 changed files with 2 additions and 2 deletions

View File

@@ -147,7 +147,7 @@ export async function sign<Payload = {}, Header = {}>(payload: JwtPayload<Payloa
if (typeof options === "string")
options = { algorithm: options }
options = { algorithm: "HS256", header: { typ: "JWT" } as JwtHeader<Header>, ...options }
options = { algorithm: "HS256", header: { typ: "JWT", ...(options.header ?? {}) } as JwtHeader<Header>, ...options }
if (!payload || typeof payload !== "object")
throw new Error("payload must be an object")