From 51e12798ca1806ea218edc31b2a01632338e0246 Mon Sep 17 00:00:00 2001 From: CloudWebRTC Date: Thu, 14 Sep 2023 19:08:09 +0800 Subject: [PATCH] Feat/add more frame cryptor api (#21) * add more frame cryptor api. * bump version. --- CHANGELOG.md | 4 ++++ lib/src/frame_cryptor.dart | 21 +++++++++++++++++++++ pubspec.yaml | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b47a7b1..3c7251e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/lib/src/frame_cryptor.dart b/lib/src/frame_cryptor.dart index 0c600d1..4308dd1 100644 --- a/lib/src/frame_cryptor.dart +++ b/lib/src/frame_cryptor.dart @@ -15,11 +15,13 @@ class KeyProviderOptions { required this.ratchetSalt, required this.ratchetWindowSize, this.uncryptedMagicBytes, + this.failureTolerance = -1, }); bool sharedKey; Uint8List ratchetSalt; Uint8List? uncryptedMagicBytes; int ratchetWindowSize; + int failureTolerance; Map toJson() { return { 'sharedKey': sharedKey, @@ -27,6 +29,7 @@ class KeyProviderOptions { if (uncryptedMagicBytes != null) 'uncryptedMagicBytes': uncryptedMagicBytes, 'ratchetWindowSize': ratchetWindowSize, + 'failureTolerance': failureTolerance, }; } } @@ -36,6 +39,15 @@ abstract class KeyProvider { /// The unique identifier of the key provider. String get id; + Future setSharedKey({required Uint8List key, int index = 0}) => + throw UnimplementedError(); + + Future ratchetSharedKey({int index = 0}) => + throw UnimplementedError(); + + Future exportSharedKey({int index = 0}) => + throw UnimplementedError(); + /// Set the raw key at the given index. Future setKey({ required String participantId, @@ -49,6 +61,15 @@ abstract class KeyProvider { required int index, }); + /// Export the key at the given index. + Future exportKey({ + required String participantId, + required int index, + }); + + Future setSifTrailer({required Uint8List trailer}) => + throw UnimplementedError(); + /// Dispose the key manager. Future dispose(); } diff --git a/pubspec.yaml b/pubspec.yaml index 6799c09..e01fe53 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: