Skip to content

Commit

Permalink
Handle case of encryption key for an index to be undefined
Browse files Browse the repository at this point in the history
As per matrix-org/matrix-js-sdk#4423 the key can be undefined and so we should handle this rather than waiting for SubtleCrypto.importKey() to fail.
  • Loading branch information
hughns committed Sep 23, 2024
1 parent d089ff6 commit 062c6c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/e2ee/matrixKeyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export class MatrixKeyProvider extends BaseKeyProvider {
encryptionKeys,
] of this.rtcSession.getEncryptionKeys()) {
for (const [index, encryptionKey] of encryptionKeys.entries()) {
this.onEncryptionKeyChanged(encryptionKey, index, participant);
if (encryptionKey) {
this.onEncryptionKeyChanged(encryptionKey, index, participant);
}

Check warning on line 46 in src/e2ee/matrixKeyProvider.ts

View check run for this annotation

Codecov / codecov/patch

src/e2ee/matrixKeyProvider.ts#L44-L46

Added lines #L44 - L46 were not covered by tests
}
}
}
Expand Down

0 comments on commit 062c6c5

Please sign in to comment.