@@ -83,12 +83,45 @@ describe("Registration", () => {
8383
8484 cy . url ( ) . should ( "contain" , "/#/home" ) ;
8585
86+ /*
87+ * Cross-signing checks
88+ */
89+
90+ // check that the device considers itself verified
8691 cy . findByRole ( "button" , { name : "User menu" } ) . click ( ) ;
8792 cy . findByRole ( "menuitem" , { name : "Security & Privacy" } ) . click ( ) ;
8893 cy . get ( ".mx_DevicesPanel_myDevice .mx_DevicesPanel_deviceTrust .mx_E2EIcon" ) . should (
8994 "have.class" ,
9095 "mx_E2EIcon_verified" ,
9196 ) ;
97+
98+ // check that cross-signing keys have been uploaded.
99+ const myUserId = "@alice:localhost" ;
100+ let myDeviceId : string ;
101+ cy . window ( { log : false } )
102+ . then ( ( win ) => {
103+ const cli = win . mxMatrixClientPeg . get ( ) ;
104+ const accessToken = cli . getAccessToken ( ) ! ;
105+ myDeviceId = cli . getDeviceId ( ) ;
106+ return cy . request ( {
107+ method : "POST" ,
108+ url : `${ homeserver . baseUrl } /_matrix/client/v3/keys/query` ,
109+ headers : { Authorization : `Bearer ${ accessToken } ` } ,
110+ body : { device_keys : { [ myUserId ] : [ ] } } ,
111+ } ) ;
112+ } )
113+ . then ( ( res ) => {
114+ // there should be three cross-signing keys
115+ expect ( res . body . master_keys [ myUserId ] ) . to . have . property ( "keys" ) ;
116+ expect ( res . body . self_signing_keys [ myUserId ] ) . to . have . property ( "keys" ) ;
117+ expect ( res . body . user_signing_keys [ myUserId ] ) . to . have . property ( "keys" ) ;
118+
119+ // and the device should be signed by the self-signing key
120+ const selfSigningKeyId = Object . keys ( res . body . self_signing_keys [ myUserId ] . keys ) [ 0 ] ;
121+ expect ( res . body . device_keys [ myUserId ] [ myDeviceId ] ) . to . exist ;
122+ const myDeviceSignatures = res . body . device_keys [ myUserId ] [ myDeviceId ] . signatures [ myUserId ] ;
123+ expect ( myDeviceSignatures [ selfSigningKeyId ] ) . to . exist ;
124+ } ) ;
92125 } ) ;
93126
94127 it ( "should require username to fulfil requirements and be available" , ( ) => {
0 commit comments