@edgetoken/core
    Preparing search index...

    Function signJwt

    • Signs a payload object and produces a compact RFC 7519 JSON Web Token (JWT).

      Parameters

      • payload: Record<string, unknown>

        Key-value claims to bundle inside the JWT payload.

      • secret: string | Uint8Array<ArrayBufferLike>

        Shared HMAC symmetric secret key.

      • options: JwtSignOptions = {}

        Signing options including algorithm, expiration, issuer, and audience.

      Returns Promise<string>

      A Promise resolving to the signed compact JWT string (header.payload.signature).

      const token = await signJwt(
      { sub: "usr_100", role: "admin" },
      "my-super-secret-key",
      { expiresIn: 3600, issuer: "auth.example.com" }
      );