fix(e2ee): patch Rust FFI HKDF to match Element Call JS SDK parameters
EC JS SDK uses: salt=Uint8Array(8), info=encode("LKFrameEncryptionKey")
Rust FFI used: salt=ratchet_salt, info=[0u8;128]
The salt and info parameters were swapped, causing DEC_FAILED on every
call. This patch fixes the Rust HKDF derivation in the Dockerfile
before cargo build.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -10,6 +10,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
WORKDIR /build
|
||||
RUN git clone --branch EC-compat-changes --depth 1 --recurse-submodules \
|
||||
https://github.com/onestacked/livekit-rust-sdks.git
|
||||
WORKDIR /build/livekit-rust-sdks
|
||||
|
||||
# Patch HKDF to match Element Call JS SDK parameters.
|
||||
# EC JS: salt=Uint8Array(8) (8 zero bytes), info=encode("LKFrameEncryptionKey")
|
||||
# Rust fork: salt=ratchet_salt ("LKFrameEncryptionKey"), info=[0u8;128]
|
||||
# Fix: use 8 zero bytes as HKDF salt, use the callback's salt param as HKDF info.
|
||||
RUN find . -name '*.rs' -path '*/e2ee*' -exec grep -l 'hkdf.*expand' {} \; | head -1 | \
|
||||
xargs -I{} sh -c 'echo "Patching HKDF in: {}"; \
|
||||
sed -i "s|hkdf::Hkdf::<Sha256>::new(Some(salt), key);|hkdf::Hkdf::<Sha256>::new(Some(\&[0u8; 8]), key);|" "{}" && \
|
||||
sed -i "s|hkdf.expand(\&\[0u8; 128\], derived_key)|hkdf.expand(salt, derived_key)|" "{}"'
|
||||
|
||||
WORKDIR /build/livekit-rust-sdks/livekit-ffi
|
||||
RUN cargo build --release
|
||||
|
||||
|
||||
Reference in New Issue
Block a user