Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function jose.generateKeyPair
import { jose } from "https://deno.land/x/jwe_cookie_map@v1.0.0-rc0/deps.ts";
const { generateKeyPair } = jose;

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.

Type Parameters

optional
T 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.