@glideidentity/web-client-sdk 4.4.8-beta.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 +938 -0
- package/dist/adapters/angular/client.service.d.ts +7 -0
- package/dist/adapters/angular/client.service.js +30 -0
- package/dist/adapters/angular/index.d.ts +3 -0
- package/dist/adapters/angular/index.js +18 -0
- package/dist/adapters/angular/phone-auth.service.d.ts +38 -0
- package/dist/adapters/angular/phone-auth.service.js +130 -0
- package/dist/adapters/react/index.d.ts +9 -0
- package/dist/adapters/react/index.js +28 -0
- package/dist/adapters/react/useClient.d.ts +26 -0
- package/dist/adapters/react/useClient.js +121 -0
- package/dist/adapters/react/usePhoneAuth.d.ts +23 -0
- package/dist/adapters/react/usePhoneAuth.js +95 -0
- package/dist/adapters/vanilla/client.d.ts +8 -0
- package/dist/adapters/vanilla/client.js +33 -0
- package/dist/adapters/vanilla/index.d.ts +3 -0
- package/dist/adapters/vanilla/index.js +18 -0
- package/dist/adapters/vanilla/phone-auth.d.ts +46 -0
- package/dist/adapters/vanilla/phone-auth.js +138 -0
- package/dist/adapters/vue/index.d.ts +10 -0
- package/dist/adapters/vue/index.js +36 -0
- package/dist/adapters/vue/useClient.d.ts +115 -0
- package/dist/adapters/vue/useClient.js +131 -0
- package/dist/adapters/vue/usePhoneAuth.d.ts +94 -0
- package/dist/adapters/vue/usePhoneAuth.js +103 -0
- package/dist/browser/web-client-sdk.min.js +2 -0
- package/dist/browser/web-client-sdk.min.js.LICENSE.txt +1 -0
- package/dist/browser.d.ts +7 -0
- package/dist/browser.js +31 -0
- package/dist/core/client.d.ts +22 -0
- package/dist/core/client.js +77 -0
- package/dist/core/logger.d.ts +130 -0
- package/dist/core/logger.js +370 -0
- package/dist/core/phone-auth/api-types.d.ts +525 -0
- package/dist/core/phone-auth/api-types.js +215 -0
- package/dist/core/phone-auth/client.d.ts +187 -0
- package/dist/core/phone-auth/client.js +1353 -0
- package/dist/core/phone-auth/error-utils.d.ts +110 -0
- package/dist/core/phone-auth/error-utils.js +350 -0
- package/dist/core/phone-auth/index.d.ts +7 -0
- package/dist/core/phone-auth/index.js +47 -0
- package/dist/core/phone-auth/status-types.d.ts +107 -0
- package/dist/core/phone-auth/status-types.js +31 -0
- package/dist/core/phone-auth/strategies/desktop.d.ts +113 -0
- package/dist/core/phone-auth/strategies/desktop.js +502 -0
- package/dist/core/phone-auth/strategies/index.d.ts +11 -0
- package/dist/core/phone-auth/strategies/index.js +15 -0
- package/dist/core/phone-auth/strategies/link.d.ts +81 -0
- package/dist/core/phone-auth/strategies/link.js +265 -0
- package/dist/core/phone-auth/strategies/ts43.d.ts +32 -0
- package/dist/core/phone-auth/strategies/ts43.js +146 -0
- package/dist/core/phone-auth/strategies/types.d.ts +18 -0
- package/dist/core/phone-auth/strategies/types.js +6 -0
- package/dist/core/phone-auth/type-guards.d.ts +125 -0
- package/dist/core/phone-auth/type-guards.js +160 -0
- package/dist/core/phone-auth/types.d.ts +232 -0
- package/dist/core/phone-auth/types.js +93 -0
- package/dist/core/phone-auth/ui/mobile-debug-console.d.ts +25 -0
- package/dist/core/phone-auth/ui/mobile-debug-console.js +288 -0
- package/dist/core/phone-auth/ui/modal.d.ts +84 -0
- package/dist/core/phone-auth/ui/modal.js +574 -0
- package/dist/core/phone-auth/validation-utils.d.ts +66 -0
- package/dist/core/phone-auth/validation-utils.js +182 -0
- package/dist/core/types.d.ts +62 -0
- package/dist/core/types.js +2 -0
- package/dist/core/version.d.ts +1 -0
- package/dist/core/version.js +5 -0
- package/dist/esm/adapters/angular/client.service.d.ts +7 -0
- package/dist/esm/adapters/angular/client.service.js +27 -0
- package/dist/esm/adapters/angular/index.d.ts +3 -0
- package/dist/esm/adapters/angular/index.js +4 -0
- package/dist/esm/adapters/angular/phone-auth.service.d.ts +38 -0
- package/dist/esm/adapters/angular/phone-auth.service.js +127 -0
- package/dist/esm/adapters/react/index.d.ts +9 -0
- package/dist/esm/adapters/react/index.js +8 -0
- package/dist/esm/adapters/react/useClient.d.ts +26 -0
- package/dist/esm/adapters/react/useClient.js +116 -0
- package/dist/esm/adapters/react/usePhoneAuth.d.ts +23 -0
- package/dist/esm/adapters/react/usePhoneAuth.js +92 -0
- package/dist/esm/adapters/vanilla/client.d.ts +8 -0
- package/dist/esm/adapters/vanilla/client.js +29 -0
- package/dist/esm/adapters/vanilla/index.d.ts +3 -0
- package/dist/esm/adapters/vanilla/index.js +4 -0
- package/dist/esm/adapters/vanilla/phone-auth.d.ts +46 -0
- package/dist/esm/adapters/vanilla/phone-auth.js +134 -0
- package/dist/esm/adapters/vue/index.d.ts +10 -0
- package/dist/esm/adapters/vue/index.js +11 -0
- package/dist/esm/adapters/vue/useClient.d.ts +115 -0
- package/dist/esm/adapters/vue/useClient.js +127 -0
- package/dist/esm/adapters/vue/usePhoneAuth.d.ts +94 -0
- package/dist/esm/adapters/vue/usePhoneAuth.js +100 -0
- package/dist/esm/browser.d.ts +7 -0
- package/dist/esm/browser.js +11 -0
- package/dist/esm/core/client.d.ts +22 -0
- package/dist/esm/core/client.js +70 -0
- package/dist/esm/core/logger.d.ts +130 -0
- package/dist/esm/core/logger.js +359 -0
- package/dist/esm/core/phone-auth/api-types.d.ts +525 -0
- package/dist/esm/core/phone-auth/api-types.js +203 -0
- package/dist/esm/core/phone-auth/client.d.ts +187 -0
- package/dist/esm/core/phone-auth/client.js +1316 -0
- package/dist/esm/core/phone-auth/error-utils.d.ts +110 -0
- package/dist/esm/core/phone-auth/error-utils.js +338 -0
- package/dist/esm/core/phone-auth/index.d.ts +7 -0
- package/dist/esm/core/phone-auth/index.js +6 -0
- package/dist/esm/core/phone-auth/status-types.d.ts +107 -0
- package/dist/esm/core/phone-auth/status-types.js +26 -0
- package/dist/esm/core/phone-auth/strategies/desktop.d.ts +113 -0
- package/dist/esm/core/phone-auth/strategies/desktop.js +496 -0
- package/dist/esm/core/phone-auth/strategies/index.d.ts +11 -0
- package/dist/esm/core/phone-auth/strategies/index.js +7 -0
- package/dist/esm/core/phone-auth/strategies/link.d.ts +81 -0
- package/dist/esm/core/phone-auth/strategies/link.js +261 -0
- package/dist/esm/core/phone-auth/strategies/ts43.d.ts +32 -0
- package/dist/esm/core/phone-auth/strategies/ts43.js +142 -0
- package/dist/esm/core/phone-auth/strategies/types.d.ts +18 -0
- package/dist/esm/core/phone-auth/strategies/types.js +5 -0
- package/dist/esm/core/phone-auth/type-guards.d.ts +125 -0
- package/dist/esm/core/phone-auth/type-guards.js +150 -0
- package/dist/esm/core/phone-auth/types.d.ts +232 -0
- package/dist/esm/core/phone-auth/types.js +76 -0
- package/dist/esm/core/phone-auth/ui/mobile-debug-console.d.ts +25 -0
- package/dist/esm/core/phone-auth/ui/mobile-debug-console.js +284 -0
- package/dist/esm/core/phone-auth/ui/modal.d.ts +84 -0
- package/dist/esm/core/phone-auth/ui/modal.js +570 -0
- package/dist/esm/core/phone-auth/validation-utils.d.ts +66 -0
- package/dist/esm/core/phone-auth/validation-utils.js +174 -0
- package/dist/esm/core/types.d.ts +62 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/core/version.d.ts +1 -0
- package/dist/esm/core/version.js +2 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +15 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +52 -0
- package/package.json +92 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation utilities for phone authentication
|
|
3
|
+
*/
|
|
4
|
+
import { USE_CASE } from './api-types';
|
|
5
|
+
/**
|
|
6
|
+
* Validates E.164 phone number format
|
|
7
|
+
* @param phoneNumber - Phone number to validate
|
|
8
|
+
* @returns Validation result with error if invalid
|
|
9
|
+
*/
|
|
10
|
+
export function validatePhoneNumber(phoneNumber) {
|
|
11
|
+
if (!phoneNumber) {
|
|
12
|
+
return { valid: true }; // Phone number is optional for GetPhoneNumber
|
|
13
|
+
}
|
|
14
|
+
// E.164 format validation - strict, no cleaning
|
|
15
|
+
const e164Regex = /^\+[1-9]\d{1,14}$/;
|
|
16
|
+
if (!phoneNumber.startsWith('+')) {
|
|
17
|
+
return {
|
|
18
|
+
valid: false,
|
|
19
|
+
error: 'Phone number must be in E.164 format (start with +)'
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (phoneNumber.length < 8) {
|
|
23
|
+
return {
|
|
24
|
+
valid: false,
|
|
25
|
+
error: 'Phone number too short for E.164 format (minimum 8 characters including +)'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (phoneNumber.length > 16) {
|
|
29
|
+
return {
|
|
30
|
+
valid: false,
|
|
31
|
+
error: 'Phone number too long for E.164 format (maximum 15 digits after +)'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// Check for any invalid characters (spaces, dashes, parentheses, etc.)
|
|
35
|
+
if (!/^\+\d+$/.test(phoneNumber)) {
|
|
36
|
+
return {
|
|
37
|
+
valid: false,
|
|
38
|
+
error: 'Phone number contains invalid characters. E.164 format only allows + followed by digits'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (!e164Regex.test(phoneNumber)) {
|
|
42
|
+
return {
|
|
43
|
+
valid: false,
|
|
44
|
+
error: 'Invalid E.164 phone number format'
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return { valid: true };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validates PLMN (MCC/MNC) values
|
|
51
|
+
* @param plmn - PLMN object with MCC and MNC
|
|
52
|
+
* @returns Validation result
|
|
53
|
+
*/
|
|
54
|
+
export function validatePlmn(plmn) {
|
|
55
|
+
if (!plmn) {
|
|
56
|
+
return { valid: true }; // PLMN is optional
|
|
57
|
+
}
|
|
58
|
+
const { mcc, mnc } = plmn;
|
|
59
|
+
// MCC validation (3 digits) - no range check for telco labs
|
|
60
|
+
if (!mcc || !/^\d{3}$/.test(mcc)) {
|
|
61
|
+
return {
|
|
62
|
+
valid: false,
|
|
63
|
+
error: 'MCC must be exactly 3 digits'
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// MNC validation (2 or 3 digits)
|
|
67
|
+
if (!mnc || !/^\d{2,3}$/.test(mnc)) {
|
|
68
|
+
return {
|
|
69
|
+
valid: false,
|
|
70
|
+
error: 'MNC must be 2 or 3 digits'
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// No range validation - allowing unofficial MCCs for telco labs
|
|
74
|
+
return { valid: true };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Validates use case and phone number combination
|
|
78
|
+
* @param useCase - The use case
|
|
79
|
+
* @param phoneNumber - The phone number (required for VerifyPhoneNumber)
|
|
80
|
+
* @param hasParentSessionId - Whether parent_session_id is provided (allows skipping normal validation)
|
|
81
|
+
* @returns Validation result
|
|
82
|
+
*/
|
|
83
|
+
export function validateUseCaseRequirements(useCase, phoneNumber, hasParentSessionId) {
|
|
84
|
+
// VerifyPhoneNumber requires a phone number (unless parent_session_id is provided)
|
|
85
|
+
if (useCase === USE_CASE.VERIFY_PHONE_NUMBER && !phoneNumber && !hasParentSessionId) {
|
|
86
|
+
return {
|
|
87
|
+
valid: false,
|
|
88
|
+
error: 'Phone number is required for VerifyPhoneNumber use case'
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { valid: true };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validates consent data
|
|
95
|
+
* @param consentData - Consent data object
|
|
96
|
+
* @returns Validation result
|
|
97
|
+
*/
|
|
98
|
+
export function validateConsentData(consentData) {
|
|
99
|
+
if (!consentData) {
|
|
100
|
+
return { valid: true }; // Consent data is optional
|
|
101
|
+
}
|
|
102
|
+
const { consent_text: consentText, policy_link: policyLink, policy_text: policyText } = consentData;
|
|
103
|
+
if (!consentText || consentText.trim().length === 0) {
|
|
104
|
+
return {
|
|
105
|
+
valid: false,
|
|
106
|
+
error: 'Consent text is required when consent data is provided'
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (!policyLink || policyLink.trim().length === 0) {
|
|
110
|
+
return {
|
|
111
|
+
valid: false,
|
|
112
|
+
error: 'Policy link is required when consent data is provided'
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Validate URL format for policy link
|
|
116
|
+
try {
|
|
117
|
+
new URL(policyLink);
|
|
118
|
+
}
|
|
119
|
+
catch (_a) {
|
|
120
|
+
return {
|
|
121
|
+
valid: false,
|
|
122
|
+
error: 'Policy link must be a valid URL'
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (!policyText || policyText.trim().length === 0) {
|
|
126
|
+
return {
|
|
127
|
+
valid: false,
|
|
128
|
+
error: 'Policy text is required when consent data is provided'
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return { valid: true };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Creates a validation error
|
|
135
|
+
* @param code - Error code
|
|
136
|
+
* @param message - Error message
|
|
137
|
+
* @param field - Field that failed validation
|
|
138
|
+
*/
|
|
139
|
+
export function createValidationError(code, message, field) {
|
|
140
|
+
const error = new Error(message);
|
|
141
|
+
error.code = code;
|
|
142
|
+
if (field) {
|
|
143
|
+
error.field = field;
|
|
144
|
+
}
|
|
145
|
+
return error;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Validates nonce format
|
|
149
|
+
* @param nonce - Nonce string to validate
|
|
150
|
+
* @returns Validation result
|
|
151
|
+
*/
|
|
152
|
+
export function validateNonce(nonce) {
|
|
153
|
+
// Nonce should be base64url encoded and have reasonable length
|
|
154
|
+
const base64urlRegex = /^[A-Za-z0-9_-]+$/;
|
|
155
|
+
if (!nonce || nonce.length === 0) {
|
|
156
|
+
return {
|
|
157
|
+
valid: false,
|
|
158
|
+
error: 'Nonce is required'
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (!base64urlRegex.test(nonce)) {
|
|
162
|
+
return {
|
|
163
|
+
valid: false,
|
|
164
|
+
error: 'Nonce must be base64url encoded'
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (nonce.length < 32 || nonce.length > 128) {
|
|
168
|
+
return {
|
|
169
|
+
valid: false,
|
|
170
|
+
error: 'Nonce must be between 32 and 128 characters'
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
return { valid: true };
|
|
174
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { LogLevel, Logger } from './logger';
|
|
2
|
+
export interface ClientConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Base URL for API requests
|
|
5
|
+
* Required only if using useQuery() or client.get() methods
|
|
6
|
+
* Not required for phone authentication
|
|
7
|
+
*/
|
|
8
|
+
baseURL?: string;
|
|
9
|
+
/**
|
|
10
|
+
* API key for authentication
|
|
11
|
+
* Currently not used in the SDK but kept for backward compatibility
|
|
12
|
+
*/
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Request timeout in milliseconds
|
|
16
|
+
* @default 10000
|
|
17
|
+
*/
|
|
18
|
+
timeout?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Target origin for authentication
|
|
21
|
+
* Used for cross-origin authentication flows
|
|
22
|
+
* If not provided, uses baseURL or current origin
|
|
23
|
+
*/
|
|
24
|
+
authTargetOrigin?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Phone authentication endpoints
|
|
27
|
+
* If not provided, uses default endpoints relative to baseURL
|
|
28
|
+
*/
|
|
29
|
+
phoneAuthEndpoints?: {
|
|
30
|
+
prepareRequest: string;
|
|
31
|
+
processResponse: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Enable debug logging
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
debug?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Set specific log level
|
|
40
|
+
*/
|
|
41
|
+
logLevel?: LogLevel;
|
|
42
|
+
/**
|
|
43
|
+
* Custom logger implementation
|
|
44
|
+
*/
|
|
45
|
+
logger?: Logger;
|
|
46
|
+
/**
|
|
47
|
+
* Remote logging configuration
|
|
48
|
+
*/
|
|
49
|
+
remoteLogging?: {
|
|
50
|
+
endpoint: string;
|
|
51
|
+
apiKey: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface RequestOptions {
|
|
55
|
+
headers?: Record<string, string>;
|
|
56
|
+
params?: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
export interface ClientResponse<T = any> {
|
|
59
|
+
data: T;
|
|
60
|
+
status: number;
|
|
61
|
+
headers: Record<string, string>;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "__SDK_VERSION__";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { PhoneAuthClient } from './core/phone-auth';
|
|
2
|
+
export type { AuthConfig as PhoneAuthConfig, PhoneAuthOptions, PhoneAuthResult, AuthError as PhoneAuthError, AuthStep as PhoneAuthStep } from './core/phone-auth';
|
|
3
|
+
export { PhoneAuthErrorCode, isPhoneAuthError, isUserError, getUserMessage, isErrorCode, getRetryDelay, isRetryableError, serializeError, createErrorBreadcrumb } from './core/phone-auth';
|
|
4
|
+
export { isHeadlessResult, isCredential, isLinkStrategy, isTS43Strategy, isDesktopStrategy, getStrategy, requiresPolling, requiresUserAction } from './core/phone-auth';
|
|
5
|
+
export type { PhoneAuthCallbacks, PLMN, SessionInfo, HeadlessResult, InvokeOptions, PrepareRequest, PrepareResponse, GetPhoneNumberRequest, GetPhoneNumberResponse, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, SecureCredentialRequest, SecureCredentialResponse, DigitalCredential, TS43Data, LinkData, DesktopData, ClientInfo, ConsentData, BrowserErrorType, BrowserErrorCodeType, BrowserNameType } from './core/phone-auth/types';
|
|
6
|
+
export { USE_CASE as UseCase, AUTHENTICATION_STRATEGY as AuthenticationStrategy, BrowserError, BrowserErrorCode, BrowserName } from './core/phone-auth/types';
|
|
7
|
+
export { DesktopHandler, showQRCodeModal, createQRCodeDisplay } from './core/phone-auth/strategies/desktop';
|
|
8
|
+
export type { DesktopAuthOptions, DesktopAuthResult, PollingStatus, QRCodeData } from './core/phone-auth/strategies/desktop';
|
|
9
|
+
export { useClient, usePhoneAuth } from './adapters/react';
|
|
10
|
+
export { useClient as useVueClient, usePhoneAuth as useVuePhoneAuth } from './adapters/vue';
|
|
11
|
+
export { ClientService, PhoneAuthService } from './adapters/angular';
|
|
12
|
+
export { ClientManager, PhoneAuthManager } from './adapters/vanilla';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Phone Authentication
|
|
2
|
+
export { PhoneAuthClient } from './core/phone-auth';
|
|
3
|
+
// Phone Auth Error Utilities
|
|
4
|
+
export { PhoneAuthErrorCode, isPhoneAuthError, isUserError, getUserMessage, isErrorCode, getRetryDelay, isRetryableError, serializeError, createErrorBreadcrumb } from './core/phone-auth';
|
|
5
|
+
// Phone Auth Type Guards and Helpers
|
|
6
|
+
export { isHeadlessResult, isCredential, isLinkStrategy, isTS43Strategy, isDesktopStrategy, getStrategy, requiresPolling, requiresUserAction } from './core/phone-auth';
|
|
7
|
+
// Export constants for use case and strategy
|
|
8
|
+
export { USE_CASE as UseCase, AUTHENTICATION_STRATEGY as AuthenticationStrategy, BrowserError, BrowserErrorCode, BrowserName } from './core/phone-auth/types';
|
|
9
|
+
// Desktop Strategy Exports
|
|
10
|
+
export { DesktopHandler, showQRCodeModal, createQRCodeDisplay } from './core/phone-auth/strategies/desktop';
|
|
11
|
+
// Adapters
|
|
12
|
+
export { useClient, usePhoneAuth } from './adapters/react';
|
|
13
|
+
export { useClient as useVueClient, usePhoneAuth as useVuePhoneAuth } from './adapters/vue';
|
|
14
|
+
export { ClientService, PhoneAuthService } from './adapters/angular';
|
|
15
|
+
export { ClientManager, PhoneAuthManager } from './adapters/vanilla';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { PhoneAuthClient } from './core/phone-auth';
|
|
2
|
+
export type { AuthConfig as PhoneAuthConfig, PhoneAuthOptions, PhoneAuthResult, AuthError as PhoneAuthError, AuthStep as PhoneAuthStep } from './core/phone-auth';
|
|
3
|
+
export { PhoneAuthErrorCode, isPhoneAuthError, isUserError, getUserMessage, isErrorCode, getRetryDelay, isRetryableError, serializeError, createErrorBreadcrumb } from './core/phone-auth';
|
|
4
|
+
export { isHeadlessResult, isCredential, isLinkStrategy, isTS43Strategy, isDesktopStrategy, getStrategy, requiresPolling, requiresUserAction } from './core/phone-auth';
|
|
5
|
+
export type { PhoneAuthCallbacks, PLMN, SessionInfo, HeadlessResult, InvokeOptions, PrepareRequest, PrepareResponse, GetPhoneNumberRequest, GetPhoneNumberResponse, VerifyPhoneNumberRequest, VerifyPhoneNumberResponse, SecureCredentialRequest, SecureCredentialResponse, DigitalCredential, TS43Data, LinkData, DesktopData, ClientInfo, ConsentData, BrowserErrorType, BrowserErrorCodeType, BrowserNameType } from './core/phone-auth/types';
|
|
6
|
+
export { USE_CASE as UseCase, AUTHENTICATION_STRATEGY as AuthenticationStrategy, BrowserError, BrowserErrorCode, BrowserName } from './core/phone-auth/types';
|
|
7
|
+
export { DesktopHandler, showQRCodeModal, createQRCodeDisplay } from './core/phone-auth/strategies/desktop';
|
|
8
|
+
export type { DesktopAuthOptions, DesktopAuthResult, PollingStatus, QRCodeData } from './core/phone-auth/strategies/desktop';
|
|
9
|
+
export { useClient, usePhoneAuth } from './adapters/react';
|
|
10
|
+
export { useClient as useVueClient, usePhoneAuth as useVuePhoneAuth } from './adapters/vue';
|
|
11
|
+
export { ClientService, PhoneAuthService } from './adapters/angular';
|
|
12
|
+
export { ClientManager, PhoneAuthManager } from './adapters/vanilla';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhoneAuthManager = exports.ClientManager = exports.PhoneAuthService = exports.ClientService = exports.useVuePhoneAuth = exports.useVueClient = exports.usePhoneAuth = exports.useClient = exports.createQRCodeDisplay = exports.showQRCodeModal = exports.DesktopHandler = exports.BrowserName = exports.BrowserErrorCode = exports.BrowserError = exports.AuthenticationStrategy = exports.UseCase = exports.requiresUserAction = exports.requiresPolling = exports.getStrategy = exports.isDesktopStrategy = exports.isTS43Strategy = exports.isLinkStrategy = exports.isCredential = exports.isHeadlessResult = exports.createErrorBreadcrumb = exports.serializeError = exports.isRetryableError = exports.getRetryDelay = exports.isErrorCode = exports.getUserMessage = exports.isUserError = exports.isPhoneAuthError = exports.PhoneAuthErrorCode = exports.PhoneAuthClient = void 0;
|
|
4
|
+
// Phone Authentication
|
|
5
|
+
var phone_auth_1 = require("./core/phone-auth");
|
|
6
|
+
Object.defineProperty(exports, "PhoneAuthClient", { enumerable: true, get: function () { return phone_auth_1.PhoneAuthClient; } });
|
|
7
|
+
// Phone Auth Error Utilities
|
|
8
|
+
var phone_auth_2 = require("./core/phone-auth");
|
|
9
|
+
Object.defineProperty(exports, "PhoneAuthErrorCode", { enumerable: true, get: function () { return phone_auth_2.PhoneAuthErrorCode; } });
|
|
10
|
+
Object.defineProperty(exports, "isPhoneAuthError", { enumerable: true, get: function () { return phone_auth_2.isPhoneAuthError; } });
|
|
11
|
+
Object.defineProperty(exports, "isUserError", { enumerable: true, get: function () { return phone_auth_2.isUserError; } });
|
|
12
|
+
Object.defineProperty(exports, "getUserMessage", { enumerable: true, get: function () { return phone_auth_2.getUserMessage; } });
|
|
13
|
+
Object.defineProperty(exports, "isErrorCode", { enumerable: true, get: function () { return phone_auth_2.isErrorCode; } });
|
|
14
|
+
Object.defineProperty(exports, "getRetryDelay", { enumerable: true, get: function () { return phone_auth_2.getRetryDelay; } });
|
|
15
|
+
Object.defineProperty(exports, "isRetryableError", { enumerable: true, get: function () { return phone_auth_2.isRetryableError; } });
|
|
16
|
+
Object.defineProperty(exports, "serializeError", { enumerable: true, get: function () { return phone_auth_2.serializeError; } });
|
|
17
|
+
Object.defineProperty(exports, "createErrorBreadcrumb", { enumerable: true, get: function () { return phone_auth_2.createErrorBreadcrumb; } });
|
|
18
|
+
// Phone Auth Type Guards and Helpers
|
|
19
|
+
var phone_auth_3 = require("./core/phone-auth");
|
|
20
|
+
Object.defineProperty(exports, "isHeadlessResult", { enumerable: true, get: function () { return phone_auth_3.isHeadlessResult; } });
|
|
21
|
+
Object.defineProperty(exports, "isCredential", { enumerable: true, get: function () { return phone_auth_3.isCredential; } });
|
|
22
|
+
Object.defineProperty(exports, "isLinkStrategy", { enumerable: true, get: function () { return phone_auth_3.isLinkStrategy; } });
|
|
23
|
+
Object.defineProperty(exports, "isTS43Strategy", { enumerable: true, get: function () { return phone_auth_3.isTS43Strategy; } });
|
|
24
|
+
Object.defineProperty(exports, "isDesktopStrategy", { enumerable: true, get: function () { return phone_auth_3.isDesktopStrategy; } });
|
|
25
|
+
Object.defineProperty(exports, "getStrategy", { enumerable: true, get: function () { return phone_auth_3.getStrategy; } });
|
|
26
|
+
Object.defineProperty(exports, "requiresPolling", { enumerable: true, get: function () { return phone_auth_3.requiresPolling; } });
|
|
27
|
+
Object.defineProperty(exports, "requiresUserAction", { enumerable: true, get: function () { return phone_auth_3.requiresUserAction; } });
|
|
28
|
+
// Export constants for use case and strategy
|
|
29
|
+
var types_1 = require("./core/phone-auth/types");
|
|
30
|
+
Object.defineProperty(exports, "UseCase", { enumerable: true, get: function () { return types_1.USE_CASE; } });
|
|
31
|
+
Object.defineProperty(exports, "AuthenticationStrategy", { enumerable: true, get: function () { return types_1.AUTHENTICATION_STRATEGY; } });
|
|
32
|
+
Object.defineProperty(exports, "BrowserError", { enumerable: true, get: function () { return types_1.BrowserError; } });
|
|
33
|
+
Object.defineProperty(exports, "BrowserErrorCode", { enumerable: true, get: function () { return types_1.BrowserErrorCode; } });
|
|
34
|
+
Object.defineProperty(exports, "BrowserName", { enumerable: true, get: function () { return types_1.BrowserName; } });
|
|
35
|
+
// Desktop Strategy Exports
|
|
36
|
+
var desktop_1 = require("./core/phone-auth/strategies/desktop");
|
|
37
|
+
Object.defineProperty(exports, "DesktopHandler", { enumerable: true, get: function () { return desktop_1.DesktopHandler; } });
|
|
38
|
+
Object.defineProperty(exports, "showQRCodeModal", { enumerable: true, get: function () { return desktop_1.showQRCodeModal; } });
|
|
39
|
+
Object.defineProperty(exports, "createQRCodeDisplay", { enumerable: true, get: function () { return desktop_1.createQRCodeDisplay; } });
|
|
40
|
+
// Adapters
|
|
41
|
+
var react_1 = require("./adapters/react");
|
|
42
|
+
Object.defineProperty(exports, "useClient", { enumerable: true, get: function () { return react_1.useClient; } });
|
|
43
|
+
Object.defineProperty(exports, "usePhoneAuth", { enumerable: true, get: function () { return react_1.usePhoneAuth; } });
|
|
44
|
+
var vue_1 = require("./adapters/vue");
|
|
45
|
+
Object.defineProperty(exports, "useVueClient", { enumerable: true, get: function () { return vue_1.useClient; } });
|
|
46
|
+
Object.defineProperty(exports, "useVuePhoneAuth", { enumerable: true, get: function () { return vue_1.usePhoneAuth; } });
|
|
47
|
+
var angular_1 = require("./adapters/angular");
|
|
48
|
+
Object.defineProperty(exports, "ClientService", { enumerable: true, get: function () { return angular_1.ClientService; } });
|
|
49
|
+
Object.defineProperty(exports, "PhoneAuthService", { enumerable: true, get: function () { return angular_1.PhoneAuthService; } });
|
|
50
|
+
var vanilla_1 = require("./adapters/vanilla");
|
|
51
|
+
Object.defineProperty(exports, "ClientManager", { enumerable: true, get: function () { return vanilla_1.ClientManager; } });
|
|
52
|
+
Object.defineProperty(exports, "PhoneAuthManager", { enumerable: true, get: function () { return vanilla_1.PhoneAuthManager; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@glideidentity/web-client-sdk",
|
|
3
|
+
"version": "4.4.8-beta.1",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/esm/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"browser": "./dist/browser/web-client-sdk.min.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"browser": "./dist/browser/web-client-sdk.min.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./vue": {
|
|
20
|
+
"types": "./dist/adapters/vue/index.d.ts",
|
|
21
|
+
"import": "./dist/esm/adapters/vue/index.js",
|
|
22
|
+
"require": "./dist/adapters/vue/index.js",
|
|
23
|
+
"default": "./dist/adapters/vue/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./react": {
|
|
26
|
+
"types": "./dist/adapters/react/index.d.ts",
|
|
27
|
+
"import": "./dist/esm/adapters/react/index.js",
|
|
28
|
+
"require": "./dist/adapters/react/index.js",
|
|
29
|
+
"default": "./dist/adapters/react/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./angular": {
|
|
32
|
+
"types": "./dist/adapters/angular/index.d.ts",
|
|
33
|
+
"import": "./dist/esm/adapters/angular/index.js",
|
|
34
|
+
"require": "./dist/adapters/angular/index.js",
|
|
35
|
+
"default": "./dist/adapters/angular/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:browser && npm run inject-version",
|
|
40
|
+
"build:cjs": "tsc -p tsconfig.build.json",
|
|
41
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
42
|
+
"build:browser": "webpack",
|
|
43
|
+
"clean": "rm -rf dist",
|
|
44
|
+
"inject-version": "node scripts/inject-version.js",
|
|
45
|
+
"prepublishOnly": "npm run build",
|
|
46
|
+
"test": "jest"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"sdk",
|
|
53
|
+
"authentication",
|
|
54
|
+
"api",
|
|
55
|
+
"react",
|
|
56
|
+
"vue",
|
|
57
|
+
"angular"
|
|
58
|
+
],
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@angular/core": "^15.0.0",
|
|
61
|
+
"react": "^18.0.0",
|
|
62
|
+
"vue": "^3.0.0"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"axios": "^1.7.9"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@angular/core": "^19.0.6",
|
|
69
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
70
|
+
"@testing-library/react": "^14.0.0",
|
|
71
|
+
"@types/jest": "^29.5.14",
|
|
72
|
+
"@types/node": "^18.19.70",
|
|
73
|
+
"@types/react": "^18.2.0",
|
|
74
|
+
"@types/react-dom": "^18.2.0",
|
|
75
|
+
"@vue/compiler-dom": "^3.5.13",
|
|
76
|
+
"@vue/runtime-dom": "^3.3.0",
|
|
77
|
+
"@vue/server-renderer": "^3.5.13",
|
|
78
|
+
"@vue/test-utils": "^2.4.0-alpha.2",
|
|
79
|
+
"@vue/vue3-jest": "^29.2.6",
|
|
80
|
+
"jest": "^29.0.0",
|
|
81
|
+
"jest-environment-jsdom": "^29.0.0",
|
|
82
|
+
"react": "^18.2.0",
|
|
83
|
+
"react-dom": "^18.2.0",
|
|
84
|
+
"rxjs": "^7.8.1",
|
|
85
|
+
"ts-jest": "^29.2.5",
|
|
86
|
+
"ts-loader": "^9.5.1",
|
|
87
|
+
"typescript": "^5.9.2",
|
|
88
|
+
"vue": "^3.3.0",
|
|
89
|
+
"webpack": "^5.89.0",
|
|
90
|
+
"webpack-cli": "^5.1.4"
|
|
91
|
+
}
|
|
92
|
+
}
|