UNPKG

node-rsa-es

Version:
21 lines (20 loc) 706 B
// var crypt = require('crypto'); import crypt from 'crypto'; import js from './js.js'; import io from './io.js'; import node12 from './node12.js'; export default { getEngine: function (keyPair, options) { var engine = js; if (options.environment === 'node') { if (typeof crypt.publicEncrypt === 'function' && typeof crypt.privateDecrypt === 'function') { if (typeof crypt.privateEncrypt === 'function' && typeof crypt.publicDecrypt === 'function') { engine = io; } else { engine = node12; } } } return engine(keyPair, options); } };