bitmessage-js/lib/crypto.js
2014-12-27 18:18:14 +03:00

25 lines
554 B
JavaScript

/**
* Isomorphic Bitmessage crypto module. Reexport platform-specific
* functions and also export some common routines.
* @module bitmessage/crypto
*/
"use strict";
var eccrypto = require("eccrypto");
var cryptoPlatform = require("./crypto-platform");
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;