@glideidentity/web-client-sdk 5.1.3 → 6.0.0-beta.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.
- package/README.md +337 -526
- package/dist/browser/web-client-sdk.min.js +1 -1
- package/dist/cjs/adapters/index.js +15 -0
- package/dist/cjs/adapters/react.js +192 -0
- package/dist/cjs/adapters/vanilla.js +38 -0
- package/dist/cjs/adapters/vue.js +187 -0
- package/dist/cjs/browser.js +58 -0
- package/dist/cjs/client/http.js +159 -0
- package/dist/cjs/client/index.js +19 -0
- package/dist/cjs/client/logger.js +135 -0
- package/dist/cjs/client/phone-auth-client.js +428 -0
- package/dist/cjs/client/strategies/polling.js +177 -0
- package/dist/cjs/core/errors.js +204 -0
- package/dist/cjs/core/index.js +83 -0
- package/dist/cjs/core/type-guards.js +196 -0
- package/dist/cjs/core/types.js +25 -0
- package/dist/{core/phone-auth/validation-utils.js → cjs/core/validators.js} +70 -23
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/ui/index.js +11 -0
- package/dist/{core/phone-auth → cjs}/ui/mobile-debug-console.js +149 -78
- package/dist/cjs/ui/modal.js +1122 -0
- package/dist/esm/adapters/index.js +11 -0
- package/dist/esm/adapters/react.js +182 -0
- package/dist/esm/adapters/vanilla.js +29 -0
- package/dist/esm/adapters/vue.js +177 -0
- package/dist/esm/browser.js +30 -11
- package/dist/esm/client/http.js +156 -0
- package/dist/esm/client/index.js +11 -0
- package/dist/esm/client/logger.js +131 -0
- package/dist/esm/client/phone-auth-client.js +424 -0
- package/dist/esm/client/strategies/polling.js +174 -0
- package/dist/esm/core/errors.js +193 -0
- package/dist/esm/core/index.js +60 -0
- package/dist/esm/core/type-guards.js +181 -0
- package/dist/esm/core/types.js +22 -1
- package/dist/esm/core/{phone-auth/validation-utils.js → validators.js} +66 -21
- package/dist/esm/index.js +45 -17
- package/dist/esm/ui/index.js +5 -0
- package/dist/esm/{core/phone-auth/ui → ui}/mobile-debug-console.js +149 -78
- package/dist/esm/ui/modal.js +1117 -0
- package/dist/types/adapters/index.d.ts +10 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/react.d.ts +70 -0
- package/dist/types/adapters/react.d.ts.map +1 -0
- package/dist/types/adapters/vanilla.d.ts +29 -0
- package/dist/types/adapters/vanilla.d.ts.map +1 -0
- package/dist/types/adapters/vue.d.ts +71 -0
- package/dist/types/adapters/vue.d.ts.map +1 -0
- package/dist/types/browser.d.ts +27 -0
- package/dist/types/browser.d.ts.map +1 -0
- package/dist/types/client/http.d.ts +41 -0
- package/dist/types/client/http.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +10 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/logger.d.ts +36 -0
- package/dist/types/client/logger.d.ts.map +1 -0
- package/dist/types/client/phone-auth-client.d.ts +91 -0
- package/dist/types/client/phone-auth-client.d.ts.map +1 -0
- package/dist/types/client/strategies/polling.d.ts +36 -0
- package/dist/types/client/strategies/polling.d.ts.map +1 -0
- package/dist/types/core/errors.d.ts +71 -0
- package/dist/types/core/errors.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +38 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/type-guards.d.ts +118 -0
- package/dist/types/core/type-guards.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +535 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/validators.d.ts +63 -0
- package/dist/types/core/validators.d.ts.map +1 -0
- package/dist/types/index.d.ts +40 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +6 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/{esm/core/phone-auth → types}/ui/mobile-debug-console.d.ts +1 -0
- package/dist/types/ui/mobile-debug-console.d.ts.map +1 -0
- package/dist/types/ui/modal.d.ts +87 -0
- package/dist/types/ui/modal.d.ts.map +1 -0
- package/package.json +48 -34
- package/dist/adapters/angular/client.service.d.ts +0 -7
- package/dist/adapters/angular/client.service.js +0 -30
- package/dist/adapters/angular/index.d.ts +0 -3
- package/dist/adapters/angular/index.js +0 -18
- package/dist/adapters/angular/phone-auth.service.d.ts +0 -38
- package/dist/adapters/angular/phone-auth.service.js +0 -130
- package/dist/adapters/react/index.d.ts +0 -9
- package/dist/adapters/react/index.js +0 -28
- package/dist/adapters/react/useClient.d.ts +0 -26
- package/dist/adapters/react/useClient.js +0 -121
- package/dist/adapters/react/usePhoneAuth.d.ts +0 -23
- package/dist/adapters/react/usePhoneAuth.js +0 -95
- package/dist/adapters/vanilla/client.d.ts +0 -8
- package/dist/adapters/vanilla/client.js +0 -33
- package/dist/adapters/vanilla/index.d.ts +0 -3
- package/dist/adapters/vanilla/index.js +0 -18
- package/dist/adapters/vanilla/phone-auth.d.ts +0 -46
- package/dist/adapters/vanilla/phone-auth.js +0 -138
- package/dist/adapters/vue/index.d.ts +0 -10
- package/dist/adapters/vue/index.js +0 -36
- package/dist/adapters/vue/useClient.d.ts +0 -115
- package/dist/adapters/vue/useClient.js +0 -131
- package/dist/adapters/vue/usePhoneAuth.d.ts +0 -94
- package/dist/adapters/vue/usePhoneAuth.js +0 -103
- package/dist/browser.d.ts +0 -7
- package/dist/browser.js +0 -31
- package/dist/core/client.d.ts +0 -22
- package/dist/core/client.js +0 -77
- package/dist/core/logger.d.ts +0 -130
- package/dist/core/logger.js +0 -370
- package/dist/core/phone-auth/api-types.d.ts +0 -593
- package/dist/core/phone-auth/api-types.js +0 -215
- package/dist/core/phone-auth/client.d.ts +0 -189
- package/dist/core/phone-auth/client.js +0 -1441
- package/dist/core/phone-auth/error-utils.d.ts +0 -110
- package/dist/core/phone-auth/error-utils.js +0 -350
- package/dist/core/phone-auth/index.d.ts +0 -7
- package/dist/core/phone-auth/index.js +0 -50
- package/dist/core/phone-auth/status-types.d.ts +0 -107
- package/dist/core/phone-auth/status-types.js +0 -31
- package/dist/core/phone-auth/strategies/desktop.d.ts +0 -122
- package/dist/core/phone-auth/strategies/desktop.js +0 -596
- package/dist/core/phone-auth/strategies/index.d.ts +0 -11
- package/dist/core/phone-auth/strategies/index.js +0 -15
- package/dist/core/phone-auth/strategies/link.d.ts +0 -89
- package/dist/core/phone-auth/strategies/link.js +0 -384
- package/dist/core/phone-auth/strategies/ts43.d.ts +0 -32
- package/dist/core/phone-auth/strategies/ts43.js +0 -161
- package/dist/core/phone-auth/strategies/types.d.ts +0 -18
- package/dist/core/phone-auth/strategies/types.js +0 -6
- package/dist/core/phone-auth/type-guards.d.ts +0 -143
- package/dist/core/phone-auth/type-guards.js +0 -198
- package/dist/core/phone-auth/types.d.ts +0 -237
- package/dist/core/phone-auth/types.js +0 -93
- package/dist/core/phone-auth/ui/mobile-debug-console.d.ts +0 -25
- package/dist/core/phone-auth/ui/modal.d.ts +0 -88
- package/dist/core/phone-auth/ui/modal.js +0 -598
- package/dist/core/phone-auth/validation-utils.d.ts +0 -44
- package/dist/core/types.d.ts +0 -62
- package/dist/core/types.js +0 -2
- package/dist/core/version.d.ts +0 -1
- package/dist/core/version.js +0 -5
- package/dist/esm/adapters/angular/client.service.d.ts +0 -7
- package/dist/esm/adapters/angular/client.service.js +0 -27
- package/dist/esm/adapters/angular/index.d.ts +0 -3
- package/dist/esm/adapters/angular/index.js +0 -4
- package/dist/esm/adapters/angular/phone-auth.service.d.ts +0 -38
- package/dist/esm/adapters/angular/phone-auth.service.js +0 -127
- package/dist/esm/adapters/react/index.d.ts +0 -9
- package/dist/esm/adapters/react/index.js +0 -8
- package/dist/esm/adapters/react/useClient.d.ts +0 -26
- package/dist/esm/adapters/react/useClient.js +0 -116
- package/dist/esm/adapters/react/usePhoneAuth.d.ts +0 -23
- package/dist/esm/adapters/react/usePhoneAuth.js +0 -92
- package/dist/esm/adapters/vanilla/client.d.ts +0 -8
- package/dist/esm/adapters/vanilla/client.js +0 -29
- package/dist/esm/adapters/vanilla/index.d.ts +0 -3
- package/dist/esm/adapters/vanilla/index.js +0 -4
- package/dist/esm/adapters/vanilla/phone-auth.d.ts +0 -46
- package/dist/esm/adapters/vanilla/phone-auth.js +0 -134
- package/dist/esm/adapters/vue/index.d.ts +0 -10
- package/dist/esm/adapters/vue/index.js +0 -11
- package/dist/esm/adapters/vue/useClient.d.ts +0 -115
- package/dist/esm/adapters/vue/useClient.js +0 -127
- package/dist/esm/adapters/vue/usePhoneAuth.d.ts +0 -94
- package/dist/esm/adapters/vue/usePhoneAuth.js +0 -100
- package/dist/esm/browser.d.ts +0 -7
- package/dist/esm/core/client.d.ts +0 -22
- package/dist/esm/core/client.js +0 -70
- package/dist/esm/core/logger.d.ts +0 -130
- package/dist/esm/core/logger.js +0 -359
- package/dist/esm/core/phone-auth/api-types.d.ts +0 -593
- package/dist/esm/core/phone-auth/api-types.js +0 -203
- package/dist/esm/core/phone-auth/client.d.ts +0 -189
- package/dist/esm/core/phone-auth/client.js +0 -1404
- package/dist/esm/core/phone-auth/error-utils.d.ts +0 -110
- package/dist/esm/core/phone-auth/error-utils.js +0 -338
- package/dist/esm/core/phone-auth/index.d.ts +0 -7
- package/dist/esm/core/phone-auth/index.js +0 -8
- package/dist/esm/core/phone-auth/status-types.d.ts +0 -107
- package/dist/esm/core/phone-auth/status-types.js +0 -26
- package/dist/esm/core/phone-auth/strategies/desktop.d.ts +0 -122
- package/dist/esm/core/phone-auth/strategies/desktop.js +0 -590
- package/dist/esm/core/phone-auth/strategies/index.d.ts +0 -11
- package/dist/esm/core/phone-auth/strategies/index.js +0 -7
- package/dist/esm/core/phone-auth/strategies/link.d.ts +0 -89
- package/dist/esm/core/phone-auth/strategies/link.js +0 -380
- package/dist/esm/core/phone-auth/strategies/ts43.d.ts +0 -32
- package/dist/esm/core/phone-auth/strategies/ts43.js +0 -157
- package/dist/esm/core/phone-auth/strategies/types.d.ts +0 -18
- package/dist/esm/core/phone-auth/strategies/types.js +0 -5
- package/dist/esm/core/phone-auth/type-guards.d.ts +0 -143
- package/dist/esm/core/phone-auth/type-guards.js +0 -185
- package/dist/esm/core/phone-auth/types.d.ts +0 -237
- package/dist/esm/core/phone-auth/types.js +0 -76
- package/dist/esm/core/phone-auth/ui/modal.d.ts +0 -88
- package/dist/esm/core/phone-auth/ui/modal.js +0 -594
- package/dist/esm/core/phone-auth/validation-utils.d.ts +0 -44
- package/dist/esm/core/types.d.ts +0 -62
- package/dist/esm/core/version.d.ts +0 -1
- package/dist/esm/core/version.js +0 -2
- package/dist/esm/index.d.ts +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -55
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework adapters for Phone Authentication SDK.
|
|
3
|
+
*
|
|
4
|
+
* Import from specific adapter paths for proper tree-shaking:
|
|
5
|
+
* - @glideidentity/web-client-sdk/react
|
|
6
|
+
* - @glideidentity/web-client-sdk/vue
|
|
7
|
+
* - @glideidentity/web-client-sdk/vanilla
|
|
8
|
+
*/
|
|
9
|
+
export { PhoneAuthClient } from '../client/phone-auth-client';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Adapter for Phone Authentication SDK.
|
|
3
|
+
*
|
|
4
|
+
* Provides a React hook that wraps PhoneAuthClient with React state management.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { usePhoneAuth } from '@glideidentity/web-client-sdk/react';
|
|
9
|
+
*
|
|
10
|
+
* function AuthButton() {
|
|
11
|
+
* const { authenticate, isLoading, error, result } = usePhoneAuth({ debug: true });
|
|
12
|
+
*
|
|
13
|
+
* const handleClick = async () => {
|
|
14
|
+
* try {
|
|
15
|
+
* const result = await authenticate({
|
|
16
|
+
* use_case: 'VerifyPhoneNumber',
|
|
17
|
+
* phone_number: '+14155551234'
|
|
18
|
+
* });
|
|
19
|
+
* console.log('Verified:', result.verified);
|
|
20
|
+
* } catch (err) {
|
|
21
|
+
* // Error is also in `error` state
|
|
22
|
+
* }
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* return (
|
|
26
|
+
* <button onClick={handleClick} disabled={isLoading}>
|
|
27
|
+
* {isLoading ? 'Verifying...' : 'Verify Phone'}
|
|
28
|
+
* </button>
|
|
29
|
+
* );
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import { PhoneAuthClient } from '../client/phone-auth-client';
|
|
34
|
+
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError, SessionInfo } from '../core/types';
|
|
35
|
+
export { PhoneAuthClient } from '../client/phone-auth-client';
|
|
36
|
+
export { USE_CASE, AUTHENTICATION_STRATEGY } from '../core/types';
|
|
37
|
+
export { ERROR_CODES, isAuthError, createAuthError } from '../core/errors';
|
|
38
|
+
export type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError, AuthCredential, SessionInfo, UseCase, AuthenticationStrategy, } from '../core/types';
|
|
39
|
+
export type AuthStep = 'idle' | 'preparing' | 'invoking' | 'processing' | 'complete' | 'error';
|
|
40
|
+
export interface UsePhoneAuthReturn {
|
|
41
|
+
/** Whether an operation is in progress */
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
/** Current error if any */
|
|
44
|
+
error: AuthError | null;
|
|
45
|
+
/** Last successful result */
|
|
46
|
+
result: PhoneAuthResult | null;
|
|
47
|
+
/** Current step in the auth flow */
|
|
48
|
+
step: AuthStep;
|
|
49
|
+
/** Whether Digital Credentials API is supported */
|
|
50
|
+
isSupported: boolean;
|
|
51
|
+
/** High-level: Complete authentication flow */
|
|
52
|
+
authenticate: (request: PrepareRequest, options?: InvokeOptions) => Promise<PhoneAuthResult>;
|
|
53
|
+
/** Granular: Prepare request */
|
|
54
|
+
prepare: (request: PrepareRequest) => Promise<PrepareResponse>;
|
|
55
|
+
/** Granular: Invoke secure prompt */
|
|
56
|
+
invokeSecurePrompt: (prepared: PrepareResponse, options?: InvokeOptions) => Promise<InvokeResult>;
|
|
57
|
+
/** Granular: Get phone number from credential */
|
|
58
|
+
getPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
59
|
+
/** Granular: Verify phone number with credential */
|
|
60
|
+
verifyPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
61
|
+
/** Reset state */
|
|
62
|
+
reset: () => void;
|
|
63
|
+
/** Direct access to client for advanced use */
|
|
64
|
+
client: PhoneAuthClient;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* React hook for phone authentication.
|
|
68
|
+
*/
|
|
69
|
+
export declare function usePhoneAuth(config?: AuthConfig): UsePhoneAuthReturn;
|
|
70
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/adapters/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EAET,WAAW,EACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,YAAY,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACT,cAAc,EACd,WAAW,EACX,OAAO,EACP,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAMvB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/F,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,2BAA2B;IAC3B,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,6BAA6B;IAC7B,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,oCAAoC;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,mDAAmD;IACnD,WAAW,EAAE,OAAO,CAAC;IAErB,+CAA+C;IAC/C,YAAY,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7F,gCAAgC;IAChC,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/D,qCAAqC;IACrC,kBAAkB,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAClG,iDAAiD;IACjD,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACvF,oDAAoD;IACpD,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAE1F,kBAAkB;IAClB,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB,+CAA+C;IAC/C,MAAM,EAAE,eAAe,CAAC;CACzB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,kBAAkB,CA0JpE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vanilla JavaScript Adapter for Phone Authentication SDK.
|
|
3
|
+
*
|
|
4
|
+
* Simply re-exports the PhoneAuthClient for use without a framework.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { PhoneAuthClient } from '@glideidentity/web-client-sdk/vanilla';
|
|
9
|
+
*
|
|
10
|
+
* const client = new PhoneAuthClient({ debug: true });
|
|
11
|
+
*
|
|
12
|
+
* document.getElementById('auth-btn').addEventListener('click', async () => {
|
|
13
|
+
* try {
|
|
14
|
+
* const result = await client.authenticate({
|
|
15
|
+
* use_case: 'VerifyPhoneNumber',
|
|
16
|
+
* phone_number: '+14155551234'
|
|
17
|
+
* });
|
|
18
|
+
* console.log('Verified:', result.verified);
|
|
19
|
+
* } catch (error) {
|
|
20
|
+
* console.error('Auth failed:', error);
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export { PhoneAuthClient } from '../client/phone-auth-client';
|
|
26
|
+
export { USE_CASE, AUTHENTICATION_STRATEGY } from '../core/types';
|
|
27
|
+
export { ERROR_CODES, isAuthError, createAuthError } from '../core/errors';
|
|
28
|
+
export type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, AuthCredential, PhoneAuthResult, AuthError, SessionInfo, UseCase, AuthenticationStrategy, GetPhoneNumberResponse, VerifyPhoneNumberResponse, } from '../core/types';
|
|
29
|
+
//# sourceMappingURL=vanilla.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vanilla.d.ts","sourceRoot":"","sources":["../../../src/adapters/vanilla.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG3E,YAAY,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,SAAS,EACT,WAAW,EACX,OAAO,EACP,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Adapter for Phone Authentication SDK.
|
|
3
|
+
*
|
|
4
|
+
* Provides a Vue composable that wraps PhoneAuthClient with Vue reactivity.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```vue
|
|
8
|
+
* <script setup>
|
|
9
|
+
* import { usePhoneAuth } from '@glideidentity/web-client-sdk/vue';
|
|
10
|
+
*
|
|
11
|
+
* const { authenticate, isLoading, error, result } = usePhoneAuth({ debug: true });
|
|
12
|
+
*
|
|
13
|
+
* const handleClick = async () => {
|
|
14
|
+
* try {
|
|
15
|
+
* const result = await authenticate({
|
|
16
|
+
* use_case: 'VerifyPhoneNumber',
|
|
17
|
+
* phone_number: '+14155551234'
|
|
18
|
+
* });
|
|
19
|
+
* console.log('Verified:', result.verified);
|
|
20
|
+
* } catch (err) {
|
|
21
|
+
* // Error is also in `error` ref
|
|
22
|
+
* }
|
|
23
|
+
* };
|
|
24
|
+
* </script>
|
|
25
|
+
*
|
|
26
|
+
* <template>
|
|
27
|
+
* <button @click="handleClick" :disabled="isLoading">
|
|
28
|
+
* {{ isLoading ? 'Verifying...' : 'Verify Phone' }}
|
|
29
|
+
* </button>
|
|
30
|
+
* </template>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import { PhoneAuthClient } from '../client/phone-auth-client';
|
|
34
|
+
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, AuthError, SessionInfo } from '../core/types';
|
|
35
|
+
export { PhoneAuthClient } from '../client/phone-auth-client';
|
|
36
|
+
export { USE_CASE, AUTHENTICATION_STRATEGY } from '../core/types';
|
|
37
|
+
export { ERROR_CODES, isAuthError, createAuthError } from '../core/errors';
|
|
38
|
+
export type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, PhoneAuthResult, GetPhoneNumberResponse, VerifyPhoneNumberResponse, AuthError, AuthCredential, SessionInfo, UseCase, AuthenticationStrategy, } from '../core/types';
|
|
39
|
+
export type AuthStep = 'idle' | 'preparing' | 'invoking' | 'processing' | 'complete' | 'error';
|
|
40
|
+
/**
|
|
41
|
+
* Vue composable for phone authentication.
|
|
42
|
+
*/
|
|
43
|
+
export declare function usePhoneAuth(config?: AuthConfig): {
|
|
44
|
+
isLoading: import("vue").Ref<boolean, boolean>;
|
|
45
|
+
error: import("vue").Ref<AuthError | null, AuthError | null>;
|
|
46
|
+
result: import("vue").Ref<{
|
|
47
|
+
phone_number: import("../core/types").PhoneNumber;
|
|
48
|
+
aud?: string | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
phone_number: import("../core/types").PhoneNumber;
|
|
51
|
+
verified: boolean;
|
|
52
|
+
aud?: string | undefined;
|
|
53
|
+
} | null, PhoneAuthResult | {
|
|
54
|
+
phone_number: import("../core/types").PhoneNumber;
|
|
55
|
+
aud?: string | undefined;
|
|
56
|
+
} | {
|
|
57
|
+
phone_number: import("../core/types").PhoneNumber;
|
|
58
|
+
verified: boolean;
|
|
59
|
+
aud?: string | undefined;
|
|
60
|
+
} | null>;
|
|
61
|
+
step: import("vue").Ref<AuthStep, AuthStep>;
|
|
62
|
+
isSupported: import("vue").ComputedRef<boolean>;
|
|
63
|
+
authenticate: (request: PrepareRequest, options?: InvokeOptions) => Promise<PhoneAuthResult>;
|
|
64
|
+
prepare: (request: PrepareRequest) => Promise<PrepareResponse>;
|
|
65
|
+
invokeSecurePrompt: (prepared: PrepareResponse, options?: InvokeOptions) => Promise<InvokeResult>;
|
|
66
|
+
getPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
67
|
+
verifyPhoneNumber: (credential: string, session: SessionInfo) => Promise<PhoneAuthResult>;
|
|
68
|
+
reset: () => void;
|
|
69
|
+
client: PhoneAuthClient;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EAET,WAAW,EACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,YAAY,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,SAAS,EACT,cAAc,EACd,WAAW,EACX,OAAO,EACP,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAMvB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAM/F;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;4BAiBnC,cAAc,YACb,aAAa,KACtB,OAAO,CAAC,eAAe,CAAC;uBAsBK,cAAc,KAAG,OAAO,CAAC,eAAe,CAAC;mCAsB7D,eAAe,YACf,aAAa,KACtB,OAAO,CAAC,YAAY,CAAC;iCAgBV,MAAM,WACT,WAAW,KACnB,OAAO,CAAC,eAAe,CAAC;oCAsBb,MAAM,WACT,WAAW,KACnB,OAAO,CAAC,eAAe,CAAC;;;EA0C5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-specific entry point for vanilla JavaScript usage.
|
|
3
|
+
* This is bundled via webpack and exposed as `window.GlideWebClientSDK`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```html
|
|
7
|
+
* <script src="/sdk/web-client-sdk.min.js"></script>
|
|
8
|
+
* <script>
|
|
9
|
+
* const client = new GlideWebClientSDK.PhoneAuthClient({ debug: true });
|
|
10
|
+
* const result = await client.authenticate({
|
|
11
|
+
* use_case: GlideWebClientSDK.USE_CASE.VERIFY_PHONE_NUMBER,
|
|
12
|
+
* phone_number: '+14155551234'
|
|
13
|
+
* });
|
|
14
|
+
* </script>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export { PhoneAuthClient } from './client/phone-auth-client';
|
|
18
|
+
export { USE_CASE, AUTHENTICATION_STRATEGY } from './core/types';
|
|
19
|
+
export { ERROR_CODES } from './core/errors';
|
|
20
|
+
export { isInvokeResult, isAuthCredential, isTS43Strategy, isLinkStrategy, isDesktopStrategy, isCancellable, isTS43Data, isLinkData, isDesktopData, isGetPhoneNumberResponse, isVerifyPhoneNumberResponse, isErrorResponse, } from './core/type-guards';
|
|
21
|
+
export { isAuthError, isClientError, isRetryableError, getUserMessage, createAuthError, } from './core/errors';
|
|
22
|
+
export { validatePhoneNumber, validatePlmn, } from './core/validators';
|
|
23
|
+
export { AuthModal, createQRCodeDataFromDesktop } from './ui/modal';
|
|
24
|
+
export type { UseCase, AuthenticationStrategy, PhoneNumber, SessionInfo, PLMN, ClientInfo, PrepareOptions, PrepareRequest, PrepareResponse, TS43Data, LinkData, DesktopData, InvokeOptions, InvokeResult, AuthCredential, GetPhoneNumberRequest, GetPhoneNumberResponse, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, PhoneAuthResult, AuthConfig, HttpClient, Logger, ModalViewMode, ModalTheme, ModalOptions, AuthError, } from './core/types';
|
|
25
|
+
export type { ErrorCode } from './core/errors';
|
|
26
|
+
export type { QRCodeData } from './ui/modal';
|
|
27
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,EACb,wBAAwB,EACxB,2BAA2B,EAC3B,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAGpE,YAAY,EACV,OAAO,EACP,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,EACf,UAAU,EACV,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Client for Phone Authentication SDK.
|
|
3
|
+
*
|
|
4
|
+
* Provides a default fetch-based implementation with:
|
|
5
|
+
* - Timeout support
|
|
6
|
+
* - Static and dynamic headers
|
|
7
|
+
* - Error parsing using Core utilities
|
|
8
|
+
*/
|
|
9
|
+
import type { HttpClient, HttpOptions, HeaderConfig, HeaderContext } from '../core/types';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for creating an HTTP client.
|
|
12
|
+
*/
|
|
13
|
+
export interface HttpClientConfig {
|
|
14
|
+
/** Request timeout in milliseconds @default 30000 */
|
|
15
|
+
timeout?: number;
|
|
16
|
+
/** Static headers per endpoint type */
|
|
17
|
+
headers?: HeaderConfig;
|
|
18
|
+
/** Dynamic headers function (for auth tokens, etc.) */
|
|
19
|
+
dynamicHeaders?: (context: HeaderContext) => Record<string, string> | Promise<Record<string, string>>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a default fetch-based HTTP client.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const http = createHttpClient({
|
|
27
|
+
* timeout: 30000,
|
|
28
|
+
* headers: {
|
|
29
|
+
* common: { 'X-Client-Version': '2.0.0' },
|
|
30
|
+
* prepare: { 'X-Prepare-Only': 'true' }
|
|
31
|
+
* },
|
|
32
|
+
* dynamicHeaders: async (ctx) => {
|
|
33
|
+
* const token = await getAuthToken();
|
|
34
|
+
* return { 'Authorization': `Bearer ${token}` };
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function createHttpClient(config?: HttpClientConfig): HttpClient;
|
|
40
|
+
export type { HttpClient, HttpOptions, HeaderConfig, HeaderContext };
|
|
41
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/client/http.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAO1F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,uDAAuD;IACvD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACvG;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,gBAAqB,GAAG,UAAU,CAsK1E;AAMD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client module exports.
|
|
3
|
+
*/
|
|
4
|
+
export { PhoneAuthClient } from './phone-auth-client';
|
|
5
|
+
export { createHttpClient, type HttpClientConfig } from './http';
|
|
6
|
+
export type { HttpClient, HttpOptions, HeaderConfig, HeaderContext } from './http';
|
|
7
|
+
export { createLogger, createNoopLogger, type LoggerConfig } from './logger';
|
|
8
|
+
export type { Logger } from './logger';
|
|
9
|
+
export { createPollingHandler, type PollingConfig, type PollingResult } from './strategies/polling';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGnF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger for Phone Authentication SDK.
|
|
3
|
+
*
|
|
4
|
+
* Provides a simple console-based logger with:
|
|
5
|
+
* - Debug mode toggle
|
|
6
|
+
* - PII sanitization
|
|
7
|
+
* - Configurable prefix
|
|
8
|
+
*/
|
|
9
|
+
import type { Logger } from '../core/types';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for creating a logger.
|
|
12
|
+
*/
|
|
13
|
+
export interface LoggerConfig {
|
|
14
|
+
/** Enable debug logging @default false */
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
/** Log prefix @default '[PhoneAuth]' */
|
|
17
|
+
prefix?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a logger instance.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const logger = createLogger({ debug: true });
|
|
25
|
+
* logger.debug('Preparing request', { use_case: 'GetPhoneNumber' });
|
|
26
|
+
* logger.error('Request failed', { code: 'NETWORK_ERROR' });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function createLogger(config?: LoggerConfig): Logger;
|
|
30
|
+
/**
|
|
31
|
+
* Create a no-op logger (silent).
|
|
32
|
+
* Useful for testing or when logging is not needed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createNoopLogger(): Logger;
|
|
35
|
+
export type { Logger };
|
|
36
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/client/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAM5C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqFD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAE,YAAiB,GAAG,MAAM,CAwC9D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAOzC;AAMD,YAAY,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phone Authentication Client
|
|
3
|
+
*
|
|
4
|
+
* Main SDK client for phone number authentication.
|
|
5
|
+
* Supports all strategies: TS43 (Android), Link (iOS), Desktop (QR).
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: invokeSecurePrompt must be called from a user gesture (button click)
|
|
8
|
+
* because both iOS App Clips and Android Digital Credentials API require
|
|
9
|
+
* transient activation (user interaction) to open system UI.
|
|
10
|
+
*/
|
|
11
|
+
import type { AuthConfig, PrepareRequest, PrepareResponse, InvokeOptions, InvokeResult, SessionInfo, GetPhoneNumberResponse, VerifyPhoneNumberResponse, PhoneAuthResult } from '../core/types';
|
|
12
|
+
export declare class PhoneAuthClient {
|
|
13
|
+
private config;
|
|
14
|
+
private http;
|
|
15
|
+
private logger;
|
|
16
|
+
constructor(config?: AuthConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Complete authentication flow in one call.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Get phone number
|
|
23
|
+
* const result = await client.authenticate({ use_case: 'GetPhoneNumber' });
|
|
24
|
+
* console.log(result.phone_number);
|
|
25
|
+
*
|
|
26
|
+
* // Verify phone number
|
|
27
|
+
* const result = await client.authenticate({
|
|
28
|
+
* use_case: 'VerifyPhoneNumber',
|
|
29
|
+
* phone_number: '+14155551234'
|
|
30
|
+
* });
|
|
31
|
+
* console.log(result.verified);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
authenticate(request: PrepareRequest, options?: InvokeOptions): Promise<PhoneAuthResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Step 1: Prepare authentication request.
|
|
37
|
+
*
|
|
38
|
+
* Validates input and sends prepare request to backend.
|
|
39
|
+
*/
|
|
40
|
+
prepare(request: PrepareRequest): Promise<PrepareResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Step 2: Invoke secure prompt for authentication.
|
|
43
|
+
*
|
|
44
|
+
* IMPORTANT: Must be called from a user gesture (button click).
|
|
45
|
+
*
|
|
46
|
+
* Returns unified InvokeResult with:
|
|
47
|
+
* - credential: Promise that resolves to AuthCredential
|
|
48
|
+
* - cancel?: Function to cancel (Link/Desktop only)
|
|
49
|
+
* - strategy: The authentication strategy used
|
|
50
|
+
* - session: Session info
|
|
51
|
+
*/
|
|
52
|
+
invokeSecurePrompt(prepared: PrepareResponse, options?: InvokeOptions): Promise<InvokeResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Step 3A: Get phone number from credential.
|
|
55
|
+
*/
|
|
56
|
+
getPhoneNumber(credential: string, session: SessionInfo): Promise<GetPhoneNumberResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Step 3B: Verify phone number with credential.
|
|
59
|
+
*/
|
|
60
|
+
verifyPhoneNumber(credential: string, session: SessionInfo): Promise<VerifyPhoneNumberResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Check if Digital Credentials API is supported.
|
|
63
|
+
*/
|
|
64
|
+
isSupported(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Get browser support info for debugging.
|
|
67
|
+
*/
|
|
68
|
+
getBrowserSupportInfo(): {
|
|
69
|
+
supported: boolean;
|
|
70
|
+
browser: string;
|
|
71
|
+
message?: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Handle TS43 strategy (Android Digital Credentials API).
|
|
75
|
+
*/
|
|
76
|
+
private handleTS43;
|
|
77
|
+
/**
|
|
78
|
+
* Handle Link strategy (iOS App Clips).
|
|
79
|
+
* Uses window.location.href to navigate to the App Clip.
|
|
80
|
+
*/
|
|
81
|
+
private handleLink;
|
|
82
|
+
/**
|
|
83
|
+
* Handle Desktop strategy (QR code).
|
|
84
|
+
*/
|
|
85
|
+
private handleDesktop;
|
|
86
|
+
/**
|
|
87
|
+
* Generate a unique request ID.
|
|
88
|
+
*/
|
|
89
|
+
private generateRequestId;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=phone-auth-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-auth-client.d.ts","sourceRoot":"","sources":["../../../src/client/phone-auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EAEZ,WAAW,EAEX,sBAAsB,EAEtB,yBAAyB,EACzB,eAAe,EAShB,MAAM,eAAe,CAAC;AAuDvB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,GAAE,UAAe;IA4CnC;;;;;;;;;;;;;;;;OAgBG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IAoC9F;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAoDhE;;;;;;;;;;OAUG;IACG,kBAAkB,CACtB,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAuBxB;;OAEG;IACG,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;IAuBlC;;OAEG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,yBAAyB,CAAC;IA2BrC;;OAEG;IACH,WAAW,IAAI,OAAO;IAKtB;;OAEG;IACH,qBAAqB,IAAI;QACvB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IA4BD;;OAEG;YACW,UAAU;IA0FxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IA6ClB;;OAEG;IACH,OAAO,CAAC,aAAa;IAmFrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared polling utility for Link and Desktop strategies.
|
|
3
|
+
* Handles authentication status polling with cancel support.
|
|
4
|
+
*/
|
|
5
|
+
import type { Logger, SessionInfo } from '../../core/types';
|
|
6
|
+
export interface PollingConfig {
|
|
7
|
+
/** Session key to poll */
|
|
8
|
+
sessionKey: string;
|
|
9
|
+
/** Polling interval in ms @default 2000 */
|
|
10
|
+
interval?: number;
|
|
11
|
+
/** Max polling attempts @default 30 */
|
|
12
|
+
maxAttempts?: number;
|
|
13
|
+
/** Custom polling endpoint */
|
|
14
|
+
pollingEndpoint?: string;
|
|
15
|
+
/** Backend-provided status URL */
|
|
16
|
+
statusUrl?: string;
|
|
17
|
+
/** Logger instance */
|
|
18
|
+
logger?: Logger;
|
|
19
|
+
}
|
|
20
|
+
export interface PollingResult {
|
|
21
|
+
status: 'completed' | 'pending' | 'expired' | 'cancelled' | 'error';
|
|
22
|
+
credential?: string;
|
|
23
|
+
session?: SessionInfo;
|
|
24
|
+
message?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a polling handler for authentication status.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createPollingHandler(config: PollingConfig): {
|
|
30
|
+
start: () => Promise<PollingResult>;
|
|
31
|
+
stop: () => void;
|
|
32
|
+
cancel: () => void;
|
|
33
|
+
isPolling: () => boolean;
|
|
34
|
+
cleanup: () => void;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=polling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../../../../src/client/strategies/polling.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAO5E,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa;iBA+CtC,OAAO,CAAC,aAAa,CAAC;gBA4FvB,IAAI;kBAWF,IAAI;qBAcD,OAAO;mBAOT,IAAI;EAazB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error utilities for phone authentication.
|
|
3
|
+
*
|
|
4
|
+
* This file only handles CLIENT-SIDE errors (validation, browser issues, etc.).
|
|
5
|
+
* Server errors from Magic Auth are passed through as-is since they already
|
|
6
|
+
* have proper error codes and messages.
|
|
7
|
+
*/
|
|
8
|
+
import type { AuthError, UseCase } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Error codes for client-side errors only.
|
|
11
|
+
* Server errors use their own codes from Magic Auth backend.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ERROR_CODES: {
|
|
14
|
+
readonly INVALID_PHONE_NUMBER: "INVALID_PHONE_NUMBER";
|
|
15
|
+
readonly INVALID_PLMN: "INVALID_PLMN";
|
|
16
|
+
readonly MISSING_PARAMETERS: "MISSING_PARAMETERS";
|
|
17
|
+
readonly BROWSER_NOT_SUPPORTED: "BROWSER_NOT_SUPPORTED";
|
|
18
|
+
readonly UNSUPPORTED_STRATEGY: "UNSUPPORTED_STRATEGY";
|
|
19
|
+
readonly USER_CANCELLED: "USER_CANCELLED";
|
|
20
|
+
readonly CANCELLED: "CANCELLED";
|
|
21
|
+
readonly VERIFICATION_FAILED: "VERIFICATION_FAILED";
|
|
22
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
23
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
24
|
+
readonly INVALID_RESPONSE: "INVALID_RESPONSE";
|
|
25
|
+
};
|
|
26
|
+
export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
27
|
+
/**
|
|
28
|
+
* Type guard to check if an error is an AuthError.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isAuthError(error: unknown): error is AuthError;
|
|
31
|
+
/**
|
|
32
|
+
* Check if error is a client-side error (not from server).
|
|
33
|
+
*/
|
|
34
|
+
export declare function isClientError(error: AuthError): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Check if error is retryable.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isRetryableError(error: AuthError): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get user-friendly message for client-side errors.
|
|
41
|
+
* For server errors, returns the server's message as-is.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getUserMessage(error: AuthError): string;
|
|
44
|
+
/**
|
|
45
|
+
* Create a client-side AuthError.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* throw createAuthError('INVALID_PHONE_NUMBER', 'Phone number must start with +');
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function createAuthError(code: ErrorCode, message?: string, details?: unknown): AuthError;
|
|
53
|
+
/**
|
|
54
|
+
* Create a client-side AuthError with context.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createAuthErrorWithContext(code: ErrorCode, context: {
|
|
57
|
+
step?: 'prepare' | 'invoke' | 'process';
|
|
58
|
+
useCase?: UseCase;
|
|
59
|
+
message?: string;
|
|
60
|
+
details?: unknown;
|
|
61
|
+
}): AuthError;
|
|
62
|
+
/**
|
|
63
|
+
* Parse error response from backend API.
|
|
64
|
+
* Simply converts the server response to AuthError format without modifying the message.
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseBackendError(response: unknown): AuthError;
|
|
67
|
+
/**
|
|
68
|
+
* Serialize error for logging (sanitizes sensitive info).
|
|
69
|
+
*/
|
|
70
|
+
export declare function serializeError(error: AuthError): Record<string, unknown>;
|
|
71
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMlD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;CAqBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AA2BrE;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAS9D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOvD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,GAChB,SAAS,CAMX;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE;IACP,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,SAAS,CAUX;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAwC9D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAexE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glide Phone Authentication - Core Package
|
|
3
|
+
*
|
|
4
|
+
* This package contains:
|
|
5
|
+
* - All TypeScript types (API and SDK types)
|
|
6
|
+
* - Pure validation functions
|
|
7
|
+
* - Type guards for type-safe development
|
|
8
|
+
* - Error codes and utilities
|
|
9
|
+
*
|
|
10
|
+
* ZERO RUNTIME DEPENDENCIES - safe to import anywhere.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Import from core for types-only usage
|
|
15
|
+
* import {
|
|
16
|
+
* type PrepareRequest,
|
|
17
|
+
* type PrepareResponse,
|
|
18
|
+
* validatePhoneNumber,
|
|
19
|
+
* isDesktopStrategy,
|
|
20
|
+
* ERROR_CODES
|
|
21
|
+
* } from '@glideidentity/web-client-sdk/core';
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type { PhoneNumber, Timestamp, UUID, } from './types';
|
|
25
|
+
export type { UseCase, AuthenticationStrategy, SessionInfo, PLMN, ClientInfo, } from './types';
|
|
26
|
+
export type { PrepareOptions, PrepareRequest, PrepareResponse, } from './types';
|
|
27
|
+
export type { TS43Data, LinkData, DesktopData, } from './types';
|
|
28
|
+
export type { InvokeOptions, AuthCredential, InvokeResult, ModalViewMode, ModalTheme, ModalOptions, } from './types';
|
|
29
|
+
export type { GetPhoneNumberRequest, GetPhoneNumberResponse, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, PhoneAuthResult, } from './types';
|
|
30
|
+
export type { AuthConfig, HttpClient, HttpOptions, Logger, HeaderConfig, HeaderContext, } from './types';
|
|
31
|
+
export type { AuthError, } from './types';
|
|
32
|
+
export type { DigitalCredential, SecureCredentialRequest, SecureCredentialResponse, } from './types';
|
|
33
|
+
export { USE_CASE, AUTHENTICATION_STRATEGY, } from './types';
|
|
34
|
+
export { ERROR_CODES, type ErrorCode, } from './errors';
|
|
35
|
+
export { validatePhoneNumber, validatePlmn, validateUseCaseRequirements, validateNonce, validateSessionKey, E164_REGEX, type ValidationResult, } from './validators';
|
|
36
|
+
export { isInvokeResult, isAuthCredential, isTS43Strategy, isLinkStrategy, isDesktopStrategy, isCancellable, isTS43Data, isLinkData, isDesktopData, getStrategyData, isGetPhoneNumberResponse, isVerifyPhoneNumberResponse, isErrorResponse, } from './type-guards';
|
|
37
|
+
export { isAuthError, isClientError, isRetryableError, getUserMessage, createAuthError, createAuthErrorWithContext, parseBackendError, serializeError, } from './errors';
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,YAAY,EACV,WAAW,EACX,SAAS,EACT,IAAI,GACL,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,OAAO,EACP,sBAAsB,EACtB,WAAW,EACX,IAAI,EACJ,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,MAAM,EACN,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,SAAS,GACV,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAMjB,OAAO,EACL,QAAQ,EACR,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,WAAW,EACX,KAAK,SAAS,GACf,MAAM,UAAU,CAAC;AAMlB,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,2BAA2B,EAC3B,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAEL,cAAc,EACd,gBAAgB,EAGhB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EAGb,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EAGf,wBAAwB,EACxB,2BAA2B,EAG3B,eAAe,GAChB,MAAM,eAAe,CAAC;AAMvB,OAAO,EAEL,WAAW,EACX,aAAa,EACb,gBAAgB,EAGhB,cAAc,EAGd,eAAe,EACf,0BAA0B,EAG1B,iBAAiB,EAGjB,cAAc,GACf,MAAM,UAAU,CAAC"}
|