@unwanted/matrix-sdk-mini 34.12.0-1 → 34.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/git-revision.txt +1 -1
- package/lib/client.d.ts +1 -0
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +5 -1
- package/lib/client.js.map +1 -1
- package/lib/crypto/index.d.ts +1 -0
- package/lib/crypto/index.d.ts.map +1 -1
- package/lib/crypto/index.js +4 -0
- package/lib/crypto/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +9 -0
- package/src/crypto/index.ts +4 -0
package/package.json
CHANGED
package/src/client.ts
CHANGED
@@ -81,6 +81,7 @@ import {
|
|
81
81
|
fixBackupKey,
|
82
82
|
ICheckOwnCrossSigningTrustOpts,
|
83
83
|
IRoomKeyRequestBody,
|
84
|
+
isCryptoAvailable,
|
84
85
|
} from "./crypto/index.ts";
|
85
86
|
import { DeviceInfo } from "./crypto/deviceinfo.ts";
|
86
87
|
import { User, UserEvent, UserEventHandlerMap } from "./models/user.ts";
|
@@ -251,6 +252,7 @@ export type Store = IStore;
|
|
251
252
|
export type ResetTimelineCallback = (roomId: string) => boolean;
|
252
253
|
|
253
254
|
const SCROLLBACK_DELAY_MS = 3000;
|
255
|
+
export const CRYPTO_ENABLED: boolean = isCryptoAvailable();
|
254
256
|
const TURN_CHECK_INTERVAL = 10 * 60 * 1000; // poll for turn credentials every 10 minutes
|
255
257
|
|
256
258
|
export const UNSTABLE_MSC3852_LAST_SEEN_UA = new UnstableValue(
|
@@ -2150,6 +2152,13 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|
2150
2152
|
* @deprecated libolm is deprecated. Prefer {@link initRustCrypto}.
|
2151
2153
|
*/
|
2152
2154
|
public async initCrypto(): Promise<void> {
|
2155
|
+
if (!isCryptoAvailable()) {
|
2156
|
+
throw new Error(
|
2157
|
+
`End-to-end encryption not supported in this js-sdk build: did ` +
|
2158
|
+
`you remember to load the olm library?`,
|
2159
|
+
);
|
2160
|
+
}
|
2161
|
+
|
2153
2162
|
if (this.cryptoBackend) {
|
2154
2163
|
this.logger.warn("Attempt to re-initialise e2e encryption on MatrixClient");
|
2155
2164
|
return;
|
package/src/crypto/index.ts
CHANGED
@@ -144,6 +144,10 @@ export const verificationMethods = {
|
|
144
144
|
|
145
145
|
export type VerificationMethod = keyof typeof verificationMethods | string;
|
146
146
|
|
147
|
+
export function isCryptoAvailable(): boolean {
|
148
|
+
return Boolean(globalThis.Olm);
|
149
|
+
}
|
150
|
+
|
147
151
|
// minimum time between attempting to unwedge an Olm session, if we succeeded
|
148
152
|
// in creating a new session
|
149
153
|
const MIN_FORCE_SESSION_INTERVAL_MS = 60 * 60 * 1000; // 1 hour
|