This repository has been archived on 2023-09-08. You can view files and clone it, but cannot push or open issues or pull requests.
moxplatform/pigeons/api.dart

54 lines
1.7 KiB
Dart
Raw Normal View History

2023-07-27 18:45:09 +00:00
import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(
PigeonOptions(
dartOut: 'packages/moxplatform_platform_interface/lib/src/api.g.dart',
2023-07-27 18:45:09 +00:00
//kotlinOut: 'packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Notifications.g.kt',
//kotlinOptions: KotlinOptions(
// package: 'me.polynom.moxplatform_android',
//),
javaOut: 'packages/moxplatform_android/android/src/main/java/me/polynom/moxplatform_android/Api.java',
2023-07-27 18:45:09 +00:00
javaOptions: JavaOptions(
package: 'me.polynom.moxplatform_android',
),
),
)
2023-08-03 19:19:11 +00:00
enum CipherAlgorithm {
aes128GcmNoPadding,
aes256GcmNoPadding,
aes256CbcPkcs7;
}
class CryptographyResult {
const CryptographyResult(this.plaintextHash, this.ciphertextHash);
final Uint8List plaintextHash;
final Uint8List ciphertextHash;
}
2023-08-03 19:27:13 +00:00
// The type of icon to use when no avatar path is provided.
enum FallbackIconType {
none,
person,
notes;
}
2023-07-27 18:45:09 +00:00
@HostApi()
abstract class MoxplatformApi {
2023-08-03 19:19:11 +00:00
/// Platform APIs
String getPersistentDataPath();
String getCacheDataPath();
void openBatteryOptimisationSettings();
bool isIgnoringBatteryOptimizations();
2023-08-03 19:19:11 +00:00
2023-08-03 19:27:13 +00:00
/// Contacts APIs
void recordSentMessage(String name, String jid, String? avatarPath, FallbackIconType fallbackIcon);
2023-08-03 19:19:11 +00:00
/// Cryptography APIs
@async CryptographyResult? encryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm, String hashSpec);
@async CryptographyResult? decryptFile(String sourcePath, String destPath, Uint8List key, Uint8List iv, CipherAlgorithm algorithm, String hashSpec);
@async Uint8List? hashFile(String sourcePath, String hashSpec);
/// Media APIs
bool generateVideoThumbnail(String src, String dest, int maxWidth);
2023-07-27 18:45:09 +00:00
}