lti-tool Documentation
    Preparing search index...

    Class MySqlStorage

    MySQL implementation of LTI storage interface.

    Stores clients, deployments, sessions, and nonces in MySQL with LRU caching. Uses Drizzle ORM for type-safe database operations.

    Implements

    Index

    Constructors

    Methods

    • 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

    • Clean up expired nonces, sessions, and registration sessions. Should be called periodically (e.g., every 30 minutes via EventBridge).

      Returns Promise<
          {
              noncesDeleted: number;
              registrationSessionsDeleted: number;
              sessionsDeleted: number;
          },
      >

      Object with counts of deleted items

    • Close the MySQL connection pool. Should be called on graceful server shutdown or after tests. Not required for serverless environments (Lambda manages lifecycle).

      Returns Promise<void>

    • 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

    • Stores a nonce with expiration time for replay attack prevention.

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

        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 nonce and marks it as used to prevent replay attacks.

      Parameters

      • nonce: string

        Nonce value to validate

      Returns Promise<boolean>

      true if nonce is valid and unused, false if already used or expired