refactor: Move data classes into their own files

This commit is contained in:
PapaTutuWawa 2022-08-08 17:43:15 +02:00
parent 5b739aaf1a
commit e9f190036c
6 changed files with 33 additions and 25 deletions

View File

@ -5,6 +5,6 @@ line-length=72
[title-trailing-punctuation]
[title-hard-tab]
[title-match-regex]
regex=^(feat|fix|test|release|chore|security|docs):.*$
regex=^(feat|fix|test|release|chore|security|docs|refactor):.*$
[body-trailing-whitespace]
[body-first-line-empty]

View File

@ -7,6 +7,8 @@ export 'src/helpers.dart';
export 'src/keys.dart';
export 'src/omemo/bundle.dart';
export 'src/omemo/device.dart';
export 'src/omemo/encrypted_key.dart';
export 'src/omemo/encryption_result.dart';
export 'src/omemo/fingerprint.dart';
export 'src/omemo/sessionmanager.dart';
export 'src/x3dh/x3dh.dart';

View File

@ -0,0 +1,13 @@
import 'package:meta/meta.dart';
/// EncryptedKey is the intermediary format of a <key /> element in the OMEMO message's
/// <keys /> header.
@immutable
class EncryptedKey {
const EncryptedKey(this.jid, this.rid, this.value, this.kex);
final String jid;
final int rid;
final String value;
final bool kex;
}

View File

@ -0,0 +1,15 @@
import 'package:meta/meta.dart';
import 'package:omemo_dart/src/omemo/encrypted_key.dart';
@immutable
class EncryptionResult {
const EncryptionResult(this.ciphertext, this.encryptedKeys);
/// The actual message that was encrypted
final List<int>? ciphertext;
/// Mapping of the device Id to the key for decrypting ciphertext, encrypted
/// for the ratchet with said device Id
final List<EncryptedKey> encryptedKeys;
}

View File

@ -12,6 +12,8 @@ import 'package:omemo_dart/src/helpers.dart';
import 'package:omemo_dart/src/keys.dart';
import 'package:omemo_dart/src/omemo/bundle.dart';
import 'package:omemo_dart/src/omemo/device.dart';
import 'package:omemo_dart/src/omemo/encrypted_key.dart';
import 'package:omemo_dart/src/omemo/encryption_result.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';
@ -22,30 +24,6 @@ import 'package:synchronized/synchronized.dart';
/// The info used for when encrypting the AES key for the actual payload.
const omemoPayloadInfoString = 'OMEMO Payload';
@immutable
class EncryptionResult {
const EncryptionResult(this.ciphertext, this.encryptedKeys);
/// The actual message that was encrypted
final List<int>? ciphertext;
/// Mapping of the device Id to the key for decrypting ciphertext, encrypted
/// for the ratchet with said device Id
final List<EncryptedKey> encryptedKeys;
}
/// EncryptedKey is the intermediary format of a <key /> element in the OMEMO message's
/// <keys /> header.
@immutable
class EncryptedKey {
const EncryptedKey(this.jid, this.rid, this.value, this.kex);
final String jid;
final int rid;
final String value;
final bool kex;
}
class OmemoSessionManager {