- Run the web app and Convex backend in one container with generated per-install keys - Derive Convex URLs from the server address and update self-hosting docs
15 lines
529 B
JavaScript
15 lines
529 B
JavaScript
// Prints a fresh Convex Auth signing key pair in .env format for `convex env set`.
|
|
import { generateKeyPairSync } from "node:crypto"
|
|
|
|
const { privateKey, publicKey } = generateKeyPairSync("rsa", {
|
|
modulusLength: 2048,
|
|
})
|
|
const pkcs8 = privateKey.export({ type: "pkcs8", format: "pem" })
|
|
const jwk = publicKey.export({ format: "jwk" })
|
|
const jwks = JSON.stringify({ keys: [{ use: "sig", ...jwk }] })
|
|
|
|
process.stdout.write(
|
|
`JWT_PRIVATE_KEY="${pkcs8.trimEnd().replace(/\n/g, " ")}"\n`
|
|
)
|
|
process.stdout.write(`JWKS=${jwks}\n`)
|