78 lines
3.0 KiB
TypeScript
78 lines
3.0 KiB
TypeScript
|
|
import { RustCrypto } from "./rust-crypto.ts";
|
||
|
|
import { type IHttpOpts, type MatrixHttpApi } from "../http-api/index.ts";
|
||
|
|
import { type ServerSideSecretStorage } from "../secret-storage.ts";
|
||
|
|
import { type Logger } from "../logger.ts";
|
||
|
|
import { type CryptoStore } from "../crypto/store/base.ts";
|
||
|
|
import { type CryptoCallbacks } from "../crypto-api/index.ts";
|
||
|
|
/**
|
||
|
|
* The arguments used to initialise RustCrypto, passed in to initRustCrypto.
|
||
|
|
*
|
||
|
|
* @internal
|
||
|
|
*/
|
||
|
|
export interface InitRustCryptoArgs {
|
||
|
|
/** A `Logger` instance that will be used for debug output. */
|
||
|
|
logger: Logger;
|
||
|
|
/**
|
||
|
|
* Low-level HTTP interface: used to make outgoing requests required by the rust SDK.
|
||
|
|
* We expect it to set the access token, etc.
|
||
|
|
*/
|
||
|
|
http: MatrixHttpApi<IHttpOpts & {
|
||
|
|
onlyData: true;
|
||
|
|
}>;
|
||
|
|
/** The local user's User ID. */
|
||
|
|
userId: string;
|
||
|
|
/** The local user's Device ID. */
|
||
|
|
deviceId: string;
|
||
|
|
/** Interface to server-side secret storage. */
|
||
|
|
secretStorage: ServerSideSecretStorage;
|
||
|
|
/** Crypto callbacks provided by the application. */
|
||
|
|
cryptoCallbacks: CryptoCallbacks;
|
||
|
|
/**
|
||
|
|
* The prefix to use on the indexeddbs created by rust-crypto.
|
||
|
|
* If `null`, a memory store will be used.
|
||
|
|
*/
|
||
|
|
storePrefix: string | null;
|
||
|
|
/**
|
||
|
|
* A passphrase to use to encrypt the indexeddb created by rust-crypto.
|
||
|
|
*
|
||
|
|
* Ignored if `storePrefix` is null, or `storeKey` is set. If neither this nor `storeKey` is set
|
||
|
|
* (and `storePrefix` is not null), the indexeddb will be unencrypted.
|
||
|
|
*/
|
||
|
|
storePassphrase?: string;
|
||
|
|
/**
|
||
|
|
* A key to use to encrypt the indexeddb created by rust-crypto.
|
||
|
|
*
|
||
|
|
* Ignored if `storePrefix` is null. Otherwise, if it is set, it must be a 32-byte cryptographic key, which
|
||
|
|
* will be used to encrypt the indexeddb. See also `storePassphrase`.
|
||
|
|
*/
|
||
|
|
storeKey?: Uint8Array;
|
||
|
|
/** If defined, we will check if any data needs migrating from this store to the rust store. */
|
||
|
|
legacyCryptoStore?: CryptoStore;
|
||
|
|
/** The pickle key for `legacyCryptoStore` */
|
||
|
|
legacyPickleKey?: string;
|
||
|
|
/**
|
||
|
|
* A callback which will receive progress updates on migration from `legacyCryptoStore`.
|
||
|
|
*
|
||
|
|
* Called with (-1, -1) to mark the end of migration.
|
||
|
|
*/
|
||
|
|
legacyMigrationProgressListener?: (progress: number, total: number) => void;
|
||
|
|
/**
|
||
|
|
* Whether to enable support for encrypting state events.
|
||
|
|
*/
|
||
|
|
enableEncryptedStateEvents?: boolean;
|
||
|
|
/**
|
||
|
|
* Optional PEM-formatted string that provides CA certificates. These will
|
||
|
|
* be used to check X.509 signatures on user identities. Any user identity
|
||
|
|
* that has a valid signature according to the supplied CAs will be
|
||
|
|
* considered verified, without any manual verification taking place.
|
||
|
|
*/
|
||
|
|
caCertsPem?: string;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Create a new `RustCrypto` implementation
|
||
|
|
*
|
||
|
|
* @param args - InitRustCryptoArgs
|
||
|
|
* @internal
|
||
|
|
*/
|
||
|
|
export declare function initRustCrypto(args: InitRustCryptoArgs): Promise<RustCrypto>;
|
||
|
|
//# sourceMappingURL=index.d.ts.map
|