Skip to content

Commit

Permalink
Feat/add more frame cryptor api (#21)
Browse files Browse the repository at this point in the history
* add more frame cryptor api.

* bump version.
  • Loading branch information
cloudwebrtc authored Sep 14, 2023
1 parent 359f64b commit 51e1279
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

--------------------------------------------
[1.1.2] - 2023-09-14

* Add more frame cryptor api.

[1.1.1] - 2023-08-14

* Add more async methods.
Expand Down
21 changes: 21 additions & 0 deletions lib/src/frame_cryptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ class KeyProviderOptions {
required this.ratchetSalt,
required this.ratchetWindowSize,
this.uncryptedMagicBytes,
this.failureTolerance = -1,
});
bool sharedKey;
Uint8List ratchetSalt;
Uint8List? uncryptedMagicBytes;
int ratchetWindowSize;
int failureTolerance;
Map<String, dynamic> toJson() {
return {
'sharedKey': sharedKey,
'ratchetSalt': ratchetSalt,
if (uncryptedMagicBytes != null)
'uncryptedMagicBytes': uncryptedMagicBytes,
'ratchetWindowSize': ratchetWindowSize,
'failureTolerance': failureTolerance,
};
}
}
Expand All @@ -36,6 +39,15 @@ abstract class KeyProvider {
/// The unique identifier of the key provider.
String get id;

Future<void> setSharedKey({required Uint8List key, int index = 0}) =>
throw UnimplementedError();

Future<Uint8List> ratchetSharedKey({int index = 0}) =>
throw UnimplementedError();

Future<Uint8List> exportSharedKey({int index = 0}) =>
throw UnimplementedError();

/// Set the raw key at the given index.
Future<bool> setKey({
required String participantId,
Expand All @@ -49,6 +61,15 @@ abstract class KeyProvider {
required int index,
});

/// Export the key at the given index.
Future<Uint8List> exportKey({
required String participantId,
required int index,
});

Future<void> setSifTrailer({required Uint8List trailer}) =>
throw UnimplementedError();

/// Dispose the key manager.
Future<void> dispose();
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: webrtc_interface
description: WebRTC Interface for Dart-Web/Flutter.
version: 1.1.1
version: 1.1.2
homepage: https://flutter-webrtc.org

environment:
Expand Down

0 comments on commit 51e1279

Please sign in to comment.