moxxy_native/pigeon/cryptography.dart

53 lines
1.1 KiB
Dart
Raw Normal View History

import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(
PigeonOptions(
dartOut: 'lib/pigeon/cryptography.g.dart',
2023-09-08 19:44:37 +00:00
kotlinOut:
'android/src/main/kotlin/org/moxxy/moxxy_native/cryptography/CryptographyApi.kt',
kotlinOptions: KotlinOptions(
package: 'org.moxxy.moxxy_native.cryptography',
),
),
)
enum CipherAlgorithm {
aes128GcmNoPadding,
aes256GcmNoPadding,
aes256CbcPkcs7;
}
class CryptographyResult {
const CryptographyResult(this.plaintextHash, this.ciphertextHash);
final Uint8List plaintextHash;
final Uint8List ciphertextHash;
}
@HostApi()
abstract class MoxxyCryptographyApi {
@async
2023-09-08 19:44:37 +00:00
CryptographyResult? encryptFile(
String sourcePath,
String destPath,
Uint8List key,
Uint8List iv,
CipherAlgorithm algorithm,
String hashSpec,
);
@async
2023-09-08 19:44:37 +00:00
CryptographyResult? decryptFile(
String sourcePath,
String destPath,
Uint8List key,
Uint8List iv,
CipherAlgorithm algorithm,
String hashSpec,
);
@async
2023-09-08 19:44:37 +00:00
Uint8List? hashFile(
String sourcePath,
String hashSpec,
);
}