Permalink
Browse files

bin/magicsig: use new interface

  • Loading branch information...
1 parent 4253151 commit 731d58091a16f0d2af2df2a581dbd167c9545acb @astro committed Jun 18, 2011
Showing with 6 additions and 13 deletions.
  1. +5 −12 bin/magicsig.js
  2. +1 −1 lib/ostatus/salmon.js
View
@@ -1,24 +1,17 @@
#!/usr/bin/env node
var Util = require('util');
-var Bn = require('bignumber');
-var Salmon = require('ostatus').salmon;
+var Salmon = require('../lib/ostatus').salmon;
-var bits = 2048;
-var exponent = 'deadbeef';
-
-var key = new Bn.Key();
Util.puts("Generating key... this can take a while due to pure-JSness");
-key.generate(bits, exponent);
+var keys = Salmon.generateKeys();
// Public
Util.puts("Public key:");
-Util.puts("data:application/magic-public-key,RSA." +
- Salmon.base64url_encode(key.n.toByteArray()) +
- "." +
- Salmon.base64url_encode(new Bn.BigInteger(exponent, 16).toByteArray()));
+Util.puts("data:application/magic-public-key," + keys.public);
+Util.puts("(Put it in your user's LRDD file)");
// Private
Util.puts("Private key:");
-Util.puts(Salmon.base64url_encode(key.d.toByteArray()));
+Util.puts(keys.private);
View
@@ -163,4 +163,4 @@ exports.base64url_decode = base64url_decode;
exports.base64url_encode = base64url_encode;
exports.generateKeys = generateKeys;
exports.generateSignature = generateSignature;
-exports.verifySignature = verifySignature;
+exports.verifySignature = verifySignature;

0 comments on commit 731d580

Please sign in to comment.