diff --git a/README.md b/README.md index 08dcc64..889f88c 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Argument | Type | Status | Defa `secret` | `string`, `JsonWebKey`, `CryptoKey` | required | - | A string which is used to sign the payload. `options` | `string`, `object` | optional | `HS256` | Either the `algorithm` string or an object. `options.algorithm` | `string` | optional | `HS256` | See [Available Algorithms](#available-algorithms) -`options.keyid` | `string` | optional | `undefined` | The `keyid` or `kid` to be set in the header of the resulting JWT. +`options.header` | `object` | optional | `undefined` | Extend the header of the resulting JWT. #### `return` diff --git a/src/index.ts b/src/index.ts index 9018d11..0b08f66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -147,7 +147,7 @@ export async function sign(payload: JwtPayload, ...options } + options = { algorithm: "HS256", header: { typ: "JWT", ...(options.header ?? {}) } as JwtHeader
, ...options } if (!payload || typeof payload !== "object") throw new Error("payload must be an object")