mirror of https://github.com/vector-im/riot-web
Merge pull request #5397 from matrix-org/bwindels/customise-dehydration-key
Add customisation point for dehydration keypull/21833/head
commit
067b4ca93e
|
@ -34,6 +34,7 @@ import * as StorageManager from './utils/StorageManager';
|
||||||
import IdentityAuthClient from './IdentityAuthClient';
|
import IdentityAuthClient from './IdentityAuthClient';
|
||||||
import { crossSigningCallbacks, tryToUnlockSecretStorageWithDehydrationKey } from './SecurityManager';
|
import { crossSigningCallbacks, tryToUnlockSecretStorageWithDehydrationKey } from './SecurityManager';
|
||||||
import {SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode";
|
import {SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode";
|
||||||
|
import SecurityCustomisations from "./customisations/Security";
|
||||||
|
|
||||||
export interface IMatrixClientCreds {
|
export interface IMatrixClientCreds {
|
||||||
homeserverUrl: string;
|
homeserverUrl: string;
|
||||||
|
@ -291,7 +292,10 @@ class _MatrixClientPeg implements IMatrixClientPeg {
|
||||||
// These are always installed regardless of the labs flag so that
|
// These are always installed regardless of the labs flag so that
|
||||||
// cross-signing features can toggle on without reloading and also be
|
// cross-signing features can toggle on without reloading and also be
|
||||||
// accessed immediately after login.
|
// accessed immediately after login.
|
||||||
Object.assign(opts.cryptoCallbacks, crossSigningCallbacks);
|
const customisedCallbacks = {
|
||||||
|
getDehydrationKey: SecurityCustomisations.getDehydrationKey,
|
||||||
|
};
|
||||||
|
Object.assign(opts.cryptoCallbacks, crossSigningCallbacks, customisedCallbacks);
|
||||||
|
|
||||||
this.matrixClient = createMatrixClient(opts);
|
this.matrixClient = createMatrixClient(opts);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import { IMatrixClientCreds } from "../MatrixClientPeg";
|
import { IMatrixClientCreds } from "../MatrixClientPeg";
|
||||||
import { Kind as SetupEncryptionKind } from "../toasts/SetupEncryptionToast";
|
import { Kind as SetupEncryptionKind } from "../toasts/SetupEncryptionToast";
|
||||||
|
import { ISecretStorageKeyInfo } from 'matrix-js-sdk/src/matrix';
|
||||||
|
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||||
function examineLoginResponse(
|
function examineLoginResponse(
|
||||||
|
@ -44,6 +45,13 @@ function getSecretStorageKey(): Uint8Array {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||||
|
function getDehydrationKey(
|
||||||
|
keyInfo: ISecretStorageKeyInfo,
|
||||||
|
): Promise<Uint8Array> {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
|
||||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||||
function catchAccessSecretStorageError(e: Error): void {
|
function catchAccessSecretStorageError(e: Error): void {
|
||||||
// E.g. notify the user in some way
|
// E.g. notify the user in some way
|
||||||
|
@ -74,6 +82,9 @@ export interface ISecurityCustomisations {
|
||||||
setupEncryptionNeeded?: (
|
setupEncryptionNeeded?: (
|
||||||
kind: SetupEncryptionKind,
|
kind: SetupEncryptionKind,
|
||||||
) => boolean,
|
) => boolean,
|
||||||
|
getDehydrationKey?: (
|
||||||
|
keyInfo: ISecretStorageKeyInfo,
|
||||||
|
) => Promise<Uint8Array>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// A real customisation module will define and export one or more of the
|
// A real customisation module will define and export one or more of the
|
||||||
|
|
Loading…
Reference in New Issue