@@ -17,7 +17,7 @@ import HttpBackend from "matrix-mock-request";
17
17
import { Mocked } from "jest-mock" ;
18
18
19
19
import * as utils from "../test-utils/test-utils" ;
20
- import { CRYPTO_ENABLED , IStoredClientOpts , MatrixClient } from "../../src/client" ;
20
+ import { IStoredClientOpts , MatrixClient } from "../../src/client" ;
21
21
import { MatrixEvent } from "../../src/models/event" ;
22
22
import {
23
23
Filter ,
@@ -644,126 +644,6 @@ describe("MatrixClient", function () {
644
644
} ) ;
645
645
} ) ;
646
646
647
- describe ( "downloadKeys" , function ( ) {
648
- if ( ! CRYPTO_ENABLED ) {
649
- return ;
650
- }
651
-
652
- beforeEach ( function ( ) {
653
- // running initLegacyCrypto should trigger a key upload
654
- httpBackend . when ( "POST" , "/keys/upload" ) . respond ( 200 , { } ) ;
655
- return Promise . all ( [ client . initLegacyCrypto ( ) , httpBackend . flush ( "/keys/upload" , 1 ) ] ) ;
656
- } ) ;
657
-
658
- afterEach ( ( ) => {
659
- client . stopClient ( ) ;
660
- } ) ;
661
-
662
- it ( "should do an HTTP request and then store the keys" , function ( ) {
663
- const ed25519key = "7wG2lzAqbjcyEkOP7O4gU7ItYcn+chKzh5sT/5r2l78" ;
664
- // ed25519key = client.getDeviceEd25519Key();
665
- const borisKeys = {
666
- dev1 : {
667
- algorithms : [ "1" ] ,
668
- device_id : "dev1" ,
669
- keys : { "ed25519:dev1" : ed25519key } ,
670
- signatures : {
671
- boris : {
672
- "ed25519:dev1" :
673
- "RAhmbNDq1efK3hCpBzZDsKoGSsrHUxb25NW5/WbEV9R" +
674
- "JVwLdP032mg5QsKt/pBDUGtggBcnk43n3nBWlA88WAw" ,
675
- } ,
676
- } ,
677
- unsigned : { abc : "def" } ,
678
- user_id : "boris" ,
679
- } ,
680
- } ;
681
- const chazKeys = {
682
- dev2 : {
683
- algorithms : [ "2" ] ,
684
- device_id : "dev2" ,
685
- keys : { "ed25519:dev2" : ed25519key } ,
686
- signatures : {
687
- chaz : {
688
- "ed25519:dev2" :
689
- "FwslH/Q7EYSb7swDJbNB5PSzcbEO1xRRBF1riuijqvL" +
690
- "EkrK9/XVN8jl4h7thGuRITQ01siBQnNmMK9t45QfcCQ" ,
691
- } ,
692
- } ,
693
- unsigned : { ghi : "def" } ,
694
- user_id : "chaz" ,
695
- } ,
696
- } ;
697
-
698
- /*
699
- function sign(o) {
700
- var anotherjson = require('another-json');
701
- var b = JSON.parse(JSON.stringify(o));
702
- delete(b.signatures);
703
- delete(b.unsigned);
704
- return client.crypto.olmDevice.sign(anotherjson.stringify(b));
705
- };
706
-
707
- logger.log("Ed25519: " + ed25519key);
708
- logger.log("boris:", sign(borisKeys.dev1));
709
- logger.log("chaz:", sign(chazKeys.dev2));
710
- */
711
-
712
- httpBackend
713
- . when ( "POST" , "/keys/query" )
714
- . check ( function ( req ) {
715
- expect ( req . data ) . toEqual ( {
716
- device_keys : {
717
- boris : [ ] ,
718
- chaz : [ ] ,
719
- } ,
720
- } ) ;
721
- } )
722
- . respond ( 200 , {
723
- device_keys : {
724
- boris : borisKeys ,
725
- chaz : chazKeys ,
726
- } ,
727
- } ) ;
728
-
729
- const prom = client . downloadKeys ( [ "boris" , "chaz" ] ) . then ( function ( res ) {
730
- assertObjectContains ( res . get ( "boris" ) ! . get ( "dev1" ) ! , {
731
- verified : 0 , // DeviceVerification.UNVERIFIED
732
- keys : { "ed25519:dev1" : ed25519key } ,
733
- algorithms : [ "1" ] ,
734
- unsigned : { abc : "def" } ,
735
- } ) ;
736
-
737
- assertObjectContains ( res . get ( "chaz" ) ! . get ( "dev2" ) ! , {
738
- verified : 0 , // DeviceVerification.UNVERIFIED
739
- keys : { "ed25519:dev2" : ed25519key } ,
740
- algorithms : [ "2" ] ,
741
- unsigned : { ghi : "def" } ,
742
- } ) ;
743
- } ) ;
744
-
745
- httpBackend . flush ( "" ) ;
746
- return prom ;
747
- } ) ;
748
- } ) ;
749
-
750
- describe ( "deleteDevice" , function ( ) {
751
- const auth = { identifier : 1 } ;
752
- it ( "should pass through an auth dict" , function ( ) {
753
- httpBackend
754
- . when ( "DELETE" , "/_matrix/client/v3/devices/my_device" )
755
- . check ( function ( req ) {
756
- expect ( req . data ) . toEqual ( { auth : auth } ) ;
757
- } )
758
- . respond ( 200 ) ;
759
-
760
- const prom = client . deleteDevice ( "my_device" , auth ) ;
761
-
762
- httpBackend . flush ( "" ) ;
763
- return prom ;
764
- } ) ;
765
- } ) ;
766
-
767
647
describe ( "partitionThreadedEvents" , function ( ) {
768
648
let room : Room ;
769
649
beforeEach ( ( ) => {
@@ -2197,11 +2077,3 @@ const buildEventCreate = () =>
2197
2077
type : "m.room.create" ,
2198
2078
unsigned : { age : 80126105 } ,
2199
2079
} ) ;
2200
-
2201
- function assertObjectContains ( obj : Record < string , any > , expected : any ) : void {
2202
- for ( const k in expected ) {
2203
- if ( expected . hasOwnProperty ( k ) ) {
2204
- expect ( obj [ k ] ) . toEqual ( expected [ k ] ) ;
2205
- }
2206
- }
2207
- }
0 commit comments