import type { IStorage } from "@inrupt/solid-client-authn-core"; import { Session } from "./Session"; export type GetSessionOptions = Partial<{ /** * The storage where the Session can be found. */ storage: IStorage; /** * A callback called when a new refresh token is issued. */ onNewRefreshToken: (newToken: string) => unknown; /** * A flag controlling whether the session found in storage * should be logged in using a refresh token before being returned. */ refreshSession: boolean; }>; /** * Log a session in using a refresh token from storage. * The provided session is mutated so that `session.info` * is accurate if the login is successful. * * @param session the session to log in. * @param options optional arguments to control the session refresh. * @returns Promise * * @example * ``` * const session = await getSessionFromStorage(sessionId, { refresh: false }); * await refreshSession(session); * ``` */ export declare function refreshSession(session: Session, options?: { storage?: IStorage; }): Promise; /** * Retrieve a Session from the given storage based on its session ID. If possible, * the Session is logged in before it is returned, so that `session.fetch` may * access private Resources without any additional interaction. * * If no storage is provided, a default in-memory storage will be used. It is * instantiated once on load, and is shared across all the sessions. Since it * is only available in memory, the storage is lost when the code stops running. * * A Session is available in storage as soon as it logged in once, and it is removed * from storage on logout. * * @param sessionId The ID of the Session to retrieve. * @param options Options to control the session loading behavior. * @returns A Session object, potentially authenticated, or undefined if no Session * in storage matches the given ID. * @since 2.3.0 */ export declare function getSessionFromStorage(sessionId: string, options?: GetSessionOptions): Promise; /** * Retrieve the IDs for all the Sessions available in the given storage. Note that * it is only the Session IDs that are returned, and not Session object. Given a * Session ID, one may use [[getSessionFromStorage]] to get the actual Session * object, while being conscious that logging in a Session required an HTTP * interaction, so doing it in batch for a large number of sessions may result * in performance issues. * * If no storage is provided, a default in-memory storage will be used. It is * instantiated once on load, and is shared across all the sessions. Since it * is only available in memory, the storage is lost when the code stops running. * * A Session is available in storage as soon as it logged in once, and it is removed * from storage on logout. * * @param storage The storage where the Session can be found * @returns An array of Session IDs */ export declare function getSessionIdFromStorageAll(storage?: IStorage): Promise; /** * Clear the given storage from any existing Session ID. In order to remove an * individual Session from storage, rather than going through this batch deletion, * one may simply log the Session out calling `session.logout`. * * If no storage is provided, a default in-memory storage will be used. It is * instantiated once on load, and is shared across all the sessions. Since it * is only available in memory, the storage is lost when the code stops running. * * A Session is available in storage as soon as it logged in once, and it is removed * from storage on logout. * * @param storage The storage where the Session can be found */ export declare function clearSessionFromStorageAll(storage?: IStorage): Promise;