feat: Add a base trust manager class
This commit is contained in:
11
lib/src/trust/always.dart
Normal file
11
lib/src/trust/always.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:omemo_dart/src/trust/base.dart';
|
||||
|
||||
/// Only use for testing!
|
||||
/// An implementation of TrustManager that always trusts every device and thus
|
||||
/// has no internal state.
|
||||
@visibleForTesting
|
||||
class AlwaysTrustingTrustManager extends TrustManager {
|
||||
@override
|
||||
Future<bool> isTrusted(String jid, int deviceId) async => true;
|
||||
}
|
||||
7
lib/src/trust/base.dart
Normal file
7
lib/src/trust/base.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
/// The base class for managing trust in OMEMO sessions.
|
||||
// ignore: one_member_abstracts
|
||||
abstract class TrustManager {
|
||||
/// Return true when the device with id [deviceId] of Jid [jid] is trusted, i.e. if an
|
||||
/// encrypted message should be sent to this device. If not, return false.
|
||||
Future<bool> isTrusted(String jid, int deviceId);
|
||||
}
|
||||
Reference in New Issue
Block a user