Browse Source

move exceptions into their own package.

pull/5/head
Herbert Poul 3 years ago
parent
commit
e7e342abb1
  1. 9
      lib/kdbx.dart
  2. 1
      lib/src/kdbx_entry.dart
  3. 36
      lib/src/kdbx_exceptions.dart
  4. 1
      lib/src/kdbx_file.dart
  5. 38
      lib/src/kdbx_header.dart
  6. 1
      lib/src/kdbx_meta.dart
  7. 1
      lib/src/kdbx_xml.dart

9
lib/kdbx.dart

@ -10,6 +10,7 @@ export 'src/kdbx_consts.dart';
export 'src/kdbx_custom_data.dart';
export 'src/kdbx_dao.dart' show KdbxDao;
export 'src/kdbx_entry.dart' show KdbxEntry, KdbxKey, KdbxKeyCommon;
export 'src/kdbx_exceptions.dart';
export 'src/kdbx_file.dart';
export 'src/kdbx_format.dart'
show
@ -23,13 +24,7 @@ export 'src/kdbx_format.dart'
KeyFileCredentials,
PasswordCredentials;
export 'src/kdbx_group.dart' show KdbxGroup;
export 'src/kdbx_header.dart'
show
KdbxException,
KdbxInvalidKeyException,
KdbxCorruptedFileException,
KdbxUnsupportedException,
KdbxVersion;
export 'src/kdbx_header.dart' show KdbxVersion;
export 'src/kdbx_meta.dart';
export 'src/kdbx_object.dart'
show

1
lib/src/kdbx_entry.dart

@ -5,6 +5,7 @@ import 'package:kdbx/src/crypto/protected_value.dart';
import 'package:kdbx/src/internal/extension_utils.dart';
import 'package:kdbx/src/kdbx_binary.dart';
import 'package:kdbx/src/kdbx_consts.dart';
import 'package:kdbx/src/kdbx_exceptions.dart';
import 'package:kdbx/src/kdbx_file.dart';
import 'package:kdbx/src/kdbx_format.dart';
import 'package:kdbx/src/kdbx_group.dart';

36
lib/src/kdbx_exceptions.dart

@ -0,0 +1,36 @@
class KdbxException implements Exception {}
class KdbxInvalidKeyException implements KdbxException {}
class KdbxCorruptedFileException implements KdbxException {
KdbxCorruptedFileException([this.message]);
final String? message;
@override
String toString() {
return 'KdbxCorruptedFileException{message: $message}';
}
}
class KdbxUnsupportedException implements KdbxException {
KdbxUnsupportedException(this.hint);
final String hint;
@override
String toString() {
return 'KdbxUnsupportedException{hint: $hint}';
}
}
class KdbxInvalidFileStructure implements KdbxException {
KdbxInvalidFileStructure(this.message);
final String message;
@override
String toString() {
return 'KdbxInvalidFileStructure{$message}';
}
}

1
lib/src/kdbx_file.dart

@ -5,6 +5,7 @@ import 'package:collection/collection.dart';
import 'package:kdbx/src/crypto/protected_value.dart';
import 'package:kdbx/src/kdbx_consts.dart';
import 'package:kdbx/src/kdbx_dao.dart';
import 'package:kdbx/src/kdbx_exceptions.dart';
import 'package:kdbx/src/kdbx_format.dart';
import 'package:kdbx/src/kdbx_group.dart';
import 'package:kdbx/src/kdbx_header.dart';

38
lib/src/kdbx_header.dart

@ -4,6 +4,7 @@ import 'package:crypto/crypto.dart' as crypto;
import 'package:kdbx/src/crypto/key_encrypter_kdf.dart';
import 'package:kdbx/src/internal/consts.dart';
import 'package:kdbx/src/kdbx_binary.dart';
import 'package:kdbx/src/kdbx_exceptions.dart';
import 'package:kdbx/src/kdbx_var_dictionary.dart';
import 'package:kdbx/src/utils/byte_utils.dart';
import 'package:logging/logging.dart';
@ -557,43 +558,6 @@ class KdbxHeader {
}
}
class KdbxException implements Exception {}
class KdbxInvalidKeyException implements KdbxException {}
class KdbxCorruptedFileException implements KdbxException {
KdbxCorruptedFileException([this.message]);
final String? message;
@override
String toString() {
return 'KdbxCorruptedFileException{message: $message}';
}
}
class KdbxUnsupportedException implements KdbxException {
KdbxUnsupportedException(this.hint);
final String hint;
@override
String toString() {
return 'KdbxUnsupportedException{hint: $hint}';
}
}
class KdbxInvalidFileStructure implements KdbxException {
KdbxInvalidFileStructure(this.message);
final String message;
@override
String toString() {
return 'KdbxInvalidFileStructure{$message}';
}
}
class HashedBlockReader {
static const BLOCK_SIZE = 1024 * 1024;
static const HASH_SIZE = 32;

1
lib/src/kdbx_meta.dart

@ -5,6 +5,7 @@ import 'package:collection/collection.dart';
import 'package:kdbx/src/internal/extension_utils.dart';
import 'package:kdbx/src/kdbx_binary.dart';
import 'package:kdbx/src/kdbx_custom_data.dart';
import 'package:kdbx/src/kdbx_exceptions.dart';
import 'package:kdbx/src/kdbx_format.dart';
import 'package:kdbx/src/kdbx_header.dart';
import 'package:kdbx/src/kdbx_object.dart';

1
lib/src/kdbx_xml.dart

@ -4,6 +4,7 @@ import 'dart:typed_data';
import 'package:clock/clock.dart';
import 'package:collection/collection.dart' show IterableExtension;
import 'package:kdbx/src/kdbx_consts.dart';
import 'package:kdbx/src/kdbx_exceptions.dart';
import 'package:kdbx/src/kdbx_format.dart';
import 'package:kdbx/src/kdbx_header.dart';
import 'package:kdbx/src/kdbx_object.dart';

Loading…
Cancel
Save