@atlasauth/backend 0.23.0 → 0.24.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 +7 -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/index.d.ts +54 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- 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/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 +8 -1
- package/dist/index.js +11 -0
- 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/migration-bridge.d.ts +153 -0
- package/dist/migration-bridge.js +328 -0
- package/dist/migration-bridge.js.map +1 -0
- package/dist/migration-presets.d.ts +150 -0
- package/dist/migration-presets.js +440 -0
- package/dist/migration-presets.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleLegacyVerify = handleLegacyVerify;
|
|
4
|
+
exports.oktaPasswordVerifier = oktaPasswordVerifier;
|
|
5
|
+
exports.auth0PasswordVerifier = auth0PasswordVerifier;
|
|
6
|
+
exports.descopePasswordVerifier = descopePasswordVerifier;
|
|
7
|
+
exports.clerkPasswordVerifier = clerkPasswordVerifier;
|
|
8
|
+
const jose_1 = require("jose");
|
|
9
|
+
const webhooks_1 = require("./webhooks");
|
|
10
|
+
const DEFAULT_TIMEOUT_MS = 4000;
|
|
11
|
+
/**
|
|
12
|
+
* Check Atlas's signature on the request and run `verify`. Returns the status
|
|
13
|
+
* and JSON body to send: 200 `{ user }` on a valid credential, 401 when the
|
|
14
|
+
* old system rejected it, 400 on a bad signature or body.
|
|
15
|
+
*/
|
|
16
|
+
async function handleLegacyVerify(input) {
|
|
17
|
+
const checked = (0, webhooks_1.verifyWebhook)({
|
|
18
|
+
body: input.body,
|
|
19
|
+
headers: input.headers,
|
|
20
|
+
secret: input.secret,
|
|
21
|
+
now: input.now,
|
|
22
|
+
});
|
|
23
|
+
if (!checked.verified)
|
|
24
|
+
return { status: 400, body: { error: 'invalid_signature' } };
|
|
25
|
+
const identifier = typeof checked.event?.identifier === 'string' ? checked.event.identifier.trim() : '';
|
|
26
|
+
const password = typeof checked.event?.password === 'string' ? checked.event.password : '';
|
|
27
|
+
if (!identifier || !password)
|
|
28
|
+
return { status: 400, body: { error: 'invalid_body' } };
|
|
29
|
+
let profile = null;
|
|
30
|
+
try {
|
|
31
|
+
profile = await input.verify({ identifier, password });
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
profile = null;
|
|
35
|
+
}
|
|
36
|
+
if (!profile || !profile.email.includes('@'))
|
|
37
|
+
return { status: 401, body: { error: 'invalid_credentials' } };
|
|
38
|
+
return { status: 200, body: { user: profile } };
|
|
39
|
+
}
|
|
40
|
+
const str = (v) => (typeof v === 'string' && v.trim() ? v.trim() : undefined);
|
|
41
|
+
const obj = (v) => v && typeof v === 'object' && !Array.isArray(v) ? v : undefined;
|
|
42
|
+
async function call(t, url, init) {
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
const timer = setTimeout(() => controller.abort(), t.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
45
|
+
try {
|
|
46
|
+
const res = await (t.fetchImpl ?? fetch)(url, { ...init, signal: controller.signal, redirect: 'manual' });
|
|
47
|
+
let raw = null;
|
|
48
|
+
try {
|
|
49
|
+
raw = (await res.json());
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
raw = null;
|
|
53
|
+
}
|
|
54
|
+
return { status: res.status, json: obj(raw) ?? null, raw };
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
clearTimeout(timer);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const origin = (domain) => `https://${domain.replace(/^https?:\/\//, '').replace(/\/+$/, '')}`;
|
|
64
|
+
const joinName = (...parts) => parts.filter(Boolean).join(' ').trim() || undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Okta (Workforce Identity Cloud / Customer Identity Solution): the Authn API,
|
|
67
|
+
* `POST /api/v1/authn`, needs no API token. A primary-authentication result of
|
|
68
|
+
* SUCCESS, or any state that is only reached after a correct password
|
|
69
|
+
* (MFA_REQUIRED, MFA_ENROLL, PASSWORD_WARN, PASSWORD_EXPIRED), counts as
|
|
70
|
+
* verified; 401 (E0000004) and LOCKED_OUT do not.
|
|
71
|
+
*
|
|
72
|
+
* Orgs where the Authn API is turned off can verify with the resource-owner
|
|
73
|
+
* password grant of an app that allows it: pass `passwordGrant`.
|
|
74
|
+
*/
|
|
75
|
+
function oktaPasswordVerifier(opts) {
|
|
76
|
+
const base = origin(opts.domain);
|
|
77
|
+
const PASSED = new Set(['SUCCESS', 'MFA_REQUIRED', 'MFA_ENROLL', 'MFA_CHALLENGE', 'PASSWORD_WARN', 'PASSWORD_EXPIRED']);
|
|
78
|
+
return async ({ identifier, password }) => {
|
|
79
|
+
if (opts.passwordGrant) {
|
|
80
|
+
const g = opts.passwordGrant;
|
|
81
|
+
const server = g.authorizationServerId ?? 'default';
|
|
82
|
+
const form = new URLSearchParams({ grant_type: 'password', username: identifier, password, scope: 'openid email profile', client_id: g.clientId });
|
|
83
|
+
if (g.clientSecret)
|
|
84
|
+
form.set('client_secret', g.clientSecret);
|
|
85
|
+
const res = await call(opts, `${base}/oauth2/${server}/v1/token`, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded', accept: 'application/json' },
|
|
88
|
+
body: form.toString(),
|
|
89
|
+
});
|
|
90
|
+
if (!res || res.status !== 200)
|
|
91
|
+
return null;
|
|
92
|
+
return profileFromIdToken(str(res.json?.id_token), { externalIdClaim: 'sub' });
|
|
93
|
+
}
|
|
94
|
+
const res = await call(opts, `${base}/api/v1/authn`, {
|
|
95
|
+
method: 'POST',
|
|
96
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
97
|
+
body: JSON.stringify({ username: identifier, password, options: { warnBeforePasswordExpired: false, multiOptionalFactorEnroll: false } }),
|
|
98
|
+
});
|
|
99
|
+
if (!res || res.status !== 200 || !res.json)
|
|
100
|
+
return null;
|
|
101
|
+
if (!PASSED.has(String(res.json.status)))
|
|
102
|
+
return null;
|
|
103
|
+
const user = obj(obj(res.json._embedded)?.user);
|
|
104
|
+
const profile = obj(user?.profile);
|
|
105
|
+
const email = str(profile?.login)?.includes('@') ? str(profile?.login) : undefined;
|
|
106
|
+
if (!email)
|
|
107
|
+
return null;
|
|
108
|
+
return {
|
|
109
|
+
email: email.toLowerCase(),
|
|
110
|
+
// Okta proved the user controls the login; it does not say the address was verified.
|
|
111
|
+
email_verified: false,
|
|
112
|
+
name: joinName(str(profile?.firstName), str(profile?.lastName)),
|
|
113
|
+
external_id: str(user?.id),
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Auth0 (and Okta Customer Identity Cloud): the resource-owner password grant
|
|
119
|
+
* against ONE database connection (`realm`), from an application with the
|
|
120
|
+
* Password grant enabled. `mfa_required` means the password was right (Auth0
|
|
121
|
+
* only asks for the second factor after it). Use a dedicated application for
|
|
122
|
+
* this and keep its secret on your server.
|
|
123
|
+
*/
|
|
124
|
+
function auth0PasswordVerifier(opts) {
|
|
125
|
+
const base = origin(opts.domain);
|
|
126
|
+
return async ({ identifier, password }) => {
|
|
127
|
+
const body = {
|
|
128
|
+
grant_type: 'http://auth0.com/oauth/grant-type/password-realm',
|
|
129
|
+
realm: opts.realm,
|
|
130
|
+
username: identifier,
|
|
131
|
+
password,
|
|
132
|
+
client_id: opts.clientId,
|
|
133
|
+
scope: 'openid email profile',
|
|
134
|
+
};
|
|
135
|
+
if (opts.clientSecret)
|
|
136
|
+
body.client_secret = opts.clientSecret;
|
|
137
|
+
if (opts.audience)
|
|
138
|
+
body.audience = opts.audience;
|
|
139
|
+
const res = await call(opts, `${base}/oauth/token`, {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
142
|
+
body: JSON.stringify(body),
|
|
143
|
+
});
|
|
144
|
+
if (!res)
|
|
145
|
+
return null;
|
|
146
|
+
if (res.status === 200)
|
|
147
|
+
return profileFromIdToken(str(res.json?.id_token), { externalIdClaim: 'sub' });
|
|
148
|
+
if (res.status === 403 && res.json?.error === 'mfa_required') {
|
|
149
|
+
// No ID token yet: the password is right, the profile comes from the MFA
|
|
150
|
+
// token's user. Atlas needs at least the email, which is the identifier.
|
|
151
|
+
return identifier.includes('@') ? { email: identifier.toLowerCase(), email_verified: false } : null;
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Descope: `POST /v1/auth/password/signin` with the project id (public — no
|
|
158
|
+
* management key). A 200 with a `user` means the password is right.
|
|
159
|
+
*/
|
|
160
|
+
function descopePasswordVerifier(opts) {
|
|
161
|
+
const base = origin(opts.baseUrl ?? 'api.descope.com');
|
|
162
|
+
return async ({ identifier, password }) => {
|
|
163
|
+
const res = await call(opts, `${base}/v1/auth/password/signin`, {
|
|
164
|
+
method: 'POST',
|
|
165
|
+
headers: { 'content-type': 'application/json', authorization: `Bearer ${opts.projectId}` },
|
|
166
|
+
body: JSON.stringify({ loginId: identifier, password }),
|
|
167
|
+
});
|
|
168
|
+
if (!res || res.status !== 200 || !res.json)
|
|
169
|
+
return null;
|
|
170
|
+
const user = obj(res.json.user);
|
|
171
|
+
const email = str(user?.email) ?? (identifier.includes('@') ? identifier : undefined);
|
|
172
|
+
if (!user || !email)
|
|
173
|
+
return null;
|
|
174
|
+
return {
|
|
175
|
+
email: email.toLowerCase(),
|
|
176
|
+
email_verified: user.verifiedEmail === true,
|
|
177
|
+
name: str(user.name) ?? joinName(str(user.givenName), str(user.familyName)),
|
|
178
|
+
external_id: str(user.userId),
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Clerk exports bcrypt digests, so most moves need no lazy step. For users
|
|
184
|
+
* whose digest could not move (a peppered or Cognito-backed hasher), look the
|
|
185
|
+
* user up by email and call `POST /v1/users/{id}/verify_password` with your
|
|
186
|
+
* Clerk secret key.
|
|
187
|
+
*/
|
|
188
|
+
function clerkPasswordVerifier(opts) {
|
|
189
|
+
const base = (opts.apiUrl ?? 'https://api.clerk.com').replace(/\/+$/, '');
|
|
190
|
+
const headers = { authorization: `Bearer ${opts.secretKey}`, 'content-type': 'application/json', accept: 'application/json' };
|
|
191
|
+
return async ({ identifier, password }) => {
|
|
192
|
+
if (!identifier.includes('@'))
|
|
193
|
+
return null;
|
|
194
|
+
const found = await call(opts, `${base}/v1/users?email_address=${encodeURIComponent(identifier)}&limit=1`, { headers });
|
|
195
|
+
if (!found || found.status !== 200)
|
|
196
|
+
return null;
|
|
197
|
+
// GET /v1/users answers with a bare array (or `{ data }` from newer API versions).
|
|
198
|
+
const list = Array.isArray(found.raw) ? found.raw : Array.isArray(found.json?.data) ? found.json.data : [];
|
|
199
|
+
const user = obj(list[0]);
|
|
200
|
+
const id = str(user?.id);
|
|
201
|
+
if (!user || !id)
|
|
202
|
+
return null;
|
|
203
|
+
const res = await call(opts, `${base}/v1/users/${encodeURIComponent(id)}/verify_password`, {
|
|
204
|
+
method: 'POST',
|
|
205
|
+
headers,
|
|
206
|
+
body: JSON.stringify({ password }),
|
|
207
|
+
});
|
|
208
|
+
if (!res || res.status !== 200 || res.json?.verified !== true)
|
|
209
|
+
return null;
|
|
210
|
+
const emails = Array.isArray(user.email_addresses) ? user.email_addresses.map(obj) : [];
|
|
211
|
+
const primary = emails.find((e) => e && e.id === user.primary_email_address_id) ?? emails[0];
|
|
212
|
+
return {
|
|
213
|
+
email: (str(primary?.email_address) ?? identifier).toLowerCase(),
|
|
214
|
+
email_verified: obj(primary?.verification)?.status === 'verified',
|
|
215
|
+
name: joinName(str(user.first_name), str(user.last_name)),
|
|
216
|
+
external_id: id,
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The profile in an ID token returned DIRECTLY by the vendor's token endpoint
|
|
222
|
+
* over TLS (so its signature need not be re-checked here).
|
|
223
|
+
*/
|
|
224
|
+
function profileFromIdToken(idToken, o) {
|
|
225
|
+
if (!idToken)
|
|
226
|
+
return null;
|
|
227
|
+
let claims;
|
|
228
|
+
try {
|
|
229
|
+
claims = (0, jose_1.decodeJwt)(idToken);
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
const email = str(claims.email);
|
|
235
|
+
if (!email || !email.includes('@'))
|
|
236
|
+
return null;
|
|
237
|
+
return {
|
|
238
|
+
email: email.toLowerCase(),
|
|
239
|
+
email_verified: claims.email_verified === true,
|
|
240
|
+
name: str(claims.name) ?? joinName(str(claims.given_name), str(claims.family_name)),
|
|
241
|
+
external_id: str(claims[o.externalIdClaim]),
|
|
242
|
+
};
|
|
243
|
+
}
|
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,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;QAC1B,cAAc,EAAE,MAAM,CAAC,cAAc,KAAK,IAAI;QAC9C,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACnF,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { BridgeCookie } from './better-auth';
|
|
2
|
+
import { type TokenFormat } from './migration-presets';
|
|
3
|
+
/** The Frontend API exchange path for a source. */
|
|
4
|
+
export declare function migrationExchangePath(source: string): string;
|
|
5
|
+
/** The Backend API (secret-key) exchange path for a source. */
|
|
6
|
+
export declare function migrationBapiExchangePath(source: string): string;
|
|
7
|
+
/** Why Atlas refused an exchange (`meta.bridge_outcome`). */
|
|
8
|
+
export type MigrationBridgeRefusal = 'closed' | 'invalid' | 'signature_invalid' | 'expired' | 'reused' | 'user_unavailable' | 'user_unknown' | 'rate_limited' | 'unavailable';
|
|
9
|
+
export type MigrationExchangeResult = {
|
|
10
|
+
kind: 'session';
|
|
11
|
+
jwt: string;
|
|
12
|
+
refreshToken: string;
|
|
13
|
+
sessionId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
expiresIn: number;
|
|
16
|
+
}
|
|
17
|
+
/** The user still owes a second factor (or MFA enrolment) — the old session is spent. */
|
|
18
|
+
| {
|
|
19
|
+
kind: 'needs_mfa';
|
|
20
|
+
attemptId: string;
|
|
21
|
+
status: 'needs_second_factor' | 'needs_mfa_enrollment';
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'refused';
|
|
24
|
+
outcome: MigrationBridgeRefusal;
|
|
25
|
+
status: number;
|
|
26
|
+
};
|
|
27
|
+
export interface ExchangeMigrationSessionOptions {
|
|
28
|
+
/** The migration source (`auth0`, `clerk`, `cognito`, `better_auth` …). */
|
|
29
|
+
source: string;
|
|
30
|
+
/** The instance's Frontend API origin. */
|
|
31
|
+
fapiOrigin: string;
|
|
32
|
+
publishableKey: string;
|
|
33
|
+
/**
|
|
34
|
+
* The instance secret key. When set (recommended on a server) the exchange
|
|
35
|
+
* goes to the Backend API — limited per instance with a ceiling sized for a
|
|
36
|
+
* bulk cutover, not per IP — and takes the user's IP / user agent from
|
|
37
|
+
* `clientIp` / `userAgent`.
|
|
38
|
+
*/
|
|
39
|
+
secretKey?: string;
|
|
40
|
+
/** Backend API origin for the secret-key path. Default `https://api.atlasauth.net`. */
|
|
41
|
+
bapiBaseUrl?: string;
|
|
42
|
+
clientIp?: string;
|
|
43
|
+
/** The old session token as read from the cookie / header (after the preset's token format). */
|
|
44
|
+
token: string;
|
|
45
|
+
remember?: boolean;
|
|
46
|
+
fetchImpl?: typeof fetch;
|
|
47
|
+
userAgent?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Exchange an old vendor session for an Atlas session, server to server
|
|
51
|
+
* (`delivery: "body"`). Never throws: a transport failure is
|
|
52
|
+
* `{ kind: 'refused', outcome: 'unavailable' }`, so the caller keeps the old
|
|
53
|
+
* cookie and tries again on a later request.
|
|
54
|
+
*/
|
|
55
|
+
export declare function exchangeMigrationSession(options: ExchangeMigrationSessionOptions): Promise<MigrationExchangeResult>;
|
|
56
|
+
type HeaderBag = {
|
|
57
|
+
get(name: string): string | null;
|
|
58
|
+
} | Record<string, string | string[] | undefined>;
|
|
59
|
+
/** Everything the bridge sees of a request. */
|
|
60
|
+
export interface MigrationBridgeRequest {
|
|
61
|
+
headers: HeaderBag;
|
|
62
|
+
/** The end user's IP as your framework resolved it (forwarded on the secret-key path). */
|
|
63
|
+
ip?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Pull the old token out of a request yourself — for a vendor whose cookie is
|
|
67
|
+
* encrypted with a secret only your server has (nextjs-auth0, WorkOS AuthKit,
|
|
68
|
+
* Auth.js JWT sessions): open it locally and return the JWT inside. Return
|
|
69
|
+
* undefined when the request carries no old session.
|
|
70
|
+
*/
|
|
71
|
+
export type MigrationTokenExtractor = (input: {
|
|
72
|
+
cookies: Record<string, string>;
|
|
73
|
+
headers: HeaderBag;
|
|
74
|
+
}) => string | undefined | Promise<string | undefined>;
|
|
75
|
+
export interface MigrationBridgeOptions {
|
|
76
|
+
/** The migration source (`auth0`, `clerk`, `cognito`, `supabase`, `better_auth` …). */
|
|
77
|
+
source: string;
|
|
78
|
+
fapiOrigin: string;
|
|
79
|
+
publishableKey: string;
|
|
80
|
+
/** The instance secret key: exchanges go through the Backend API (recommended). */
|
|
81
|
+
secretKey?: string;
|
|
82
|
+
bapiBaseUrl?: string;
|
|
83
|
+
/** The bridge preset (default: the preset named like the source). */
|
|
84
|
+
preset?: string;
|
|
85
|
+
/** Variables the preset's cookie names need (`project_ref`, `client_id`, `cookie_prefix` …). */
|
|
86
|
+
presetVars?: Record<string, string>;
|
|
87
|
+
/** Cookie names to read, instead of the preset's (`*` wildcards allowed). */
|
|
88
|
+
cookieNames?: string[];
|
|
89
|
+
/** Cookie names to clear after an exchange, instead of the preset's. */
|
|
90
|
+
clearCookieNames?: string[];
|
|
91
|
+
/** How the cookie holds the token (`raw`, `supabase`); default the preset's. */
|
|
92
|
+
tokenFormat?: TokenFormat;
|
|
93
|
+
/** A custom extractor; replaces cookie reading entirely. */
|
|
94
|
+
extractToken?: MigrationTokenExtractor;
|
|
95
|
+
/** Also read `Authorization: Bearer` (default: the preset's choice). */
|
|
96
|
+
bearer?: boolean;
|
|
97
|
+
/** The `domain` the old cookies were set on, so they clear. */
|
|
98
|
+
oldCookieDomain?: string;
|
|
99
|
+
/** Mark the Atlas cookies `Secure`. Default true; false only for plain-http local development. */
|
|
100
|
+
secure?: boolean;
|
|
101
|
+
fetchImpl?: typeof fetch;
|
|
102
|
+
}
|
|
103
|
+
/** What the bridge decided for one request. */
|
|
104
|
+
export type MigrationBridgeDecision =
|
|
105
|
+
/** No old session, or an Atlas session already present: carry on. */
|
|
106
|
+
{
|
|
107
|
+
action: 'none';
|
|
108
|
+
}
|
|
109
|
+
/** Exchanged: set these cookies and re-enter (redirect to the same URL) so the new session is read. */
|
|
110
|
+
| {
|
|
111
|
+
action: 'signed_in';
|
|
112
|
+
cookies: BridgeCookie[];
|
|
113
|
+
session: Extract<MigrationExchangeResult, {
|
|
114
|
+
kind: 'session';
|
|
115
|
+
}>;
|
|
116
|
+
}
|
|
117
|
+
/** A second factor is owed: send the browser to your sign-in page carrying the attempt. */
|
|
118
|
+
| {
|
|
119
|
+
action: 'needs_mfa';
|
|
120
|
+
cookies: BridgeCookie[];
|
|
121
|
+
attemptId: string;
|
|
122
|
+
status: string;
|
|
123
|
+
continuationUrl: (url: string) => string;
|
|
124
|
+
}
|
|
125
|
+
/** Refused. `cookies` clears the old cookies when the refusal is final. */
|
|
126
|
+
| {
|
|
127
|
+
action: 'refused';
|
|
128
|
+
cookies: BridgeCookie[];
|
|
129
|
+
outcome: MigrationBridgeRefusal;
|
|
130
|
+
};
|
|
131
|
+
/** Parse a Cookie header into name → raw value (first occurrence wins). */
|
|
132
|
+
export declare function parseCookieHeader(cookieHeader: string | null | undefined): Record<string, string>;
|
|
133
|
+
/**
|
|
134
|
+
* Supabase SSR cookie: `sb-<ref>-auth-token` (or chunks `.0`, `.1`, … joined in
|
|
135
|
+
* order), the value JSON or `base64-` + base64url(JSON), holding `access_token`.
|
|
136
|
+
*/
|
|
137
|
+
export declare function readSupabaseAccessToken(cookies: Record<string, string>, baseName: string): string | undefined;
|
|
138
|
+
/** Resolve the cookie names / format / bearer flag the bridge uses for its source. */
|
|
139
|
+
export declare function bridgeCookieConfig(options: Pick<MigrationBridgeOptions, 'source' | 'preset' | 'presetVars' | 'cookieNames' | 'clearCookieNames' | 'tokenFormat' | 'bearer'>): {
|
|
140
|
+
cookies: string[];
|
|
141
|
+
clear: string[];
|
|
142
|
+
format: TokenFormat;
|
|
143
|
+
bearer: boolean;
|
|
144
|
+
sharesAtlasCookie: boolean;
|
|
145
|
+
issuer: string | null;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* The bridge as a function of a request's headers. Call it from middleware
|
|
149
|
+
* before your normal auth check; it does nothing (no network) for a request
|
|
150
|
+
* without an old session, or with an Atlas session already present.
|
|
151
|
+
*/
|
|
152
|
+
export declare function createMigrationBridge(options: MigrationBridgeOptions): (request: MigrationBridgeRequest) => Promise<MigrationBridgeDecision>;
|
|
153
|
+
export {};
|