UNPKG

ltijs

Version:

Easily turn your web application into a LTI 1.3 Learning Tool.

50 lines (49 loc) • 3.21 kB
import type { Logger } from '#services/logger/logger.types'; import type { DatabaseManager } from '#services/database-manager/database-manager.types'; import type { Platform } from './platform-manager.types'; import type { PlatformRegistrationInput, PlatformSearchInput, PlatformUpdateInput } from '#services/platform-manager/platform-manager.types'; import type { CacheManager } from '#services/cache-manager/cache-manager.types'; /** Registers, looks up, updates, and (de)activates platforms. Reachable as `Provider.platformManager`. */ export declare class PlatformManager { private readonly LOG_COMPONENT; private readonly databaseManager; private readonly logger; private readonly cacheManager; constructor(databaseManager: DatabaseManager, logger: Logger, cacheManager: CacheManager); /** Registers a new platform, generating its RSA keypair. Throws `PlatformAlreadyRegisteredError` if the `url`/`clientId` pair already exists. */ registerPlatform(platform: PlatformRegistrationInput): Promise<Platform>; /** Lists registered platforms, optionally narrowed by `filter` (e.g. `{ active: true }`). */ getPlatforms(filter?: PlatformSearchInput): Promise<Platform[]>; getPlatformById(platformId: string): Promise<Platform | undefined>; /** The lookup used at login time: `url`/`clientId` together identify a platform, mirroring how the OIDC login request identifies it. */ getPlatformByUrlAndClientId(url: string, clientId: string): Promise<Platform | undefined>; /** * Writes only the fields present in `update` (never the rest of `platform`'s current fields), so a * concurrent update to a different field can't be silently reverted. Throws * `UrlClientIdCombinationAlreadyExistsError` if changing `url`/`clientId` would collide with another * platform. */ updatePlatform(platform: Platform, update: PlatformUpdateInput): Promise<Platform>; deletePlatform(platform: Platform): Promise<void>; /** A deactivated platform's login/launch requests are rejected (or routed to `onInactivePlatform`, if set) until reactivated. */ activatePlatform(platform: Platform): Promise<Platform>; deactivatePlatform(platform: Platform): Promise<Platform>; /** Generates a fresh RSA keypair for the platform and invalidates the cached keyset: the old key stops being served immediately. */ rotateKeys(platform: Platform): Promise<Platform>; getPublicKey(platform: Platform): Promise<string>; getPrivateKey(platform: Platform): Promise<string>; private createNewPlatform; private invalidateKeysetCache; private buildPlatformUpdate; /** * @deprecated Kept as a v5-migration bridge. Use {@link PlatformManager.getPlatforms} with no parameters instead. */ getAllPlatforms(): Promise<Platform[]>; /** * @deprecated Kept as a v5-migration bridge. Use {@link PlatformManager.getPlatforms} (or * {@link PlatformManager.getPlatformByUrlAndClientId} for a single result) instead. */ getPlatform(url: string, clientId: string): Promise<Platform | false>; getPlatform(url: string, clientId?: undefined): Promise<Platform[] | false>; } export default PlatformManager;