Files
otunes/docker/generate-auth-keys.mjs
joshuafhiggins Verified 1cea1fe745 feat(docker): bundle Convex backend with oTunes
- 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
2026-10-08 15:24:00 -04:00

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`)