Revisione/scripts/gen-keypair.mjs

13 lines
569 B
JavaScript

#!/usr/bin/env node
import { generateKeyPairSync } from "crypto";
const { privateKey, publicKey } = generateKeyPairSync("ed25519", {
privateKeyEncoding: { type: "pkcs8", format: "der" },
publicKeyEncoding: { type: "spki", format: "der" },
});
console.log("Add these to your .env files:\n");
console.log(`LICENSE_PRIVATE_KEY=${privateKey.toString("base64")}`);
console.log(`LICENSE_PUBLIC_KEY=${publicKey.toString("base64")}`);
console.log("\nLICENSE_PRIVATE_KEY goes on your LOCAL machine only.");
console.log("LICENSE_PUBLIC_KEY goes on the SERVER .env only.");