diff --git a/src/client.ts b/src/client.ts index 9106e5277..0067a4fa7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -65,7 +65,7 @@ import { IIdentityServerProvider } from "./@types/IIdentityServerProvider"; import type Request from "request"; import { MatrixScheduler } from "./scheduler"; import { ICryptoCallbacks, NotificationCountType } from "./matrix"; -import { ISecretStorageKeyInfo } from "./crypto/SecretStorage"; +import { ISecretStorageKeyInfo } from "./crypto/api"; import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store"; import { LocalStorageCryptoStore } from "./crypto/store/localStorage-crypto-store"; import { IndexedDBCryptoStore } from "./crypto/store/indexeddb-crypto-store"; diff --git a/src/crypto/EncryptionSetup.ts b/src/crypto/EncryptionSetup.ts index ccf8aeb47..406abc512 100644 --- a/src/crypto/EncryptionSetup.ts +++ b/src/crypto/EncryptionSetup.ts @@ -12,7 +12,7 @@ import { ISignedKey, KeySignatures, } from "../matrix"; -import { ISecretStorageKeyInfo } from "./SecretStorage"; +import { ISecretStorageKeyInfo } from "./api"; import { IKeyBackupInfo } from "./keybackup"; interface ICrossSigningKeys { diff --git a/src/crypto/SecretStorage.ts b/src/crypto/SecretStorage.ts index 3b2fca435..0668b0b3a 100644 --- a/src/crypto/SecretStorage.ts +++ b/src/crypto/SecretStorage.ts @@ -20,23 +20,13 @@ import { randomString } from '../randomstring'; import { encryptAES, decryptAES, IEncryptedPayload } from './aes'; import { encodeBase64 } from "./olmlib"; import { ICryptoCallbacks, MatrixClient, MatrixEvent } from '../matrix'; -import { IAddSecretStorageKeyOpts, IPassphraseInfo } from './api'; +import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from './api'; import { EventEmitter } from 'stream'; export const SECRET_STORAGE_ALGORITHM_V1_AES = "m.secret_storage.v1.aes-hmac-sha2"; const ZERO_STR = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; -export interface ISecretStorageKeyInfo { - name: string; - algorithm: string; - // technically the below are specific to AES keys. If we ever introduce another type, - // we can split into separate interfaces. - iv: string; - mac: string; - passphrase: IPassphraseInfo; -} - export type SecretStorageKeyTuple = [keyId: string, keyInfo: ISecretStorageKeyInfo]; export interface ISecretRequest { diff --git a/src/crypto/api.ts b/src/crypto/api.ts index a15f8bd5c..57f48c18c 100644 --- a/src/crypto/api.ts +++ b/src/crypto/api.ts @@ -16,7 +16,6 @@ limitations under the License. import { DeviceInfo } from "./deviceinfo"; import { IKeyBackupInfo } from "./keybackup"; -import { ISecretStorageKeyInfo } from "./SecretStorage"; // TODO: Merge this with crypto.js once converted @@ -107,6 +106,16 @@ export interface ICreateSecretStorageOpts { getKeyBackupPassphrase?: () => Promise; } +export interface ISecretStorageKeyInfo { + name: string; + algorithm: string; + // technically the below are specific to AES keys. If we ever introduce another type, + // we can split into separate interfaces. + iv: string; + mac: string; + passphrase: IPassphraseInfo; +} + export interface ISecretStorageKey { keyId: string; keyInfo: ISecretStorageKeyInfo; diff --git a/src/crypto/dehydration.ts b/src/crypto/dehydration.ts index ef441e7d8..0267e457e 100644 --- a/src/crypto/dehydration.ts +++ b/src/crypto/dehydration.ts @@ -19,7 +19,7 @@ import { IndexedDBCryptoStore } from '../crypto/store/indexeddb-crypto-store'; import { decryptAES, encryptAES } from './aes'; import anotherjson from "another-json"; import { logger } from '../logger'; -import { ISecretStorageKeyInfo } from "./SecretStorage"; +import { ISecretStorageKeyInfo } from "./api"; // FIXME: these types should eventually go in a different file type Signatures = Record>; diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 0b717c5b7..184557653 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -36,11 +36,10 @@ import { EncryptionSetupBuilder } from "./EncryptionSetup"; import { SECRET_STORAGE_ALGORITHM_V1_AES, SecretStorage, - ISecretStorageKeyInfo, SecretStorageKeyTuple, ISecretRequest, } from './SecretStorage'; -import { IAddSecretStorageKeyOpts } from "./api"; +import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from "./api"; import { OutgoingRoomKeyRequestManager } from './OutgoingRoomKeyRequestManager'; import { IndexedDBCryptoStore } from './store/indexeddb-crypto-store'; import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from './verification/QRCode'; diff --git a/src/matrix.ts b/src/matrix.ts index fbda72fe5..78906a716 100644 --- a/src/matrix.ts +++ b/src/matrix.ts @@ -20,7 +20,7 @@ import { MatrixScheduler } from "./scheduler"; import { MatrixClient } from "./client"; import { ICreateClientOpts } from "./client"; import { DeviceTrustLevel } from "./crypto/CrossSigning"; -import { ISecretStorageKeyInfo } from "./crypto/SecretStorage"; +import { ISecretStorageKeyInfo } from "./crypto/api"; export * from "./client"; export * from "./http-api";