@absolutejs/auth 0.84.0 → 0.86.0

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.
@@ -15,6 +15,8 @@ export type OrganizationInvitationMessage = {
15
15
  };
16
16
  export type OrganizationsConfig<UserType> = {
17
17
  getUserId: (user: UserType) => string;
18
+ /** Return only an independently verified email. Missing evidence denies acceptance. */
19
+ getVerifiedEmail?: (user: UserType) => string | undefined | Promise<string | undefined>;
18
20
  organizationStore: OrganizationStore;
19
21
  canCreateOrganization?: (user: UserType) => boolean | Promise<boolean>;
20
22
  canManageMembers?: (context: {
@@ -1,10 +1,12 @@
1
1
  import type { OrganizationId } from '../tenancy';
2
- import type { Organization, OrganizationInvitation, OrganizationMembership, OrganizationStore } from './types';
3
- export declare const acceptInvitation: ({ organizationStore, token, userId }: {
2
+ import type { Organization, OrganizationInvitation, OrganizationStore } from './types';
3
+ export declare const acceptInvitation: ({ organizationStore, token, userId, verifiedEmail }: {
4
4
  organizationStore: OrganizationStore;
5
5
  token: string;
6
6
  userId: string;
7
- }) => Promise<OrganizationMembership | undefined>;
7
+ /** Provider-verified email, never an unverified profile field or request body. */
8
+ verifiedEmail?: string;
9
+ }) => Promise<import("./types").OrganizationMembership | undefined>;
8
10
  export declare const autoAssignOrgsByEmail: ({ email, getOrgsForDomain, organizationStore, roles, userId }: {
9
11
  email: string;
10
12
  getOrgsForDomain: (domain: string) => Promise<OrganizationId[]> | OrganizationId[];
@@ -34,6 +36,6 @@ export declare const listUserOrganizations: ({ organizationStore, userId }: {
34
36
  organizationStore: OrganizationStore;
35
37
  userId: string;
36
38
  }) => Promise<{
37
- membership: OrganizationMembership;
39
+ membership: import("./types").OrganizationMembership;
38
40
  organization: Organization | undefined;
39
41
  }[]>;
@@ -1,6 +1,6 @@
1
1
  import type { SessionRecord } from '../types';
2
2
  import { type OrganizationsRouteProps } from './config';
3
- export declare const organizationRoutes: <UserType>({ authSessionStore, canCreateOrganization, canManageMembers, emit, getUserId, invitationDurationMs, onMembershipAdded, onMembershipRemoved, onOrganizationCreated, onSendInvitation, organizationsRoute, organizationStore, ownerRoles }: OrganizationsRouteProps<UserType>) => import("elysia/types").AddRoute<"", "local", {
3
+ export declare const organizationRoutes: <UserType>({ authSessionStore, canCreateOrganization, canManageMembers, emit, getUserId, getVerifiedEmail, invitationDurationMs, onMembershipAdded, onMembershipRemoved, onOrganizationCreated, onSendInvitation, organizationsRoute, organizationStore, ownerRoles }: OrganizationsRouteProps<UserType>) => import("elysia/types").AddRoute<"", "local", {
4
4
  decorator: {};
5
5
  store: {
6
6
  session: SessionRecord<UserType>;
@@ -29,6 +29,14 @@ export type OrganizationInvitation = {
29
29
  tokenHash: string;
30
30
  };
31
31
  export type OrganizationStore = {
32
+ /** Atomically consume a live invitation and add membership. Custom stores must
33
+ * implement this capability; acceptance fails closed without it. */
34
+ acceptInvitation?: (input: {
35
+ tokenHash: string;
36
+ userId: string;
37
+ verifiedEmail: string;
38
+ now: number;
39
+ }) => Promise<OrganizationMembership | undefined>;
32
40
  deleteOrganization: (organizationId: OrganizationId) => Promise<void>;
33
41
  getInvitation: (invitationId: string) => Promise<OrganizationInvitation | undefined>;
34
42
  getInvitationByTokenHash: (tokenHash: string) => Promise<OrganizationInvitation | undefined>;
@@ -1069,6 +1069,31 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
1069
1069
  encoding: "application/x-www-form-urlencoded";
1070
1070
  url: string;
1071
1071
  };
1072
+ } & import("citra").ProviderConfig<any>) | ({
1073
+ authorizationUrl: string;
1074
+ isOIDC: true;
1075
+ isRefreshable: true;
1076
+ PKCEMethod: "S256";
1077
+ profileRequest: {
1078
+ authIn: "header";
1079
+ encoding: "application/json";
1080
+ method: "GET";
1081
+ url: string;
1082
+ };
1083
+ revocationRequest: {
1084
+ authIn: "body";
1085
+ encoding: "application/x-www-form-urlencoded";
1086
+ tokenParamName: "token";
1087
+ url: string;
1088
+ };
1089
+ scopeRequired: true;
1090
+ subject: string[];
1091
+ subjectType: "string";
1092
+ tokenRequest: {
1093
+ authIn: "body";
1094
+ encoding: "application/x-www-form-urlencoded";
1095
+ url: string;
1096
+ };
1072
1097
  } & import("citra").ProviderConfig<any>) | ({
1073
1098
  authorizationUrl: string;
1074
1099
  email: string[];
@@ -1810,7 +1835,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
1810
1835
  url: string;
1811
1836
  };
1812
1837
  } & import("citra").ProviderConfig<any>);
1813
- providerInstance: OAuth2Client<"42" | "absolutejs" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "onspark" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
1838
+ providerInstance: OAuth2Client<"42" | "absolutejs" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "neon" | "notion" | "okta" | "onspark" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
1814
1839
  requiresPKCE: boolean;
1815
1840
  scope: string[] | undefined;
1816
1841
  searchParams: [string, string][] | undefined;
@@ -1821,7 +1846,7 @@ export declare const buildClientProviders: (providersConfiguration: OAuth2Config
1821
1846
  }>;
1822
1847
  export declare const normalizeProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => {
1823
1848
  [k: string]: {
1824
- [k: string]: OAuth2ProviderClientConfiguration<"42" | "absolutejs" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "onspark" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
1849
+ [k: string]: OAuth2ProviderClientConfiguration<"42" | "absolutejs" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "neon" | "notion" | "okta" | "onspark" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom">;
1825
1850
  };
1826
1851
  };
1827
1852
  export declare const resolveClientProviderEntry: ({ clientName, clientProviders, providerName }: {
@@ -1852,7 +1877,7 @@ export declare const resolveProviderClientConfiguration: ({ clientName, provider
1852
1877
  error: "Client provider not found";
1853
1878
  config?: undefined;
1854
1879
  } | {
1855
- config: OAuth2ProviderClientConfiguration<"42" | "absolutejs" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "onspark" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom"> | undefined;
1880
+ config: OAuth2ProviderClientConfiguration<"42" | "absolutejs" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "azureadb2c" | "battlenet" | "bitbucket" | "box" | "bungie" | "calendly" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraexternalid" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "neon" | "notion" | "okta" | "onspark" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "slackuser" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom"> | undefined;
1856
1881
  readonly error?: undefined;
1857
1882
  } | {
1858
1883
  error: "Client variant is required";
@@ -1262,6 +1262,32 @@ var providers = defineProviders({
1262
1262
  url: "https://nid.naver.com/oauth2.0/token"
1263
1263
  }
1264
1264
  },
1265
+ neon: {
1266
+ authorizationUrl: "https://oauth2.neon.tech/oauth2/auth",
1267
+ isOIDC: true,
1268
+ isRefreshable: true,
1269
+ PKCEMethod: "S256",
1270
+ profileRequest: {
1271
+ authIn: "header",
1272
+ encoding: "application/json",
1273
+ method: "GET",
1274
+ url: "https://oauth2.neon.tech/userinfo"
1275
+ },
1276
+ revocationRequest: {
1277
+ authIn: "body",
1278
+ encoding: "application/x-www-form-urlencoded",
1279
+ tokenParamName: "token",
1280
+ url: "https://oauth2.neon.tech/oauth2/revoke"
1281
+ },
1282
+ scopeRequired: true,
1283
+ subject: ["sub"],
1284
+ subjectType: "string",
1285
+ tokenRequest: {
1286
+ authIn: "body",
1287
+ encoding: "application/x-www-form-urlencoded",
1288
+ url: "https://oauth2.neon.tech/oauth2/token"
1289
+ }
1290
+ },
1265
1291
  notion: {
1266
1292
  authorizationUrl: "https://api.notion.com/v1/oauth/authorize",
1267
1293
  email: ["bot", "owner", "user", "person", "email"],
@@ -2883,39 +2909,13 @@ var buildOAuth2Client = async (meta, config) => {
2883
2909
  var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Client(providerConfig, credentials);
2884
2910
  var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
2885
2911
  // src/providers/neon.ts
2886
- var neonProviderConfiguration = defineProvider({
2887
- authorizationUrl: "https://oauth2.neon.tech/oauth2/auth",
2888
- isOIDC: true,
2889
- isRefreshable: true,
2890
- PKCEMethod: "S256",
2891
- profileRequest: {
2892
- authIn: "header",
2893
- encoding: "application/json",
2894
- method: "GET",
2895
- url: "https://oauth2.neon.tech/userinfo"
2896
- },
2897
- revocationRequest: {
2898
- authIn: "body",
2899
- encoding: "application/x-www-form-urlencoded",
2900
- tokenParamName: "token",
2901
- url: "https://oauth2.neon.tech/oauth2/revoke"
2902
- },
2903
- scopeRequired: true,
2904
- subject: ["sub"],
2905
- subjectType: "string",
2906
- tokenRequest: {
2907
- authIn: "body",
2908
- encoding: "application/x-www-form-urlencoded",
2909
- url: "https://oauth2.neon.tech/oauth2/token"
2910
- }
2911
- });
2912
+ var neonProviderConfiguration = providers.neon;
2912
2913
  var createNeonProviderConfiguration = ({
2913
2914
  credentials,
2914
2915
  offlineAccess = false,
2915
2916
  scopes
2916
2917
  }) => ({
2917
2918
  credentials: { ...credentials },
2918
- providerConfig: neonProviderConfiguration,
2919
2919
  scope: [
2920
2920
  "openid",
2921
2921
  ...offlineAccess ? ["offline", "offline_access"] : [],
@@ -2943,5 +2943,5 @@ export {
2943
2943
  scopeRequiredProviderOptions
2944
2944
  };
2945
2945
 
2946
- //# debugId=B1F765FDFC228CB564756E2164756E21
2946
+ //# debugId=5BB504DE6AFE93D864756E2164756E21
2947
2947
  //# sourceMappingURL=index.js.map