@@ -621,7 +621,7 @@ export interface IMyDevice {
621621 last_seen_ts ?: number ;
622622}
623623
624- interface IDownloadKeyResult {
624+ export interface IDownloadKeyResult {
625625 failures : { [ serverName : string ] : object } ;
626626 device_keys : {
627627 [ userId : string ] : {
@@ -632,13 +632,42 @@ interface IDownloadKeyResult {
632632 } ;
633633 } ;
634634 } ;
635+ // the following three fields were added in 1.1
636+ master_keys ?: {
637+ [ userId : string ] : {
638+ keys : { [ keyId : string ] : string } ;
639+ usage : string [ ] ;
640+ user_id : string ;
641+ } ;
642+ } ;
643+ self_signing_keys ?: {
644+ [ userId : string ] : {
645+ keys : { [ keyId : string ] : string } ;
646+ signatures : ISignatures ;
647+ usage : string [ ] ;
648+ user_id : string ;
649+ } ;
650+ } ;
651+ user_signing_keys ?: {
652+ [ userId : string ] : {
653+ keys : { [ keyId : string ] : string } ;
654+ signatures : ISignatures ;
655+ usage : string [ ] ;
656+ user_id : string ;
657+ } ;
658+ } ;
635659}
636660
637- interface IClaimOTKsResult {
661+ export interface IClaimOTKsResult {
638662 failures : { [ serverName : string ] : object } ;
639663 one_time_keys : {
640664 [ userId : string ] : {
641- [ deviceId : string ] : string ;
665+ [ deviceId : string ] : {
666+ [ keyId : string ] : {
667+ key : string ;
668+ signatures : ISignatures ;
669+ } ;
670+ } ;
642671 } ;
643672 } ;
644673}
@@ -1421,14 +1450,12 @@ export class MatrixClient extends EventEmitter {
14211450 }
14221451 }
14231452
1424- // We swallow errors because we need a default object anyhow
14251453 return this . http . authedRequest (
14261454 undefined , "GET" , "/capabilities" ,
1427- ) . catch ( ( e : Error ) => {
1455+ ) . catch ( ( e : Error ) : void => {
1456+ // We swallow errors because we need a default object anyhow
14281457 logger . error ( e ) ;
1429- return null ; // otherwise consume the error
1430- } ) . then ( ( r ) => {
1431- if ( ! r ) r = { } ;
1458+ } ) . then ( ( r : { capabilities ?: ICapabilities } = { } ) => {
14321459 const capabilities : ICapabilities = r [ "capabilities" ] || { } ;
14331460
14341461 // If the capabilities missed the cache, cache it for a shorter amount
@@ -2836,7 +2863,7 @@ export class MatrixClient extends EventEmitter {
28362863 }
28372864
28382865 let totalKeyCount = 0 ;
2839- let keys = [ ] ;
2866+ let keys : IMegolmSessionData [ ] = [ ] ;
28402867
28412868 const path = this . makeKeyBackupPath ( targetRoomId , targetSessionId , backupInfo . version ) ;
28422869
@@ -5692,18 +5719,14 @@ export class MatrixClient extends EventEmitter {
56925719 searchResults . count = roomEvents . count ;
56935720 searchResults . next_batch = roomEvents . next_batch ;
56945721
5695- // combine the highlight list with our existing list; build an object
5696- // to avoid O(N^2) fail
5697- const highlights = { } ;
5698- roomEvents . highlights . forEach ( ( hl ) => {
5699- highlights [ hl ] = 1 ;
5700- } ) ;
5722+ // combine the highlight list with our existing list;
5723+ const highlights = new Set < string > ( roomEvents . highlights ) ;
57015724 searchResults . highlights . forEach ( ( hl ) => {
5702- highlights [ hl ] = 1 ;
5725+ highlights . add ( hl ) ;
57035726 } ) ;
57045727
57055728 // turn it back into a list.
5706- searchResults . highlights = Object . keys ( highlights ) ;
5729+ searchResults . highlights = Array . from ( highlights ) ;
57075730
57085731 // append the new results to our existing results
57095732 const resultsLength = roomEvents . results ? roomEvents . results . length : 0 ;
@@ -5794,11 +5817,9 @@ export class MatrixClient extends EventEmitter {
57945817
57955818 return this . http . authedRequest (
57965819 undefined , "GET" , path , undefined , undefined ,
5797- ) . then ( ( response ) => {
5820+ ) . then ( ( response : IFilterDefinition ) => {
57985821 // persist the filter
5799- const filter = Filter . fromJson (
5800- userId , filterId , response ,
5801- ) ;
5822+ const filter = Filter . fromJson ( userId , filterId , response ) ;
58025823 this . store . storeFilter ( filter ) ;
58035824 return filter ;
58045825 } ) ;
@@ -6096,7 +6117,7 @@ export class MatrixClient extends EventEmitter {
60966117 {
60976118 prefix : '' ,
60986119 } ,
6099- ) . catch ( ( e ) => {
6120+ ) . catch ( ( e : Error ) => {
61006121 // Need to unset this if it fails, otherwise we'll never retry
61016122 this . serverVersionsPromise = null ;
61026123 // but rethrow the exception to anything that was waiting
@@ -6420,7 +6441,7 @@ export class MatrixClient extends EventEmitter {
64206441 public isUsernameAvailable ( username : string ) : Promise < true > {
64216442 return this . http . authedRequest (
64226443 undefined , "GET" , '/register/available' , { username : username } ,
6423- ) . then ( ( response ) => {
6444+ ) . then ( ( response : { available : boolean } ) => {
64246445 return response . available ;
64256446 } ) ;
64266447 }
@@ -7741,11 +7762,11 @@ export class MatrixClient extends EventEmitter {
77417762 * an error response ({@link module:http-api.MatrixError}).
77427763 */
77437764 public claimOneTimeKeys (
7744- devices : string [ ] ,
7765+ devices : [ string , string ] [ ] ,
77457766 keyAlgorithm = "signed_curve25519" ,
77467767 timeout ?: number ,
77477768 ) : Promise < IClaimOTKsResult > {
7748- const queries = { } ;
7769+ const queries : Record < string , Record < string , string > > = { } ;
77497770
77507771 if ( keyAlgorithm === undefined ) {
77517772 keyAlgorithm = "signed_curve25519" ;
0 commit comments