Added repositories using provider package

This commit is contained in:
mitchell 2019-07-04 17:45:05 -04:00
parent cad969d98c
commit d0505a4a58
30 changed files with 1539 additions and 63 deletions

15
lib/utils/crypto.dart Normal file
View file

@ -0,0 +1,15 @@
import 'dart:math';
import 'dart:convert';
import 'package:crypt/crypt.dart';
String hashPassword(String password) {
final random = Random.secure();
final saltInts = List<int>.generate(16, (_) => random.nextInt(256));
final salt = base64.encode(saltInts);
return Crypt.sha256(password, salt: salt).toString();
}
bool matchHashedPassword(String hashedPassword, String password) =>
Crypt(hashedPassword).match(password);