import { IStartClientOpts, MatrixClient, TokenRefreshFunction } from "matrix-js-sdk/src/matrix";
export interface IMatrixClientCreds {
    homeserverUrl: string;
    identityServerUrl?: string;
    userId: string;
    deviceId?: string;
    accessToken: string;
    refreshToken?: string;
    guest?: boolean;
    pickleKey?: string;
    freshLogin?: boolean;
}
export interface MatrixClientPegAssignOpts {
    /**
     * If we are using Rust crypto, a key with which to encrypt the indexeddb.
     *
     * If provided, it must be exactly 32 bytes of data. If both this and
     * {@link MatrixClientPegAssignOpts.rustCryptoStorePassword} are undefined,
     * the store will be unencrypted.
     */
    rustCryptoStoreKey?: Uint8Array;
    /**
     * If we are using Rust crypto, a password which will be used to derive a key to encrypt the store with.
     *
     * An alternative to {@link MatrixClientPegAssignOpts.rustCryptoStoreKey}. Ignored if `rustCryptoStoreKey` is set.
     *
     * Deriving a key from a password is (deliberately) a slow operation, so prefer to pass a `rustCryptoStoreKey`
     * directly where possible.
     */
    rustCryptoStorePassword?: string;
}
/**
 * Holds the current instance of the `MatrixClient` to use across the codebase.
 * Looking for an `MatrixClient`? Just look for the `MatrixClientPeg` on the peg
 * board. "Peg" is the literal meaning of something you hang something on. So
 * you'll find a `MatrixClient` hanging on the `MatrixClientPeg`.
 */
export interface IMatrixClientPeg {
    /**
     * The opts used to start the client
     */
    opts: IStartClientOpts;
    /**
     * Get the current MatrixClient, if any
     */
    get(): MatrixClient | null;
    /**
     * Get the current MatrixClient, throwing an error if there isn't one
     */
    safeGet(): MatrixClient;
    /**
     * Unset the current MatrixClient
     */
    unset(): void;
    /**
     * Prepare the MatrixClient for use, including initialising the store and crypto, but do not start it.
     */
    assign(opts?: MatrixClientPegAssignOpts): Promise<IStartClientOpts>;
    /**
     * Prepare the MatrixClient for use, including initialising the store and crypto, and start it.
     */
    start(opts?: MatrixClientPegAssignOpts): Promise<void>;
    /**
     * If we've registered a user ID we set this to the ID of the
     * user we've just registered. If they then go & log in, we
     * can send them to the welcome user (obviously this doesn't
     * guarantee they'll get a chat with the welcome user).
     *
     * @param {string} uid The user ID of the user we've just registered
     */
    setJustRegisteredUserId(uid: string | null): void;
    /**
     * Returns true if the current user has just been registered by this
     * client as determined by setJustRegisteredUserId()
     *
     * @returns {bool} True if user has just been registered
     */
    currentUserIsJustRegistered(): boolean;
    /**
     * If the current user has been registered by this device then this
     * returns a boolean of whether it was within the last N hours given.
     */
    userRegisteredWithinLastHours(hours: number): boolean;
    /**
     * If the current user has been registered by this device then this
     * returns a boolean of whether it was after a given timestamp.
     */
    userRegisteredAfter(date: Date): boolean;
    /**
     * Replace this MatrixClientPeg's client with a client instance that has
     * homeserver / identity server URLs and active credentials
     *
     * @param {IMatrixClientCreds} creds The new credentials to use.
     * @param {TokenRefreshFunction} tokenRefreshFunction OPTIONAL function used by MatrixClient to attempt token refresh
     *          see {@link ICreateClientOpts.tokenRefreshFunction}
     */
    replaceUsingCreds(creds: IMatrixClientCreds, tokenRefreshFunction?: TokenRefreshFunction): void;
}
/**
 * Note: You should be using a React context with access to a client rather than
 * using this, as in a multi-account world this will not exist!
 */
export declare const MatrixClientPeg: IMatrixClientPeg;
