index.js 552 B

123456789101112131415161718
  1. var crypto = require('crypto')
  2. if (typeof crypto.publicEncrypt !== 'function') {
  3. crypto = require('./browser')
  4. }
  5. exports.publicEncrypt = crypto.publicEncrypt
  6. exports.privateDecrypt = crypto.privateDecrypt
  7. if (typeof crypto.privateEncrypt !== 'function') {
  8. exports.privateEncrypt = require('./browser').privateEncrypt
  9. } else {
  10. exports.privateEncrypt = crypto.privateEncrypt
  11. }
  12. if (typeof crypto.publicDecrypt !== 'function') {
  13. exports.publicDecrypt = require('./browser').publicDecrypt
  14. } else {
  15. exports.publicDecrypt = crypto.publicDecrypt
  16. }