UNPKG

2.18 kBJavaScriptView Raw
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/**
18 * @fileoverview Definitions for bcrypt.js 2.
19 * @externs
20 * @author Daniel Wirtz <dcode@dcode.io>
21 */
22
23/**
24 * @type {Object.<string,*>}
25 */
26var bcrypt = {};
27
28/**
29 * @param {?function(number):!Array.<number>} random
30 */
31bcrypt.setRandomFallback = function(random) {};
32
33/**
34 * @param {number=} rounds
35 * @param {number=} seed_length
36 * @returns {string}
37 */
38bcrypt.genSaltSync = function(rounds, seed_length) {};
39
40/**
41 * @param {(number|function(Error, ?string))=} rounds
42 * @param {(number|function(Error, ?string))=} seed_length
43 * @param {function(Error, string=)=} callback
44 */
45bcrypt.genSalt = function(rounds, seed_length, callback) {};
46
47/**
48 * @param {string} s
49 * @param {(number|string)=} salt
50 * @returns {?string}
51 */
52bcrypt.hashSync = function(s, salt) {};
53
54/**
55 * @param {string} s
56 * @param {number|string} salt
57 * @param {function(Error, string=)} callback
58 * @expose
59 */
60bcrypt.hash = function(s, salt, callback) {};
61
62/**
63 * @param {string} s
64 * @param {string} hash
65 * @returns {boolean}
66 * @throws {Error}
67 */
68bcrypt.compareSync = function(s, hash) {};
69
70/**
71 * @param {string} s
72 * @param {string} hash
73 * @param {function(Error, boolean)} callback
74 * @throws {Error}
75 */
76bcrypt.compare = function(s, hash, callback) {};
77
78/**
79 * @param {string} hash
80 * @returns {number}
81 * @throws {Error}
82 */
83bcrypt.getRounds = function(hash) {};
84
85/**
86 * @param {string} hash
87 * @returns {string}
88 * @throws {Error}
89 * @expose
90 */
91bcrypt.getSalt = function(hash) {};