You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
fix types
This commit is contained in:
@@ -78,7 +78,7 @@ interface BackupAlgorithmClass {
|
||||
key: string | Uint8Array | null,
|
||||
): Promise<[Uint8Array, AuthData]>;
|
||||
|
||||
checkBackupVersion(info: BackupInfo): void;
|
||||
checkBackupVersion(info: IKeyBackupInfo): void;
|
||||
}
|
||||
|
||||
interface BackupAlgorithm {
|
||||
@@ -112,9 +112,9 @@ export class BackupManager {
|
||||
*
|
||||
* Throws an error if a problem is detected.
|
||||
*
|
||||
* @param {BackupInfo} info the key backup info
|
||||
* @param {IKeyBackupInfo} info the key backup info
|
||||
*/
|
||||
public static checkBackupVersion(info: BackupInfo): void {
|
||||
public static checkBackupVersion(info: IKeyBackupInfo): void {
|
||||
const Algorithm = algorithmsByName[info.algorithm];
|
||||
if (!Algorithm) {
|
||||
throw new Error("Unknown backup algorithm: " + info.algorithm);
|
||||
@@ -273,7 +273,7 @@ export class BackupManager {
|
||||
/**
|
||||
* Check if the given backup info is trusted.
|
||||
*
|
||||
* @param {object} backupInfo key backup info dict from /room_keys/version
|
||||
* @param {IKeyBackupInfo} backupInfo key backup info dict from /room_keys/version
|
||||
* @return {object} {
|
||||
* usable: [bool], // is the backup trusted, true iff there is a sig that is valid & from a trusted device
|
||||
* sigs: [
|
||||
@@ -619,7 +619,7 @@ export class Curve25519 implements BackupAlgorithm {
|
||||
}
|
||||
}
|
||||
|
||||
public static checkBackupVersion(info: BackupInfo): void {
|
||||
public static checkBackupVersion(info: IKeyBackupInfo): void {
|
||||
if (!info.auth_data.public_key) {
|
||||
throw new Error("Invalid backup data returned");
|
||||
}
|
||||
@@ -754,7 +754,7 @@ export class Aes256 implements BackupAlgorithm {
|
||||
return [outKey, authData];
|
||||
}
|
||||
|
||||
public static checkBackupVersion(info: BackupInfo): void {
|
||||
public static checkBackupVersion(info: IKeyBackupInfo): void {
|
||||
if (!info.auth_data.iv || !info.auth_data.mac) {
|
||||
throw new Error("Invalid backup data returned");
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ export interface IMegolmSessionData {
|
||||
session_id: string;
|
||||
session_key: string;
|
||||
algorithm: string;
|
||||
untrusted?: boolean;
|
||||
}
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
|
||||
@@ -15,18 +15,13 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import { randomString } from '../randomstring';
|
||||
import { IKeyBackupInfo } from "./keybackup";
|
||||
|
||||
const DEFAULT_ITERATIONS = 500000;
|
||||
|
||||
const DEFAULT_BITSIZE = 256;
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
interface IAuthData {
|
||||
private_key_salt: string;
|
||||
private_key_iterations: number;
|
||||
private_key_bits?: number;
|
||||
}
|
||||
/* eslint-enable camelcase */
|
||||
type IAuthData = IKeyBackupInfo["auth_data"];
|
||||
|
||||
interface IKey {
|
||||
key: Uint8Array;
|
||||
|
||||
@@ -35,11 +35,13 @@ export interface IKeyBackupRoomSessions {
|
||||
export interface IKeyBackupInfo {
|
||||
algorithm: string;
|
||||
auth_data: {
|
||||
public_key: string;
|
||||
signatures: ISignatures;
|
||||
private_key_salt: string;
|
||||
private_key_iterations: number;
|
||||
public_key?: string;
|
||||
signatures?: ISignatures;
|
||||
private_key_salt?: string;
|
||||
private_key_iterations?: number;
|
||||
private_key_bits?: number;
|
||||
iv?: string;
|
||||
mac?: string;
|
||||
};
|
||||
count?: number;
|
||||
etag?: string;
|
||||
|
||||
Reference in New Issue
Block a user