crypto.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var crypto = require("crypto");
  2. var promisify = require("./_promisify.js");
  3. var bind = function(c, f) { return f && f.bind(c); };
  4. Object.defineProperties(module.exports, {
  5. Certificate: { enumerable: true, value: crypto.Certificate },
  6. Cipher: { enumerable: true, value: crypto.Cipher },
  7. Cipheriv: { enumerable: true, value: crypto.Cipheriv },
  8. Credentials: { enumerable: true, value: crypto.Credentials },
  9. DEFAULT_ENCODING: { enumerable: true, get: function() { return crypto.DEFAULT_ENCODING; }, set: function(v) { crypto.DEFAULT_ENCODING = v; } },
  10. Decipher: { enumerable: true, value: crypto.Decipher },
  11. Decipheriv: { enumerable: true, value: crypto.Decipheriv },
  12. DiffieHellman: { enumerable: true, value: crypto.DiffieHellman },
  13. DiffieHellmanGroup: { enumerable: true, value: crypto.DiffieHellmanGroup },
  14. ECDH: { enumerable: true, value: crypto.ECDH },
  15. Hash: { enumerable: true, value: crypto.Hash },
  16. Hmac: { enumerable: true, value: crypto.Hmac },
  17. Sign: { enumerable: true, value: crypto.Sign },
  18. Verify: { enumerable: true, value: crypto.Verify },
  19. //_toBuf: // skipping
  20. constants: { enumerable: true, get: function() { return crypto.constants; }, set: function(v) { crypto.constants = v; } },
  21. createCipher: { enumerable: true, value: bind(crypto, crypto.createCipher) },
  22. createCipheriv: { enumerable: true, value: bind(crypto, crypto.createCipheriv) },
  23. createCredentials: { enumerable: true, value: bind(crypto, crypto.createCredentials) },
  24. createDecipher: { enumerable: true, value: bind(crypto, crypto.createDecipher) },
  25. createDecipheriv: { enumerable: true, value: bind(crypto, crypto.createDecipheriv) },
  26. createDiffieHellman: { enumerable: true, value: bind(crypto, crypto.createDiffieHellman) },
  27. createDiffieHellmanGroup: { enumerable: true, value: bind(crypto, crypto.createDiffieHellmanGroup) },
  28. createECDH: { enumerable: true, value: bind(crypto, crypto.createECDH) },
  29. createHash: { enumerable: true, value: bind(crypto, crypto.createHash) },
  30. createHmac: { enumerable: true, value: bind(crypto, crypto.createHmac) },
  31. createSign: { enumerable: true, value: bind(crypto, crypto.createSign) },
  32. createVerify: { enumerable: true, value: bind(crypto, crypto.createVerify) },
  33. getCiphers: { enumerable: true, value: bind(crypto, crypto.getCiphers) },
  34. getCurves: { enumerable: true, value: bind(crypto, crypto.getCurves) },
  35. getDiffieHellman: { enumerable: true, value: bind(crypto, crypto.getDiffieHellman) },
  36. getHashes: { enumerable: true, value: bind(crypto, crypto.getHashes) },
  37. pbkdf2: { enumerable: true, value: promisify(crypto, crypto.pbkdf2, 5) },
  38. pbkdf2Sync: { enumerable: true, value: bind(crypto, crypto.pbkdf2Sync) },
  39. privateDecrypt: { enumerable: true, value: bind(crypto, crypto.privateDecrypt) },
  40. privateEncrypt: { enumerable: true, value: bind(crypto, crypto.privateEncrypt) },
  41. prng: { enumerable: true, value: bind(crypto, crypto.prng) },
  42. pseudoRandomBytes: { enumerable: true, value: promisify(crypto, crypto.pseudoRandomBytes, 1) },
  43. pseudoRandomBytesSync: { enumerable: true, value: crypto.pseudoRandomBytes.bind(crypto) },
  44. publicDecrypt: { enumerable: true, value: bind(crypto, crypto.publicDecrypt) },
  45. publicEncrypt: { enumerable: true, value: bind(crypto, crypto.publicEncrypt) },
  46. randomBytes: { enumerable: true, value: promisify(crypto, crypto.randomBytes, 1) },
  47. randomBytesSync: { enumerable: true, value: crypto.randomBytes.bind(crypto) },
  48. randomFill: { enumerable: true, value: promisify(crypto, crypto.randomFill, 1) },
  49. randomFillSync: { enumerable: true, value: bind(crypto, crypto.randomFillSync) },
  50. rng: { enumerable: true, value: bind(crypto, crypto.rng) },
  51. setEngine: { enumerable: true, value: bind(crypto, crypto.setEngine) },
  52. timingSafeEqual: { enumerable: true, value: bind(crypto, crypto.timingSafeEqual) },
  53. });