Created
November 14, 2017 17:47
-
-
Save cyan33/c1e3e520f42fa549527399fc875262e4 to your computer and use it in GitHub Desktop.
How the async wrapper is used
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var login = async(function* (username, password, session) { | |
var user = yield getUser(username); | |
var hash = yield crypto.hashAsync(password + user.salt); | |
if (user.hash !== hash) { | |
throw new Error('Incorrect password'); | |
} | |
session.setUser(user); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment