Skip to main content
Module

x/faster/deps.ts>generateSecret

A fast and optimized middleware server with an absurdly small amount of code (300 lines) built on top of Deno's native HTTP APIs with no dependencies. It also has a collection of useful middlewares: log file, serve static, CORS, session, rate limit, token, body parsers, redirect, proxy and handle upload. In "README" there are examples of all the resources. Faster's ideology is: all you need is an optimized middleware manager, all other functionality is middleware.
Go to Latest
function generateSecret
import { generateSecret } from "https://deno.land/x/faster@v6.3/deps.ts";

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

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

Examples

Usage

const secret = await jose.generateSecret('HS256')
console.log(secret)

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<KeyLike | Uint8Array>