Created
November 30, 2021 13:28
-
-
Save efleming969/4d930025aa544329353b141c4f3744fa to your computer and use it in GitHub Desktop.
utility for create public/private keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as FS from "fs" | |
import * as Jose from "jose" | |
const { publicKey, privateKey } = await Jose.generateKeyPair( "RS256" ) | |
const publicPem = await Jose.exportSPKI( publicKey ) | |
await FS.promises.writeFile( "./public.pem", publicPem, "utf-8" ) | |
const privatePem = await Jose.exportPKCS8( privateKey ) | |
await FS.promises.writeFile( "./private.pem", privatePem, "utf-8" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment