File tree Expand file tree Collapse file tree
livekit-android-sdk/src/main/java/io/livekit/android/e2ee
sample-app-common/src/main/java/io/livekit/android/sample Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " client-sdk-android " : patch
3+ ---
4+
5+ Add convenience constructor to E2EEOptions for shared key encryption
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ internal const val defaultKeyRingSize = 16
2727internal const val defaultDiscardFrameWhenCryptorNotReady = false
2828internal val defaultKeyDerivationAlgorithm = FrameCryptorKeyDerivationAlgorithm .PBKDF2
2929
30- class E2EEOptions (
30+ data class E2EEOptions (
3131 var keyProvider : KeyProvider = BaseKeyProvider (
3232 defaultRatchetSalt,
3333 defaultMagicBytes,
@@ -38,11 +38,18 @@ class E2EEOptions(
3838 defaultDiscardFrameWhenCryptorNotReady,
3939 defaultKeyDerivationAlgorithm,
4040 ),
41- encryptionType : Encryption .Type = Encryption .Type .GCM ,
41+ var encryptionType : Encryption .Type = Encryption .Type .GCM ,
4242) {
43- var encryptionType: Encryption .Type = Encryption .Type .NONE
44-
45- init {
46- this .encryptionType = encryptionType
43+ constructor (
44+ /* *
45+ * The shared encryption key for the room.
46+ */
47+ sharedKey: String ,
48+ /* *
49+ * The encryption type to use. Defaults to GCM.
50+ */
51+ encryptionType: Encryption .Type = Encryption .Type .GCM ,
52+ ) : this (encryptionType = encryptionType) {
53+ this .keyProvider.setSharedKey(sharedKey)
4754 }
4855}
Original file line number Diff line number Diff line change @@ -77,11 +77,11 @@ class CallViewModel(
7777) : AndroidViewModel(application) {
7878
7979 private fun getE2EEOptions (): E2EEOptions ? {
80- var e2eeOptions: E2EEOptions ? = null
81- if (e2ee && e2eeKey != null ) {
82- e2eeOptions = E2EEOptions ()
80+ var e2eeOptions = if (e2ee && e2eeKey != null ) {
81+ E2EEOptions (sharedKey = e2eeKey)
82+ } else {
83+ null
8384 }
84- e2eeOptions?.keyProvider?.setSharedKey(e2eeKey!! )
8585 return e2eeOptions
8686 }
8787
You can’t perform that action at this time.
0 commit comments