@@ -19,23 +19,27 @@ import WebRTC
19
19
20
20
public let defaultRatchetSalt : String = " LKFrameEncryptionKey "
21
21
public let defaultMagicBytes : String = " LK-ROCKS "
22
- public let defaultRatchetWindowSize : Int32 = 16
22
+ public let defaultRatchetWindowSize : Int32 = 0
23
+ public let defaultFailureTolerance : Int32 = - 1
23
24
24
25
public class KeyProviderOptions {
25
26
let sharedKey : Bool
26
27
let ratchetSalt : Data
27
28
let ratchetWindowSize : Int32
28
29
let uncryptedMagicBytes : Data
30
+ let failureTolerance : Int32
29
31
30
32
public init ( sharedKey: Bool = true ,
31
33
ratchetSalt: Data = defaultRatchetSalt. data ( using: . utf8) !,
32
34
ratchetWindowSize: Int32 = defaultRatchetWindowSize,
33
- uncryptedMagicBytes: Data = defaultMagicBytes. data ( using: . utf8) !
35
+ uncryptedMagicBytes: Data = defaultMagicBytes. data ( using: . utf8) !,
36
+ failureTolerance: Int32 = defaultFailureTolerance
34
37
) {
35
38
self . sharedKey = sharedKey
36
39
self . ratchetSalt = ratchetSalt
37
40
self . ratchetWindowSize = ratchetWindowSize
38
41
self . uncryptedMagicBytes = uncryptedMagicBytes
42
+ self . failureTolerance = defaultFailureTolerance
39
43
}
40
44
}
41
45
@@ -47,7 +51,8 @@ public class BaseKeyProvider: Loggable {
47
51
self . rtcKeyProvider = RTCFrameCryptorKeyProvider ( ratchetSalt: options. ratchetSalt,
48
52
ratchetWindowSize: options. ratchetWindowSize,
49
53
sharedKeyMode: isSharedKey,
50
- uncryptedMagicBytes: options. uncryptedMagicBytes)
54
+ uncryptedMagicBytes: options. uncryptedMagicBytes,
55
+ failureTolerance: options. failureTolerance)
51
56
if isSharedKey && sharedKey != nil {
52
57
let keyData = sharedKey!. data ( using: . utf8) !
53
58
self . rtcKeyProvider? . setSharedKey ( keyData, with: 0 )
0 commit comments