makeAsync static method
same as make, but runs bcrypt on a worker isolate of
Dox().compute, so the server can answer other requests in the
meantime. Use it in the web server. It works without a server too.
String hash = await Hash.makeAsync('secret');
Implementation
static Future<String> makeAsync(String password, {int? rounds}) async {
_checkLength(password);
int cost = rounds ?? Hash.rounds;
return ComputePool.instance.run(() {
return BCrypt.hashpw(password, BCrypt.gensalt(logRounds: cost));
});
}