feat: Move the result type into moxlib

This commit is contained in:
PapaTutuWawa 2023-06-17 21:22:16 +02:00
parent 3829c6c11b
commit 207215cc5f
7 changed files with 7 additions and 24 deletions

View File

@ -11,4 +11,3 @@ analyzer:
exclude:
- "lib/src/protobuf/*.dart"
- "example/omemo_dart_example.dart"
- "test/serialisation_test.dart"

View File

@ -1,19 +0,0 @@
// TODO: Pull into moxlib
class Result<T, V> {
const Result(this._data)
: assert(
_data is T || _data is V,
'Invalid data type $_data: Must be either $T or $V',
);
final dynamic _data;
bool isType<S>() => _data is S;
S get<S>() {
assert(_data is S, 'Data is not $S');
return _data as S;
}
Object get dataRuntimeType => _data.runtimeType;
}

View File

@ -1,6 +1,6 @@
import 'dart:convert';
import 'package:cryptography/cryptography.dart';
import 'package:omemo_dart/src/common/result.dart';
import 'package:moxlib/moxlib.dart';
import 'package:omemo_dart/src/errors.dart';
import 'package:omemo_dart/src/keys.dart';

View File

@ -1,8 +1,8 @@
import 'package:cryptography/cryptography.dart';
import 'package:hex/hex.dart';
import 'package:meta/meta.dart';
import 'package:moxlib/moxlib.dart';
import 'package:omemo_dart/src/common/constants.dart';
import 'package:omemo_dart/src/common/result.dart';
import 'package:omemo_dart/src/crypto.dart';
import 'package:omemo_dart/src/double_ratchet/kdf.dart';
import 'package:omemo_dart/src/errors.dart';

View File

@ -4,8 +4,8 @@ import 'package:collection/collection.dart';
import 'package:cryptography/cryptography.dart';
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:moxlib/moxlib.dart';
import 'package:omemo_dart/src/common/constants.dart';
import 'package:omemo_dart/src/common/result.dart';
import 'package:omemo_dart/src/crypto.dart';
import 'package:omemo_dart/src/double_ratchet/double_ratchet.dart';
import 'package:omemo_dart/src/errors.dart';

View File

@ -1,8 +1,8 @@
import 'dart:convert';
import 'dart:math';
import 'package:cryptography/cryptography.dart';
import 'package:moxlib/moxlib.dart';
import 'package:omemo_dart/src/common/constants.dart';
import 'package:omemo_dart/src/common/result.dart';
import 'package:omemo_dart/src/crypto.dart';
import 'package:omemo_dart/src/errors.dart';
import 'package:omemo_dart/src/helpers.dart';

View File

@ -13,6 +13,9 @@ dependencies:
hex: ^0.2.0
logging: ^1.0.2
meta: ^1.7.0
moxlib:
version: ^0.2.0
hosted: https://git.polynom.me/api/packages/Moxxy/pub
pinenacl: ^0.5.1
protobuf: ^2.1.0
protoc_plugin: ^20.0.1