Repository navigation
Add a key size option for AES-256 E2EE keys #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "client-sdk-android": minor | ||
| --- | ||
|
|
||
| Add a `keySize` option to `BaseKeyProvider` (`KeyProviderKeySize.BITS_128` by default, or `BITS_256`) to derive AES-256-GCM frame keys for E2EE. All participants in a room must use the same size. Matches `KeyProviderOptions.keySize` in the JS and Swift SDKs. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,18 @@ internal class KeyInfo(var participantId: String, var keyIndex: Int, var key: St | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * The length of the AES-GCM key derived from the shared or per-participant key material. | ||
| * | ||
| * Every participant in a room must use the same size: a 256-bit client and a 128-bit client | ||
| * cannot decrypt each other's media or data. The default is [BITS_128], which matches the | ||
| * historical behavior of all SDKs. | ||
| */ | ||
| enum class KeyProviderKeySize(val bits: Int) { | ||
| BITS_128(128), | ||
| BITS_256(256), | ||
| } | ||
|
|
||
| interface KeyProvider { | ||
| fun setSharedKey(key: String, keyIndex: Int? = 0): Boolean | ||
| fun ratchetSharedKey(keyIndex: Int? = 0): ByteArray | ||
|
|
@@ -51,6 +63,7 @@ class BaseKeyProvider( | |
| keyRingSize: Int = defaultKeyRingSize, | ||
| discardFrameWhenCryptorNotReady: Boolean = defaultDiscardFrameWhenCryptorNotReady, | ||
| keyDerivationAlgorithm: FrameCryptorKeyDerivationAlgorithm = defaultKeyDerivationAlgorithm, | ||
| keySize: KeyProviderKeySize = defaultKeySize, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Precompiled E2EE clients fail after upgrade Precompiled clients using Learn moreKotlin compiles calls with omitted constructor parameters against a synthetic JVM constructor containing every parameter and a default-value mask. Adding Example: An existing compiled library calls Recommended fix: Preserve the old JVM constructor signatures, including the synthetic default-argument form, while exposing the new size configuration through a compatible additional API. Verify compatibility against a client compiled using the base SDK. Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| ) : KeyProvider { | ||
|
|
||
| private val latestSetIndex = mutableMapOf<String, Int>() | ||
|
|
@@ -64,6 +77,7 @@ class BaseKeyProvider( | |
| keyRingSize, | ||
| discardFrameWhenCryptorNotReady, | ||
| keyDerivationAlgorithm, | ||
| keySize.bits, | ||
| ) | ||
|
|
||
| override fun setSharedKey(key: String, keyIndex: Int?): Boolean { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.