1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Merge pull request #1913 from matrix-org/gsouquet/ts-security

This commit is contained in:
Germain
2021-09-15 08:27:29 +01:00
committed by GitHub
3 changed files with 6 additions and 6 deletions

View File

@@ -2036,7 +2036,7 @@ export class MatrixClient extends EventEmitter {
* recovery key which should be disposed of after displaying to the user, * recovery key which should be disposed of after displaying to the user,
* and raw private key to avoid round tripping if needed. * and raw private key to avoid round tripping if needed.
*/ */
public createRecoveryKeyFromPassphrase(password: string): Promise<IRecoveryKey> { public createRecoveryKeyFromPassphrase(password?: string): Promise<IRecoveryKey> {
if (!this.crypto) { if (!this.crypto) {
throw new Error("End-to-end encryption disabled"); throw new Error("End-to-end encryption disabled");
} }
@@ -2479,7 +2479,7 @@ export class MatrixClient extends EventEmitter {
*/ */
// TODO: Verify types // TODO: Verify types
public async prepareKeyBackupVersion( public async prepareKeyBackupVersion(
password: string, password?: string,
opts: IKeyBackupPrepareOpts = { secureSecretStorage: false }, opts: IKeyBackupPrepareOpts = { secureSecretStorage: false },
): Promise<Pick<IPreparedKeyBackupVersion, "algorithm" | "auth_data" | "recovery_key">> { ): Promise<Pick<IPreparedKeyBackupVersion, "algorithm" | "auth_data" | "recovery_key">> {
if (!this.crypto) { if (!this.crypto) {
@@ -7460,7 +7460,7 @@ export class MatrixClient extends EventEmitter {
return this.http.authedRequest(undefined, "GET", path, qps, undefined); return this.http.authedRequest(undefined, "GET", path, qps, undefined);
} }
public uploadDeviceSigningKeys(auth: any, keys: CrossSigningKeys): Promise<{}> { // TODO: types public uploadDeviceSigningKeys(auth: any, keys?: CrossSigningKeys): Promise<{}> { // TODO: types
const data = Object.assign({}, keys); const data = Object.assign({}, keys);
if (auth) Object.assign(data, { auth }); if (auth) Object.assign(data, { auth });
return this.http.authedRequest( return this.http.authedRequest(

View File

@@ -58,7 +58,7 @@ export interface IEncryptedEventInfo {
} }
export interface IRecoveryKey { export interface IRecoveryKey {
keyInfo: { keyInfo?: {
pubkey: string; pubkey: string;
passphrase?: { passphrase?: {
algorithm: string; algorithm: string;
@@ -67,7 +67,7 @@ export interface IRecoveryKey {
}; };
}; };
privateKey: Uint8Array; privateKey: Uint8Array;
encodedPrivateKey: string; encodedPrivateKey?: string;
} }
export interface ICreateSecretStorageOpts { export interface ICreateSecretStorageOpts {

View File

@@ -506,7 +506,7 @@ export class Crypto extends EventEmitter {
* recovery key which should be disposed of after displaying to the user, * recovery key which should be disposed of after displaying to the user,
* and raw private key to avoid round tripping if needed. * and raw private key to avoid round tripping if needed.
*/ */
public async createRecoveryKeyFromPassphrase(password: string): Promise<IRecoveryKey> { public async createRecoveryKeyFromPassphrase(password?: string): Promise<IRecoveryKey> {
const decryption = new global.Olm.PkDecryption(); const decryption = new global.Olm.PkDecryption();
try { try {
const keyInfo: Partial<IRecoveryKey["keyInfo"]> = {}; const keyInfo: Partial<IRecoveryKey["keyInfo"]> = {};