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
    • 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 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

    • 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