@atlasauth/backend 0.23.0 → 0.25.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.
- package/CHANGELOG.md +14 -0
- package/dist/auth0-session.d.ts +23 -0
- package/dist/auth0-session.js +80 -0
- package/dist/auth0-session.js.map +1 -0
- package/dist/better-auth.d.ts +4 -8
- package/dist/better-auth.js +42 -150
- package/dist/better-auth.js.map +1 -1
- package/dist/client/abac.d.ts +132 -0
- package/dist/client/abac.js +48 -0
- package/dist/client/abac.js.map +1 -0
- package/dist/client/access-policies.d.ts +100 -0
- package/dist/client/access-policies.js +29 -0
- package/dist/client/access-policies.js.map +1 -0
- package/dist/client/action-gallery.d.ts +1 -1
- package/dist/client/action-gallery.js.map +1 -1
- package/dist/client/actions.d.ts +129 -6
- package/dist/client/actions.js +4 -0
- package/dist/client/actions.js.map +1 -1
- package/dist/client/analytics-reports.d.ts +215 -0
- package/dist/client/analytics-reports.js +56 -0
- package/dist/client/analytics-reports.js.map +1 -0
- package/dist/client/app-catalog.d.ts +74 -0
- package/dist/client/app-catalog.js +30 -0
- package/dist/client/app-catalog.js.map +1 -0
- package/dist/client/attack-protection.d.ts +10 -0
- package/dist/client/attack-protection.js +8 -0
- package/dist/client/attack-protection.js.map +1 -1
- package/dist/client/audit-events.d.ts +71 -0
- package/dist/client/audit-events.js +28 -0
- package/dist/client/audit-events.js.map +1 -1
- package/dist/client/credentials.d.ts +8 -0
- package/dist/client/credentials.js.map +1 -1
- package/dist/client/delegated-ui-proxy.d.ts +25 -0
- package/dist/client/delegated-ui-proxy.js +46 -0
- package/dist/client/delegated-ui-proxy.js.map +1 -0
- package/dist/client/devices.d.ts +44 -0
- package/dist/client/devices.js +26 -0
- package/dist/client/devices.js.map +1 -0
- package/dist/client/email-templates.d.ts +1 -1
- package/dist/client/email-templates.js.map +1 -1
- package/dist/client/flags.d.ts +101 -0
- package/dist/client/flags.js +104 -0
- package/dist/client/flags.js.map +1 -0
- package/dist/client/groups.d.ts +146 -0
- package/dist/client/groups.js +67 -0
- package/dist/client/groups.js.map +1 -0
- package/dist/client/identity-verification.d.ts +62 -0
- package/dist/client/identity-verification.js +39 -0
- package/dist/client/identity-verification.js.map +1 -0
- package/dist/client/index.d.ts +997 -2
- package/dist/client/index.js +77 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/journeys.d.ts +108 -0
- package/dist/client/journeys.js +35 -0
- package/dist/client/journeys.js.map +1 -0
- package/dist/client/log-streams.d.ts +1 -1
- package/dist/client/marketing.d.ts +67 -0
- package/dist/client/marketing.js +26 -0
- package/dist/client/marketing.js.map +1 -0
- package/dist/client/mcp-gateways.d.ts +54 -0
- package/dist/client/mcp-gateways.js +25 -0
- package/dist/client/mcp-gateways.js.map +1 -0
- package/dist/client/messaging.d.ts +14 -3
- package/dist/client/messaging.js.map +1 -1
- package/dist/client/mfa-factors.d.ts +120 -0
- package/dist/client/mfa-factors.js +73 -0
- package/dist/client/mfa-factors.js.map +1 -0
- package/dist/client/migrations.d.ts +286 -0
- package/dist/client/migrations.js +103 -0
- package/dist/client/migrations.js.map +1 -0
- package/dist/client/network-acls.d.ts +6 -1
- package/dist/client/network-acls.js.map +1 -1
- package/dist/client/network-zones.d.ts +56 -0
- package/dist/client/network-zones.js +29 -0
- package/dist/client/network-zones.js.map +1 -0
- package/dist/client/notifications.d.ts +1 -1
- package/dist/client/notifications.js.map +1 -1
- package/dist/client/oauth-clients.d.ts +183 -3
- package/dist/client/oauth-clients.js +64 -0
- package/dist/client/oauth-clients.js.map +1 -1
- package/dist/client/org-role-grants.d.ts +57 -0
- package/dist/client/org-role-grants.js +40 -0
- package/dist/client/org-role-grants.js.map +1 -0
- package/dist/client/organizations.d.ts +52 -0
- package/dist/client/organizations.js +44 -0
- package/dist/client/organizations.js.map +1 -1
- package/dist/client/page-templates.d.ts +78 -0
- package/dist/client/page-templates.js +31 -0
- package/dist/client/page-templates.js.map +1 -0
- package/dist/client/passkey-api.d.ts +73 -0
- package/dist/client/passkey-api.js +34 -0
- package/dist/client/passkey-api.js.map +1 -0
- package/dist/client/resources.d.ts +149 -0
- package/dist/client/resources.js +73 -0
- package/dist/client/resources.js.map +1 -0
- package/dist/client/risk-based-mfa.d.ts +147 -0
- package/dist/client/risk-based-mfa.js +30 -0
- package/dist/client/risk-based-mfa.js.map +1 -1
- package/dist/client/roles.d.ts +4 -0
- package/dist/client/roles.js.map +1 -1
- package/dist/client/service-connectors.d.ts +83 -0
- package/dist/client/service-connectors.js +33 -0
- package/dist/client/service-connectors.js.map +1 -0
- package/dist/client/ssf.d.ts +111 -0
- package/dist/client/ssf.js +49 -0
- package/dist/client/ssf.js.map +1 -0
- package/dist/client/sso-onboarding.d.ts +6 -0
- package/dist/client/sso-onboarding.js.map +1 -1
- package/dist/client/users.d.ts +302 -0
- package/dist/client/users.js +125 -0
- package/dist/client/users.js.map +1 -1
- package/dist/client/vault.d.ts +85 -0
- package/dist/client/vault.js +50 -0
- package/dist/client/vault.js.map +1 -0
- package/dist/client/vc.d.ts +128 -0
- package/dist/client/vc.js +43 -0
- package/dist/client/vc.js.map +1 -0
- package/dist/client/webhooks.d.ts +31 -2
- package/dist/client/webhooks.js.map +1 -1
- package/dist/client/workflows.d.ts +131 -0
- package/dist/client/workflows.js +36 -0
- package/dist/client/workflows.js.map +1 -0
- package/dist/framework-bridge.d.ts +98 -0
- package/dist/framework-bridge.js +264 -0
- package/dist/framework-bridge.js.map +1 -0
- package/dist/framework-sessions.d.ts +147 -0
- package/dist/framework-sessions.js +544 -0
- package/dist/framework-sessions.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy-issuer-presets.d.ts +85 -0
- package/dist/legacy-issuer-presets.js +165 -0
- package/dist/legacy-issuer-presets.js.map +1 -0
- package/dist/legacy-issuers.d.ts +16 -2
- package/dist/legacy-issuers.js +16 -1
- package/dist/legacy-issuers.js.map +1 -1
- package/dist/legacy-verify.d.ts +103 -0
- package/dist/legacy-verify.js +244 -0
- package/dist/legacy-verify.js.map +1 -0
- package/dist/magic-did.d.ts +5 -0
- package/dist/magic-did.js +49 -0
- package/dist/magic-did.js.map +1 -0
- package/dist/migration-bridge.d.ts +162 -0
- package/dist/migration-bridge.js +354 -0
- package/dist/migration-bridge.js.map +1 -0
- package/dist/migration-presets-g3.d.ts +2 -0
- package/dist/migration-presets-g3.js +254 -0
- package/dist/migration-presets-g3.js.map +1 -0
- package/dist/migration-presets-g4/authentik.d.ts +14 -0
- package/dist/migration-presets-g4/authentik.js +37 -0
- package/dist/migration-presets-g4/authentik.js.map +1 -0
- package/dist/migration-presets-g4/fusionauth.d.ts +2 -0
- package/dist/migration-presets-g4/fusionauth.js +52 -0
- package/dist/migration-presets-g4/fusionauth.js.map +1 -0
- package/dist/migration-presets-g4/hanko.d.ts +12 -0
- package/dist/migration-presets-g4/hanko.js +46 -0
- package/dist/migration-presets-g4/hanko.js.map +1 -0
- package/dist/migration-presets-g4/keycloak.d.ts +16 -0
- package/dist/migration-presets-g4/keycloak.js +37 -0
- package/dist/migration-presets-g4/keycloak.js.map +1 -0
- package/dist/migration-presets-g4/logto.d.ts +12 -0
- package/dist/migration-presets-g4/logto.js +35 -0
- package/dist/migration-presets-g4/logto.js.map +1 -0
- package/dist/migration-presets-g4/ory.d.ts +2 -0
- package/dist/migration-presets-g4/ory.js +67 -0
- package/dist/migration-presets-g4/ory.js.map +1 -0
- package/dist/migration-presets-g4/supertokens.d.ts +13 -0
- package/dist/migration-presets-g4/supertokens.js +35 -0
- package/dist/migration-presets-g4/supertokens.js.map +1 -0
- package/dist/migration-presets-g4/zitadel.d.ts +2 -0
- package/dist/migration-presets-g4/zitadel.js +36 -0
- package/dist/migration-presets-g4/zitadel.js.map +1 -0
- package/dist/migration-presets-g4.d.ts +10 -0
- package/dist/migration-presets-g4.js +30 -0
- package/dist/migration-presets-g4.js.map +1 -0
- package/dist/migration-presets.d.ts +156 -0
- package/dist/migration-presets.js +536 -0
- package/dist/migration-presets.js.map +1 -0
- package/dist/request-auth.d.ts +32 -0
- package/dist/request-auth.js +72 -0
- package/dist/request-auth.js.map +1 -0
- package/dist/verify.d.ts +2 -0
- package/dist/verify.js.map +1 -1
- package/dist/workos-session.d.ts +30 -0
- package/dist/workos-session.js +123 -0
- package/dist/workos-session.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZERO-LOGOUT BRIDGE PRESETS — per vendor, how an old session is recognised.
|
|
3
|
+
*
|
|
4
|
+
* Shared by the Atlas API (which verifies the token and resolves the user) and
|
|
5
|
+
* the SDK middleware (which knows which cookie / header carries it), so both
|
|
6
|
+
* read one table. Pure data plus a few string templates: safe on every runtime.
|
|
7
|
+
*
|
|
8
|
+
* Three modes:
|
|
9
|
+
* - `jwt`: the vendor's session (or a token inside it) is a JWT. Atlas
|
|
10
|
+
* verifies it against the vendor's issuer and keys (JWKS, or an X.509 map
|
|
11
|
+
* like Firebase session cookies use), maps `claims.subject` to the imported
|
|
12
|
+
* user (`external_id` = the source user id), and spends `claims.sessionKey`
|
|
13
|
+
* (`jti` / `sid`, falling back to the whole token) in the single-use ledger.
|
|
14
|
+
* - `session_table`: an opaque token; Atlas looks up sha256(token) among the
|
|
15
|
+
* sessions imported in the migration bundle.
|
|
16
|
+
* - `remote`: the vendor's session can only be checked by asking the vendor
|
|
17
|
+
* with the user's own token (Appwrite, PocketBase): Atlas calls
|
|
18
|
+
* `remote.url` with the token filled into `{token}` and reads the subject
|
|
19
|
+
* (and profile) from the JSON answer by dot path.
|
|
20
|
+
*
|
|
21
|
+
* Templates use `{var}` placeholders filled from the bridge settings'
|
|
22
|
+
* `preset_vars` (e.g. `{domain}`, `{region}`); {@link resolveMigrationBridgePreset}
|
|
23
|
+
* refuses a template with a missing variable.
|
|
24
|
+
*
|
|
25
|
+
* Vendor tracks register their preset (or refine the starter below) with
|
|
26
|
+
* {@link registerMigrationBridgePreset}; a test checks every preset resolves.
|
|
27
|
+
*/
|
|
28
|
+
export interface MigrationBridgeClaims {
|
|
29
|
+
/** Claim holding the source user id (default `sub`). */
|
|
30
|
+
subject: string;
|
|
31
|
+
email?: string;
|
|
32
|
+
emailVerified?: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
/** Claim whose value spends the token in the single-use ledger (`jti`, `sid`); the whole token when absent. */
|
|
35
|
+
sessionKey?: string;
|
|
36
|
+
/**
|
|
37
|
+
* How the vendor says a second factor was passed: `amr:mfa` (the `amr` array
|
|
38
|
+
* contains `mfa`), `acr:<value>`, or `claim:<name>` (a truthy claim).
|
|
39
|
+
*/
|
|
40
|
+
mfa?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* How the middleware gets the token out of the cookie: `raw` (the cookie value
|
|
44
|
+
* is the token), `supabase` (Supabase SSR's `base64-` JSON cookie, possibly
|
|
45
|
+
* chunked `.0`/`.1`, holding `access_token`), or a custom extractor a vendor
|
|
46
|
+
* track registers on the middleware side.
|
|
47
|
+
*/
|
|
48
|
+
export type TokenFormat = 'raw' | 'supabase' | (string & {});
|
|
49
|
+
export interface MigrationBridgePreset {
|
|
50
|
+
id: string;
|
|
51
|
+
label: string;
|
|
52
|
+
mode: 'jwt' | 'session_table' | 'remote';
|
|
53
|
+
/** Variables the templates need, with a one-line hint each. */
|
|
54
|
+
vars?: Record<string, string>;
|
|
55
|
+
/** Optional variables and their defaults. */
|
|
56
|
+
defaults?: Record<string, string>;
|
|
57
|
+
jwt?: {
|
|
58
|
+
issuer: string;
|
|
59
|
+
/** Where the keys are. Omitted → OIDC discovery from the issuer. */
|
|
60
|
+
keysUrl?: string;
|
|
61
|
+
/** `jwks` (default) or `x509` (a `{ kid: PEM certificate }` map). */
|
|
62
|
+
keysFormat?: 'jwks' | 'x509';
|
|
63
|
+
/** Expected `aud` template(s); unchecked when absent. */
|
|
64
|
+
audience?: string[];
|
|
65
|
+
algorithms: string[];
|
|
66
|
+
claims: MigrationBridgeClaims;
|
|
67
|
+
/**
|
|
68
|
+
* Accept a validly signed token this many seconds past `exp` (each one still
|
|
69
|
+
* exchanges once). For vendors whose cookie holds a short-lived token that
|
|
70
|
+
* their client SDK refreshes and nothing refreshes after the switch. 0 by default.
|
|
71
|
+
*/
|
|
72
|
+
expiredGraceSeconds?: number;
|
|
73
|
+
/** The vendor may sign with a shared secret (HS256) instead of keys (Supabase legacy JWT secret). */
|
|
74
|
+
allowSharedSecret?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The token is not a JWT but another signed token Atlas checks natively:
|
|
77
|
+
* `magic_did` (Magic DID tokens — signed by the user's own key, subject the
|
|
78
|
+
* `iss` DID, audience the Magic client id). Default `jwt`.
|
|
79
|
+
*/
|
|
80
|
+
tokenType?: 'jwt' | 'magic_did';
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Mode `remote`: the vendor call that vouches for a token. Templates take the
|
|
84
|
+
* preset variables; `{token}` is the presented token and is filled only at
|
|
85
|
+
* call time, by the server.
|
|
86
|
+
*/
|
|
87
|
+
remote?: MigrationBridgeRemote;
|
|
88
|
+
/**
|
|
89
|
+
* Cookies that may carry the token, most specific first. `*` matches any run
|
|
90
|
+
* of characters (Amplify names cookies per client id and username).
|
|
91
|
+
*/
|
|
92
|
+
cookies: string[];
|
|
93
|
+
tokenFormat?: TokenFormat;
|
|
94
|
+
/** Read `Authorization: Bearer` too (API clients holding the old token). */
|
|
95
|
+
bearer?: boolean;
|
|
96
|
+
/** Cookies to clear once exchanged (defaults to `cookies`). */
|
|
97
|
+
clearCookies?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* The cookie name collides with Atlas's own (`__session`): the middleware
|
|
100
|
+
* only treats it as the old vendor's when the token's `iss` is the vendor's.
|
|
101
|
+
*/
|
|
102
|
+
sharesAtlasCookie?: boolean;
|
|
103
|
+
/** Integrator-facing notes (what must be configured at the vendor, caveats). */
|
|
104
|
+
notes?: string;
|
|
105
|
+
}
|
|
106
|
+
/** How a `remote` preset asks the vendor about a token. */
|
|
107
|
+
export interface MigrationBridgeRemote {
|
|
108
|
+
/** URL template (`{var}` from the preset variables, `{token}` at call time). */
|
|
109
|
+
url: string;
|
|
110
|
+
method: 'GET' | 'POST';
|
|
111
|
+
/** Header templates, e.g. `{ authorization: 'Bearer {token}' }`. */
|
|
112
|
+
headers?: Record<string, string>;
|
|
113
|
+
/** Body template (POST). */
|
|
114
|
+
body?: string;
|
|
115
|
+
/** Dot path into the JSON answer holding the source user id (`record.id`, `$id`). */
|
|
116
|
+
subjectPath: string;
|
|
117
|
+
emailPath?: string;
|
|
118
|
+
emailVerifiedPath?: string;
|
|
119
|
+
namePath?: string;
|
|
120
|
+
}
|
|
121
|
+
export declare function registerMigrationBridgePreset(preset: MigrationBridgePreset, options?: {
|
|
122
|
+
replace?: boolean;
|
|
123
|
+
}): void;
|
|
124
|
+
export declare function getMigrationBridgePreset(id: string): MigrationBridgePreset | undefined;
|
|
125
|
+
export declare function listMigrationBridgePresets(): MigrationBridgePreset[];
|
|
126
|
+
/** The bridge settings a preset resolves to, every template filled in. */
|
|
127
|
+
export interface ResolvedBridgePreset {
|
|
128
|
+
preset: string;
|
|
129
|
+
mode: 'jwt' | 'session_table' | 'remote';
|
|
130
|
+
issuer: string | null;
|
|
131
|
+
keysUrl: string | null;
|
|
132
|
+
keysFormat: 'jwks' | 'x509';
|
|
133
|
+
audience: string[] | null;
|
|
134
|
+
algorithms: string[];
|
|
135
|
+
claims: MigrationBridgeClaims;
|
|
136
|
+
expiredGraceSeconds: number;
|
|
137
|
+
cookies: string[];
|
|
138
|
+
tokenFormat: TokenFormat;
|
|
139
|
+
bearer: boolean;
|
|
140
|
+
clearCookies: string[];
|
|
141
|
+
sharesAtlasCookie: boolean;
|
|
142
|
+
/** Mode `remote`: the vendor call, preset variables filled, `{token}` left for the server. */
|
|
143
|
+
remote: MigrationBridgeRemote | null;
|
|
144
|
+
}
|
|
145
|
+
export declare class PresetVariableError extends Error {
|
|
146
|
+
readonly variable: string;
|
|
147
|
+
constructor(variable: string, message: string);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Fill a preset's templates. Throws {@link PresetVariableError} for a missing or
|
|
151
|
+
* malformed variable. Values are trimmed; a trailing slash on a URL-ish value
|
|
152
|
+
* is removed (`https://example.com/` → `https://example.com`).
|
|
153
|
+
*/
|
|
154
|
+
export declare function resolveMigrationBridgePreset(id: string, rawVars?: Record<string, string>): ResolvedBridgePreset;
|
|
155
|
+
/** Does a cookie name match a preset pattern (`*` = any run of characters)? */
|
|
156
|
+
export declare function cookieNameMatches(pattern: string, name: string): boolean;
|