Theia API Documentation v1.77.0
    Preparing search index...

    Backend implementation of the "Sign in with ChatGPT" OAuth flow. The browser is sent to the OpenAI authorization page and returns the authorization code to a loopback listener. If that listener is not reachable, e.g. because the backend does not run on the user's machine, the code can be handed over manually instead.

    Implements

    Index
    clients: Set<ChatGptAuthServiceClient> = ...
    credentials: StoredCredentials | undefined
    credentialsGeneration: number = 0

    Incremented on sign out or a new login being accepted, so results from earlier sessions are discarded.

    credentialsLoaded: boolean = false
    credentialsLoading: Promise<StoredCredentials | undefined> | undefined
    keyStoreService: KeyStoreService
    keyStoreUpdates: Promise<unknown> = ...

    Serializes the key store updates, so a slow update cannot be applied on top of a later one.

    logger: ILogger
    onAuthStateChanged: Event<ChatGptAuthState> = ...

    Emitted whenever the sign in state changes.

    onAuthStateChangedEmitter: Emitter<ChatGptAuthState> = ...
    pendingLogin: PendingLogin | undefined
    refreshInProgress:
        | {
            generation: number;
            promise: Promise<ChatGptCredentials | undefined>;
        }
        | undefined
    • Parameters

      • pending: PendingLogin
      • request: IncomingMessage
      • response: ServerResponse

      Returns void

    • The messages are application constants, so they need no escaping.

      Parameters

      • response: ServerResponse
      • statusCode: number
      • message: string

      Returns void

    • Parameters

      • pending: PendingLogin

      Returns Promise<Server<typeof IncomingMessage, typeof ServerResponse> | undefined>

    • Persists a session before publishing it, rolling back a login write if its attempt lost ownership.

      Parameters

      • credentials: StoredCredentials
      • Optionalpending: PendingLogin

      Returns Promise<boolean>

    • Parses a stored session, rejecting anything that could not be used to authenticate a request.

      Parameters

      • stored: string

      Returns StoredCredentials | undefined