Skip to content

Commit 63e4fa8

Browse files
authored
feat: add setKey variant, setRawKey (#482)
1 parent 211f057 commit 63e4fa8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/src/e2ee/key_provider.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ abstract class KeyProvider {
4040
Future<Uint8List> ratchetSharedKey({int? keyIndex});
4141
Future<Uint8List> exportSharedKey({int? keyIndex});
4242
Future<void> setKey(String key, {String? participantId, int? keyIndex});
43+
Future<void> setRawKey(Uint8List key, {String? participantId, int? keyIndex});
4344
Future<Uint8List> ratchetKey(String participantId, int? keyIndex);
4445
Future<Uint8List> exportKey(String participantId, int? keyIndex);
4546
Future<void> setSifTrailer(Uint8List trailer);
@@ -131,6 +132,13 @@ class BaseKeyProvider implements KeyProvider {
131132
return _setKey(keyInfo);
132133
}
133134

135+
@override
136+
Future<void> setRawKey(Uint8List key,
137+
{String? participantId, int? keyIndex}) async {
138+
return setKey(String.fromCharCodes(key),
139+
participantId: participantId, keyIndex: keyIndex);
140+
}
141+
134142
Future<void> _setKey(KeyInfo keyInfo) async {
135143
if (!_keys.containsKey(keyInfo.participantId)) {
136144
_keys[keyInfo.participantId] = {};

0 commit comments

Comments
 (0)