For the complete documentation index, see llms.txt. This page is also available as Markdown.

JWTGenerateKeyPair

Generates an asymmetric key pair appropriate for the given JWS algorithm. Returns a struct with privateKey and publicKey as PEM-encoded strings.

Method Signature

JWTGenerateKeyPair( [algorithm] )

Arguments

Argument
Type
Required
Description
Default

algorithm

string

No

Target algorithm. Determines key type and size.

RS256

Supported Algorithms

Algorithm
Key Type
Key Size

RS256 / RS384

RSA

2048-bit

RS512

RSA

4096-bit

ES256

EC (P-256)

ES384

EC (P-384)

ES512

EC (P-521)

Returns

A struct with:

  • privateKey — PEM string

  • publicKey — PEM string

Examples

Last updated

Was this helpful?