1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Move some interfaces around

This commit is contained in:
David Baker
2021-07-07 20:21:44 +01:00
parent c34d4e777f
commit 5c6d3724b0
7 changed files with 16 additions and 18 deletions

View File

@@ -65,7 +65,7 @@ import { IIdentityServerProvider } from "./@types/IIdentityServerProvider";
import type Request from "request"; import type Request from "request";
import { MatrixScheduler } from "./scheduler"; import { MatrixScheduler } from "./scheduler";
import { ICryptoCallbacks, NotificationCountType } from "./matrix"; import { ICryptoCallbacks, NotificationCountType } from "./matrix";
import { ISecretStorageKeyInfo } from "./crypto/SecretStorage"; import { ISecretStorageKeyInfo } from "./crypto/api";
import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store"; import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store";
import { LocalStorageCryptoStore } from "./crypto/store/localStorage-crypto-store"; import { LocalStorageCryptoStore } from "./crypto/store/localStorage-crypto-store";
import { IndexedDBCryptoStore } from "./crypto/store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./crypto/store/indexeddb-crypto-store";

View File

@@ -12,7 +12,7 @@ import {
ISignedKey, ISignedKey,
KeySignatures, KeySignatures,
} from "../matrix"; } from "../matrix";
import { ISecretStorageKeyInfo } from "./SecretStorage"; import { ISecretStorageKeyInfo } from "./api";
import { IKeyBackupInfo } from "./keybackup"; import { IKeyBackupInfo } from "./keybackup";
interface ICrossSigningKeys { interface ICrossSigningKeys {

View File

@@ -20,23 +20,13 @@ import { randomString } from '../randomstring';
import { encryptAES, decryptAES, IEncryptedPayload } from './aes'; import { encryptAES, decryptAES, IEncryptedPayload } from './aes';
import { encodeBase64 } from "./olmlib"; import { encodeBase64 } from "./olmlib";
import { ICryptoCallbacks, MatrixClient, MatrixEvent } from '../matrix'; import { ICryptoCallbacks, MatrixClient, MatrixEvent } from '../matrix';
import { IAddSecretStorageKeyOpts, IPassphraseInfo } from './api'; import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from './api';
import { EventEmitter } from 'stream'; import { EventEmitter } from 'stream';
export const SECRET_STORAGE_ALGORITHM_V1_AES = "m.secret_storage.v1.aes-hmac-sha2"; 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"; 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 type SecretStorageKeyTuple = [keyId: string, keyInfo: ISecretStorageKeyInfo];
export interface ISecretRequest { export interface ISecretRequest {

View File

@@ -16,7 +16,6 @@ limitations under the License.
import { DeviceInfo } from "./deviceinfo"; import { DeviceInfo } from "./deviceinfo";
import { IKeyBackupInfo } from "./keybackup"; import { IKeyBackupInfo } from "./keybackup";
import { ISecretStorageKeyInfo } from "./SecretStorage";
// TODO: Merge this with crypto.js once converted // TODO: Merge this with crypto.js once converted
@@ -107,6 +106,16 @@ export interface ICreateSecretStorageOpts {
getKeyBackupPassphrase?: () => Promise<Uint8Array>; getKeyBackupPassphrase?: () => Promise<Uint8Array>;
} }
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 { export interface ISecretStorageKey {
keyId: string; keyId: string;
keyInfo: ISecretStorageKeyInfo; keyInfo: ISecretStorageKeyInfo;

View File

@@ -19,7 +19,7 @@ import { IndexedDBCryptoStore } from '../crypto/store/indexeddb-crypto-store';
import { decryptAES, encryptAES } from './aes'; import { decryptAES, encryptAES } from './aes';
import anotherjson from "another-json"; import anotherjson from "another-json";
import { logger } from '../logger'; import { logger } from '../logger';
import { ISecretStorageKeyInfo } from "./SecretStorage"; import { ISecretStorageKeyInfo } from "./api";
// FIXME: these types should eventually go in a different file // FIXME: these types should eventually go in a different file
type Signatures = Record<string, Record<string, string>>; type Signatures = Record<string, Record<string, string>>;

View File

@@ -36,11 +36,10 @@ import { EncryptionSetupBuilder } from "./EncryptionSetup";
import { import {
SECRET_STORAGE_ALGORITHM_V1_AES, SECRET_STORAGE_ALGORITHM_V1_AES,
SecretStorage, SecretStorage,
ISecretStorageKeyInfo,
SecretStorageKeyTuple, SecretStorageKeyTuple,
ISecretRequest, ISecretRequest,
} from './SecretStorage'; } from './SecretStorage';
import { IAddSecretStorageKeyOpts } from "./api"; import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from "./api";
import { OutgoingRoomKeyRequestManager } from './OutgoingRoomKeyRequestManager'; import { OutgoingRoomKeyRequestManager } from './OutgoingRoomKeyRequestManager';
import { IndexedDBCryptoStore } from './store/indexeddb-crypto-store'; import { IndexedDBCryptoStore } from './store/indexeddb-crypto-store';
import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from './verification/QRCode'; import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from './verification/QRCode';

View File

@@ -20,7 +20,7 @@ import { MatrixScheduler } from "./scheduler";
import { MatrixClient } from "./client"; import { MatrixClient } from "./client";
import { ICreateClientOpts } from "./client"; import { ICreateClientOpts } from "./client";
import { DeviceTrustLevel } from "./crypto/CrossSigning"; import { DeviceTrustLevel } from "./crypto/CrossSigning";
import { ISecretStorageKeyInfo } from "./crypto/SecretStorage"; import { ISecretStorageKeyInfo } from "./crypto/api";
export * from "./client"; export * from "./client";
export * from "./http-api"; export * from "./http-api";