@glideidentity/glide-be-node-magical-auth 3.2.0 → 3.2.1
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/README.md +87 -9
- package/dist/index.cjs +297 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -8
- package/dist/index.d.ts +72 -8
- package/dist/index.js +292 -14
- package/dist/index.js.map +1 -1
- package/dist/{types-BPuPzIcL.d.cts → types-t9HAB-7Q.d.cts} +153 -40
- package/dist/{types-BPuPzIcL.d.ts → types-t9HAB-7Q.d.ts} +153 -40
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import { A as AuthenticationStrategy,
|
|
2
|
-
export { B as BadRequestError, b as BrowserMismatchError, C as
|
|
1
|
+
import { A as AuthenticationStrategy, S as PLMN, j as ClientInfo, X as PhoneNumberDetails, a as BiometricVerification, N as MagicalAuthConfig, a0 as PrepareRequest, a2 as PrepareResult, Z as PrepareMultipleRequest, _ as PrepareMultipleResult, av as VerifyPhoneNumberRequest, aw as VerifyPhoneNumberResponse, G as GetPhoneNumberRequest, w as GetPhoneNumberResponse, a6 as ReportInvocationResponse, ah as StatusResponse, H as HttpClient, K as Logger } from './types-t9HAB-7Q.cjs';
|
|
2
|
+
export { B as BadRequestError, b as BrowserMismatchError, C as CallOptions, c as CallStage, d as CallStrategyData, e as CarrierAppUnavailableError, f as CarrierNotEligibleError, g as CarrierRejectedError, h as CarrierTemporarilyUnavailableError, i as Challenge, k as ConsentData, D as DCQLCredential, l as DCQLCredentialMeta, m as DCQLQuery, n as DEFAULT_BASE_URL, o as DEFAULT_TIMEOUT, p as DesktopQRData, q as DesktopStrategyData, r as DesktopWaitError, s as DeviceBindingError, t as DeviceInfo, u as DeviceSwapInfo, E as ErrorCode, v as ErrorResponse, F as ForbiddenError, x as HttpRequestOptions, y as HttpResponse, I as InternalServerError, z as InvalidCredentialError, L as LinkStrategyData, J as LiveCallInfo, M as LoggerConfig, O as MagicalAuthError, P as MissingBindingCookieError, Q as NetworkCheck, R as NetworkOrigin, T as PREPARE_MULTIPLE_MAX, U as PasskeyChallenge, V as PasskeyOption, W as PasskeyStrategyData, Y as PhoneNumberMismatchError, $ as PrepareOptions, a1 as PrepareResponse, a3 as ProtocolType, a4 as RateLimitError, a5 as ReportInvocationRequest, a7 as ResolvedConfig, a8 as RiskLevel, a9 as ServiceUnavailableError, aa as SessionInfo, ab as SessionMetadataParentStrategy, ac as SessionNotEligibleError, ad as SessionNotFoundError, ae as SessionStatus, af as SimSwapFailureReason, ag as SimSwapInfo, ai as StepUpOption, aj as StepUpPrepared, ak as StepUpResult, al as StrategyData, am as TS43RequestData, an as TS43StrategyData, ao as Theme, ap as UnauthorizedError, aq as UnsupportedPlatformError, ar as UseCase, as as ValidationError, at as VerificationRecordError, au as VerificationRecordErrorCode, ax as createErrorFromResponse, ay as createLogger, az as defaultHttpClient, aA as noopLogger, aB as resolveConfig, aC as sanitize } from './types-t9HAB-7Q.cjs';
|
|
3
|
+
|
|
4
|
+
interface DeletePasskeysRequest {
|
|
5
|
+
/** E.164 number whose passkeys are deleted. */
|
|
6
|
+
phone_number: string;
|
|
7
|
+
/** A registered https (or localhost) origin of this application: the passkeys' relying party. */
|
|
8
|
+
origin: string;
|
|
9
|
+
}
|
|
10
|
+
interface DeletePasskeysResponse {
|
|
11
|
+
/** Base64url ids of the deleted credentials; empty when there were none. */
|
|
12
|
+
deleted_credential_ids: string[];
|
|
13
|
+
/** The id of this request, the same value as the `X-Request-ID` response header. */
|
|
14
|
+
request_id?: string;
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
/**
|
|
5
18
|
* Request body for device-bound session completion (link protocol only).
|
|
@@ -89,6 +102,8 @@ interface Requirements {
|
|
|
89
102
|
android_min_sdk?: number;
|
|
90
103
|
/** Minimum iOS version (App Clip floor for link). */
|
|
91
104
|
ios_min_version?: number;
|
|
105
|
+
/** TS43 from an Android client: `unavailable` on Android Chrome below 156. */
|
|
106
|
+
biometric?: 'available' | 'unavailable';
|
|
92
107
|
/** Forward-compat: any future fields are preserved here. */
|
|
93
108
|
[key: string]: unknown;
|
|
94
109
|
}
|
|
@@ -169,6 +184,12 @@ interface VerificationRecordAgeBand {
|
|
|
169
184
|
from: number;
|
|
170
185
|
to: number;
|
|
171
186
|
}
|
|
187
|
+
/** The `live_call` claim on records of `call` sessions only. */
|
|
188
|
+
interface VerificationRecordLiveCall {
|
|
189
|
+
status: 'active' | 'none' | 'unavailable';
|
|
190
|
+
carrier_name?: string;
|
|
191
|
+
reason?: string;
|
|
192
|
+
}
|
|
172
193
|
/** A record's `sim_swap` or `device_swap` claim. */
|
|
173
194
|
interface VerificationRecordSwap {
|
|
174
195
|
checked: boolean;
|
|
@@ -199,7 +220,11 @@ interface VerificationRecordClaims {
|
|
|
199
220
|
biometric_verification: BiometricVerification;
|
|
200
221
|
sim_swap?: VerificationRecordSwap;
|
|
201
222
|
device_swap?: VerificationRecordSwap;
|
|
223
|
+
live_call?: VerificationRecordLiveCall;
|
|
202
224
|
sign_offs: VerificationRecordSignOff[];
|
|
225
|
+
/** `['carrier']` when the record omits the claim. */
|
|
226
|
+
factors: string[];
|
|
227
|
+
action_hash?: string;
|
|
203
228
|
}
|
|
204
229
|
/**
|
|
205
230
|
* How the SDK treated one sign-off: `unavailable` (with the server's reason)
|
|
@@ -274,9 +299,10 @@ declare class MagicalAuthClient {
|
|
|
274
299
|
/**
|
|
275
300
|
* Prepares authentication by checking carrier eligibility and generating protocol-specific requests.
|
|
276
301
|
*
|
|
277
|
-
* Automatically generates `fe_code` / `fe_hash` for device binding. If the
|
|
278
|
-
*
|
|
279
|
-
*
|
|
302
|
+
* Automatically generates `fe_code` / `fe_hash` for device binding. If the strategy or
|
|
303
|
+
* its fallback is 'link', `feCode` is included in the result so the caller can set it
|
|
304
|
+
* as an HttpOnly cookie for the link session (`fallback.session` when the fallback is
|
|
305
|
+
* link) via `buildSetBindingCookieHeader()`.
|
|
280
306
|
*
|
|
281
307
|
* @param request - Prepare request parameters
|
|
282
308
|
* @param options - Per-request options (e.g., correlationId)
|
|
@@ -345,6 +371,16 @@ declare class MagicalAuthClient {
|
|
|
345
371
|
* @throws {VerificationRecordError} On any failed check; `code` is a {@link VerificationRecordErrorCode}
|
|
346
372
|
*/
|
|
347
373
|
verifyVerificationRecord(record: string | undefined, options?: VerificationRecordOptions): Promise<VerifiedVerificationRecord>;
|
|
374
|
+
/**
|
|
375
|
+
* Verifies a step-up verification record and requires that it is verified,
|
|
376
|
+
* carries both the `passkey` and `carrier` factors, is bound to `action` and
|
|
377
|
+
* is for `phoneNumber` (E.164). The record is accepted past `exp` while its
|
|
378
|
+
* `iat` is within `maxAgeSeconds` (non-finite, zero or negative means 300).
|
|
379
|
+
* `expectedAudience` is the record aud to require; unset means this client's ID.
|
|
380
|
+
*
|
|
381
|
+
* @throws {VerificationRecordError} `EXPIRED` when older than `maxAgeSeconds`, `STEP_UP_REJECTED` when a step-up check fails, or any record verification code
|
|
382
|
+
*/
|
|
383
|
+
verifyStepUp(record: string | undefined, action: Record<string, string>, phoneNumber: string, maxAgeSeconds?: number, expectedAudience?: string): Promise<VerifiedVerificationRecord>;
|
|
348
384
|
/**
|
|
349
385
|
* Retrieves the phone number associated with the device using digital credentials.
|
|
350
386
|
*
|
|
@@ -359,6 +395,17 @@ declare class MagicalAuthClient {
|
|
|
359
395
|
* @throws {MagicalAuthError} For other API errors
|
|
360
396
|
*/
|
|
361
397
|
getPhoneNumber(request: GetPhoneNumberRequest, options?: RequestOptions): Promise<GetPhoneNumberResponse>;
|
|
398
|
+
/**
|
|
399
|
+
* Deletes every passkey Glide holds for the number on origin, a registered origin of this application.
|
|
400
|
+
*
|
|
401
|
+
* @param request - Phone number and origin whose passkeys are deleted
|
|
402
|
+
* @param options - Per-request options (e.g., correlationId)
|
|
403
|
+
* @returns The deleted credential ids; empty when there were none
|
|
404
|
+
* @throws {ValidationError} If phone_number is not E.164 or origin is missing
|
|
405
|
+
* @throws {ForbiddenError} If origin is not registered to this application
|
|
406
|
+
* @throws {MagicalAuthError} For other API errors
|
|
407
|
+
*/
|
|
408
|
+
deletePasskeys(request: DeletePasskeysRequest, options?: RequestOptions): Promise<DeletePasskeysResponse>;
|
|
362
409
|
/**
|
|
363
410
|
* Reports when a user clicks the invoke/authenticate button.
|
|
364
411
|
*
|
|
@@ -437,7 +484,9 @@ declare class TokenManager {
|
|
|
437
484
|
* in progress, subsequent calls will await the same promise.
|
|
438
485
|
*
|
|
439
486
|
* @returns A valid access token
|
|
440
|
-
* @throws {
|
|
487
|
+
* @throws {RateLimitError} If the token endpoint returns 429 (includes Retry-After when present)
|
|
488
|
+
* @throws {ServiceUnavailableError} If the token endpoint returns 5xx or temporarily_unavailable
|
|
489
|
+
* @throws {UnauthorizedError} For other token fetch failures (e.g. 401)
|
|
441
490
|
*/
|
|
442
491
|
getToken(): Promise<string>;
|
|
443
492
|
/**
|
|
@@ -560,6 +609,9 @@ declare function parseBindingCookie(cookieHeader: string | undefined, sessionKey
|
|
|
560
609
|
* @returns Array of Set-Cookie header values that expire stale binding cookies
|
|
561
610
|
*/
|
|
562
611
|
declare function clearStaleBindingCookies(cookieHeader: string | undefined, options?: BindingCookieOptions): string[];
|
|
612
|
+
interface CompletionPageOptions {
|
|
613
|
+
beacon?: boolean;
|
|
614
|
+
}
|
|
563
615
|
/**
|
|
564
616
|
* Returns the HTML for the completion redirect page.
|
|
565
617
|
*
|
|
@@ -576,11 +628,23 @@ declare function clearStaleBindingCookies(cookieHeader: string | undefined, opti
|
|
|
576
628
|
* must still find the signal when it resumes. The FE SDK removes them on
|
|
577
629
|
* consume; the page only erases them after 10 minutes as a fallback.
|
|
578
630
|
*
|
|
631
|
+
* Pass `{ beacon: true }` to also fire-and-forget same-origin JSON beacons
|
|
632
|
+
* (`page_start`, `invalid_link`, `post_outcome`, `close`, `tab_survived`) to
|
|
633
|
+
* `window.location.pathname`. Default is off. Beacons never include `agg_code`.
|
|
634
|
+
* `close` reports `close_outcome` (`unknown` | `failed`) and never `close_succeeded`.
|
|
635
|
+
*
|
|
579
636
|
* @param completeEndpoint - Relative path to POST to (e.g., "/api/glide/complete")
|
|
637
|
+
* @param options - Optional `{ beacon: true }` to emit page beacons
|
|
580
638
|
* @returns Complete HTML string ready to serve
|
|
581
639
|
* @throws {Error} If completeEndpoint is not a relative path starting with "/"
|
|
582
640
|
*/
|
|
583
|
-
declare function getCompletionPageHtml(completeEndpoint: string): string;
|
|
641
|
+
declare function getCompletionPageHtml(completeEndpoint: string, options?: CompletionPageOptions): string;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Base64url SHA-256 of the canonical action: keys sorted by byte value, each
|
|
645
|
+
* `key=value`, joined with `|`.
|
|
646
|
+
*/
|
|
647
|
+
declare function actionHash(action: Record<string, string>): string;
|
|
584
648
|
|
|
585
649
|
/**
|
|
586
650
|
* Glide Magical Auth SDK for Node.js
|
|
@@ -631,4 +695,4 @@ declare function getCompletionPageHtml(completeEndpoint: string): string;
|
|
|
631
695
|
*/
|
|
632
696
|
declare const VERSION: string;
|
|
633
697
|
|
|
634
|
-
export { AuthenticationStrategy, type AvailableOption, BINDING_COOKIE_MAX_AGE, BINDING_COOKIE_PREFIX, type BindingCookieOptions, BiometricVerification, ClientInfo, type CompleteRequest, type CompleteResponse, type DesktopWaitResponse, type EligibilityRequest, type EligibilityResponse, GetPhoneNumberRequest, GetPhoneNumberResponse, HEX_64, HttpClient, Logger, MagicalAuthClient, MagicalAuthConfig, PLMN, PrepareMultipleRequest, PrepareMultipleResult, PrepareRequest, PrepareResult, ReportInvocationResponse, type RequestOptions, type Requirements, SENSITIVE_KEYS, type SignOffResult, StatusResponse, TokenManager, VERSION, type VerificationRecordAgeBand, type VerificationRecordCarrier, type VerificationRecordClaims, type VerificationRecordOptions, type VerificationRecordSignOff, type VerificationRecordSwap, type VerifiedVerificationRecord, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, assertValidFeCode, buildClearBindingCookieHeader, buildSetBindingCookieHeader, clearStaleBindingCookies, computeFeHash, generateFeCode, getBindingCookieName, getCompletionPageHtml, parseBindingCookie };
|
|
698
|
+
export { AuthenticationStrategy, type AvailableOption, BINDING_COOKIE_MAX_AGE, BINDING_COOKIE_PREFIX, type BindingCookieOptions, BiometricVerification, ClientInfo, type CompleteRequest, type CompleteResponse, type CompletionPageOptions, type DeletePasskeysRequest, type DeletePasskeysResponse, type DesktopWaitResponse, type EligibilityRequest, type EligibilityResponse, GetPhoneNumberRequest, GetPhoneNumberResponse, HEX_64, HttpClient, Logger, MagicalAuthClient, MagicalAuthConfig, PLMN, PrepareMultipleRequest, PrepareMultipleResult, PrepareRequest, PrepareResult, ReportInvocationResponse, type RequestOptions, type Requirements, SENSITIVE_KEYS, type SignOffResult, StatusResponse, TokenManager, VERSION, type VerificationRecordAgeBand, type VerificationRecordCarrier, type VerificationRecordClaims, type VerificationRecordLiveCall, type VerificationRecordOptions, type VerificationRecordSignOff, type VerificationRecordSwap, type VerifiedVerificationRecord, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, actionHash, assertValidFeCode, buildClearBindingCookieHeader, buildSetBindingCookieHeader, clearStaleBindingCookies, computeFeHash, generateFeCode, getBindingCookieName, getCompletionPageHtml, parseBindingCookie };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import { A as AuthenticationStrategy,
|
|
2
|
-
export { B as BadRequestError, b as BrowserMismatchError, C as
|
|
1
|
+
import { A as AuthenticationStrategy, S as PLMN, j as ClientInfo, X as PhoneNumberDetails, a as BiometricVerification, N as MagicalAuthConfig, a0 as PrepareRequest, a2 as PrepareResult, Z as PrepareMultipleRequest, _ as PrepareMultipleResult, av as VerifyPhoneNumberRequest, aw as VerifyPhoneNumberResponse, G as GetPhoneNumberRequest, w as GetPhoneNumberResponse, a6 as ReportInvocationResponse, ah as StatusResponse, H as HttpClient, K as Logger } from './types-t9HAB-7Q.js';
|
|
2
|
+
export { B as BadRequestError, b as BrowserMismatchError, C as CallOptions, c as CallStage, d as CallStrategyData, e as CarrierAppUnavailableError, f as CarrierNotEligibleError, g as CarrierRejectedError, h as CarrierTemporarilyUnavailableError, i as Challenge, k as ConsentData, D as DCQLCredential, l as DCQLCredentialMeta, m as DCQLQuery, n as DEFAULT_BASE_URL, o as DEFAULT_TIMEOUT, p as DesktopQRData, q as DesktopStrategyData, r as DesktopWaitError, s as DeviceBindingError, t as DeviceInfo, u as DeviceSwapInfo, E as ErrorCode, v as ErrorResponse, F as ForbiddenError, x as HttpRequestOptions, y as HttpResponse, I as InternalServerError, z as InvalidCredentialError, L as LinkStrategyData, J as LiveCallInfo, M as LoggerConfig, O as MagicalAuthError, P as MissingBindingCookieError, Q as NetworkCheck, R as NetworkOrigin, T as PREPARE_MULTIPLE_MAX, U as PasskeyChallenge, V as PasskeyOption, W as PasskeyStrategyData, Y as PhoneNumberMismatchError, $ as PrepareOptions, a1 as PrepareResponse, a3 as ProtocolType, a4 as RateLimitError, a5 as ReportInvocationRequest, a7 as ResolvedConfig, a8 as RiskLevel, a9 as ServiceUnavailableError, aa as SessionInfo, ab as SessionMetadataParentStrategy, ac as SessionNotEligibleError, ad as SessionNotFoundError, ae as SessionStatus, af as SimSwapFailureReason, ag as SimSwapInfo, ai as StepUpOption, aj as StepUpPrepared, ak as StepUpResult, al as StrategyData, am as TS43RequestData, an as TS43StrategyData, ao as Theme, ap as UnauthorizedError, aq as UnsupportedPlatformError, ar as UseCase, as as ValidationError, at as VerificationRecordError, au as VerificationRecordErrorCode, ax as createErrorFromResponse, ay as createLogger, az as defaultHttpClient, aA as noopLogger, aB as resolveConfig, aC as sanitize } from './types-t9HAB-7Q.js';
|
|
3
|
+
|
|
4
|
+
interface DeletePasskeysRequest {
|
|
5
|
+
/** E.164 number whose passkeys are deleted. */
|
|
6
|
+
phone_number: string;
|
|
7
|
+
/** A registered https (or localhost) origin of this application: the passkeys' relying party. */
|
|
8
|
+
origin: string;
|
|
9
|
+
}
|
|
10
|
+
interface DeletePasskeysResponse {
|
|
11
|
+
/** Base64url ids of the deleted credentials; empty when there were none. */
|
|
12
|
+
deleted_credential_ids: string[];
|
|
13
|
+
/** The id of this request, the same value as the `X-Request-ID` response header. */
|
|
14
|
+
request_id?: string;
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
/**
|
|
5
18
|
* Request body for device-bound session completion (link protocol only).
|
|
@@ -89,6 +102,8 @@ interface Requirements {
|
|
|
89
102
|
android_min_sdk?: number;
|
|
90
103
|
/** Minimum iOS version (App Clip floor for link). */
|
|
91
104
|
ios_min_version?: number;
|
|
105
|
+
/** TS43 from an Android client: `unavailable` on Android Chrome below 156. */
|
|
106
|
+
biometric?: 'available' | 'unavailable';
|
|
92
107
|
/** Forward-compat: any future fields are preserved here. */
|
|
93
108
|
[key: string]: unknown;
|
|
94
109
|
}
|
|
@@ -169,6 +184,12 @@ interface VerificationRecordAgeBand {
|
|
|
169
184
|
from: number;
|
|
170
185
|
to: number;
|
|
171
186
|
}
|
|
187
|
+
/** The `live_call` claim on records of `call` sessions only. */
|
|
188
|
+
interface VerificationRecordLiveCall {
|
|
189
|
+
status: 'active' | 'none' | 'unavailable';
|
|
190
|
+
carrier_name?: string;
|
|
191
|
+
reason?: string;
|
|
192
|
+
}
|
|
172
193
|
/** A record's `sim_swap` or `device_swap` claim. */
|
|
173
194
|
interface VerificationRecordSwap {
|
|
174
195
|
checked: boolean;
|
|
@@ -199,7 +220,11 @@ interface VerificationRecordClaims {
|
|
|
199
220
|
biometric_verification: BiometricVerification;
|
|
200
221
|
sim_swap?: VerificationRecordSwap;
|
|
201
222
|
device_swap?: VerificationRecordSwap;
|
|
223
|
+
live_call?: VerificationRecordLiveCall;
|
|
202
224
|
sign_offs: VerificationRecordSignOff[];
|
|
225
|
+
/** `['carrier']` when the record omits the claim. */
|
|
226
|
+
factors: string[];
|
|
227
|
+
action_hash?: string;
|
|
203
228
|
}
|
|
204
229
|
/**
|
|
205
230
|
* How the SDK treated one sign-off: `unavailable` (with the server's reason)
|
|
@@ -274,9 +299,10 @@ declare class MagicalAuthClient {
|
|
|
274
299
|
/**
|
|
275
300
|
* Prepares authentication by checking carrier eligibility and generating protocol-specific requests.
|
|
276
301
|
*
|
|
277
|
-
* Automatically generates `fe_code` / `fe_hash` for device binding. If the
|
|
278
|
-
*
|
|
279
|
-
*
|
|
302
|
+
* Automatically generates `fe_code` / `fe_hash` for device binding. If the strategy or
|
|
303
|
+
* its fallback is 'link', `feCode` is included in the result so the caller can set it
|
|
304
|
+
* as an HttpOnly cookie for the link session (`fallback.session` when the fallback is
|
|
305
|
+
* link) via `buildSetBindingCookieHeader()`.
|
|
280
306
|
*
|
|
281
307
|
* @param request - Prepare request parameters
|
|
282
308
|
* @param options - Per-request options (e.g., correlationId)
|
|
@@ -345,6 +371,16 @@ declare class MagicalAuthClient {
|
|
|
345
371
|
* @throws {VerificationRecordError} On any failed check; `code` is a {@link VerificationRecordErrorCode}
|
|
346
372
|
*/
|
|
347
373
|
verifyVerificationRecord(record: string | undefined, options?: VerificationRecordOptions): Promise<VerifiedVerificationRecord>;
|
|
374
|
+
/**
|
|
375
|
+
* Verifies a step-up verification record and requires that it is verified,
|
|
376
|
+
* carries both the `passkey` and `carrier` factors, is bound to `action` and
|
|
377
|
+
* is for `phoneNumber` (E.164). The record is accepted past `exp` while its
|
|
378
|
+
* `iat` is within `maxAgeSeconds` (non-finite, zero or negative means 300).
|
|
379
|
+
* `expectedAudience` is the record aud to require; unset means this client's ID.
|
|
380
|
+
*
|
|
381
|
+
* @throws {VerificationRecordError} `EXPIRED` when older than `maxAgeSeconds`, `STEP_UP_REJECTED` when a step-up check fails, or any record verification code
|
|
382
|
+
*/
|
|
383
|
+
verifyStepUp(record: string | undefined, action: Record<string, string>, phoneNumber: string, maxAgeSeconds?: number, expectedAudience?: string): Promise<VerifiedVerificationRecord>;
|
|
348
384
|
/**
|
|
349
385
|
* Retrieves the phone number associated with the device using digital credentials.
|
|
350
386
|
*
|
|
@@ -359,6 +395,17 @@ declare class MagicalAuthClient {
|
|
|
359
395
|
* @throws {MagicalAuthError} For other API errors
|
|
360
396
|
*/
|
|
361
397
|
getPhoneNumber(request: GetPhoneNumberRequest, options?: RequestOptions): Promise<GetPhoneNumberResponse>;
|
|
398
|
+
/**
|
|
399
|
+
* Deletes every passkey Glide holds for the number on origin, a registered origin of this application.
|
|
400
|
+
*
|
|
401
|
+
* @param request - Phone number and origin whose passkeys are deleted
|
|
402
|
+
* @param options - Per-request options (e.g., correlationId)
|
|
403
|
+
* @returns The deleted credential ids; empty when there were none
|
|
404
|
+
* @throws {ValidationError} If phone_number is not E.164 or origin is missing
|
|
405
|
+
* @throws {ForbiddenError} If origin is not registered to this application
|
|
406
|
+
* @throws {MagicalAuthError} For other API errors
|
|
407
|
+
*/
|
|
408
|
+
deletePasskeys(request: DeletePasskeysRequest, options?: RequestOptions): Promise<DeletePasskeysResponse>;
|
|
362
409
|
/**
|
|
363
410
|
* Reports when a user clicks the invoke/authenticate button.
|
|
364
411
|
*
|
|
@@ -437,7 +484,9 @@ declare class TokenManager {
|
|
|
437
484
|
* in progress, subsequent calls will await the same promise.
|
|
438
485
|
*
|
|
439
486
|
* @returns A valid access token
|
|
440
|
-
* @throws {
|
|
487
|
+
* @throws {RateLimitError} If the token endpoint returns 429 (includes Retry-After when present)
|
|
488
|
+
* @throws {ServiceUnavailableError} If the token endpoint returns 5xx or temporarily_unavailable
|
|
489
|
+
* @throws {UnauthorizedError} For other token fetch failures (e.g. 401)
|
|
441
490
|
*/
|
|
442
491
|
getToken(): Promise<string>;
|
|
443
492
|
/**
|
|
@@ -560,6 +609,9 @@ declare function parseBindingCookie(cookieHeader: string | undefined, sessionKey
|
|
|
560
609
|
* @returns Array of Set-Cookie header values that expire stale binding cookies
|
|
561
610
|
*/
|
|
562
611
|
declare function clearStaleBindingCookies(cookieHeader: string | undefined, options?: BindingCookieOptions): string[];
|
|
612
|
+
interface CompletionPageOptions {
|
|
613
|
+
beacon?: boolean;
|
|
614
|
+
}
|
|
563
615
|
/**
|
|
564
616
|
* Returns the HTML for the completion redirect page.
|
|
565
617
|
*
|
|
@@ -576,11 +628,23 @@ declare function clearStaleBindingCookies(cookieHeader: string | undefined, opti
|
|
|
576
628
|
* must still find the signal when it resumes. The FE SDK removes them on
|
|
577
629
|
* consume; the page only erases them after 10 minutes as a fallback.
|
|
578
630
|
*
|
|
631
|
+
* Pass `{ beacon: true }` to also fire-and-forget same-origin JSON beacons
|
|
632
|
+
* (`page_start`, `invalid_link`, `post_outcome`, `close`, `tab_survived`) to
|
|
633
|
+
* `window.location.pathname`. Default is off. Beacons never include `agg_code`.
|
|
634
|
+
* `close` reports `close_outcome` (`unknown` | `failed`) and never `close_succeeded`.
|
|
635
|
+
*
|
|
579
636
|
* @param completeEndpoint - Relative path to POST to (e.g., "/api/glide/complete")
|
|
637
|
+
* @param options - Optional `{ beacon: true }` to emit page beacons
|
|
580
638
|
* @returns Complete HTML string ready to serve
|
|
581
639
|
* @throws {Error} If completeEndpoint is not a relative path starting with "/"
|
|
582
640
|
*/
|
|
583
|
-
declare function getCompletionPageHtml(completeEndpoint: string): string;
|
|
641
|
+
declare function getCompletionPageHtml(completeEndpoint: string, options?: CompletionPageOptions): string;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Base64url SHA-256 of the canonical action: keys sorted by byte value, each
|
|
645
|
+
* `key=value`, joined with `|`.
|
|
646
|
+
*/
|
|
647
|
+
declare function actionHash(action: Record<string, string>): string;
|
|
584
648
|
|
|
585
649
|
/**
|
|
586
650
|
* Glide Magical Auth SDK for Node.js
|
|
@@ -631,4 +695,4 @@ declare function getCompletionPageHtml(completeEndpoint: string): string;
|
|
|
631
695
|
*/
|
|
632
696
|
declare const VERSION: string;
|
|
633
697
|
|
|
634
|
-
export { AuthenticationStrategy, type AvailableOption, BINDING_COOKIE_MAX_AGE, BINDING_COOKIE_PREFIX, type BindingCookieOptions, BiometricVerification, ClientInfo, type CompleteRequest, type CompleteResponse, type DesktopWaitResponse, type EligibilityRequest, type EligibilityResponse, GetPhoneNumberRequest, GetPhoneNumberResponse, HEX_64, HttpClient, Logger, MagicalAuthClient, MagicalAuthConfig, PLMN, PrepareMultipleRequest, PrepareMultipleResult, PrepareRequest, PrepareResult, ReportInvocationResponse, type RequestOptions, type Requirements, SENSITIVE_KEYS, type SignOffResult, StatusResponse, TokenManager, VERSION, type VerificationRecordAgeBand, type VerificationRecordCarrier, type VerificationRecordClaims, type VerificationRecordOptions, type VerificationRecordSignOff, type VerificationRecordSwap, type VerifiedVerificationRecord, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, assertValidFeCode, buildClearBindingCookieHeader, buildSetBindingCookieHeader, clearStaleBindingCookies, computeFeHash, generateFeCode, getBindingCookieName, getCompletionPageHtml, parseBindingCookie };
|
|
698
|
+
export { AuthenticationStrategy, type AvailableOption, BINDING_COOKIE_MAX_AGE, BINDING_COOKIE_PREFIX, type BindingCookieOptions, BiometricVerification, ClientInfo, type CompleteRequest, type CompleteResponse, type CompletionPageOptions, type DeletePasskeysRequest, type DeletePasskeysResponse, type DesktopWaitResponse, type EligibilityRequest, type EligibilityResponse, GetPhoneNumberRequest, GetPhoneNumberResponse, HEX_64, HttpClient, Logger, MagicalAuthClient, MagicalAuthConfig, PLMN, PrepareMultipleRequest, PrepareMultipleResult, PrepareRequest, PrepareResult, ReportInvocationResponse, type RequestOptions, type Requirements, SENSITIVE_KEYS, type SignOffResult, StatusResponse, TokenManager, VERSION, type VerificationRecordAgeBand, type VerificationRecordCarrier, type VerificationRecordClaims, type VerificationRecordLiveCall, type VerificationRecordOptions, type VerificationRecordSignOff, type VerificationRecordSwap, type VerifiedVerificationRecord, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, actionHash, assertValidFeCode, buildClearBindingCookieHeader, buildSetBindingCookieHeader, clearStaleBindingCookies, computeFeHash, generateFeCode, getBindingCookieName, getCompletionPageHtml, parseBindingCookie };
|