E2EE and Keypair

This commit is contained in:
2024-05-12 20:15:12 +08:00
parent 08d0a99b10
commit 98547708af
20 changed files with 665 additions and 115 deletions

View File

@ -12,6 +12,7 @@ class Channel {
Account account;
int accountId;
int? realmId;
bool isEncrypted;
bool isAvailable = false;
@ -26,6 +27,7 @@ class Channel {
required this.type,
required this.account,
required this.accountId,
required this.isEncrypted,
this.realmId,
});
@ -41,6 +43,7 @@ class Channel {
account: Account.fromJson(json['account']),
accountId: json['account_id'],
realmId: json['realm_id'],
isEncrypted: json['is_encrypted'],
);
Map<String, dynamic> toJson() => {
@ -55,6 +58,7 @@ class Channel {
'account': account,
'account_id': accountId,
'realm_id': realmId,
'is_encrypted': isEncrypted,
};
}

32
lib/models/keypair.dart Normal file
View File

@ -0,0 +1,32 @@
class Keypair {
final String id;
final String algorithm;
final String publicKey;
final String? privateKey;
final bool isOwned;
Keypair({
required this.id,
required this.algorithm,
required this.publicKey,
required this.privateKey,
this.isOwned = false,
});
factory Keypair.fromJson(Map<String, dynamic> json) => Keypair(
id: json['id'],
algorithm: json['algorithm'],
publicKey: json['public_key'],
privateKey: json['private_key'],
isOwned: json['is_owned'],
);
Map<String, dynamic> toJson() => {
'id': id,
'algorithm': algorithm,
'public_key': publicKey,
'private_key': privateKey,
'is_owned': isOwned,
};
}