Reflecion of #589

This commit is contained in:
Alex Ivanov
2019-11-29 08:41:28 +03:00
parent 40ea2b1d70
commit c36eb17db2

View File

@ -9,19 +9,21 @@
### Пример кода
```javascript
try {
// asynchronously generate a secure password using 10 hashing rounds
bcrypt.hash('myPassword', 10, function(err, hash) {
const hash = await bcrypt.hash('myPassword', 10);
// Store secure hash in user record
});
// compare a provided password input with saved hash
bcrypt.compare('somePassword', hash, function(err, match) {
const match = await bcrypt.compare('somePassword', hash);
if (match) {
// Passwords match
} else {
// Passwords don't match
}
});
} catch {
logger.error('could not hash password.')
}
```
### Что говорят другие блогеры