Browse files

a handy dandy script to generate keypairs and set them in heroku

  • Loading branch information...
1 parent ca6cd06 commit 4cad3fd9908b9b19fc5d30a28886cf44f10e348c @lloyd lloyd committed Dec 17, 2011
Showing with 22 additions and 0 deletions.
  1. +22 −0 scripts/set_keys_in_heroku.js
View
22 scripts/set_keys_in_heroku.js
@@ -0,0 +1,22 @@
+#!/usr/bin/env node
+
+const
+jwk = require('jwcrypto/jwk'),
+child_process = require('child_process');
+
+// generate a 2048 bit RSA key
+var keypair = jwk.KeyPair.generate('RS', 128);
+
+// set the heroku PUBLIC_KEY param
+child_process.exec(
+ "heroku config:add PUBLIC_KEY='" + keypair.publicKey.serialize() + "'",
+ function(err, r) {
+ if (err) throw "can't set public key";
+ console.log("public key set");
+ child_process.exec(
+ "heroku config:add PRIVATE_KEY='" + keypair.secretKey.serialize() + "'",
+ function(err, r) {
+ if (err) throw "can't set private key";
+ console.log("private key set");
+ });
+ });

0 comments on commit 4cad3fd

Please sign in to comment.