Skip to content
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

globalErrorOnUnknownDevices not accessible from CryptoApi #3802

Closed
marekvospel opened this issue Oct 17, 2023 · 1 comment
Closed

globalErrorOnUnknownDevices not accessible from CryptoApi #3802

marekvospel opened this issue Oct 17, 2023 · 1 comment

Comments

@marekvospel
Copy link

Looking at MatrixClient.setGlobalErrorOnUnknownDevices(boolean) I've noticed it's deprecated, saying to use

client.getCrypto().globalBlacklistUnverifiedDevices = value

matrix-js-sdk/src/client.ts

Lines 2684 to 2690 in 884bd25

* @deprecated Prefer direct access to {@link CryptoApi.globalBlacklistUnverifiedDevices}:
*
* ```ts
* client.getCrypto().globalBlacklistUnverifiedDevices = value;
* ```
*/
public setGlobalErrorOnUnknownDevices(value: boolean): void {

Using the suggested line I get UnverifiedDeviceError when trying to send a message to a room that has unverified devices, I got an error.
I began looking into things and noticed the function was actually changing cryptoBackend.globalErrorOnUnknownDevices, doing something else than what the deprecation message said. Later when I tried

client.getCrypto().globalErrorOnUnknownDevices = value

I got a typescript error telling me that this property doesn't exist, but the error in runtime has dissapeared.

Looking at CryptoApi, it only exposes globalBlacklistUnverifiedDevices, not globalErrorOnUnknownDevices.

export interface CryptoApi {
/**
* Global override for whether the client should ever send encrypted
* messages to unverified devices. This provides the default for rooms which
* do not specify a value.
*
* If true, all unverified devices will be blacklisted by default
*/
globalBlacklistUnverifiedDevices: boolean;

globalErrorOnUnknownDevices does exist on CryptoBackend but when casted to CryptoApi in getCrypto(), this property is lost.

@richvdh
Copy link
Member

richvdh commented May 16, 2024

The documentation on this method has been updated, sorry about that. Basically, for now you just need to continue to use MatrixClient.setGlobalErrorOnUnknownDevices. Once we remove the legacy crypto stack (element-hq/element-web#26922), setGlobalErrorOnUnknownDevices(false) will become a no-op.

@richvdh richvdh closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants