encodeJWT

Builds a JSON Web Token (JWT) using the provided options.

Example

import { encodeJWT } from "thirdweb/utils";
const jwt = await encodeJWT({
payload: {
iss: "0x1234567890123456789012345678901234567890",
sub: "0x1234567890123456789012345678901234567890",
aud: "0x1234567890123456789012345678901234567890",
exp: new Date(Date.now() + 1000 * 60 * 60),
nbf: new Date(),
iat: new Date(),
jti: "1234567890",
ctx: {
example: "example",
},
},
wallet,
});
function encodeJWT(options: EncodeJWTParams): Promise<string>;

Parameters

The options for building the JWT.

Type

let options: EncodeJWTParams;

Returns

let returnType: Promise<string>;

The generated JWT.