@@ -2658,7 +2658,14 @@ export class MatrixClient extends EventEmitter {
2658
2658
) ;
2659
2659
}
2660
2660
2661
- private makeKeyBackupPath ( roomId : string , sessionId : string , version : string ) : IKeyBackupPath {
2661
+ private makeKeyBackupPath ( roomId : undefined , sessionId : undefined , version : string ) : IKeyBackupPath ;
2662
+ private makeKeyBackupPath ( roomId : string , sessionId : undefined , version : string ) : IKeyBackupPath ;
2663
+ private makeKeyBackupPath ( roomId : string , sessionId : string , version : string ) : IKeyBackupPath ;
2664
+ private makeKeyBackupPath (
2665
+ roomId : string | undefined ,
2666
+ sessionId : string | undefined ,
2667
+ version : string ,
2668
+ ) : IKeyBackupPath {
2662
2669
let path ;
2663
2670
if ( sessionId !== undefined ) {
2664
2671
path = utils . encodeUri ( "/room_keys/keys/$roomId/$sessionId" , {
@@ -2685,7 +2692,15 @@ export class MatrixClient extends EventEmitter {
2685
2692
* @return {Promise } a promise that will resolve when the keys
2686
2693
* are uploaded
2687
2694
*/
2688
- public sendKeyBackup ( roomId : string , sessionId : string , version : string , data : IKeyBackup ) : Promise < void > {
2695
+ public sendKeyBackup ( roomId : undefined , sessionId : undefined , version : string , data : IKeyBackup ) : Promise < void > ;
2696
+ public sendKeyBackup ( roomId : string , sessionId : undefined , version : string , data : IKeyBackup ) : Promise < void > ;
2697
+ public sendKeyBackup ( roomId : string , sessionId : string , version : string , data : IKeyBackup ) : Promise < void > ;
2698
+ public sendKeyBackup (
2699
+ roomId : string ,
2700
+ sessionId : string | undefined ,
2701
+ version : string | undefined ,
2702
+ data : IKeyBackup ,
2703
+ ) : Promise < void > {
2689
2704
if ( ! this . crypto ) {
2690
2705
throw new Error ( "End-to-end encryption disabled" ) ;
2691
2706
}
@@ -2771,12 +2786,33 @@ export class MatrixClient extends EventEmitter {
2771
2786
* @return {Promise<object> } Status of restoration with `total` and `imported`
2772
2787
* key counts.
2773
2788
*/
2789
+ public async restoreKeyBackupWithPassword (
2790
+ password : string ,
2791
+ targetRoomId : undefined ,
2792
+ targetSessionId : undefined ,
2793
+ backupInfo : IKeyBackupInfo ,
2794
+ opts : IKeyBackupRestoreOpts ,
2795
+ ) : Promise < IKeyBackupRestoreResult > ;
2796
+ public async restoreKeyBackupWithPassword (
2797
+ password : string ,
2798
+ targetRoomId : string ,
2799
+ targetSessionId : undefined ,
2800
+ backupInfo : IKeyBackupInfo ,
2801
+ opts : IKeyBackupRestoreOpts ,
2802
+ ) : Promise < IKeyBackupRestoreResult > ;
2774
2803
public async restoreKeyBackupWithPassword (
2775
2804
password : string ,
2776
2805
targetRoomId : string ,
2777
2806
targetSessionId : string ,
2778
2807
backupInfo : IKeyBackupInfo ,
2779
2808
opts : IKeyBackupRestoreOpts ,
2809
+ ) : Promise < IKeyBackupRestoreResult > ;
2810
+ public async restoreKeyBackupWithPassword (
2811
+ password : string ,
2812
+ targetRoomId : string | undefined ,
2813
+ targetSessionId : string | undefined ,
2814
+ backupInfo : IKeyBackupInfo ,
2815
+ opts : IKeyBackupRestoreOpts ,
2780
2816
) : Promise < IKeyBackupRestoreResult > {
2781
2817
const privKey = await keyFromAuthData ( backupInfo . auth_data , password ) ;
2782
2818
return this . restoreKeyBackup (
@@ -2833,22 +2869,61 @@ export class MatrixClient extends EventEmitter {
2833
2869
* @return {Promise<object> } Status of restoration with `total` and `imported`
2834
2870
* key counts.
2835
2871
*/
2872
+ public restoreKeyBackupWithRecoveryKey (
2873
+ recoveryKey : string ,
2874
+ targetRoomId : undefined ,
2875
+ targetSessionId : undefined ,
2876
+ backupInfo : IKeyBackupInfo ,
2877
+ opts : IKeyBackupRestoreOpts ,
2878
+ ) : Promise < IKeyBackupRestoreResult > ;
2879
+ public restoreKeyBackupWithRecoveryKey (
2880
+ recoveryKey : string ,
2881
+ targetRoomId : string ,
2882
+ targetSessionId : undefined ,
2883
+ backupInfo : IKeyBackupInfo ,
2884
+ opts : IKeyBackupRestoreOpts ,
2885
+ ) : Promise < IKeyBackupRestoreResult > ;
2836
2886
public restoreKeyBackupWithRecoveryKey (
2837
2887
recoveryKey : string ,
2838
2888
targetRoomId : string ,
2839
2889
targetSessionId : string ,
2840
2890
backupInfo : IKeyBackupInfo ,
2841
2891
opts : IKeyBackupRestoreOpts ,
2892
+ ) : Promise < IKeyBackupRestoreResult > ;
2893
+ public restoreKeyBackupWithRecoveryKey (
2894
+ recoveryKey : string ,
2895
+ targetRoomId : string | undefined ,
2896
+ targetSessionId : string | undefined ,
2897
+ backupInfo : IKeyBackupInfo ,
2898
+ opts : IKeyBackupRestoreOpts ,
2842
2899
) : Promise < IKeyBackupRestoreResult > {
2843
2900
const privKey = decodeRecoveryKey ( recoveryKey ) ;
2844
2901
return this . restoreKeyBackup ( privKey , targetRoomId , targetSessionId , backupInfo , opts ) ;
2845
2902
}
2846
2903
2904
+ public async restoreKeyBackupWithCache (
2905
+ targetRoomId : undefined ,
2906
+ targetSessionId : undefined ,
2907
+ backupInfo : IKeyBackupInfo ,
2908
+ opts ?: IKeyBackupRestoreOpts ,
2909
+ ) : Promise < IKeyBackupRestoreResult > ;
2910
+ public async restoreKeyBackupWithCache (
2911
+ targetRoomId : string ,
2912
+ targetSessionId : undefined ,
2913
+ backupInfo : IKeyBackupInfo ,
2914
+ opts ?: IKeyBackupRestoreOpts ,
2915
+ ) : Promise < IKeyBackupRestoreResult > ;
2847
2916
public async restoreKeyBackupWithCache (
2848
2917
targetRoomId : string ,
2849
2918
targetSessionId : string ,
2850
2919
backupInfo : IKeyBackupInfo ,
2851
2920
opts ?: IKeyBackupRestoreOpts ,
2921
+ ) : Promise < IKeyBackupRestoreResult > ;
2922
+ public async restoreKeyBackupWithCache (
2923
+ targetRoomId : string | undefined ,
2924
+ targetSessionId : string | undefined ,
2925
+ backupInfo : IKeyBackupInfo ,
2926
+ opts ?: IKeyBackupRestoreOpts ,
2852
2927
) : Promise < IKeyBackupRestoreResult > {
2853
2928
const privKey = await this . crypto . getSessionBackupPrivateKey ( ) ;
2854
2929
if ( ! privKey ) {
@@ -2857,12 +2932,33 @@ export class MatrixClient extends EventEmitter {
2857
2932
return this . restoreKeyBackup ( privKey , targetRoomId , targetSessionId , backupInfo , opts ) ;
2858
2933
}
2859
2934
2935
+ private async restoreKeyBackup (
2936
+ privKey : ArrayLike < number > ,
2937
+ targetRoomId : undefined ,
2938
+ targetSessionId : undefined ,
2939
+ backupInfo : IKeyBackupInfo ,
2940
+ opts ?: IKeyBackupRestoreOpts ,
2941
+ ) : Promise < IKeyBackupRestoreResult > ;
2942
+ private async restoreKeyBackup (
2943
+ privKey : ArrayLike < number > ,
2944
+ targetRoomId : string ,
2945
+ targetSessionId : undefined ,
2946
+ backupInfo : IKeyBackupInfo ,
2947
+ opts ?: IKeyBackupRestoreOpts ,
2948
+ ) : Promise < IKeyBackupRestoreResult > ;
2860
2949
private async restoreKeyBackup (
2861
2950
privKey : ArrayLike < number > ,
2862
2951
targetRoomId : string ,
2863
2952
targetSessionId : string ,
2864
2953
backupInfo : IKeyBackupInfo ,
2865
2954
opts ?: IKeyBackupRestoreOpts ,
2955
+ ) : Promise < IKeyBackupRestoreResult > ;
2956
+ private async restoreKeyBackup (
2957
+ privKey : ArrayLike < number > ,
2958
+ targetRoomId : string | undefined ,
2959
+ targetSessionId : string | undefined ,
2960
+ backupInfo : IKeyBackupInfo ,
2961
+ opts ?: IKeyBackupRestoreOpts ,
2866
2962
) : Promise < IKeyBackupRestoreResult > {
2867
2963
const cacheCompleteCallback = opts ?. cacheCompleteCallback ;
2868
2964
const progressCallback = opts ?. progressCallback ;
@@ -2953,7 +3049,14 @@ export class MatrixClient extends EventEmitter {
2953
3049
return { total : totalKeyCount , imported : keys . length } ;
2954
3050
}
2955
3051
2956
- public deleteKeysFromBackup ( roomId : string , sessionId : string , version : string ) : Promise < void > {
3052
+ public deleteKeysFromBackup ( roomId : undefined , sessionId : undefined , version : string ) : Promise < void > ;
3053
+ public deleteKeysFromBackup ( roomId : string , sessionId : undefined , version : string ) : Promise < void > ;
3054
+ public deleteKeysFromBackup ( roomId : string , sessionId : string , version : string ) : Promise < void > ;
3055
+ public deleteKeysFromBackup (
3056
+ roomId : string | undefined ,
3057
+ sessionId : string | undefined ,
3058
+ version : string ,
3059
+ ) : Promise < void > {
2957
3060
if ( ! this . crypto ) {
2958
3061
throw new Error ( "End-to-end encryption disabled" ) ;
2959
3062
}
0 commit comments