@@ -68,13 +68,11 @@ import {
68
68
PolicyRecommendation ,
69
69
PolicyScope ,
70
70
} from "../../src/models/invites-ignorer" ;
71
- import { IOlmDevice } from "../../src/crypto/algorithms/megolm" ;
72
71
import { defer , QueryDict } from "../../src/utils" ;
73
72
import { SyncState } from "../../src/sync" ;
74
73
import * as featureUtils from "../../src/feature" ;
75
74
import { StubStore } from "../../src/store/stub" ;
76
- import { SecretStorageKeyDescriptionAesV1 , ServerSideSecretStorageImpl } from "../../src/secret-storage" ;
77
- import { CryptoBackend } from "../../src/common-crypto/CryptoBackend" ;
75
+ import { ServerSideSecretStorageImpl } from "../../src/secret-storage" ;
78
76
import { KnownMembership } from "../../src/@types/membership" ;
79
77
import { RoomMessageEventContent } from "../../src/@types/events" ;
80
78
import { mockOpenIdConfiguration } from "../test-utils/oidc.ts" ;
@@ -1937,7 +1935,7 @@ describe("MatrixClient", function () {
1937
1935
encryptEvent : jest . fn ( ) ,
1938
1936
stop : jest . fn ( ) ,
1939
1937
} as unknown as Mocked < Crypto > ;
1940
- client . crypto = client [ "cryptoBackend" ] = mockCrypto ;
1938
+ client [ "cryptoBackend" ] = mockCrypto ;
1941
1939
} ) ;
1942
1940
1943
1941
function assertCancelled ( ) {
@@ -2323,21 +2321,6 @@ describe("MatrixClient", function () {
2323
2321
} ) ;
2324
2322
} ) ;
2325
2323
2326
- describe ( "encryptAndSendToDevices" , ( ) => {
2327
- it ( "throws an error if crypto is unavailable" , ( ) => {
2328
- client . crypto = undefined ;
2329
- expect ( ( ) => client . encryptAndSendToDevices ( [ ] , { } ) ) . toThrow ( ) ;
2330
- } ) ;
2331
-
2332
- it ( "is an alias for the crypto method" , async ( ) => {
2333
- client . crypto = testUtils . mock ( Crypto , "Crypto" ) ;
2334
- const deviceInfos : IOlmDevice [ ] = [ ] ;
2335
- const payload = { } ;
2336
- await client . encryptAndSendToDevices ( deviceInfos , payload ) ;
2337
- expect ( client . crypto . encryptAndSendToDevices ) . toHaveBeenLastCalledWith ( deviceInfos , payload ) ;
2338
- } ) ;
2339
- } ) ;
2340
-
2341
2324
describe ( "support for ignoring invites" , ( ) => {
2342
2325
beforeEach ( ( ) => {
2343
2326
// Mockup `getAccountData`/`setAccountData`.
@@ -3199,85 +3182,13 @@ describe("MatrixClient", function () {
3199
3182
client [ "_secretStorage" ] = mockSecretStorage ;
3200
3183
} ) ;
3201
3184
3202
- it ( "hasSecretStorageKey" , async ( ) => {
3203
- mockSecretStorage . hasKey . mockResolvedValue ( false ) ;
3204
- expect ( await client . hasSecretStorageKey ( "mykey" ) ) . toBe ( false ) ;
3205
- expect ( mockSecretStorage . hasKey ) . toHaveBeenCalledWith ( "mykey" ) ;
3206
- } ) ;
3207
-
3208
- it ( "isSecretStored" , async ( ) => {
3209
- const mockResult = { key : { } as SecretStorageKeyDescriptionAesV1 } ;
3210
- mockSecretStorage . isStored . mockResolvedValue ( mockResult ) ;
3211
- expect ( await client . isSecretStored ( "mysecret" ) ) . toBe ( mockResult ) ;
3212
- expect ( mockSecretStorage . isStored ) . toHaveBeenCalledWith ( "mysecret" ) ;
3213
- } ) ;
3214
-
3215
- it ( "getDefaultSecretStorageKeyId" , async ( ) => {
3216
- mockSecretStorage . getDefaultKeyId . mockResolvedValue ( "bzz" ) ;
3217
- expect ( await client . getDefaultSecretStorageKeyId ( ) ) . toEqual ( "bzz" ) ;
3218
- } ) ;
3219
-
3220
3185
it ( "isKeyBackupKeyStored" , async ( ) => {
3221
3186
mockSecretStorage . isStored . mockResolvedValue ( null ) ;
3222
3187
expect ( await client . isKeyBackupKeyStored ( ) ) . toBe ( null ) ;
3223
3188
expect ( mockSecretStorage . isStored ) . toHaveBeenCalledWith ( "m.megolm_backup.v1" ) ;
3224
3189
} ) ;
3225
3190
} ) ;
3226
3191
3227
- // these wrappers are deprecated, but we need coverage of them to pass the quality gate
3228
- describe ( "Crypto wrappers" , ( ) => {
3229
- describe ( "exception if no crypto" , ( ) => {
3230
- it ( "isCrossSigningReady" , ( ) => {
3231
- expect ( ( ) => client . isCrossSigningReady ( ) ) . toThrow ( "End-to-end encryption disabled" ) ;
3232
- } ) ;
3233
-
3234
- it ( "bootstrapCrossSigning" , ( ) => {
3235
- expect ( ( ) => client . bootstrapCrossSigning ( { } ) ) . toThrow ( "End-to-end encryption disabled" ) ;
3236
- } ) ;
3237
-
3238
- it ( "isSecretStorageReady" , ( ) => {
3239
- expect ( ( ) => client . isSecretStorageReady ( ) ) . toThrow ( "End-to-end encryption disabled" ) ;
3240
- } ) ;
3241
- } ) ;
3242
-
3243
- describe ( "defer to crypto backend" , ( ) => {
3244
- let mockCryptoBackend : Mocked < CryptoBackend > ;
3245
-
3246
- beforeEach ( ( ) => {
3247
- mockCryptoBackend = {
3248
- isCrossSigningReady : jest . fn ( ) ,
3249
- bootstrapCrossSigning : jest . fn ( ) ,
3250
- isSecretStorageReady : jest . fn ( ) ,
3251
- stop : jest . fn ( ) . mockResolvedValue ( undefined ) ,
3252
- } as unknown as Mocked < CryptoBackend > ;
3253
- client [ "cryptoBackend" ] = mockCryptoBackend ;
3254
- } ) ;
3255
-
3256
- it ( "isCrossSigningReady" , async ( ) => {
3257
- const testResult = "test" ;
3258
- mockCryptoBackend . isCrossSigningReady . mockResolvedValue ( testResult as unknown as boolean ) ;
3259
- expect ( await client . isCrossSigningReady ( ) ) . toBe ( testResult ) ;
3260
- expect ( mockCryptoBackend . isCrossSigningReady ) . toHaveBeenCalledTimes ( 1 ) ;
3261
- } ) ;
3262
-
3263
- it ( "bootstrapCrossSigning" , async ( ) => {
3264
- const testOpts = { } ;
3265
- mockCryptoBackend . bootstrapCrossSigning . mockResolvedValue ( undefined ) ;
3266
- await client . bootstrapCrossSigning ( testOpts ) ;
3267
- expect ( mockCryptoBackend . bootstrapCrossSigning ) . toHaveBeenCalledTimes ( 1 ) ;
3268
- expect ( mockCryptoBackend . bootstrapCrossSigning ) . toHaveBeenCalledWith ( testOpts ) ;
3269
- } ) ;
3270
-
3271
- it ( "isSecretStorageReady" , async ( ) => {
3272
- client [ "cryptoBackend" ] = mockCryptoBackend ;
3273
- const testResult = "test" ;
3274
- mockCryptoBackend . isSecretStorageReady . mockResolvedValue ( testResult as unknown as boolean ) ;
3275
- expect ( await client . isSecretStorageReady ( ) ) . toBe ( testResult ) ;
3276
- expect ( mockCryptoBackend . isSecretStorageReady ) . toHaveBeenCalledTimes ( 1 ) ;
3277
- } ) ;
3278
- } ) ;
3279
- } ) ;
3280
-
3281
3192
describe ( "paginateEventTimeline()" , ( ) => {
3282
3193
describe ( "notifications timeline" , ( ) => {
3283
3194
const unsafeNotification = {
0 commit comments