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
|
2023-09-11 20:36:39 +00:00
|
|
|
import 'dart:collection';
|
|
|
|
|
2021-10-29 23:37:02 +00:00
|
|
|
const DefaultPassword = "be gay do crime";
|
|
|
|
|
2022-04-01 22:54:06 +00:00
|
|
|
const LastMessageSeenTimeKey = "profile.lastMessageSeenTime";
|
|
|
|
|
2021-06-24 23:10:45 +00:00
|
|
|
abstract class Cwtch {
|
2023-09-11 20:36:39 +00:00
|
|
|
Future<HashMap<String, String>> PlatformChannelInfo();
|
|
|
|
|
2021-06-24 23:10:45 +00:00
|
|
|
// ignore: non_constant_identifier_names
|
|
|
|
Future<void> Start();
|
|
|
|
|
2024-02-02 07:48:20 +00:00
|
|
|
Future<String> getCwtchDir();
|
|
|
|
|
2024-01-05 09:13:43 +00:00
|
|
|
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);
|
2022-12-05 19:58:44 +00:00
|
|
|
|
|
|
|
// 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();
|
2023-03-02 21:17:44 +00:00
|
|
|
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);
|
2022-01-06 21:54:25 +00:00
|
|
|
// ignore: non_constant_identifier_names
|
|
|
|
void UnblockContact(String profileOnion, int contactHandle);
|
2021-06-24 23:10:45 +00:00
|
|
|
|
2023-05-11 22:06:14 +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);
|
2023-05-11 22:06:14 +00:00
|
|
|
|
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-11-26 22:25:21 +00:00
|
|
|
|
2021-06-24 23:10:45 +00:00
|
|
|
// ignore: non_constant_identifier_names
|
2021-11-26 22:25:21 +00:00
|
|
|
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
|
2022-03-23 23:08:19 +00:00
|
|
|
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
|
2022-03-23 23:08:19 +00:00
|
|
|
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
|
2022-03-23 23:08:19 +00:00
|
|
|
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
|
2023-03-16 23:37:38 +00:00
|
|
|
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
|
2021-10-14 01:24:07 +00:00
|
|
|
void SetProfileAttribute(String profile, String key, String val);
|
2023-05-18 18:15:13 +00:00
|
|
|
Future<String?> GetProfileAttribute(String profile, String key);
|
2021-10-14 01:24:07 +00:00
|
|
|
// ignore: non_constant_identifier_names
|
2021-12-01 12:17:48 +00:00
|
|
|
void SetConversationAttribute(String profile, int conversation, String key, String val);
|
|
|
|
// ignore: non_constant_identifier_names
|
2023-05-18 18:15:13 +00:00
|
|
|
Future<String?> GetConversationAttribute(String profile, int identifier, String s);
|
2023-04-04 20:58:42 +00:00
|
|
|
// ignore: non_constant_identifier_names
|
2021-12-01 12:17:48 +00:00
|
|
|
void SetMessageAttribute(String profile, int conversation, int channel, int message, String key, String val);
|
2021-10-14 01:24:07 +00:00
|
|
|
// 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);
|
2021-10-14 01:24:07 +00:00
|
|
|
// 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);
|
2021-10-14 01:24:07 +00:00
|
|
|
// 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
|
2022-03-04 01:00:36 +00:00
|
|
|
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
|
|
|
|
2022-02-08 21:54:17 +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();
|
2023-03-02 21:17:44 +00:00
|
|
|
|
|
|
|
bool IsServersCompiled();
|
2023-03-27 19:00:49 +00:00
|
|
|
|
|
|
|
Future<String> SummarizeConversation(String profile, int conversation);
|
|
|
|
Future<String> TranslateMessage(String profile, int conversation, int message, String language);
|
|
|
|
|
|
|
|
bool IsBlodeuweddSupported();
|
2023-08-02 16:43:27 +00:00
|
|
|
|
|
|
|
// ignore: non_constant_identifier_names
|
|
|
|
Future<String> SearchConversations(String profile, String pattern);
|
2023-08-21 17:50:55 +00:00
|
|
|
void DeleteServerInfo(String profile, String handle);
|
2023-09-26 19:50:02 +00:00
|
|
|
void PublishServerUpdate(String onion);
|
2023-09-20 19:28:49 +00:00
|
|
|
Future<void> ConfigureConnections(String onion, bool listen, bool peers, bool servers);
|
2024-01-03 22:10:07 +00:00
|
|
|
|
|
|
|
bool IsLoaded();
|
2021-06-24 23:10:45 +00:00
|
|
|
}
|