Skip to content

Commit 18d6e5d

Browse files
committed
add more frame cryptor api.
1 parent 359f64b commit 18d6e5d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/src/frame_cryptor.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@ class KeyProviderOptions {
1515
required this.ratchetSalt,
1616
required this.ratchetWindowSize,
1717
this.uncryptedMagicBytes,
18+
this.failureTolerance = -1,
1819
});
1920
bool sharedKey;
2021
Uint8List ratchetSalt;
2122
Uint8List? uncryptedMagicBytes;
2223
int ratchetWindowSize;
24+
int failureTolerance;
2325
Map<String, dynamic> toJson() {
2426
return {
2527
'sharedKey': sharedKey,
2628
'ratchetSalt': ratchetSalt,
2729
if (uncryptedMagicBytes != null)
2830
'uncryptedMagicBytes': uncryptedMagicBytes,
2931
'ratchetWindowSize': ratchetWindowSize,
32+
'failureTolerance': failureTolerance,
3033
};
3134
}
3235
}
@@ -36,6 +39,15 @@ abstract class KeyProvider {
3639
/// The unique identifier of the key provider.
3740
String get id;
3841

42+
Future<void> setSharedKey({required Uint8List key, int index = 0}) =>
43+
throw UnimplementedError();
44+
45+
Future<Uint8List> ratchetSharedKey({int index = 0}) =>
46+
throw UnimplementedError();
47+
48+
Future<Uint8List> exportSharedKey({int index = 0}) =>
49+
throw UnimplementedError();
50+
3951
/// Set the raw key at the given index.
4052
Future<bool> setKey({
4153
required String participantId,
@@ -49,6 +61,15 @@ abstract class KeyProvider {
4961
required int index,
5062
});
5163

64+
/// Export the key at the given index.
65+
Future<Uint8List> exportKey({
66+
required String participantId,
67+
required int index,
68+
});
69+
70+
Future<void> setSifTrailer({required Uint8List trailer}) =>
71+
throw UnimplementedError();
72+
5273
/// Dispose the key manager.
5374
Future<void> dispose();
5475
}

0 commit comments

Comments
 (0)