lti-tool Documentation
    Preparing search index...

    Interface LTIStorage

    Storage interface for persisting LTI Client configurations, user sessions, and security nonces. Implement this interface to use different storage backends (memory, database, Redis, etc.).

    interface LTIStorage {
        addClient(
            client: Omit<LTIClient, "id" | "deployments">,
        ): Promise<string>;
        addDeployment(
            clientId: string,
            deployment: Omit<LTIDeployment, "id">,
        ): Promise<string>;
        addSession(session: LTISession): Promise<string>;
        deleteClient(clientId: string): Promise<void>;
        deleteDeployment(clientId: string, deploymentId: string): Promise<void>;
        deleteRegistrationSession(sessionId: string): Promise<void>;
        getClientById(clientId: string): Promise<LTIClient | undefined>;
        getDeployment(
            clientId: string,
            deploymentId: string,
        ): Promise<LTIDeployment | undefined>;
        getLaunchConfig(
            iss: string,
            clientId: string,
            deploymentId: string,
        ): Promise<LTILaunchConfig | undefined>;
        getRegistrationSession(
            sessionId: string,
        ): Promise<LTIDynamicRegistrationSession | undefined>;
        getSession(sessionId: string): Promise<LTISession | undefined>;
        listClients(): Promise<Omit<LTIClient, "deployments">[]>;
        listDeployments(clientId: string): Promise<LTIDeployment[]>;
        saveLaunchConfig(launchConfig: LTILaunchConfig): Promise<void>;
        setRegistrationSession(
            sessionId: string,
            session: LTIDynamicRegistrationSession,
        ): Promise<void>;
        storeNonce(nonce: string, expiresAt: Date): Promise<void>;
        updateClient(
            clientId: string,
            client: Partial<Omit<LTIClient, "id" | "deployments">>,
        ): Promise<void>;
        updateDeployment(
            clientId: string,
            deploymentId: string,
            deployment: Partial<LTIDeployment>,
        ): Promise<void>;
        validateNonce(nonce: string): Promise<boolean>;
    }

    Implemented by

    Index
    • Adds a new client configuration to storage.

      Parameters

      • client: Omit<LTIClient, "id" | "deployments">

        Partial client configuration object

      Returns Promise<string>

    • Adds a new deployment to an existing client.

      Parameters

      • clientId: string

        Client identifier

      • deployment: Omit<LTIDeployment, "id">

        Deployment configuration to add

      Returns Promise<string>

    • Stores a new user session after successful LTI launch.

      Parameters

      • session: LTISession

        Complete session object with user, context, and service data

      Returns Promise<string>

      The session ID for reference

    • Removes a client configuration from storage.

      Parameters

      • clientId: string

        Unique client identifier

      Returns Promise<void>

    • Removes a deployment from a Client.

      Parameters

      • clientId: string

        Client identifier

      • deploymentId: string

        Deployment identifier to remove

      Returns Promise<void>

    • Removes a registration session from storage (cleanup after completion or expiration).

      Parameters

      • sessionId: string

        Unique session identifier to delete

      Returns Promise<void>

    • Retrieves client configuration by its unique id.

      Parameters

      • clientId: string

        Unique client identifier

      Returns Promise<LTIClient | undefined>

      Client configuration if found, undefined otherwise

    • Retrieves deployment configuration by client ID and deployment ID (admin use).

      Parameters

      • clientId: string

        Unique client identifier

      • deploymentId: string

        Deployment identifier

      Returns Promise<LTIDeployment | undefined>

      Deployment configuration if found, undefined otherwise

    • Retrieves launch configuration for LTI authentication flow.

      Parameters

      • iss: string

        Platform issuer URL (identifies the LMS)

      • clientId: string

        OAuth2 client identifier for this tool

      • deploymentId: string

        Deployment identifier within the platform

      Returns Promise<LTILaunchConfig | undefined>

      Launch configuration if found, undefined otherwise

    • Retrieves an active user session by session ID.

      Parameters

      • sessionId: string

        Unique session identifier (typically a UUID)

      Returns Promise<LTISession | undefined>

      Session object if found and valid, undefined otherwise

    • Retrieves all clients configured in the system.

      Returns Promise<Omit<LTIClient, "deployments">[]>

      Array of all client configurations

    • Stores a temporary registration session during LTI 1.3 dynamic registration flow. Sessions have a TTL and are automatically cleaned up when expired.

      Parameters

      • sessionId: string

        Unique session identifier (typically a UUID)

      • session: LTIDynamicRegistrationSession

        Registration session data including platform config and tokens

      Returns Promise<void>

    • Stores an issued nonce with expiration time for replay attack prevention. Implementations should treat this as create-only and fail if the nonce already exists.

      Parameters

      • nonce: string

        Unique nonce value (typically a UUID)

      • expiresAt: Date

        When this nonce should be considered expired

      Returns Promise<void>

    • Updates an existing client configuration.

      Parameters

      • clientId: string

        Unique client identifier

      • client: Partial<Omit<LTIClient, "id" | "deployments">>

        Partial client object with fields to update

      Returns Promise<void>

    • Updates an existing deployment configuration.

      Parameters

      • clientId: string

        Client identifier

      • deploymentId: string

        Deployment identifier to update

      • deployment: Partial<LTIDeployment>

        Partial deployment object with fields to update

      Returns Promise<void>

    • Validates a previously stored nonce and marks it as used to prevent replay attacks.

      Parameters

      • nonce: string

        Nonce value to validate

      Returns Promise<boolean>

      true if nonce was stored, unexpired, and unused; false if unknown, already used, or expired