Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/jose/key/generate_secret.ts>generateSecret

"JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes.
Extremely Popular
Go to Latest
function generateSecret
import { generateSecret } from "https://deno.land/x/jose@v4.14.0/key/generate_secret.ts";

Generates a symmetric secret key for a given JWA algorithm identifier.

Note: Under Web Crypto API runtime the secret key is generated with extractable set to false by default.

Type Parameters

optional
T extends KeyLike = KeyLike

Parameters

alg: string

JWA Algorithm Identifier to be used with the generated secret.

optional
options: GenerateSecretOptions

Additional options passed down to the secret generation.

Returns

Promise<T | Uint8Array>