cwtch-ui/lib/cwtch/cwtch.dart

108 lines
4.3 KiB
Dart
Raw Normal View History

2021-06-24 23:10:45 +00:00
import 'package:flutter/src/services/text_input.dart';
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
2021-10-29 23:37:02 +00:00
const DefaultPassword = "be gay do crime";
2021-06-24 23:10:45 +00:00
abstract class Cwtch {
// ignore: non_constant_identifier_names
Future<void> Start();
// ignore: non_constant_identifier_names
Future<void> ReconnectCwtchForeground();
// ignore: non_constant_identifier_names
void CreateProfile(String nick, String pass);
// 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
// ignore: non_constant_identifier_names
void ResetTor();
// todo: remove these
// ignore: non_constant_identifier_names
void SendProfileEvent(String onion, String jsonEvent);
// ignore: non_constant_identifier_names
void SendAppEvent(String jsonEvent);
// 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);
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
2021-11-18 23:44:54 +00:00
void SendMessage(String profile, int handle, String message);
2021-06-24 23:10:45 +00:00
// ignore: non_constant_identifier_names
2021-11-18 23:44:54 +00:00
void 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
2021-11-18 23:44:54 +00:00
void ShareFile(String profile, int handle, String filepath);
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
2021-11-18 23:44:54 +00:00
void CreateDownloadableFile(String profile, int handle, String filenameSuggestion, String filekey);
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
void ImportBundle(String profile, String bundle);
// ignore: non_constant_identifier_names
void SetProfileAttribute(String profile, String key, String val);
// ignore: non_constant_identifier_names
void SetConversationAttribute(String profile, int conversation, String key, String val);
// 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
void Shutdown();
2021-12-14 21:33:30 +00:00
// non-ffi
String defaultDownloadPath();
2021-06-24 23:10:45 +00:00
void dispose();
}