bitmessage-js/lib/crypto.js

25 lines
548 B
JavaScript
Raw Normal View History

2014-12-13 18:56:14 +00:00
/**
2014-12-27 21:04:23 +00:00
* Isomorphic Bitmessage crypto module. Reexports platform-specific
* functions and also some common routines.
2014-12-18 16:47:18 +00:00
* @module bitmessage/crypto
2014-12-13 18:56:14 +00:00
*/
"use strict";
var eccrypto = require("eccrypto");
2014-12-26 16:47:25 +00:00
var cryptoPlatform = require("./crypto-platform");
2014-12-26 17:17:01 +00:00
2014-12-26 16:47:25 +00:00
Object.keys(cryptoPlatform).forEach(function(key) {
exports[key] = cryptoPlatform[key];
});
/**
* Generate new random private key.
* @return {Buffer} New private key.
*/
exports.getPrivate = function() {
return cryptoPlatform.randomBytes(32);
};
exports.getPublic = eccrypto.getPublic;