chore: null safe crypto dependencies
This commit is contained in:
parent
7d0402b99f
commit
285b14912a
|
|
@ -24,7 +24,10 @@ import 'dart:async';
|
||||||
import 'package:base58check/base58.dart';
|
import 'package:base58check/base58.dart';
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:encrypt/encrypt.dart';
|
import 'package:encrypt/encrypt.dart';
|
||||||
import 'package:password_hash/password_hash.dart';
|
import 'package:pointycastle/digests/sha512.dart';
|
||||||
|
import 'package:pointycastle/key_derivators/api.dart';
|
||||||
|
import 'package:pointycastle/key_derivators/pbkdf2.dart';
|
||||||
|
import 'package:pointycastle/macs/hmac.dart';
|
||||||
|
|
||||||
import '../famedlysdk.dart';
|
import '../famedlysdk.dart';
|
||||||
import '../src/database/database.dart';
|
import '../src/database/database.dart';
|
||||||
|
|
@ -155,9 +158,12 @@ class SSSS {
|
||||||
if (info.algorithm != AlgorithmTypes.pbkdf2) {
|
if (info.algorithm != AlgorithmTypes.pbkdf2) {
|
||||||
throw Exception('Unknown algorithm');
|
throw Exception('Unknown algorithm');
|
||||||
}
|
}
|
||||||
final generator = PBKDF2(hashAlgorithm: sha512);
|
final out = Uint8List(info.bits != null ? (info.bits / 8).ceil() : 32);
|
||||||
return Uint8List.fromList(generator.generateKey(passphrase, info.salt,
|
final generator = PBKDF2KeyDerivator(HMac(SHA512Digest(), 128));
|
||||||
info.iterations, info.bits != null ? (info.bits / 8).ceil() : 32));
|
generator.init(
|
||||||
|
Pbkdf2Parameters(utf8.encode(info.salt), info.iterations, out.length));
|
||||||
|
generator.deriveKey(utf8.encode(passphrase), 0, out, 0);
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setValidator(String type, FutureOr<bool> Function(String) validator) {
|
void setValidator(String type, FutureOr<bool> Function(String) validator) {
|
||||||
|
|
|
||||||
16
pubspec.yaml
16
pubspec.yaml
|
|
@ -15,15 +15,18 @@ dependencies:
|
||||||
html_unescape: ^1.0.2
|
html_unescape: ^1.0.2
|
||||||
moor: ^4.0.0
|
moor: ^4.0.0
|
||||||
random_string: ^2.1.0
|
random_string: ^2.1.0
|
||||||
encrypt: ^4.1.0
|
encrypt: ^5.0.0-beta.1
|
||||||
crypto: ^2.1.5
|
crypto: ^3.0.0
|
||||||
base58check: ^1.0.1
|
base58check: ^2.0.0
|
||||||
password_hash: ^2.0.0
|
|
||||||
olm: ^2.0.0
|
olm: ^2.0.0
|
||||||
matrix_file_e2ee: ^1.1.0
|
matrix_file_e2ee:
|
||||||
|
git:
|
||||||
|
url: https://gitlab.com/famedly/libraries/matrix_file_e2ee.git
|
||||||
|
ref: nullsafety
|
||||||
isolate: ^2.0.3
|
isolate: ^2.0.3
|
||||||
logger: ^1.0.0
|
logger: ^1.0.0
|
||||||
matrix_api_lite: ^0.2.4
|
matrix_api_lite: ^0.2.4
|
||||||
|
pointycastle: ^3.0.0-nullsafety.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.15.7
|
test: ^1.15.7
|
||||||
|
|
@ -35,5 +38,4 @@ dev_dependencies:
|
||||||
#flutter_test: {sdk: flutter}
|
#flutter_test: {sdk: flutter}
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
# needed until crypto packages upgrade
|
args: ^2.0.0
|
||||||
convert: ^3.0.0
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue