@@ -19,23 +19,27 @@ import WebRTC
1919
2020public let defaultRatchetSalt : String = " LKFrameEncryptionKey "
2121public let defaultMagicBytes : String = " LK-ROCKS "
22- public let defaultRatchetWindowSize : Int32 = 16
22+ public let defaultRatchetWindowSize : Int32 = 0
23+ public let defaultFailureTolerance : Int32 = - 1
2324
2425public class KeyProviderOptions {
2526 let sharedKey : Bool
2627 let ratchetSalt : Data
2728 let ratchetWindowSize : Int32
2829 let uncryptedMagicBytes : Data
30+ let failureTolerance : Int32
2931
3032 public init ( sharedKey: Bool = true ,
3133 ratchetSalt: Data = defaultRatchetSalt. data ( using: . utf8) !,
3234 ratchetWindowSize: Int32 = defaultRatchetWindowSize,
33- uncryptedMagicBytes: Data = defaultMagicBytes. data ( using: . utf8) !
35+ uncryptedMagicBytes: Data = defaultMagicBytes. data ( using: . utf8) !,
36+ failureTolerance: Int32 = defaultFailureTolerance
3437 ) {
3538 self . sharedKey = sharedKey
3639 self . ratchetSalt = ratchetSalt
3740 self . ratchetWindowSize = ratchetWindowSize
3841 self . uncryptedMagicBytes = uncryptedMagicBytes
42+ self . failureTolerance = defaultFailureTolerance
3943 }
4044}
4145
@@ -47,7 +51,8 @@ public class BaseKeyProvider: Loggable {
4751 self . rtcKeyProvider = RTCFrameCryptorKeyProvider ( ratchetSalt: options. ratchetSalt,
4852 ratchetWindowSize: options. ratchetWindowSize,
4953 sharedKeyMode: isSharedKey,
50- uncryptedMagicBytes: options. uncryptedMagicBytes)
54+ uncryptedMagicBytes: options. uncryptedMagicBytes,
55+ failureTolerance: options. failureTolerance)
5156 if isSharedKey && sharedKey != nil {
5257 let keyData = sharedKey!. data ( using: . utf8) !
5358 self . rtcKeyProvider? . setSharedKey ( keyData, with: 0 )
0 commit comments