import { ExecutionContext } from "./execution-context"; import { SlackApp } from "./app"; import { SlackOAuthEnv } from "./app-env"; import { InstallationStore } from "./oauth/installation-store"; import { StateStore } from "./oauth/state-store"; import { AfterInstallation, BeforeInstallation, OAuthCallback, OAuthStart, OnFailure, OnStateValidationError } from "./oauth/hook"; import { OpenIDConnectCallback } from "./oidc/hook"; import { OAuthStartPageRenderer, OAuthCompletionPageRenderer, OAuthErrorPageRenderer } from "./oauth/oauth-page-renderer"; import { AssistantThreadContextStore } from "./assistant/thread-context-store"; import { AuthorizeErrorHandler } from "./authorization/authorize-error-handler"; /** * Options for initializing SlackOAuthApp instance. */ export interface SlackOAuthAppOptions { /** * Passed env variables for configuring the app. */ env: E; /** * InstallationStore for managing installation data such as issued OAUth tokens. */ installationStore: InstallationStore; /** * The hoook that handles authorization failure. */ authorizeErrorHandler?: AuthorizeErrorHandler; /** * Server-side store for managing the state parameter string used for general OAuth security. * When this is absent, the OAuth flow uses only web browser cookies to ensure security. */ stateStore?: StateStore; /** * Settings for app-installation OAuth flow. */ oauth?: { stateCookieName?: string; beforeInstallation?: BeforeInstallation; afterInstallation?: AfterInstallation; onFailure?: OnFailure; onFailureRenderer?: OAuthErrorPageRenderer; onStateValidationError?: OnStateValidationError; onStateValidationRenderer?: OAuthErrorPageRenderer; redirectUri?: string; start?: OAuthStart; startImmediateRedirect?: boolean; startRenderer?: OAuthStartPageRenderer; callback?: OAuthCallback; callbackRenderer?: OAuthCompletionPageRenderer; }; /** * Settings for Sign in with Slack (SIWS / OpenID Connect) * * @see https://api.slack.com/authentication/sign-in-with-slack */ oidc?: { stateCookieName?: string; start?: OAuthStart; startImmediateRedirect?: boolean; startRenderer?: OAuthStartPageRenderer; callback: OpenIDConnectCallback; onFailure?: OnFailure; onFailureRenderer?: OAuthErrorPageRenderer; onStateValidationError?: OnStateValidationError; onStateValidationRenderer?: OAuthErrorPageRenderer; redirectUri?: string; }; /** * The endpoint routes to handle requests from Slack's API server. * When this app connects to Slack through Socket Mode, this setting won't be used. */ routes?: { events: string; oauth: { start: string; callback: string; }; oidc?: { start: string; callback: string; }; }; /** * When this is set to true, all lazy listeners are invoked after the ack function completion. * The default is set to false. */ startLazyListenerAfterAck?: boolean; /** * When this is set to false, the built-in ignoringSelfEvents middleware is disabled. * The default is set to true. */ ignoreSelfEvents?: boolean; /** * Your custom assistant thread context store implementation. */ assistantThreadContextStore?: AssistantThreadContextStore; } /** * The class representing a Slack app process * that handles both event requests and the OAuth flow for app installation. */ export declare class SlackOAuthApp extends SlackApp { #private; /** * Passed env variables for configuring the app. */ env: E; /** * InstallationStore for managing installation data such as issued OAUth tokens. */ installationStore: InstallationStore; /** * Server-side store for managing the state parameter string used for general OAuth security. * When this is absent, the OAuth flow uses only web browser cookies to ensure security. */ stateStore: StateStore; /** * Settings for app-installation OAuth flow. */ oauth: { stateCookieName?: string; beforeInstallation?: BeforeInstallation; afterInstallation?: AfterInstallation; onFailure: OnFailure; onStateValidationError: OnStateValidationError; redirectUri?: string; start: OAuthStart; callback: OAuthCallback; }; /** * Settings for Sign in with Slack (SIWS / OpenID Connect) * * @see https://api.slack.com/authentication/sign-in-with-slack */ oidc?: { stateCookieName?: string; start: OAuthStart; callback: OpenIDConnectCallback; onFailure: OnFailure; onStateValidationError: OnStateValidationError; redirectUri?: string; }; /** * The endpoint routes to handle requests from Slack's API server. * When this app connects to Slack through Socket Mode, this setting won't be used. */ routes: { events: string; oauth: { start: string; callback: string; }; oidc?: { start: string; callback: string; }; }; constructor(options: SlackOAuthAppOptions); run(request: Request, ctx?: ExecutionContext): Promise; /** * Handles an HTTP request from Slack's API server and returns a response to it. * @param request request * @param ctx execution context * @returns response */ handleEventRequest(request: Request, ctx: ExecutionContext): Promise; /** * Handles an HTTP request to initiate the app-installation OAuth flow within a web browser. * @param request request * @returns response */ handleOAuthStartRequest(request: Request): Promise; /** * Handles an HTTP request to handle the app-installation OAuth flow callback within a web browser. * @param request request * @returns response */ handleOAuthCallbackRequest(request: Request): Promise; /** * Handles an HTTP request to initiate the SIWS flow within a web browser. * @param request request * @returns response */ handleOIDCStartRequest(request: Request): Promise; /** * Handles an HTTP request to handle the SIWS callback within a web browser. * @param request request * @returns response */ handleOIDCCallbackRequest(request: Request): Promise; } //# sourceMappingURL=oauth-app.d.ts.map