feat: Make RatchetMapKey internal

This commit is contained in:
PapaTutuWawa 2022-08-08 14:28:02 +02:00
parent dd96e840d4
commit 9a9c9f064b
2 changed files with 19 additions and 16 deletions

View File

@ -0,0 +1,18 @@
import 'package:meta/meta.dart';
@internal
@immutable
class RatchetMapKey {
const RatchetMapKey(this.jid, this.deviceId);
final String jid;
final int deviceId;
@override
bool operator ==(Object other) {
return other is RatchetMapKey && jid == other.jid && deviceId == other.deviceId;
}
@override
int get hashCode => jid.hashCode ^ deviceId.hashCode;
}

View File

@ -13,6 +13,7 @@ import 'package:omemo_dart/src/keys.dart';
import 'package:omemo_dart/src/omemo/bundle.dart'; import 'package:omemo_dart/src/omemo/bundle.dart';
import 'package:omemo_dart/src/omemo/device.dart'; import 'package:omemo_dart/src/omemo/device.dart';
import 'package:omemo_dart/src/omemo/fingerprint.dart'; import 'package:omemo_dart/src/omemo/fingerprint.dart';
import 'package:omemo_dart/src/omemo/ratchet_map_key.dart';
import 'package:omemo_dart/src/protobuf/omemo_authenticated_message.dart'; import 'package:omemo_dart/src/protobuf/omemo_authenticated_message.dart';
import 'package:omemo_dart/src/protobuf/omemo_key_exchange.dart'; import 'package:omemo_dart/src/protobuf/omemo_key_exchange.dart';
import 'package:omemo_dart/src/protobuf/omemo_message.dart'; import 'package:omemo_dart/src/protobuf/omemo_message.dart';
@ -43,22 +44,6 @@ class EncryptedKey {
final bool kex; final bool kex;
} }
@immutable
class RatchetMapKey {
const RatchetMapKey(this.jid, this.deviceId);
final String jid;
final int deviceId;
@override
bool operator ==(Object other) {
return other is RatchetMapKey && jid == other.jid && deviceId == other.deviceId;
}
@override
int get hashCode => jid.hashCode ^ deviceId.hashCode;
}
class OmemoSessionManager { class OmemoSessionManager {
OmemoSessionManager(this._device, this._deviceMap, this._ratchetMap) OmemoSessionManager(this._device, this._deviceMap, this._ratchetMap)