Browse Source

fix warnings.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
dd4b7dbbb2
  1. 6
      lib/src/crypto/protected_salt_generator.dart
  2. 5
      lib/src/crypto/protected_value.dart
  3. 1
      lib/src/kdbx_object.dart

6
lib/src/crypto/protected_salt_generator.dart

@ -7,13 +7,15 @@ import 'package:pointycastle/export.dart';
class ProtectedSaltGenerator {
factory ProtectedSaltGenerator(Uint8List key) {
final hash = sha256.convert(key).bytes as Uint8List;
final cipher = Salsa20Engine()..init(false, ParametersWithIV(KeyParameter(hash), SalsaNonce));
final cipher = Salsa20Engine()
..init(false, ParametersWithIV(KeyParameter(hash), salsaNonce));
return ProtectedSaltGenerator._(cipher);
}
ProtectedSaltGenerator._(this._cipher);
static final SalsaNonce = Uint8List.fromList([0xE8, 0x30, 0x09, 0x4B, 0x97, 0x20, 0x5D, 0x2A]);
static final salsaNonce =
Uint8List.fromList([0xE8, 0x30, 0x09, 0x4B, 0x97, 0x20, 0x5D, 0x2A]);
final StreamCipher _cipher;
String decryptBase64(String protectedValue) {

5
lib/src/crypto/protected_value.dart

@ -73,6 +73,11 @@ class ProtectedValue implements StringValue {
bool operator ==(dynamic other) =>
other is ProtectedValue && other.getText() == getText();
int _hashCodeCached;
@override
int get hashCode => _hashCodeCached ??= getText().hashCode;
@override
String toString() {
return 'ProtectedValue{${base64.encode(hash)}}';

1
lib/src/kdbx_object.dart

@ -11,6 +11,7 @@ import 'package:uuid/uuid.dart';
import 'package:uuid/uuid_util.dart';
import 'package:xml/xml.dart';
// ignore: unused_element
final _logger = Logger('kdbx.kdbx_object');
class ChangeEvent<T> {

Loading…
Cancel
Save