cwtch-ui/lib/cwtch/cwtch.dart

164 lines
6.3 KiB
Dart
Raw Normal View History

2021-11-02 21:48:52 +00:00
// To handle profiles that are "unencrypted" (i.e don't require a password to open) we currently create a profile with a defacto, hardcoded password.
// Details: https://docs.openprivacy.ca/cwtch-security-handbook/profile_encryption_and_storage.html
import 'dart:collection';
2021-10-29 23:37:02 +00:00
const DefaultPassword = "be gay do crime";
const LastMessageSeenTimeKey = "profile.lastMessageSeenTime";
2021-06-24 23:10:45 +00:00
abstract class Cwtch {
Future<HashMap<String, String>> PlatformChannelInfo();
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
Future<void> Start();
Future<String> getCwtchDir();
String getAssetsDir();
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
2022-12-11 01:21:08 +00:00
void CreateProfile(String nick, String pass, bool autostart);
// ignore: non_constant_identifier_names
void ActivatePeerEngine(String profile);
// ignore: non_constant_identifier_names
void DeactivatePeerEngine(String profile);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
void LoadProfiles(String pass);
// ignore: non_constant_identifier_names
2021-12-18 00:54:30 +00:00
void DeleteProfile(String profile, String pass);
// ignore: non_constant_identifier_names
void ChangePassword(String profile, String pass, String newpass, String newpassAgain);
2021-06-24 23:10:45 +00:00
2022-03-09 22:35:12 +00:00
// ignore: non_constant_identifier_names
void ExportProfile(String profile, String file);
// ignore: non_constant_identifier_names
Future<dynamic> ImportProfile(String file, String pass);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
void ResetTor();
void UpdateSettings(String json);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void AcceptContact(String profileOnion, int contactHandle);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void BlockContact(String profileOnion, int contactHandle);
// ignore: non_constant_identifier_names
void UnblockContact(String profileOnion, int contactHandle);
2021-06-24 23:10:45 +00:00
void AttemptReconnection(String profileOnion, String onion);
2023-09-14 01:38:08 +00:00
void AttemptReconnectionServer(String profileOnion, String onion);
void DisconnectFromPeer(String profileOnion, String onion);
void DisconnectFromServer(String profileOnion, String onion);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
Future<dynamic> GetMessage(String profile, int handle, int index);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
Future<dynamic> GetMessageByID(String profile, int handle, int index);
2021-07-05 19:31:16 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
Future<dynamic> GetMessageByContentHash(String profile, int handle, String contentHash);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
Future<dynamic> GetMessages(String profile, int handle, int index, int count);
// ignore: non_constant_identifier_names
Future<dynamic> SendMessage(String profile, int handle, String message);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
Future<dynamic> SendInvitation(String profile, int handle, int target);
2021-06-24 23:10:45 +00:00
2021-09-21 21:57:40 +00:00
// ignore: non_constant_identifier_names
Future<dynamic> ShareFile(String profile, int handle, String filepath);
2022-07-06 18:54:07 +00:00
// ignore: non_constant_identifier_names
Future<dynamic> GetSharedFiles(String profile, int handle);
// ignore: non_constant_identifier_names
void RestartSharing(String profile, String filekey);
// ignore: non_constant_identifier_names
void StopSharing(String profile, String filekey);
2021-09-21 21:57:40 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void DownloadFile(String profile, int handle, String filepath, String manifestpath, String filekey);
2021-12-19 01:43:32 +00:00
// android-only
2021-09-21 21:57:40 +00:00
// ignore: non_constant_identifier_names
void CreateDownloadableFile(String profile, int handle, String filenameSuggestion, String filekey, String manifestPath);
2021-09-29 20:31:01 +00:00
// ignore: non_constant_identifier_names
void CheckDownloadStatus(String profile, String fileKey);
2021-11-04 22:31:50 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void VerifyOrResumeDownload(String profile, int handle, String filekey);
2021-12-19 01:43:32 +00:00
// android-only
2021-12-14 23:50:08 +00:00
// ignore: non_constant_identifier_names
void ExportPreviewedFile(String sourceFile, String suggestion);
2021-09-21 21:57:40 +00:00
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void ArchiveConversation(String profile, int handle);
2021-08-27 20:46:13 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void DeleteContact(String profile, int handle);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
void CreateGroup(String profile, String server, String groupName);
// ignore: non_constant_identifier_names
2022-08-16 05:33:09 +00:00
Future<dynamic> ImportBundle(String profile, String bundle);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
void SetProfileAttribute(String profile, String key, String val);
Future<String?> GetProfileAttribute(String profile, String key);
// ignore: non_constant_identifier_names
void SetConversationAttribute(String profile, int conversation, String key, String val);
// ignore: non_constant_identifier_names
Future<String?> GetConversationAttribute(String profile, int identifier, String s);
2023-04-04 20:58:42 +00:00
// ignore: non_constant_identifier_names
void SetMessageAttribute(String profile, int conversation, int channel, int message, String key, String val);
// ignore: non_constant_identifier_names
void LoadServers(String password);
// ignore: non_constant_identifier_names
2021-10-29 23:37:02 +00:00
void CreateServer(String password, String description, bool autostart);
// ignore: non_constant_identifier_names
void DeleteServer(String serverOnion, String password);
// ignore: non_constant_identifier_names
void LaunchServers();
// ignore: non_constant_identifier_names
void LaunchServer(String serverOnion);
// ignore: non_constant_identifier_names
2021-11-02 02:29:58 +00:00
void StopServer(String serverOnion);
// ignore: non_constant_identifier_names
2021-11-02 02:29:58 +00:00
void StopServers();
// ignore: non_constant_identifier_names
void DestroyServers();
2021-10-29 23:37:02 +00:00
// ignore: non_constant_identifier_names
void SetServerAttribute(String serverOnion, String key, String val);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
Future<void> Shutdown();
2021-06-24 23:10:45 +00:00
2021-12-14 21:33:30 +00:00
// non-ffi
2022-09-09 19:23:08 +00:00
String? defaultDownloadPath();
2021-12-14 21:33:30 +00:00
bool isL10nInit();
void l10nInit(String notificationSimple, String notificationConversationInfo);
2021-06-24 23:10:45 +00:00
void dispose();
2022-04-14 22:34:17 +00:00
Future<dynamic> GetDebugInfo();
bool IsServersCompiled();
Future<String> SummarizeConversation(String profile, int conversation);
Future<String> TranslateMessage(String profile, int conversation, int message, String language);
bool IsBlodeuweddSupported();
// ignore: non_constant_identifier_names
Future<String> SearchConversations(String profile, String pattern);
void DeleteServerInfo(String profile, String handle);
void PublishServerUpdate(String onion);
Future<void> ConfigureConnections(String onion, bool listen, bool peers, bool servers);
bool IsLoaded();
2021-06-24 23:10:45 +00:00
}