kavachos 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { a5 as AuthAdapter, o as ResolvedUser, X as KavachPlugin, D as Database, _ as AdminConfig, p as SessionManager, a2 as ApiKeyManagerConfig, aa as EmailOtpConfig, P as Permission, ae as MagicLinkConfig, aj as OrgConfig, ao as PasskeyConfig, N as PluginEndpoint, aF as TotpConfig } from '../types-RJPOU4un.js';
3
3
  export { u as AdminModule, $ as AdminUser, a1 as ApiKey, v as ApiKeyManagerModule, a6 as CaptchaConfig, G as CaptchaModule, a7 as CaptchaVerifyResult, a8 as CreateTokenInput, E as EmailOtpModule, ab as EmailVerificationConfig, y as EmailVerificationModule, r as MagicLinkModule, ag as OidcProvider, ah as OneTimeTokenConfig, z as OneTimeTokenModule, ai as OneTimeTokenPurpose, ak as OrgInvitation, al as OrgMember, O as OrgModule, am as OrgRole, an as Organization, ap as PasskeyCredential, s as PasskeyModule, aq as PasswordResetConfig, x as PasswordResetModule, as as PhoneAuthConfig, F as PhoneAuthModule, av as RevokeTokensResult, aw as SSO_ERROR, ax as SamlProvider, aA as SsoAuditEvent, aB as SsoConfig, aC as SsoConnection, aD as SsoError, t as SsoModule, T as TotpModule, aG as TotpSetup, aH as UsernameAuthConfig, w as UsernameAuthModule, aI as ValidateTokenResult, bu as WebhookConfig, bv as WebhookEvent, W as WebhookModule, aS as createAdminModule, aT as createApiKeyManagerModule, aV as createCaptchaModule, aY as createEmailOtpModule, aZ as createEmailVerificationModule, a_ as createMagicLinkModule, a$ as createOneTimeTokenModule, b0 as createOrgModule, b1 as createPasskeyModule, b2 as createPasswordResetModule, b3 as createPhoneAuthModule, b6 as createSsoModule, b7 as createTotpModule, b8 as createUsernameAuthModule, bw as createWebhookModule } from '../types-RJPOU4un.js';
4
4
  import { R as Result } from '../types-BiUe9e8u.js';
5
+ import { AgentType, TrustTier } from '../standards/index.js';
5
6
  import * as jose from 'jose';
6
7
  import 'drizzle-orm/sqlite-core';
7
8
  import '../redirect/index.js';
@@ -982,37 +983,6 @@ declare class HibpApiError extends Error {
982
983
  constructor(message: string);
983
984
  }
984
985
 
985
- /**
986
- * IETF agentic JWT claim name constants.
987
- *
988
- * Sources:
989
- * - draft-goswami-agentic-jwt-00
990
- * - draft-liu-agent-operation-authorization-01
991
- *
992
- * These constants are off by default. Set `emitAgenticJwtClaims: true` in
993
- * KavachConfig to include them in issued tokens.
994
- */
995
- /**
996
- * Operational mode of an agent within a delegation chain.
997
- *
998
- * - `autonomous` — no human-in-the-loop; the agent acts on its own behalf.
999
- * - `delegated` — the agent is acting under explicit delegation from another principal.
1000
- * - `supervised` — the agent acts autonomously but requires human approval for sensitive ops.
1001
- */
1002
- type AgentType = "autonomous" | "delegated" | "supervised";
1003
- /**
1004
- * Trust tier band assigned at token issuance, derived from the numeric trust
1005
- * score. Matches the five-level model in KavachOS trust scoring.
1006
- *
1007
- * Mapping (inclusive lower bound):
1008
- * score 0–19 → "unverified"
1009
- * score 20–39 → "low"
1010
- * score 40–59 → "standard"
1011
- * score 60–79 → "elevated"
1012
- * score 80+ → "high"
1013
- */
1014
- type TrustTier = "unverified" | "low" | "standard" | "elevated" | "high";
1015
-
1016
986
  /**
1017
987
  * JWT session plugin for KavachOS.
1018
988
  *
@@ -1510,6 +1480,41 @@ declare function oauth(config: OAuthPluginConfig): KavachPlugin;
1510
1480
  */
1511
1481
  declare function createAppleProvider(config: OAuthProviderConfig): OAuthProvider;
1512
1482
 
1483
+ /**
1484
+ * Atlassian OAuth 2.0 (3LO) provider.
1485
+ *
1486
+ * Endpoints:
1487
+ * - Authorization: https://auth.atlassian.com/authorize
1488
+ * - Token: https://auth.atlassian.com/oauth/token
1489
+ * - UserInfo: https://api.atlassian.com/me
1490
+ *
1491
+ * Notes:
1492
+ * - PKCE S256 is supported by Atlassian's OAuth 2.0 implementation.
1493
+ * - The `audience` parameter (`api.atlassian.com`) is required on the
1494
+ * authorization URL. Without it, tokens will not be accepted by the
1495
+ * Atlassian APIs.
1496
+ * - The `read:me` scope grants access to the user's identity (account ID,
1497
+ * email, name, avatar). Add `offline_access` if refresh tokens are needed.
1498
+ * - Atlassian account IDs are in the format `557058:xxxxxxxx-xxxx-...`.
1499
+ *
1500
+ * Docs: https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/
1501
+ */
1502
+
1503
+ declare const DEFAULT_ATLASSIAN_SCOPES: string[];
1504
+ declare function normalizeProfile$9(raw: Record<string, unknown>): OAuthUserInfo;
1505
+ /**
1506
+ * Create an Atlassian OAuth provider instance.
1507
+ *
1508
+ * @example
1509
+ * ```typescript
1510
+ * const atlassian = createAtlassianProvider({
1511
+ * clientId: process.env.ATLASSIAN_CLIENT_ID,
1512
+ * clientSecret: process.env.ATLASSIAN_CLIENT_SECRET,
1513
+ * });
1514
+ * ```
1515
+ */
1516
+ declare function createAtlassianProvider(config: OAuthProviderConfig): OAuthProvider;
1517
+
1513
1518
  /**
1514
1519
  * Discord OAuth 2.0 provider.
1515
1520
  *
@@ -1530,6 +1535,7 @@ declare function createAppleProvider(config: OAuthProviderConfig): OAuthProvider
1530
1535
  * Docs: https://discord.com/developers/docs/topics/oauth2
1531
1536
  */
1532
1537
 
1538
+ declare const DEFAULT_DISCORD_SCOPES: string[];
1533
1539
  /**
1534
1540
  * Create a Discord OAuth provider instance.
1535
1541
  *
@@ -1542,6 +1548,141 @@ declare function createAppleProvider(config: OAuthProviderConfig): OAuthProvider
1542
1548
  * ```
1543
1549
  */
1544
1550
  declare function createDiscordProvider(config: OAuthProviderConfig): OAuthProvider;
1551
+ declare function normalizeProfile$8(raw: Record<string, unknown>): OAuthUserInfo;
1552
+
1553
+ /**
1554
+ * Dropbox OAuth 2.0 provider.
1555
+ *
1556
+ * Endpoints:
1557
+ * - Authorization: https://www.dropbox.com/oauth2/authorize
1558
+ * - Token: https://api.dropboxapi.com/oauth2/token
1559
+ * - UserInfo: https://api.dropboxapi.com/2/users/get_current_account (POST)
1560
+ *
1561
+ * Notes:
1562
+ * - PKCE S256 is supported by Dropbox's OAuth 2.0 implementation (since 2021).
1563
+ * - The userinfo endpoint is a POST with an empty body (JSON null is the
1564
+ * documented request body). No query params are needed.
1565
+ * - The `account_info.read` scope grants access to basic account info including
1566
+ * email, name, and account ID.
1567
+ * - Dropbox account IDs start with "dbid:" and are stable across sessions.
1568
+ * - The `name` object contains `display_name`, `given_name`, `surname`, etc.
1569
+ *
1570
+ * Docs: https://developers.dropbox.com/oauth-guide
1571
+ */
1572
+
1573
+ declare const DEFAULT_DROPBOX_SCOPES: string[];
1574
+ declare function normalizeProfile$7(raw: Record<string, unknown>): OAuthUserInfo;
1575
+ /**
1576
+ * Create a Dropbox OAuth provider instance.
1577
+ *
1578
+ * @example
1579
+ * ```typescript
1580
+ * const dropbox = createDropboxProvider({
1581
+ * clientId: process.env.DROPBOX_CLIENT_ID,
1582
+ * clientSecret: process.env.DROPBOX_CLIENT_SECRET,
1583
+ * });
1584
+ * ```
1585
+ */
1586
+ declare function createDropboxProvider(config: OAuthProviderConfig): OAuthProvider;
1587
+
1588
+ /**
1589
+ * Figma OAuth 2.0 provider.
1590
+ *
1591
+ * Endpoints:
1592
+ * - Authorization: https://www.figma.com/oauth
1593
+ * - Token: https://api.figma.com/v1/oauth/token
1594
+ * - UserInfo: https://api.figma.com/v1/me
1595
+ *
1596
+ * Notes:
1597
+ * - PKCE S256 is supported by Figma's OAuth implementation.
1598
+ * - The `file_read` scope is the minimum required for sign-in; it grants
1599
+ * read access to files, projects, and user information.
1600
+ * - The email address is always returned; Figma accounts always have one.
1601
+ *
1602
+ * Docs: https://www.figma.com/developers/api#authentication
1603
+ */
1604
+
1605
+ declare const DEFAULT_FIGMA_SCOPES: string[];
1606
+ declare function normalizeProfile$6(raw: Record<string, unknown>): OAuthUserInfo;
1607
+ /**
1608
+ * Create a Figma OAuth provider instance.
1609
+ *
1610
+ * @example
1611
+ * ```typescript
1612
+ * const figma = createFigmaProvider({
1613
+ * clientId: process.env.FIGMA_CLIENT_ID,
1614
+ * clientSecret: process.env.FIGMA_CLIENT_SECRET,
1615
+ * });
1616
+ * ```
1617
+ */
1618
+ declare function createFigmaProvider(config: OAuthProviderConfig): OAuthProvider;
1619
+
1620
+ /**
1621
+ * Generic OIDC provider factory.
1622
+ *
1623
+ * Builds a fully functional OAuthProvider from a minimal config. When an
1624
+ * OIDC issuer URL is supplied the factory constructs the standard
1625
+ * `/.well-known/openid-configuration` discovery URL. Explicit endpoint
1626
+ * overrides take precedence over discovery, so the factory works with
1627
+ * providers that do not implement RFC 8414.
1628
+ *
1629
+ * Spec references:
1630
+ * - OIDC Discovery: https://openid.net/specs/openid-connect-discovery-1_0.html
1631
+ * - RFC 8414 (OAuth 2.0 Authorization Server Metadata)
1632
+ */
1633
+
1634
+ interface GenericOIDCConfig {
1635
+ /** Machine-readable provider ID, e.g. `'okta'`, `'auth0'`. */
1636
+ id: string;
1637
+ /** Human-readable display name, e.g. `'Okta'`. */
1638
+ name: string;
1639
+ /**
1640
+ * OIDC issuer URL. Used to derive the discovery document URL as
1641
+ * `${issuer}/.well-known/openid-configuration` when explicit endpoint
1642
+ * overrides are not provided.
1643
+ *
1644
+ * @example "https://dev-12345678.okta.com"
1645
+ */
1646
+ issuer: string;
1647
+ /** OAuth application client ID. */
1648
+ clientId: string;
1649
+ /** OAuth application client secret. */
1650
+ clientSecret: string;
1651
+ /**
1652
+ * Scopes to request. Defaults to `['openid', 'email', 'profile']`.
1653
+ */
1654
+ scopes?: string[];
1655
+ /**
1656
+ * Override the redirect URI registered with the provider.
1657
+ * When omitted the URI passed at call time is used.
1658
+ */
1659
+ redirectUri?: string;
1660
+ /** Authorization endpoint. Overrides discovery. */
1661
+ authorizationUrl?: string;
1662
+ /** Token endpoint. Overrides discovery. */
1663
+ tokenUrl?: string;
1664
+ /** UserInfo endpoint. Overrides discovery. */
1665
+ userinfoUrl?: string;
1666
+ }
1667
+ /**
1668
+ * Create an OAuthProvider backed by a standard OIDC issuer.
1669
+ *
1670
+ * Endpoints are resolved from the issuer's discovery document on first use
1671
+ * and cached in memory for the lifetime of the process. Pass explicit
1672
+ * `authorizationUrl`, `tokenUrl`, and `userinfoUrl` to bypass discovery.
1673
+ *
1674
+ * @example
1675
+ * ```typescript
1676
+ * const okta = genericOIDC({
1677
+ * id: "okta",
1678
+ * name: "Okta",
1679
+ * issuer: "https://dev-12345678.okta.com",
1680
+ * clientId: process.env.OKTA_CLIENT_ID,
1681
+ * clientSecret: process.env.OKTA_CLIENT_SECRET,
1682
+ * });
1683
+ * ```
1684
+ */
1685
+ declare function genericOIDC(config: GenericOIDCConfig): OAuthProvider;
1545
1686
 
1546
1687
  /**
1547
1688
  * GitHub OAuth 2.0 provider.
@@ -1702,6 +1843,309 @@ declare function createLinkedInProvider(config: OAuthProviderConfig): OAuthProvi
1702
1843
  */
1703
1844
  declare function createMicrosoftProvider(config: OAuthProviderConfig): OAuthProvider;
1704
1845
 
1846
+ /**
1847
+ * Notion OAuth 2.0 provider.
1848
+ *
1849
+ * Endpoints:
1850
+ * - Authorization: https://api.notion.com/v1/oauth/authorize
1851
+ * - Token: https://api.notion.com/v1/oauth/token
1852
+ * - UserInfo: embedded in the token response (`owner` field)
1853
+ *
1854
+ * Notes:
1855
+ * - Notion does not have a separate UserInfo endpoint. User identity is
1856
+ * returned as part of the token exchange response inside `owner.user`.
1857
+ * The provider captures the token response in a closure so that
1858
+ * `getUserInfo` can extract it without a redundant network call.
1859
+ * - The token endpoint uses HTTP Basic auth (client_id:client_secret).
1860
+ * - All Notion API requests require the `Notion-Version` header.
1861
+ * - Notion uses integration-level permissions rather than OAuth scopes.
1862
+ * Workspaces a user authorizes appear in `workspace_id` / `workspace_name`
1863
+ * in the token response.
1864
+ * - The `owner.user.person.email` field is present only when the integration
1865
+ * is authorized by a person (not a bot). For bot authorizations
1866
+ * `owner.type` is `"workspace"` and `email` may be absent.
1867
+ * - PKCE is not documented by Notion; the code_challenge is omitted for
1868
+ * compatibility with their authorization server.
1869
+ *
1870
+ * Docs: https://developers.notion.com/docs/authorization
1871
+ */
1872
+
1873
+ declare const DEFAULT_NOTION_SCOPES: string[];
1874
+ declare function normalizeProfile$5(raw: Record<string, unknown>): OAuthUserInfo;
1875
+ /**
1876
+ * Create a Notion OAuth provider instance.
1877
+ *
1878
+ * @example
1879
+ * ```typescript
1880
+ * const notion = createNotionProvider({
1881
+ * clientId: process.env.NOTION_CLIENT_ID,
1882
+ * clientSecret: process.env.NOTION_CLIENT_SECRET,
1883
+ * });
1884
+ * ```
1885
+ */
1886
+ declare function createNotionProvider(config: OAuthProviderConfig): OAuthProvider;
1887
+
1888
+ /**
1889
+ * Preset OAuth provider configs.
1890
+ *
1891
+ * Each export is a factory function that takes `(clientId, clientSecret)`
1892
+ * and returns a config accepted by `genericOIDC` or usable directly as a
1893
+ * plain provider when the provider does not support OIDC discovery.
1894
+ *
1895
+ * OIDC-capable providers (Auth0, Okta) use `genericOIDC` and require the
1896
+ * caller to supply their tenant/domain as a third argument.
1897
+ *
1898
+ * All other presets return a `GenericOIDCConfig`-compatible object with
1899
+ * explicit endpoints so they work without any network discovery call.
1900
+ */
1901
+
1902
+ /**
1903
+ * Facebook (Meta) OAuth 2.0.
1904
+ *
1905
+ * Docs: https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow
1906
+ */
1907
+ declare function facebookProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1908
+ /**
1909
+ * Spotify OAuth 2.0.
1910
+ *
1911
+ * Docs: https://developer.spotify.com/documentation/web-api/concepts/authorization
1912
+ */
1913
+ declare function spotifyProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1914
+ /**
1915
+ * Twitch OAuth 2.0 / OIDC.
1916
+ *
1917
+ * Docs: https://dev.twitch.tv/docs/authentication
1918
+ */
1919
+ declare function twitchProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1920
+ /**
1921
+ * Reddit OAuth 2.0.
1922
+ *
1923
+ * Docs: https://github.com/reddit-archive/reddit/wiki/OAuth2
1924
+ */
1925
+ declare function redditProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1926
+ /**
1927
+ * Dropbox OAuth 2.0.
1928
+ *
1929
+ * Docs: https://developers.dropbox.com/oauth-guide
1930
+ */
1931
+ declare function dropboxProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1932
+ /**
1933
+ * Zoom OAuth 2.0 / OIDC.
1934
+ *
1935
+ * Docs: https://developers.zoom.us/docs/integrations/oauth/
1936
+ */
1937
+ declare function zoomProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1938
+ /**
1939
+ * Notion OAuth 2.0.
1940
+ *
1941
+ * Docs: https://developers.notion.com/docs/authorization
1942
+ */
1943
+ declare function notionProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1944
+ /**
1945
+ * Figma OAuth 2.0.
1946
+ *
1947
+ * Docs: https://www.figma.com/developers/api#authentication
1948
+ */
1949
+ declare function figmaProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1950
+ /**
1951
+ * Bitbucket OAuth 2.0.
1952
+ *
1953
+ * Docs: https://developer.atlassian.com/cloud/bitbucket/oauth-2/
1954
+ */
1955
+ declare function bitbucketProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1956
+ /**
1957
+ * Atlassian OAuth 2.0 (Jira, Confluence, etc.).
1958
+ *
1959
+ * Docs: https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/
1960
+ */
1961
+ declare function atlassianProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1962
+ /**
1963
+ * Yahoo OAuth 2.0 / OIDC.
1964
+ *
1965
+ * Docs: https://developer.yahoo.com/oauth2/guide/
1966
+ */
1967
+ declare function yahooProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1968
+ /**
1969
+ * LINE Login OAuth 2.0 / OIDC.
1970
+ *
1971
+ * Docs: https://developers.line.biz/en/docs/line-login/integrate-line-login/
1972
+ */
1973
+ declare function lineProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1974
+ /**
1975
+ * Coinbase OAuth 2.0.
1976
+ *
1977
+ * Docs: https://docs.cdp.coinbase.com/coinbase-app/docs/coinbase-connect-reference
1978
+ */
1979
+ declare function coinbaseProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1980
+ /**
1981
+ * TikTok OAuth 2.0.
1982
+ *
1983
+ * Docs: https://developers.tiktok.com/doc/oauth-user-access-token-management
1984
+ */
1985
+ declare function tiktokProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1986
+ /**
1987
+ * PayPal OAuth 2.0 / OIDC.
1988
+ *
1989
+ * Docs: https://developer.paypal.com/api/rest/authentication/
1990
+ */
1991
+ declare function paypalProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1992
+ /**
1993
+ * Salesforce OAuth 2.0 / OIDC.
1994
+ *
1995
+ * Docs: https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_flows.htm
1996
+ */
1997
+ declare function salesforceProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
1998
+ /**
1999
+ * VK ID OAuth 2.0.
2000
+ *
2001
+ * Docs: https://id.vk.com/about/business/go/docs/ru/vkid/latest/vkid/sdk/web/get-started
2002
+ */
2003
+ declare function vkProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2004
+ /**
2005
+ * Kakao OAuth 2.0.
2006
+ *
2007
+ * Docs: https://developers.kakao.com/docs/latest/en/kakaologin/rest-api
2008
+ */
2009
+ declare function kakaoProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2010
+ /**
2011
+ * Naver OAuth 2.0.
2012
+ *
2013
+ * Docs: https://developers.naver.com/docs/login/api/api.md
2014
+ */
2015
+ declare function naverProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2016
+ /**
2017
+ * Hugging Face OAuth 2.0 / OIDC.
2018
+ *
2019
+ * Docs: https://huggingface.co/docs/hub/en/oauth
2020
+ */
2021
+ declare function huggingfaceProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2022
+ /**
2023
+ * Roblox OAuth 2.0 / OIDC.
2024
+ *
2025
+ * Docs: https://create.roblox.com/docs/cloud/open-cloud/oauth2-overview
2026
+ */
2027
+ declare function robloxProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2028
+ /**
2029
+ * Vercel OAuth 2.0.
2030
+ *
2031
+ * Docs: https://vercel.com/docs/integrations/create-integration/submit-integration#oauth2
2032
+ */
2033
+ declare function vercelProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2034
+ /**
2035
+ * Linear OAuth 2.0.
2036
+ *
2037
+ * Docs: https://developers.linear.app/docs/oauth/authentication
2038
+ */
2039
+ declare function linearProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2040
+ /**
2041
+ * Railway OAuth 2.0.
2042
+ *
2043
+ * Docs: https://docs.railway.app/reference/public-api#oauth2
2044
+ */
2045
+ declare function railwayProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2046
+ /**
2047
+ * Kick OAuth 2.0.
2048
+ *
2049
+ * Docs: https://docs.kick.com/getting-started/authorization-oauth2-flow
2050
+ */
2051
+ declare function kickProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2052
+ /**
2053
+ * WeChat OAuth 2.0 (Web Login via QR code).
2054
+ *
2055
+ * Docs: https://developers.weixin.qq.com/doc/oplatform/en/Website_App/WeChat_Login/Wechat_Login.html
2056
+ */
2057
+ declare function wechatProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2058
+ /**
2059
+ * Polar OAuth 2.0 / OIDC.
2060
+ *
2061
+ * Docs: https://docs.polar.sh/api-reference/oauth2
2062
+ */
2063
+ declare function polarProvider(clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2064
+ /**
2065
+ * Auth0 OIDC provider.
2066
+ *
2067
+ * Requires the Auth0 tenant domain (e.g. `"dev-abc123.us.auth0.com"`).
2068
+ *
2069
+ * Docs: https://auth0.com/docs/authenticate/protocols/openid-connect-protocol
2070
+ *
2071
+ * @example
2072
+ * ```typescript
2073
+ * const auth0 = auth0Provider("dev-abc123.us.auth0.com", clientId, clientSecret);
2074
+ * ```
2075
+ */
2076
+ declare function auth0Provider(domain: string, clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2077
+ /**
2078
+ * Okta OIDC provider.
2079
+ *
2080
+ * Requires the Okta domain (e.g. `"dev-12345678.okta.com"`).
2081
+ *
2082
+ * Docs: https://developer.okta.com/docs/guides/implement-grant-type/authcode/main/
2083
+ *
2084
+ * @example
2085
+ * ```typescript
2086
+ * const okta = oktaProvider("dev-12345678.okta.com", clientId, clientSecret);
2087
+ * ```
2088
+ */
2089
+ declare function oktaProvider(domain: string, clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2090
+ /**
2091
+ * AWS Cognito OIDC provider.
2092
+ *
2093
+ * Requires the Cognito hosted UI domain (e.g. `"my-app.auth.us-east-1.amazoncognito.com"`).
2094
+ *
2095
+ * Docs: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html
2096
+ *
2097
+ * @example
2098
+ * ```typescript
2099
+ * const cognito = cognitoProvider(
2100
+ * "my-app.auth.us-east-1.amazoncognito.com",
2101
+ * clientId,
2102
+ * clientSecret,
2103
+ * );
2104
+ * ```
2105
+ */
2106
+ declare function cognitoProvider(domain: string, clientId: string, clientSecret: string, scopes?: string[]): OAuthProvider;
2107
+
2108
+ /**
2109
+ * Reddit OAuth 2.0 provider.
2110
+ *
2111
+ * Endpoints:
2112
+ * - Authorization: https://www.reddit.com/api/v1/authorize
2113
+ * - Token: https://www.reddit.com/api/v1/access_token
2114
+ * - UserInfo: https://oauth.reddit.com/api/v1/me
2115
+ *
2116
+ * Notes:
2117
+ * - Reddit's token endpoint uses HTTP Basic authentication (client_id as the
2118
+ * username, client_secret as the password) rather than posting credentials
2119
+ * in the request body.
2120
+ * - The `identity` scope grants access to the user's Reddit account info.
2121
+ * - Reddit does not expose the user's email address via OAuth; the `name`
2122
+ * field (Reddit username) is the stable identifier.
2123
+ * - The UserInfo endpoint requires a descriptive `User-Agent` header. Reddit
2124
+ * blocks requests with generic agents (e.g., "python-requests"). Format:
2125
+ * `platform:app_id:version (by /u/username)`.
2126
+ * - Avatar URLs (`icon_img`) include query parameters; strip them when storing
2127
+ * to avoid caching issues.
2128
+ * - PKCE is supported but Reddit also accepts flows without it for server-side
2129
+ * apps; KavachOS uses PKCE S256 consistently.
2130
+ *
2131
+ * Docs: https://www.reddit.com/dev/api/oauth
2132
+ */
2133
+
2134
+ declare const DEFAULT_REDDIT_SCOPES: string[];
2135
+ /**
2136
+ * Create a Reddit OAuth provider instance.
2137
+ *
2138
+ * @example
2139
+ * ```typescript
2140
+ * const reddit = createRedditProvider({
2141
+ * clientId: process.env.REDDIT_CLIENT_ID,
2142
+ * clientSecret: process.env.REDDIT_CLIENT_SECRET,
2143
+ * });
2144
+ * ```
2145
+ */
2146
+ declare function createRedditProvider(config: OAuthProviderConfig): OAuthProvider;
2147
+ declare function normalizeProfile$4(raw: Record<string, unknown>): OAuthUserInfo;
2148
+
1705
2149
  /**
1706
2150
  * Slack OAuth 2.0 / OIDC provider.
1707
2151
  *
@@ -1725,6 +2169,7 @@ declare function createMicrosoftProvider(config: OAuthProviderConfig): OAuthProv
1725
2169
  * Docs: https://api.slack.com/authentication/sign-in-with-slack
1726
2170
  */
1727
2171
 
2172
+ declare const DEFAULT_SLACK_SCOPES: string[];
1728
2173
  /**
1729
2174
  * Create a Slack OAuth provider instance.
1730
2175
  *
@@ -1737,6 +2182,79 @@ declare function createMicrosoftProvider(config: OAuthProviderConfig): OAuthProv
1737
2182
  * ```
1738
2183
  */
1739
2184
  declare function createSlackProvider(config: OAuthProviderConfig): OAuthProvider;
2185
+ declare function normalizeProfile$3(raw: Record<string, unknown>): OAuthUserInfo;
2186
+
2187
+ /**
2188
+ * Spotify OAuth 2.0 provider.
2189
+ *
2190
+ * Endpoints:
2191
+ * - Authorization: https://accounts.spotify.com/authorize
2192
+ * - Token: https://accounts.spotify.com/api/token
2193
+ * - UserInfo: https://api.spotify.com/v1/me
2194
+ *
2195
+ * Notes:
2196
+ * - PKCE S256 is supported and encouraged for public clients.
2197
+ * - The `user-read-email` scope is required to get the user's email.
2198
+ * - The `user-read-private` scope is required to access the user's country
2199
+ * and subscription type. Both are included in the defaults for sign-in.
2200
+ * - Email may be absent from the response when the account was created without
2201
+ * one (e.g., via Facebook sign-up on Spotify). Handle the undefined case.
2202
+ * - Avatar images are returned as an array of `images`; the first entry is
2203
+ * typically the largest.
2204
+ *
2205
+ * Docs: https://developer.spotify.com/documentation/web-api/concepts/authorization
2206
+ */
2207
+
2208
+ declare const DEFAULT_SPOTIFY_SCOPES: string[];
2209
+ declare function normalizeProfile$2(raw: Record<string, unknown>): OAuthUserInfo;
2210
+ /**
2211
+ * Create a Spotify OAuth provider instance.
2212
+ *
2213
+ * @example
2214
+ * ```typescript
2215
+ * const spotify = createSpotifyProvider({
2216
+ * clientId: process.env.SPOTIFY_CLIENT_ID,
2217
+ * clientSecret: process.env.SPOTIFY_CLIENT_SECRET,
2218
+ * });
2219
+ * ```
2220
+ */
2221
+ declare function createSpotifyProvider(config: OAuthProviderConfig): OAuthProvider;
2222
+
2223
+ /**
2224
+ * Twitch OAuth 2.0 provider.
2225
+ *
2226
+ * Endpoints:
2227
+ * - Authorization: https://id.twitch.tv/oauth2/authorize
2228
+ * - Token: https://id.twitch.tv/oauth2/token
2229
+ * - UserInfo: https://api.twitch.tv/helix/users
2230
+ *
2231
+ * Notes:
2232
+ * - PKCE S256 is supported by the Twitch OAuth 2.0 implementation.
2233
+ * - The `user:read:email` scope is required to receive the user's email address.
2234
+ * - The UserInfo endpoint (/helix/users) requires a `Client-ID` header in
2235
+ * addition to the Bearer token. Without it the request returns 400.
2236
+ * - User data is nested under a `data` array; the authenticated user is always
2237
+ * the first element.
2238
+ * - Profile image URLs are direct CDN links and may change when the user
2239
+ * updates their profile picture.
2240
+ *
2241
+ * Docs: https://dev.twitch.tv/docs/authentication/
2242
+ */
2243
+
2244
+ declare const DEFAULT_TWITCH_SCOPES: string[];
2245
+ /**
2246
+ * Create a Twitch OAuth provider instance.
2247
+ *
2248
+ * @example
2249
+ * ```typescript
2250
+ * const twitch = createTwitchProvider({
2251
+ * clientId: process.env.TWITCH_CLIENT_ID,
2252
+ * clientSecret: process.env.TWITCH_CLIENT_SECRET,
2253
+ * });
2254
+ * ```
2255
+ */
2256
+ declare function createTwitchProvider(config: OAuthProviderConfig): OAuthProvider;
2257
+ declare function normalizeProfile$1(raw: Record<string, unknown>): OAuthUserInfo;
1740
2258
 
1741
2259
  /**
1742
2260
  * Twitter / X OAuth 2.0 provider.
@@ -1778,6 +2296,39 @@ declare function createSlackProvider(config: OAuthProviderConfig): OAuthProvider
1778
2296
  */
1779
2297
  declare function createTwitterProvider(config: OAuthProviderConfig): OAuthProvider;
1780
2298
 
2299
+ /**
2300
+ * Zoom OAuth 2.0 provider.
2301
+ *
2302
+ * Endpoints:
2303
+ * - Authorization: https://zoom.us/oauth/authorize
2304
+ * - Token: https://zoom.us/oauth/token
2305
+ * - UserInfo: https://api.zoom.us/v2/users/me
2306
+ *
2307
+ * Notes:
2308
+ * - PKCE S256 is supported by Zoom's OAuth implementation.
2309
+ * - The `user:read` scope grants read access to the authenticated user's
2310
+ * account details including email, name, and profile picture.
2311
+ * - Zoom user IDs are alphanumeric strings, not numeric.
2312
+ * - The `pic_url` field may be absent when the user has not set a profile photo.
2313
+ *
2314
+ * Docs: https://developers.zoom.us/docs/integrations/oauth/
2315
+ */
2316
+
2317
+ declare const DEFAULT_ZOOM_SCOPES: string[];
2318
+ declare function normalizeProfile(raw: Record<string, unknown>): OAuthUserInfo;
2319
+ /**
2320
+ * Create a Zoom OAuth provider instance.
2321
+ *
2322
+ * @example
2323
+ * ```typescript
2324
+ * const zoom = createZoomProvider({
2325
+ * clientId: process.env.ZOOM_CLIENT_ID,
2326
+ * clientSecret: process.env.ZOOM_CLIENT_SECRET,
2327
+ * });
2328
+ * ```
2329
+ */
2330
+ declare function createZoomProvider(config: OAuthProviderConfig): OAuthProvider;
2331
+
1781
2332
  /**
1782
2333
  * OAuth proxy module for mobile apps.
1783
2334
  *
@@ -2912,4 +3463,4 @@ declare function createTrustedDeviceModule(config: TrustedDeviceConfig, db: Data
2912
3463
  */
2913
3464
  declare function deviceLabelFromRequest(request: Request): string;
2914
3465
 
2915
- export { type AccessTokenClaims, type AdditionalFieldsConfig, type AdditionalFieldsModule, AdminConfig, type AnonymousAuthConfig, type AnonymousAuthModule, ApiKeyManagerConfig, AuthAdapter, type AuthorizeParams, type BearerAuthOptions, type BudgetCheckResult, type CheckParams, type CheckResult, type CheckoutOptions, type CostAlert, type CostAttributionConfig, type CostAttributionModule, type CostReport, type CreateEphemeralSessionInput, type CustomSessionConfig, type CustomSessionModule, type DeleteOptions, type DeleteResult, type DeviceAuthConfig, type DeviceAuthModule, type DeviceAuthStatus, type DeviceCodeResponse, EVENT_TYPES, EmailOtpConfig, type EndpointGroup, type EndpointLimit, type EphemeralSession, type EphemeralSessionConfig, type EphemeralSessionModule, type EphemeralSessionValidateResult, type EventStreamConfig, type EventStreamModule, type EventType, type ExpandParams, type FederatedAgent, type FederationConfig, type FederationModule, type FederationToken, type FederationWellKnown, type FieldDefinition, type GdprModule, type GetUserClaimsFn, type GoogleUser, type HeaderAuthOptions, HibpApiError, HibpBreachedError, type HibpConfig, type HibpModule, type InstanceIdentity, type IssueFederationTokenInput, type JsonWebKeySet, type JwtSessionConfig, type JwtSessionModule, type KVNamespace, KVStore, type LastLoginConfig, type LastLoginModule, type ListObjectsParams, type ListSubjectsParams, type LoginEvent, type LoginMethod, MagicLinkConfig, MemoryStore, type OAuthAccount, type OAuthCallbackResult, type OAuthModule, type OAuthModuleConfig, type OAuthPluginConfig, type OAuthProvider, type OAuthProviderConfig, type OAuthProxyConfig, OAuthProxyError, type OAuthProxyModule, type OAuthProxyPluginConfig, type OAuthTokens, type OAuthUserInfo, type OidcClient, type OidcDiscoveryDocument, type OidcProviderConfig, type OidcProviderModule, type OneTapConfig, type OneTapModule, OneTapVerifyError, type OpenApiComponents, type OpenApiConfig, type OpenApiDocument, type OpenApiInfo, type OpenApiMediaType, type OpenApiModule, type OpenApiOperation, type OpenApiParameter, type OpenApiPathItem, type OpenApiRequestBody, type OpenApiResponse, type OpenApiSchema, type OpenApiSecurityRequirement, type OpenApiSecurityScheme, type OpenApiServer, OrgConfig, PasskeyConfig, type PermissionRuleSet, type PolarConfig, type PolarModule, type PolarSubscription, type ProxyTokens, type RateLimitConfig, type RateLimitMiddlewareOptions, type RateLimitConfig$1 as RateLimitPluginConfig, type RateLimitResult, type RateLimitStore, type RateLimiter, type ReBACConfig, type ReBACModule, type RecordCostInput, type RecordLoginInput, type RegisterClientInput, type Relationship, ResolvedUser, type ResourceNode, type ScimConfig, type ScimGroup, type ScimModule, type ScimUser, type SessionTokens, type SessionUser, type SiweConfig, type SiweModule, type SiweVerifyResult, type StreamEvent, type StripeConfig, type StripeModule, type SubscriptionInfo, type TokenParams, type TokenResponse, TotpConfig, type TrustLevel, type TrustedDevice, type TrustedDeviceConfig, type TrustedDeviceModule, type TrustedInstance, type TwoFactorConfig, type UserDataExport, type UserInfoClaims, type ValidationResult, type VerifiedSession, additionalFields, admin, anonymousAuth, apiKeys, bearerAuth, createAdditionalFieldsModule, createAnonymousAuthModule, createAppleProvider, createCostAttributionModule, createCustomSessionModule, createDeviceAuthModule, createDiscordProvider, createEphemeralSessionModule, createEventStreamModule, createFederationModule, createGdprModule, createGithubProvider, createGitlabProvider, createGoogleProvider, createHibpModule, createJwtSessionModule, createLastLoginModule, createLinkedInProvider, createMicrosoftProvider, createOAuthModule, createOAuthProxyModule, createOidcProviderModule, createOneTapModule, createOpenApiModule, createPolarModule, createRateLimiter, createReBACModule, createScimModule, createSiweModule, createSlackProvider, createStripeModule, createTrustedDeviceModule, createTwitterProvider, customAuth, customSession, deviceAuth, deviceLabelFromRequest, emailOtp, gdpr, headerAuth, kvStore, magicLink, oauth, oauthProxy, oneTap, organization, passkey, polar, rateLimit, scim, siwe, stripe, twoFactor, withRateLimit };
3466
+ export { type AccessTokenClaims, type AdditionalFieldsConfig, type AdditionalFieldsModule, AdminConfig, type AnonymousAuthConfig, type AnonymousAuthModule, ApiKeyManagerConfig, AuthAdapter, type AuthorizeParams, type BearerAuthOptions, type BudgetCheckResult, type CheckParams, type CheckResult, type CheckoutOptions, type CostAlert, type CostAttributionConfig, type CostAttributionModule, type CostReport, type CreateEphemeralSessionInput, type CustomSessionConfig, type CustomSessionModule, DEFAULT_ATLASSIAN_SCOPES, DEFAULT_DISCORD_SCOPES, DEFAULT_DROPBOX_SCOPES, DEFAULT_FIGMA_SCOPES, DEFAULT_NOTION_SCOPES, DEFAULT_REDDIT_SCOPES, DEFAULT_SLACK_SCOPES, DEFAULT_SPOTIFY_SCOPES, DEFAULT_TWITCH_SCOPES, DEFAULT_ZOOM_SCOPES, type DeleteOptions, type DeleteResult, type DeviceAuthConfig, type DeviceAuthModule, type DeviceAuthStatus, type DeviceCodeResponse, EVENT_TYPES, EmailOtpConfig, type EndpointGroup, type EndpointLimit, type EphemeralSession, type EphemeralSessionConfig, type EphemeralSessionModule, type EphemeralSessionValidateResult, type EventStreamConfig, type EventStreamModule, type EventType, type ExpandParams, type FederatedAgent, type FederationConfig, type FederationModule, type FederationToken, type FederationWellKnown, type FieldDefinition, type GdprModule, type GenericOIDCConfig, type GetUserClaimsFn, type GoogleUser, type HeaderAuthOptions, HibpApiError, HibpBreachedError, type HibpConfig, type HibpModule, type InstanceIdentity, type IssueFederationTokenInput, type JsonWebKeySet, type JwtSessionConfig, type JwtSessionModule, type KVNamespace, KVStore, type LastLoginConfig, type LastLoginModule, type ListObjectsParams, type ListSubjectsParams, type LoginEvent, type LoginMethod, MagicLinkConfig, MemoryStore, type OAuthAccount, type OAuthCallbackResult, type OAuthModule, type OAuthModuleConfig, type OAuthPluginConfig, type OAuthProvider, type OAuthProviderConfig, type OAuthProxyConfig, OAuthProxyError, type OAuthProxyModule, type OAuthProxyPluginConfig, type OAuthTokens, type OAuthUserInfo, type OidcClient, type OidcDiscoveryDocument, type OidcProviderConfig, type OidcProviderModule, type OneTapConfig, type OneTapModule, OneTapVerifyError, type OpenApiComponents, type OpenApiConfig, type OpenApiDocument, type OpenApiInfo, type OpenApiMediaType, type OpenApiModule, type OpenApiOperation, type OpenApiParameter, type OpenApiPathItem, type OpenApiRequestBody, type OpenApiResponse, type OpenApiSchema, type OpenApiSecurityRequirement, type OpenApiSecurityScheme, type OpenApiServer, OrgConfig, PasskeyConfig, type PermissionRuleSet, type PolarConfig, type PolarModule, type PolarSubscription, type ProxyTokens, type RateLimitConfig, type RateLimitMiddlewareOptions, type RateLimitConfig$1 as RateLimitPluginConfig, type RateLimitResult, type RateLimitStore, type RateLimiter, type ReBACConfig, type ReBACModule, type RecordCostInput, type RecordLoginInput, type RegisterClientInput, type Relationship, ResolvedUser, type ResourceNode, type ScimConfig, type ScimGroup, type ScimModule, type ScimUser, type SessionTokens, type SessionUser, type SiweConfig, type SiweModule, type SiweVerifyResult, type StreamEvent, type StripeConfig, type StripeModule, type SubscriptionInfo, type TokenParams, type TokenResponse, TotpConfig, type TrustLevel, type TrustedDevice, type TrustedDeviceConfig, type TrustedDeviceModule, type TrustedInstance, type TwoFactorConfig, type UserDataExport, type UserInfoClaims, type ValidationResult, type VerifiedSession, additionalFields, admin, anonymousAuth, apiKeys, atlassianProvider, auth0Provider, bearerAuth, bitbucketProvider, cognitoProvider, coinbaseProvider, createAdditionalFieldsModule, createAnonymousAuthModule, createAppleProvider, createAtlassianProvider, createCostAttributionModule, createCustomSessionModule, createDeviceAuthModule, createDiscordProvider, createDropboxProvider, createEphemeralSessionModule, createEventStreamModule, createFederationModule, createFigmaProvider, createGdprModule, createGithubProvider, createGitlabProvider, createGoogleProvider, createHibpModule, createJwtSessionModule, createLastLoginModule, createLinkedInProvider, createMicrosoftProvider, createNotionProvider, createOAuthModule, createOAuthProxyModule, createOidcProviderModule, createOneTapModule, createOpenApiModule, createPolarModule, createRateLimiter, createReBACModule, createRedditProvider, createScimModule, createSiweModule, createSlackProvider, createSpotifyProvider, createStripeModule, createTrustedDeviceModule, createTwitchProvider, createTwitterProvider, createZoomProvider, customAuth, customSession, deviceAuth, deviceLabelFromRequest, dropboxProvider, emailOtp, facebookProvider, figmaProvider, gdpr, genericOIDC, headerAuth, huggingfaceProvider, kakaoProvider, kickProvider, kvStore, lineProvider, linearProvider, magicLink, naverProvider, normalizeProfile$9 as normalizeAtlassianProfile, normalizeProfile$8 as normalizeDiscordProfile, normalizeProfile$7 as normalizeDropboxProfile, normalizeProfile$6 as normalizeFigmaProfile, normalizeProfile$5 as normalizeNotionProfile, normalizeProfile$4 as normalizeRedditProfile, normalizeProfile$3 as normalizeSlackProfile, normalizeProfile$2 as normalizeSpotifyProfile, normalizeProfile$1 as normalizeTwitchProfile, normalizeProfile as normalizeZoomProfile, notionProvider, oauth, oauthProxy, oktaProvider, oneTap, organization, passkey, paypalProvider, polar, polarProvider, railwayProvider, rateLimit, redditProvider, robloxProvider, salesforceProvider, scim, siwe, spotifyProvider, stripe, tiktokProvider, twitchProvider, twoFactor, vercelProvider, vkProvider, wechatProvider, withRateLimit, yahooProvider, zoomProvider };