Skip to main content
Module

x/jose/index.ts>generateKeyPair

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 generateKeyPair
import { generateKeyPair } from "https://deno.land/x/jose@v5.2.4/index.ts";

Generates a private and a public key for a given JWA algorithm identifier. This can only generate asymmetric key pairs. For symmetric secrets use the generateSecret function.

Note: Under Web Crypto API runtime the privateKey is generated with extractable set to false by default. See GenerateKeyPairOptions.extractable to generate an extractable privateKey.

Type Parameters

optional
KeyLikeType extends KeyLike = KeyLike

Parameters

alg: string

JWA Algorithm Identifier to be used with the generated key pair.

optional
options: GenerateKeyPairOptions

Additional options passed down to the key pair generation.