You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note:** Since bcrypt.js 2.4.0, if the callback argument has been omitted when calling an asynchronous function, the function returns a Promise.
119
+
118
120
API
119
121
---
120
122
### setRandomFallback(random)
@@ -152,6 +154,8 @@ Asynchronously generates a salt.
152
154
| rounds | *number | function(Error, string=)* | Number of rounds to use, defaults to 10 if omitted
153
155
| seed_length | *number | function(Error, string=)* | Not supported.
154
156
| callback | *function(Error, string=)* | Callback receiving the error, if any, and the resulting salt
157
+
| @returns | *Promise* | If `callback` has been omitted
158
+
| **@throws** | *Error* | If the callback argument is present but not a function
155
159
156
160
### hashSync(s, salt=)
157
161
@@ -172,7 +176,9 @@ Asynchronously generates a hash for the given string.
172
176
| s | *string* | String to hash
173
177
| salt | *number | string* | Salt length to generate or salt to use
174
178
| callback | *function(Error, string=)* | Callback receiving the error, if any, and the resulting hash
175
-
| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
179
+
| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
180
+
| @returns | *Promise* | If `callback` has been omitted
181
+
| **@throws** | *Error* | If the callback argument is present but not a function
176
182
177
183
### compareSync(s, hash)
178
184
@@ -194,8 +200,9 @@ Asynchronously compares the given data against the given hash.
194
200
| s | *string* | Data to compare
195
201
| hash | *string* | Data to be compared to
196
202
| callback | *function(Error, boolean)* | Callback receiving the error, if any, otherwise the result
197
-
| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
198
-
| **@throws** | *Error* | If the callback argument is invalid
203
+
| progressCallback | *function(number)* | Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per `MAX_EXECUTION_TIME = 100` ms.
204
+
| @returns | *Promise* | If `callback` has been omitted
205
+
| **@throws** | *Error* | If the callback argument is present but not a function
0 commit comments