import { JWTPayload } from 'hono/utils/jwt/types'; import { Provider } from './provider.js'; import 'hono'; import '../storage/storage.js'; /** * Use this to connect authentication providers that support OIDC. * * ```ts {5-8} * import { OidcProvider } from "@aryalabs/openauth/provider/oidc" * * export default issuer({ * providers: { * oauth2: OidcProvider({ * clientId: "1234567890", * issuer: "https://auth.myserver.com" * }) * } * }) * ``` * * * @packageDocumentation */ interface OidcConfig { /** * @internal */ type?: string; /** * The client ID. * * This is just a string to identify your app. * * @example * ```ts * { * clientID: "my-client" * } * ``` */ clientID: string; /** * The URL of your authorization server. * * @example * ```ts * { * issuer: "https://auth.myserver.com" * } * ``` */ issuer: string; /** * A list of OIDC scopes that you want to request. * * @example * ```ts * { * scopes: ["openid", "profile", "email"] * } * ``` */ scopes?: string[]; /** * Any additional parameters that you want to pass to the authorization endpoint. * @example * ```ts * { * query: { * prompt: "consent" * } * } * ``` */ query?: Record; /** * The response type to use for the OIDC flow. * Use "id_token" for implicit flow or "code" for authorization code flow. * Defaults to "id_token". * * @example * ```ts * { * responseType: "code" * } * ``` */ responseType?: "id_token" | "code"; /** * The client secret, required for authorization code flow. * * @example * ```ts * { * clientSecret: "your-client-secret" * } * ``` */ clientSecret?: string; /** * The token endpoint authentication method. * Defaults to "client_secret_post". * * @example * ```ts * { * tokenEndpointAuthMethod: "client_secret_basic" * } * ``` */ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic"; } /** * @internal */ type OidcWrappedConfig = Omit; /** * @internal */ interface IdTokenResponse { idToken: string; claims: Record; raw: Record; } declare function OidcProvider(config: OidcConfig): Provider<{ id: JWTPayload; clientID: string; }>; export { type IdTokenResponse, type OidcConfig, OidcProvider, type OidcWrappedConfig };