@@ -18,7 +18,7 @@ import fetchMock from "fetch-mock-jest";
18
18
import "fake-indexeddb/auto" ;
19
19
import { IDBFactory } from "fake-indexeddb" ;
20
20
21
- import { CRYPTO_BACKENDS , InitCrypto , syncPromise } from "../../test-utils/test-utils" ;
21
+ import { syncPromise } from "../../test-utils/test-utils" ;
22
22
import { AuthDict , createClient , MatrixClient } from "../../../src" ;
23
23
import { mockInitialApiRequests , mockSetupCrossSigningRequests } from "../../test-utils/mockEndpoints" ;
24
24
import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts" ;
@@ -55,11 +55,7 @@ const TEST_DEVICE_ID = "xzcvb";
55
55
* These tests work by intercepting HTTP requests via fetch-mock rather than mocking out bits of the client, so as
56
56
* to provide the most effective integration tests possible.
57
57
*/
58
- describe . each ( Object . entries ( CRYPTO_BACKENDS ) ) ( "cross-signing (%s)" , ( backend : string , initCrypto : InitCrypto ) => {
59
- // newBackendOnly is the opposite to `oldBackendOnly`: it will skip the test if we are running against the legacy
60
- // backend. Once we drop support for legacy crypto, it will go away.
61
- const newBackendOnly = backend === "rust-sdk" ? test : test . skip ;
62
-
58
+ describe ( "cross-signing" , ( ) => {
63
59
let aliceClient : MatrixClient ;
64
60
65
61
/** an object which intercepts `/sync` requests from {@link #aliceClient} */
@@ -108,7 +104,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("cross-signing (%s)", (backend: s
108
104
body : { errcode : "M_NOT_FOUND" } ,
109
105
} ) ;
110
106
111
- await initCrypto ( aliceClient ) ;
107
+ await aliceClient . initRustCrypto ( ) ;
112
108
} ,
113
109
/* it can take a while to initialise the crypto library on the first pass, so bump up the timeout. */
114
110
10000 ,
@@ -163,7 +159,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("cross-signing (%s)", (backend: s
163
159
) ;
164
160
} ) ;
165
161
166
- newBackendOnly ( "get cross signing keys from secret storage and import them" , async ( ) => {
162
+ it ( "get cross signing keys from secret storage and import them" , async ( ) => {
167
163
// Return public cross signing keys
168
164
e2eKeyResponder . addCrossSigningData ( SIGNED_CROSS_SIGNING_KEYS_DATA ) ;
169
165
@@ -264,7 +260,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("cross-signing (%s)", (backend: s
264
260
expect ( calls . length ) . toEqual ( 0 ) ;
265
261
} ) ;
266
262
267
- newBackendOnly ( "will upload existing cross-signing keys to an established secret storage" , async ( ) => {
263
+ it ( "will upload existing cross-signing keys to an established secret storage" , async ( ) => {
268
264
// This rather obscure codepath covers the case that:
269
265
// - 4S is set up and working
270
266
// - our device has private cross-signing keys, but has not published them to 4S
@@ -421,9 +417,8 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("cross-signing (%s)", (backend: s
421
417
function awaitCrossSigningKeysUpload ( ) {
422
418
return new Promise < any > ( ( resolve ) => {
423
419
fetchMock . post (
424
- // legacy crypto uses /unstable/; /v3/ is correct
425
420
{
426
- url : new RegExp ( "/_matrix/client/(unstable|v3) /keys/device_signing/upload" ) ,
421
+ url : new RegExp ( "/_matrix/client/v3 /keys/device_signing/upload" ) ,
427
422
name : "upload-keys" ,
428
423
} ,
429
424
( url , options ) => {
@@ -476,9 +471,6 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("cross-signing (%s)", (backend: s
476
471
await aliceClient . startClient ( ) ;
477
472
await syncPromise ( aliceClient ) ;
478
473
479
- // Wait for legacy crypto to find the device
480
- await jest . advanceTimersByTimeAsync ( 10 ) ;
481
-
482
474
const devices = await aliceClient . getCrypto ( ) ! . getUserDeviceInfo ( [ aliceClient . getSafeUserId ( ) ] ) ;
483
475
expect ( devices . get ( aliceClient . getSafeUserId ( ) ) ! . has ( testData . TEST_DEVICE_ID ) ) . toBeTruthy ( ) ;
484
476
} ) ;
0 commit comments