Clean up some references to internal js-sdk classes (#12363)

* Fix references to `crypto-api/verification`

This is supposed to be an internal module; use the front door instead.

* `IRecoveryKey` -> `GeneratedSecretStorageKey`

`IRecoveryKey` is just a backwards-compatibility alias for
`GeneratedSecretStorageKey`

* `ISecretStorageKeyInfo` -> `SecretStorage.SecretStorageKeyDescription`

Again, same thing

* `IPassphraseInfo` -> `SecretStorage.PassphraseInfo`

* Remove unused import restriction exceptions
This commit is contained in:
Richard van der Hoff 2024-03-22 12:28:13 +00:00 committed by GitHub
parent 79f9a130fa
commit d36c1b39fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 42 additions and 41 deletions

View file

@ -15,10 +15,10 @@ limitations under the License.
*/
import React from "react";
import { ISecretStorageKeyInfo } from "matrix-js-sdk/src/crypto/api";
import { IKeyBackupInfo } from "matrix-js-sdk/src/crypto/keybackup";
import { VerificationRequest } from "matrix-js-sdk/src/crypto-api";
import { logger } from "matrix-js-sdk/src/logger";
import { SecretStorageKeyDescription } from "matrix-js-sdk/src/secret-storage";
import { _t } from "../../../languageHandler";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
@ -29,7 +29,7 @@ import EncryptionPanel from "../../views/right_panel/EncryptionPanel";
import AccessibleButton, { ButtonEvent } from "../../views/elements/AccessibleButton";
import Spinner from "../../views/elements/Spinner";
function keyHasPassphrase(keyInfo: ISecretStorageKeyInfo): boolean {
function keyHasPassphrase(keyInfo: SecretStorageKeyDescription): boolean {
return Boolean(keyInfo.passphrase && keyInfo.passphrase.salt && keyInfo.passphrase.iterations);
}

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import React, { ReactNode } from "react";
import { GeneratedSas, ShowSasCallbacks, Verifier, VerifierEvent } from "matrix-js-sdk/src/crypto-api/verification";
import { GeneratedSas, ShowSasCallbacks, Verifier, VerifierEvent } from "matrix-js-sdk/src/crypto-api";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixClientPeg } from "../../../MatrixClientPeg";

View file

@ -17,8 +17,8 @@ limitations under the License.
import { debounce } from "lodash";
import classNames from "classnames";
import React, { ChangeEvent, FormEvent } from "react";
import { ISecretStorageKeyInfo } from "matrix-js-sdk/src/crypto/api";
import { logger } from "matrix-js-sdk/src/logger";
import { SecretStorage } from "matrix-js-sdk/src/matrix";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import Field from "../../elements/Field";
@ -42,7 +42,7 @@ const VALIDATION_THROTTLE_MS = 200;
export type KeyParams = { passphrase?: string; recoveryKey?: string };
interface IProps {
keyInfo: ISecretStorageKeyInfo;
keyInfo: SecretStorage.SecretStorageKeyDescription;
checkPrivateKey: (k: KeyParams) => Promise<boolean>;
onFinished(result?: false | KeyParams): void;
}

View file

@ -16,9 +16,8 @@ limitations under the License.
*/
import React, { ChangeEvent } from "react";
import { MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix";
import { MatrixClient, MatrixError, SecretStorage } from "matrix-js-sdk/src/matrix";
import { IKeyBackupInfo, IKeyBackupRestoreResult } from "matrix-js-sdk/src/crypto/keybackup";
import { ISecretStorageKeyInfo } from "matrix-js-sdk/src/crypto/api";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
@ -53,7 +52,7 @@ interface IProps {
interface IState {
backupInfo: IKeyBackupInfo | null;
backupKeyStored: Record<string, ISecretStorageKeyInfo> | null;
backupKeyStored: Record<string, SecretStorage.SecretStorageKeyDescription> | null;
loading: boolean;
loadError: boolean | null;
restoreError: unknown | null;

View file

@ -21,10 +21,12 @@ import {
VerificationPhase as Phase,
VerificationRequest,
VerificationRequestEvent,
ShowQrCodeCallbacks,
ShowSasCallbacks,
VerifierEvent,
} from "matrix-js-sdk/src/crypto-api";
import { RoomMember, Device, User } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { ShowQrCodeCallbacks, ShowSasCallbacks, VerifierEvent } from "matrix-js-sdk/src/crypto-api/verification";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
import VerificationQRCode from "../elements/crypto/VerificationQRCode";

View file

@ -16,7 +16,7 @@ limitations under the License.
import React from "react";
import { Device } from "matrix-js-sdk/src/matrix";
import { GeneratedSas, EmojiMapping } from "matrix-js-sdk/src/crypto-api/verification";
import { GeneratedSas, EmojiMapping } from "matrix-js-sdk/src/crypto-api";
import SasEmoji from "@matrix-org/spec/sas-emoji.json";
import { _t, getNormalizedLanguageKeys, getUserLanguage } from "../../../languageHandler";