import { z } from "zod"; import type { OAuthConfig as ProtoOAuthConfig, OAuthStepDisplay as ProtoOAuthStepDisplay, OAuthStepLocalizedText as ProtoOAuthStepLocalizedText, OAuthFlowStep as ProtoOAuthFlowStep, OAuthCredentialValidationInput as ProtoCredentialValidationInput, OAuthCredentialValidationResult as ProtoCredentialValidationResult, OAuthProvider as ProtoOAuthProvider, OAuthProviderLocalizedText as ProtoOAuthProviderLocalizedText, OAuthTokenRequestMapping as ProtoTokenRequestMapping, OAuthTokenResponseMapping as ProtoTokenResponseMapping } from "../gen/channel/app/sdk/v1/extension.js"; type ProtoBacked = T & Proto; /** * OAuth standard parameter naming convention. * * - `"snake"` (default): RFC 6749 standard (`client_id`, `redirect_uri`, `response_type`, `grant_type`, `refresh_token`). * Used by Google, Slack, GitHub, and most OAuth 2.0 providers. * - `"camel"`: camelCase (`clientId`, `redirectUri`, `responseType`, `grantType`, `refreshToken`). * Required by some tenant-aware providers such as Imweb. Applies to both authorize URL and token endpoint. */ export declare const ParameterCaseSchema: z.ZodEnum<["snake", "camel"]>; export type ParameterCase = z.infer; export declare const TokenRequestContentTypeSchema: z.ZodEnum<["form", "json"]>; export type TokenRequestContentType = z.infer; export declare const AuthorizationOpenModeSchema: z.ZodEnum<["popup", "currentTab"]>; export type AuthorizationOpenMode = z.infer; /** * OAuth credential ownership and Function hydration policy. * * - channel: always use the shared channel credential * - manager: only a manager caller can use that manager's credential * - caller: use the manager credential for manager callers and the channel * credential for every other caller */ export declare const OAuthAuthScopeSchema: z.ZodEnum<["channel", "manager", "caller"]>; export type OAuthAuthScope = z.infer; export declare const OAuthProviderSupportedLocaleSchema: z.ZodEnum<["ko", "ja", "en"]>; export type OAuthProviderSupportedLocale = z.infer; /** Built-in semantic icons rendered by App Store. No URLs or SVGs. */ export declare const OAuthStepIconSchema: z.ZodEnum<["installation", "account", "organization", "permission", "settings"]>; export type OAuthStepIcon = z.infer; export declare const OAuthStepLocalizedTextSchema: z.ZodObject<{ title: z.ZodOptional; description: z.ZodOptional; }, "strict", z.ZodTypeAny, { description?: string | undefined; title?: string | undefined; }, { description?: string | undefined; title?: string | undefined; }>; export type OAuthStepLocalizedText = ProtoBacked, ProtoOAuthStepLocalizedText>; export declare const OAuthStepDisplaySchema: z.ZodObject<{ title: z.ZodString; description: z.ZodOptional; icon: z.ZodOptional>; i18nMap: z.ZodOptional; description: z.ZodOptional; }, "strict", z.ZodTypeAny, { description?: string | undefined; title?: string | undefined; }, { description?: string | undefined; title?: string | undefined; }>>>; }, "strict", z.ZodTypeAny, { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; }, { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; }>; export type OAuthStepDisplay = ProtoBacked, ProtoOAuthStepDisplay>; export declare const OAuthFlowStepSchema: z.ZodObject<{ id: z.ZodEnum<["before", "oauth", "after"]>; title: z.ZodString; description: z.ZodOptional; icon: z.ZodEnum<["installation", "account", "organization", "permission", "settings"]>; status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "unknown"]>; detail: z.ZodOptional; }, "strict", z.ZodTypeAny, { status: "completed" | "unknown" | "pending" | "in_progress" | "failed"; id: "oauth" | "before" | "after"; title: string; icon: "installation" | "account" | "organization" | "permission" | "settings"; description?: string | undefined; detail?: string | undefined; }, { status: "completed" | "unknown" | "pending" | "in_progress" | "failed"; id: "oauth" | "before" | "after"; title: string; icon: "installation" | "account" | "organization" | "permission" | "settings"; description?: string | undefined; detail?: string | undefined; }>; export type OAuthFlowStep = ProtoBacked, ProtoOAuthFlowStep>; export declare const OAuthProviderLocalizedTextSchema: z.ZodObject<{ providerName: z.ZodOptional; providerDescription: z.ZodOptional; }, "strip", z.ZodTypeAny, { providerName?: string | undefined; providerDescription?: string | undefined; }, { providerName?: string | undefined; providerDescription?: string | undefined; }>; export type OAuthProviderLocalizedText = ProtoBacked, ProtoOAuthProviderLocalizedText>; export declare const OAuthProviderI18nMapSchema: z.ZodEffects; providerDescription: z.ZodOptional; }, "strip", z.ZodTypeAny, { providerName?: string | undefined; providerDescription?: string | undefined; }, { providerName?: string | undefined; providerDescription?: string | undefined; }>>, Record, Record>; export type OAuthProviderI18nMap = z.infer; /** Provider-specific field names used by the outbound token request. */ export declare const OAuthTokenRequestMappingSchema: z.ZodObject<{ /** Defaults to `"code"` when omitted. */ authorizationCodeParamName: z.ZodOptional; }, "strip", z.ZodTypeAny, { authorizationCodeParamName?: string | undefined; }, { authorizationCodeParamName?: string | undefined; }>; export type OAuthTokenRequestMapping = ProtoBacked, ProtoTokenRequestMapping>; /** JSON object paths used to read a provider token response. */ export declare const OAuthTokenResponseMappingSchema: z.ZodObject<{ /** Defaults to `"access_token"` when omitted. */ accessTokenPath: z.ZodOptional; /** Defaults to `"refresh_token"` when omitted. */ refreshTokenPath: z.ZodOptional; /** Defaults to `"expires_in"` when omitted. */ expiresInPath: z.ZodOptional; /** Defaults to `"token_type"` when omitted. */ tokenTypePath: z.ZodOptional; /** Opt-in path for providers that return a refresh-token lifetime. */ refreshTokenExpiresInPath: z.ZodOptional; }, "strip", z.ZodTypeAny, { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; }, { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; }>; export type OAuthTokenResponseMapping = ProtoBacked, ProtoTokenResponseMapping>; /** * OAuth 2.0 provider metadata returned from metadata.getAuthConfig. * * Client credentials are intentionally excluded. AppStore stores and manages * provider client ID/secret separately through Desk APIs/UI. */ export declare const OAuthProviderSchema: z.ZodObject<{ authorizationDisplay: z.ZodOptional; icon: z.ZodOptional>; i18nMap: z.ZodOptional; description: z.ZodOptional; }, "strict", z.ZodTypeAny, { description?: string | undefined; title?: string | undefined; }, { description?: string | undefined; title?: string | undefined; }>>>; }, "strict", z.ZodTypeAny, { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; }, { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; }>>; provider: z.ZodString; authorizationUrl: z.ZodString; tokenUrl: z.ZodString; refreshTokenUrl: z.ZodOptional; scopes: z.ZodArray; providerName: z.ZodString; providerDescription: z.ZodOptional; i18nMap: z.ZodOptional; providerDescription: z.ZodOptional; }, "strip", z.ZodTypeAny, { providerName?: string | undefined; providerDescription?: string | undefined; }, { providerName?: string | undefined; providerDescription?: string | undefined; }>>, Record, Record>>; providerIconUrl: z.ZodOptional; pkceRequired: z.ZodOptional; additionalParams: z.ZodOptional>; /** * OAuth standard parameter naming convention. Defaults to `"snake"` (RFC 6749). * Declare `"camel"` when the provider (e.g. Imweb) requires camelCase keys * on the authorize URL and token endpoint. */ parameterCase: z.ZodOptional>; /** * Token endpoint request body format. Defaults to `"form"` for RFC 6749 * providers, but some providers expect JSON bodies. */ tokenRequestContentType: z.ZodOptional>; /** * OAuth callback query parameter name that contains the authorization code. * Defaults to `"code"`. Some providers, such as Amazon SP-API, use a * provider-specific name. */ authorizationCodeParamName: z.ZodOptional; /** * Browser surface used to open the provider authorization URL. Defaults to * `"popup"`. Declare `"currentTab"` when the provider redirects to a full * Desk/AppStore URL and cannot complete the popup close contract reliably. */ authorizationOpenMode: z.ZodOptional>; /** * Outbound token request mapping. This is intentionally separate from * authorizationCodeParamName, which controls callback query parsing. */ tokenRequest: z.ZodOptional; }, "strip", z.ZodTypeAny, { authorizationCodeParamName?: string | undefined; }, { authorizationCodeParamName?: string | undefined; }>>; /** Token endpoint response JSON object paths. */ tokenResponse: z.ZodOptional; /** Defaults to `"refresh_token"` when omitted. */ refreshTokenPath: z.ZodOptional; /** Defaults to `"expires_in"` when omitted. */ expiresInPath: z.ZodOptional; /** Defaults to `"token_type"` when omitted. */ tokenTypePath: z.ZodOptional; /** Opt-in path for providers that return a refresh-token lifetime. */ refreshTokenExpiresInPath: z.ZodOptional; }, "strip", z.ZodTypeAny, { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; }, { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { providerName: string; provider: string; authorizationUrl: string; tokenUrl: string; scopes: string[]; i18nMap?: Record | undefined; providerDescription?: string | undefined; authorizationCodeParamName?: string | undefined; authorizationDisplay?: { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; } | undefined; refreshTokenUrl?: string | undefined; providerIconUrl?: string | undefined; pkceRequired?: boolean | undefined; additionalParams?: Record | undefined; parameterCase?: "snake" | "camel" | undefined; tokenRequestContentType?: "form" | "json" | undefined; authorizationOpenMode?: "popup" | "currentTab" | undefined; tokenRequest?: { authorizationCodeParamName?: string | undefined; } | undefined; tokenResponse?: { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; } | undefined; }, { providerName: string; provider: string; authorizationUrl: string; tokenUrl: string; scopes: string[]; i18nMap?: Record | undefined; providerDescription?: string | undefined; authorizationCodeParamName?: string | undefined; authorizationDisplay?: { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; } | undefined; refreshTokenUrl?: string | undefined; providerIconUrl?: string | undefined; pkceRequired?: boolean | undefined; additionalParams?: Record | undefined; parameterCase?: "snake" | "camel" | undefined; tokenRequestContentType?: "form" | "json" | undefined; authorizationOpenMode?: "popup" | "currentTab" | undefined; tokenRequest?: { authorizationCodeParamName?: string | undefined; } | undefined; tokenResponse?: { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; } | undefined; }>; export type OAuthProvider = ProtoBacked, ProtoOAuthProvider>; /** * Output schema for extension.oauth.metadata.getAuthConfig. */ export declare const OAuthConfigSchema: z.ZodObject<{ authType: z.ZodLiteral<"oauth">; authScope: z.ZodEnum<["channel", "manager", "caller"]>; oauthProvider: z.ZodObject<{ authorizationDisplay: z.ZodOptional; icon: z.ZodOptional>; i18nMap: z.ZodOptional; description: z.ZodOptional; }, "strict", z.ZodTypeAny, { description?: string | undefined; title?: string | undefined; }, { description?: string | undefined; title?: string | undefined; }>>>; }, "strict", z.ZodTypeAny, { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; }, { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; }>>; provider: z.ZodString; authorizationUrl: z.ZodString; tokenUrl: z.ZodString; refreshTokenUrl: z.ZodOptional; scopes: z.ZodArray; providerName: z.ZodString; providerDescription: z.ZodOptional; i18nMap: z.ZodOptional; providerDescription: z.ZodOptional; }, "strip", z.ZodTypeAny, { providerName?: string | undefined; providerDescription?: string | undefined; }, { providerName?: string | undefined; providerDescription?: string | undefined; }>>, Record, Record>>; providerIconUrl: z.ZodOptional; pkceRequired: z.ZodOptional; additionalParams: z.ZodOptional>; /** * OAuth standard parameter naming convention. Defaults to `"snake"` (RFC 6749). * Declare `"camel"` when the provider (e.g. Imweb) requires camelCase keys * on the authorize URL and token endpoint. */ parameterCase: z.ZodOptional>; /** * Token endpoint request body format. Defaults to `"form"` for RFC 6749 * providers, but some providers expect JSON bodies. */ tokenRequestContentType: z.ZodOptional>; /** * OAuth callback query parameter name that contains the authorization code. * Defaults to `"code"`. Some providers, such as Amazon SP-API, use a * provider-specific name. */ authorizationCodeParamName: z.ZodOptional; /** * Browser surface used to open the provider authorization URL. Defaults to * `"popup"`. Declare `"currentTab"` when the provider redirects to a full * Desk/AppStore URL and cannot complete the popup close contract reliably. */ authorizationOpenMode: z.ZodOptional>; /** * Outbound token request mapping. This is intentionally separate from * authorizationCodeParamName, which controls callback query parsing. */ tokenRequest: z.ZodOptional; }, "strip", z.ZodTypeAny, { authorizationCodeParamName?: string | undefined; }, { authorizationCodeParamName?: string | undefined; }>>; /** Token endpoint response JSON object paths. */ tokenResponse: z.ZodOptional; /** Defaults to `"refresh_token"` when omitted. */ refreshTokenPath: z.ZodOptional; /** Defaults to `"expires_in"` when omitted. */ expiresInPath: z.ZodOptional; /** Defaults to `"token_type"` when omitted. */ tokenTypePath: z.ZodOptional; /** Opt-in path for providers that return a refresh-token lifetime. */ refreshTokenExpiresInPath: z.ZodOptional; }, "strip", z.ZodTypeAny, { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; }, { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { providerName: string; provider: string; authorizationUrl: string; tokenUrl: string; scopes: string[]; i18nMap?: Record | undefined; providerDescription?: string | undefined; authorizationCodeParamName?: string | undefined; authorizationDisplay?: { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; } | undefined; refreshTokenUrl?: string | undefined; providerIconUrl?: string | undefined; pkceRequired?: boolean | undefined; additionalParams?: Record | undefined; parameterCase?: "snake" | "camel" | undefined; tokenRequestContentType?: "form" | "json" | undefined; authorizationOpenMode?: "popup" | "currentTab" | undefined; tokenRequest?: { authorizationCodeParamName?: string | undefined; } | undefined; tokenResponse?: { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; } | undefined; }, { providerName: string; provider: string; authorizationUrl: string; tokenUrl: string; scopes: string[]; i18nMap?: Record | undefined; providerDescription?: string | undefined; authorizationCodeParamName?: string | undefined; authorizationDisplay?: { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; } | undefined; refreshTokenUrl?: string | undefined; providerIconUrl?: string | undefined; pkceRequired?: boolean | undefined; additionalParams?: Record | undefined; parameterCase?: "snake" | "camel" | undefined; tokenRequestContentType?: "form" | "json" | undefined; authorizationOpenMode?: "popup" | "currentTab" | undefined; tokenRequest?: { authorizationCodeParamName?: string | undefined; } | undefined; tokenResponse?: { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; } | undefined; }>; }, "strip", z.ZodTypeAny, { authScope: "manager" | "channel" | "caller"; authType: "oauth"; oauthProvider: { providerName: string; provider: string; authorizationUrl: string; tokenUrl: string; scopes: string[]; i18nMap?: Record | undefined; providerDescription?: string | undefined; authorizationCodeParamName?: string | undefined; authorizationDisplay?: { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; } | undefined; refreshTokenUrl?: string | undefined; providerIconUrl?: string | undefined; pkceRequired?: boolean | undefined; additionalParams?: Record | undefined; parameterCase?: "snake" | "camel" | undefined; tokenRequestContentType?: "form" | "json" | undefined; authorizationOpenMode?: "popup" | "currentTab" | undefined; tokenRequest?: { authorizationCodeParamName?: string | undefined; } | undefined; tokenResponse?: { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; } | undefined; }; }, { authScope: "manager" | "channel" | "caller"; authType: "oauth"; oauthProvider: { providerName: string; provider: string; authorizationUrl: string; tokenUrl: string; scopes: string[]; i18nMap?: Record | undefined; providerDescription?: string | undefined; authorizationCodeParamName?: string | undefined; authorizationDisplay?: { title: string; description?: string | undefined; icon?: "installation" | "account" | "organization" | "permission" | "settings" | undefined; i18nMap?: Record | undefined; } | undefined; refreshTokenUrl?: string | undefined; providerIconUrl?: string | undefined; pkceRequired?: boolean | undefined; additionalParams?: Record | undefined; parameterCase?: "snake" | "camel" | undefined; tokenRequestContentType?: "form" | "json" | undefined; authorizationOpenMode?: "popup" | "currentTab" | undefined; tokenRequest?: { authorizationCodeParamName?: string | undefined; } | undefined; tokenResponse?: { accessTokenPath?: string | undefined; refreshTokenPath?: string | undefined; expiresInPath?: string | undefined; tokenTypePath?: string | undefined; refreshTokenExpiresInPath?: string | undefined; } | undefined; }; }>; export type OAuthConfig = ProtoBacked, ProtoOAuthConfig>; /** * Input schema for extension.oauth.validation.validateCredentials. * * AppStore calls this with an empty params object after token exchange and * injects the decrypted access token into context.authToken. accessToken is * kept optional for local test harnesses and older examples. */ export declare const CredentialValidationInputSchema: z.ZodObject<{ accessToken: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ accessToken: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ accessToken: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; export type CredentialValidationInput = ProtoBacked, ProtoCredentialValidationInput>; /** * Credential validation result schema */ export declare const CredentialValidationResultSchema: z.ZodObject<{ valid: z.ZodBoolean; expiresAt: z.ZodOptional; error: z.ZodOptional; }, "strip", z.ZodTypeAny, { valid: boolean; error?: string | undefined; expiresAt?: string | undefined; }, { valid: boolean; error?: string | undefined; expiresAt?: string | undefined; }>; export type CredentialValidationResult = ProtoBacked, ProtoCredentialValidationResult>; export {}; //# sourceMappingURL=oauth.d.ts.map