bcrypt.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2012 The Closure Compiler Authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @fileoverview Definitions for bcrypt.js 2.
  18. * @externs
  19. * @author Daniel Wirtz <dcode@dcode.io>
  20. */
  21. /**
  22. * @type {Object.<string,*>}
  23. */
  24. var bcrypt = {};
  25. /**
  26. * @param {?function(number):!Array.<number>} random
  27. */
  28. bcrypt.setRandomFallback = function(random) {};
  29. /**
  30. * @param {number=} rounds
  31. * @param {number=} seed_length
  32. * @returns {string}
  33. */
  34. bcrypt.genSaltSync = function(rounds, seed_length) {};
  35. /**
  36. * @param {(number|function(Error, ?string))=} rounds
  37. * @param {(number|function(Error, ?string))=} seed_length
  38. * @param {function(Error, string=)=} callback
  39. */
  40. bcrypt.genSalt = function(rounds, seed_length, callback) {};
  41. /**
  42. * @param {string} s
  43. * @param {(number|string)=} salt
  44. * @returns {?string}
  45. */
  46. bcrypt.hashSync = function(s, salt) {};
  47. /**
  48. * @param {string} s
  49. * @param {number|string} salt
  50. * @param {function(Error, string=)} callback
  51. * @expose
  52. */
  53. bcrypt.hash = function(s, salt, callback) {};
  54. /**
  55. * @param {string} s
  56. * @param {string} hash
  57. * @returns {boolean}
  58. * @throws {Error}
  59. */
  60. bcrypt.compareSync = function(s, hash) {};
  61. /**
  62. * @param {string} s
  63. * @param {string} hash
  64. * @param {function(Error, boolean)} callback
  65. * @throws {Error}
  66. */
  67. bcrypt.compare = function(s, hash, callback) {};
  68. /**
  69. * @param {string} hash
  70. * @returns {number}
  71. * @throws {Error}
  72. */
  73. bcrypt.getRounds = function(hash) {};
  74. /**
  75. * @param {string} hash
  76. * @returns {string}
  77. * @throws {Error}
  78. * @expose
  79. */
  80. bcrypt.getSalt = function(hash) {};