refactor: Move data classes into their own files
This commit is contained in:
parent
5b739aaf1a
commit
e9f190036c
2
.gitlint
2
.gitlint
@ -5,6 +5,6 @@ line-length=72
|
|||||||
[title-trailing-punctuation]
|
[title-trailing-punctuation]
|
||||||
[title-hard-tab]
|
[title-hard-tab]
|
||||||
[title-match-regex]
|
[title-match-regex]
|
||||||
regex=^(feat|fix|test|release|chore|security|docs):.*$
|
regex=^(feat|fix|test|release|chore|security|docs|refactor):.*$
|
||||||
[body-trailing-whitespace]
|
[body-trailing-whitespace]
|
||||||
[body-first-line-empty]
|
[body-first-line-empty]
|
||||||
|
@ -7,6 +7,8 @@ export 'src/helpers.dart';
|
|||||||
export 'src/keys.dart';
|
export 'src/keys.dart';
|
||||||
export 'src/omemo/bundle.dart';
|
export 'src/omemo/bundle.dart';
|
||||||
export 'src/omemo/device.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/fingerprint.dart';
|
||||||
export 'src/omemo/sessionmanager.dart';
|
export 'src/omemo/sessionmanager.dart';
|
||||||
export 'src/x3dh/x3dh.dart';
|
export 'src/x3dh/x3dh.dart';
|
||||||
|
13
lib/src/omemo/encrypted_key.dart
Normal file
13
lib/src/omemo/encrypted_key.dart
Normal 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;
|
||||||
|
}
|
15
lib/src/omemo/encryption_result.dart
Normal file
15
lib/src/omemo/encryption_result.dart
Normal 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;
|
||||||
|
}
|
@ -12,6 +12,8 @@ import 'package:omemo_dart/src/helpers.dart';
|
|||||||
import 'package:omemo_dart/src/keys.dart';
|
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/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/fingerprint.dart';
|
||||||
import 'package:omemo_dart/src/omemo/ratchet_map_key.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';
|
||||||
@ -22,30 +24,6 @@ import 'package:synchronized/synchronized.dart';
|
|||||||
|
|
||||||
/// The info used for when encrypting the AES key for the actual payload.
|
/// The info used for when encrypting the AES key for the actual payload.
|
||||||
const omemoPayloadInfoString = 'OMEMO 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 {
|
class OmemoSessionManager {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user