cgs-compliance-sdk 2.0.8 → 2.0.9
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/dist/{client-CBy3JJSM.d.ts → client-K-qkyEBM.d.ts} +225 -1
- package/dist/{client-BGI23PLG.d.mts → client-fisRnxD5.d.mts} +225 -1
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +109 -0
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +109 -0
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +46 -191
- package/dist/geolocation/index.d.ts +46 -191
- package/dist/geolocation/index.js +343 -531
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +340 -525
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +343 -531
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +340 -525
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +218 -0
- package/dist/react.d.ts +218 -0
- package/dist/react.js +784 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +775 -0
- package/dist/react.mjs.map +1 -0
- package/package.json +6 -1
|
@@ -21,6 +21,158 @@ interface DeviceFingerprintRequest {
|
|
|
21
21
|
language?: string;
|
|
22
22
|
timezone?: string;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Raw device and location data collected from the client
|
|
26
|
+
* This data is encrypted into a cipherText before being sent to the server
|
|
27
|
+
*/
|
|
28
|
+
interface CipherTextPayload {
|
|
29
|
+
/** Device fingerprint data */
|
|
30
|
+
device: {
|
|
31
|
+
device_id: string;
|
|
32
|
+
user_agent: string;
|
|
33
|
+
platform: string;
|
|
34
|
+
browser?: string;
|
|
35
|
+
browser_version?: string;
|
|
36
|
+
os?: string;
|
|
37
|
+
os_version?: string;
|
|
38
|
+
screen_resolution?: string;
|
|
39
|
+
language?: string;
|
|
40
|
+
timezone?: string;
|
|
41
|
+
color_depth?: number;
|
|
42
|
+
hardware_concurrency?: number;
|
|
43
|
+
device_memory?: number;
|
|
44
|
+
touch_support?: boolean;
|
|
45
|
+
webgl_vendor?: string;
|
|
46
|
+
webgl_renderer?: string;
|
|
47
|
+
};
|
|
48
|
+
/** GPS/Geolocation data (if available) */
|
|
49
|
+
location?: {
|
|
50
|
+
latitude: number;
|
|
51
|
+
longitude: number;
|
|
52
|
+
accuracy: number;
|
|
53
|
+
altitude?: number;
|
|
54
|
+
altitude_accuracy?: number;
|
|
55
|
+
heading?: number;
|
|
56
|
+
speed?: number;
|
|
57
|
+
timestamp: number;
|
|
58
|
+
};
|
|
59
|
+
/** Network information */
|
|
60
|
+
network?: {
|
|
61
|
+
effective_type?: string;
|
|
62
|
+
downlink?: number;
|
|
63
|
+
rtt?: number;
|
|
64
|
+
save_data?: boolean;
|
|
65
|
+
};
|
|
66
|
+
/** Collection metadata */
|
|
67
|
+
metadata: {
|
|
68
|
+
collected_at: string;
|
|
69
|
+
sdk_version: string;
|
|
70
|
+
collection_reason: CipherTextReason;
|
|
71
|
+
page_url?: string;
|
|
72
|
+
referrer?: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reason for collecting the cipherText
|
|
77
|
+
*/
|
|
78
|
+
type CipherTextReason = 'registration' | 'login' | 'transaction' | 'interval_check' | 'ip_change' | 'game_launch' | 'withdrawal' | 'manual_verification';
|
|
79
|
+
/**
|
|
80
|
+
* Options for generating cipherText
|
|
81
|
+
*/
|
|
82
|
+
interface CipherTextOptions {
|
|
83
|
+
/** Reason for collection (required) */
|
|
84
|
+
reason: CipherTextReason;
|
|
85
|
+
/** Request GPS location (default: false) */
|
|
86
|
+
requestLocation?: boolean;
|
|
87
|
+
/** GPS timeout in milliseconds (default: 10000) */
|
|
88
|
+
locationTimeout?: number;
|
|
89
|
+
/** High accuracy GPS (default: true) */
|
|
90
|
+
highAccuracy?: boolean;
|
|
91
|
+
/** Include network info (default: true) */
|
|
92
|
+
includeNetworkInfo?: boolean;
|
|
93
|
+
/** Include WebGL info for fingerprinting (default: true) */
|
|
94
|
+
includeWebGL?: boolean;
|
|
95
|
+
/** Custom user ID to include */
|
|
96
|
+
userId?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Result from cipherText generation
|
|
100
|
+
*/
|
|
101
|
+
interface CipherTextResult {
|
|
102
|
+
/** The encrypted cipherText string */
|
|
103
|
+
cipherText: string;
|
|
104
|
+
/** Whether GPS location was successfully captured */
|
|
105
|
+
locationCaptured: boolean;
|
|
106
|
+
/** Any errors that occurred during collection (non-fatal) */
|
|
107
|
+
warnings?: string[];
|
|
108
|
+
/** Timestamp when cipherText was generated */
|
|
109
|
+
generatedAt: string;
|
|
110
|
+
/** Expiry time for the cipherText */
|
|
111
|
+
expiresAt: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Decrypted cipherText data (returned by server after validation)
|
|
115
|
+
*/
|
|
116
|
+
interface DecryptedCipherText {
|
|
117
|
+
/** Whether the cipherText is valid */
|
|
118
|
+
valid: boolean;
|
|
119
|
+
/** Validation errors if any */
|
|
120
|
+
errors?: string[];
|
|
121
|
+
/** The decrypted payload */
|
|
122
|
+
payload?: CipherTextPayload;
|
|
123
|
+
/** Extracted device UUID */
|
|
124
|
+
device_uuid?: string;
|
|
125
|
+
/** Extracted IP address (from server) */
|
|
126
|
+
ip_address?: string;
|
|
127
|
+
/** Risk assessment */
|
|
128
|
+
risk?: {
|
|
129
|
+
score: number;
|
|
130
|
+
level: 'low' | 'medium' | 'high' | 'critical';
|
|
131
|
+
factors: string[];
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Request to validate cipherText on the server
|
|
136
|
+
*/
|
|
137
|
+
interface ValidateCipherTextRequest {
|
|
138
|
+
cipher_text: string;
|
|
139
|
+
user_id: string;
|
|
140
|
+
event_type: CipherTextReason;
|
|
141
|
+
expected_ip?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Response from cipherText validation
|
|
145
|
+
*/
|
|
146
|
+
interface ValidateCipherTextResponse {
|
|
147
|
+
valid: boolean;
|
|
148
|
+
device_uuid: string;
|
|
149
|
+
ip_address: string;
|
|
150
|
+
location?: {
|
|
151
|
+
latitude: number;
|
|
152
|
+
longitude: number;
|
|
153
|
+
accuracy: number;
|
|
154
|
+
country?: string;
|
|
155
|
+
country_iso?: string;
|
|
156
|
+
city?: string;
|
|
157
|
+
region?: string;
|
|
158
|
+
};
|
|
159
|
+
device: {
|
|
160
|
+
platform: string;
|
|
161
|
+
browser?: string;
|
|
162
|
+
os?: string;
|
|
163
|
+
is_mobile: boolean;
|
|
164
|
+
is_tablet: boolean;
|
|
165
|
+
};
|
|
166
|
+
risk: {
|
|
167
|
+
score: number;
|
|
168
|
+
level: 'low' | 'medium' | 'high' | 'critical';
|
|
169
|
+
factors: string[];
|
|
170
|
+
is_vpn: boolean;
|
|
171
|
+
is_proxy: boolean;
|
|
172
|
+
is_tor: boolean;
|
|
173
|
+
};
|
|
174
|
+
errors?: string[];
|
|
175
|
+
}
|
|
24
176
|
interface VerifyIPRequest {
|
|
25
177
|
ip_address: string;
|
|
26
178
|
user_id: string;
|
|
@@ -573,6 +725,78 @@ declare class GeolocationClient extends BaseClient {
|
|
|
573
725
|
* ```
|
|
574
726
|
*/
|
|
575
727
|
checkCompliance(countryISO: string): Promise<ComplianceCheckResponse>;
|
|
728
|
+
/**
|
|
729
|
+
* Validate a cipherText generated by the frontend SDK
|
|
730
|
+
*
|
|
731
|
+
* The cipherText contains encrypted device fingerprint and optional location data.
|
|
732
|
+
* This method decrypts and validates the data, returning device info, location,
|
|
733
|
+
* and risk assessment.
|
|
734
|
+
*
|
|
735
|
+
* @param cipherText - The encrypted cipherText string from generateCipherText()
|
|
736
|
+
* @param userId - User ID associated with this verification
|
|
737
|
+
* @param eventType - Reason for verification (login, registration, etc.)
|
|
738
|
+
* @param expectedIP - Optional expected IP address for additional validation
|
|
739
|
+
* @returns Validation result with device info, location, and risk assessment
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* // Validate cipherText during login
|
|
744
|
+
* const result = await client.validateCipherText(
|
|
745
|
+
* cipherText,
|
|
746
|
+
* "user_123",
|
|
747
|
+
* "login"
|
|
748
|
+
* );
|
|
749
|
+
*
|
|
750
|
+
* if (!result.valid) {
|
|
751
|
+
* console.log("CipherText validation failed:", result.errors);
|
|
752
|
+
* return;
|
|
753
|
+
* }
|
|
754
|
+
*
|
|
755
|
+
* console.log("Device UUID:", result.device_uuid);
|
|
756
|
+
* console.log("IP Address:", result.ip_address);
|
|
757
|
+
* console.log("Risk Level:", result.risk.level);
|
|
758
|
+
*
|
|
759
|
+
* if (result.risk.is_vpn) {
|
|
760
|
+
* console.log("VPN detected");
|
|
761
|
+
* }
|
|
762
|
+
* ```
|
|
763
|
+
*/
|
|
764
|
+
validateCipherText(cipherText: string, userId: string, eventType: CipherTextReason, expectedIP?: string): Promise<ValidateCipherTextResponse>;
|
|
765
|
+
/**
|
|
766
|
+
* Validate cipherText and verify IP in a single call
|
|
767
|
+
*
|
|
768
|
+
* Combines cipherText validation with IP verification for complete
|
|
769
|
+
* location and device verification in one request.
|
|
770
|
+
*
|
|
771
|
+
* @param cipherText - The encrypted cipherText string
|
|
772
|
+
* @param ipAddress - Client IP address
|
|
773
|
+
* @param userId - User ID
|
|
774
|
+
* @param eventType - Event type (login, registration, etc.)
|
|
775
|
+
* @returns Combined validation and verification result
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```typescript
|
|
779
|
+
* const result = await client.validateAndVerify(
|
|
780
|
+
* cipherText,
|
|
781
|
+
* clientIP,
|
|
782
|
+
* "user_123",
|
|
783
|
+
* "registration"
|
|
784
|
+
* );
|
|
785
|
+
*
|
|
786
|
+
* if (!result.ciphertext_valid) {
|
|
787
|
+
* throw new Error("Device verification failed");
|
|
788
|
+
* }
|
|
789
|
+
*
|
|
790
|
+
* if (result.location.is_blocked) {
|
|
791
|
+
* throw new Error("Location not allowed");
|
|
792
|
+
* }
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
validateAndVerify(cipherText: string, ipAddress: string, userId: string, eventType: CipherTextReason): Promise<{
|
|
796
|
+
ciphertext_valid: boolean;
|
|
797
|
+
ciphertext_result: ValidateCipherTextResponse;
|
|
798
|
+
location: LocationVerification;
|
|
799
|
+
}>;
|
|
576
800
|
/**
|
|
577
801
|
* Get location history for a user
|
|
578
802
|
*
|
|
@@ -881,4 +1105,4 @@ declare class GeolocationClient extends BaseClient {
|
|
|
881
1105
|
captureLocation(token: string, capture: LocationCaptureRequest): Promise<LocationCaptureResponse>;
|
|
882
1106
|
}
|
|
883
1107
|
|
|
884
|
-
export { type AlertStatus as A, type
|
|
1108
|
+
export { type UseLocationCaptureOptions as $, type AlertStatus as A, type GeolocationClientConfig as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type UseGeolocationOptions as E, type UseGeolocationResult as F, GeolocationClient as G, type UseAlertsOptions as H, type UseAlertsResult as I, type JurisdictionConfig as J, type LocationRequestStatus as K, type LocationVerification as L, type LocationRequestChannel as M, type LocationRequest as N, type CreateLocationRequestRequest as O, type LocationRequestResult as P, type LocationRequestFilters as Q, type LocationRequestListResponse as R, type ResendLocationRequestRequest as S, type LocationCaptureRequest as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type WiFiNetwork as W, type LocationShareInfo as X, type LocationCaptureResponse as Y, type UseLocationRequestsOptions as Z, type UseLocationRequestsResult as _, type CipherTextReason as a, type UseLocationCaptureResult as a0, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type ValidateCipherTextResponse as e, type VerifyIPRequest as f, type GeoIPResult as g, type GeofenceEvaluation as h, type DeviceFingerprint as i, type DeviceTrustResult as j, type ComplianceCheckResponse as k, type AlertSeverity as l, type AlertType as m, type GeolocationAlert as n, type AlertFilters as o, type AlertListResponse as p, type DashboardMetrics as q, type CreateJurisdictionRequest as r, type GeofenceRuleType as s, type GeofenceAction as t, type GeofenceRule as u, type CreateGeofenceRuleRequest as v, type UpdateGeofenceRuleRequest as w, type UpdateDeviceTrustRequest as x, type GeolocationRecord as y, type APIError as z };
|
|
@@ -21,6 +21,158 @@ interface DeviceFingerprintRequest {
|
|
|
21
21
|
language?: string;
|
|
22
22
|
timezone?: string;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Raw device and location data collected from the client
|
|
26
|
+
* This data is encrypted into a cipherText before being sent to the server
|
|
27
|
+
*/
|
|
28
|
+
interface CipherTextPayload {
|
|
29
|
+
/** Device fingerprint data */
|
|
30
|
+
device: {
|
|
31
|
+
device_id: string;
|
|
32
|
+
user_agent: string;
|
|
33
|
+
platform: string;
|
|
34
|
+
browser?: string;
|
|
35
|
+
browser_version?: string;
|
|
36
|
+
os?: string;
|
|
37
|
+
os_version?: string;
|
|
38
|
+
screen_resolution?: string;
|
|
39
|
+
language?: string;
|
|
40
|
+
timezone?: string;
|
|
41
|
+
color_depth?: number;
|
|
42
|
+
hardware_concurrency?: number;
|
|
43
|
+
device_memory?: number;
|
|
44
|
+
touch_support?: boolean;
|
|
45
|
+
webgl_vendor?: string;
|
|
46
|
+
webgl_renderer?: string;
|
|
47
|
+
};
|
|
48
|
+
/** GPS/Geolocation data (if available) */
|
|
49
|
+
location?: {
|
|
50
|
+
latitude: number;
|
|
51
|
+
longitude: number;
|
|
52
|
+
accuracy: number;
|
|
53
|
+
altitude?: number;
|
|
54
|
+
altitude_accuracy?: number;
|
|
55
|
+
heading?: number;
|
|
56
|
+
speed?: number;
|
|
57
|
+
timestamp: number;
|
|
58
|
+
};
|
|
59
|
+
/** Network information */
|
|
60
|
+
network?: {
|
|
61
|
+
effective_type?: string;
|
|
62
|
+
downlink?: number;
|
|
63
|
+
rtt?: number;
|
|
64
|
+
save_data?: boolean;
|
|
65
|
+
};
|
|
66
|
+
/** Collection metadata */
|
|
67
|
+
metadata: {
|
|
68
|
+
collected_at: string;
|
|
69
|
+
sdk_version: string;
|
|
70
|
+
collection_reason: CipherTextReason;
|
|
71
|
+
page_url?: string;
|
|
72
|
+
referrer?: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reason for collecting the cipherText
|
|
77
|
+
*/
|
|
78
|
+
type CipherTextReason = 'registration' | 'login' | 'transaction' | 'interval_check' | 'ip_change' | 'game_launch' | 'withdrawal' | 'manual_verification';
|
|
79
|
+
/**
|
|
80
|
+
* Options for generating cipherText
|
|
81
|
+
*/
|
|
82
|
+
interface CipherTextOptions {
|
|
83
|
+
/** Reason for collection (required) */
|
|
84
|
+
reason: CipherTextReason;
|
|
85
|
+
/** Request GPS location (default: false) */
|
|
86
|
+
requestLocation?: boolean;
|
|
87
|
+
/** GPS timeout in milliseconds (default: 10000) */
|
|
88
|
+
locationTimeout?: number;
|
|
89
|
+
/** High accuracy GPS (default: true) */
|
|
90
|
+
highAccuracy?: boolean;
|
|
91
|
+
/** Include network info (default: true) */
|
|
92
|
+
includeNetworkInfo?: boolean;
|
|
93
|
+
/** Include WebGL info for fingerprinting (default: true) */
|
|
94
|
+
includeWebGL?: boolean;
|
|
95
|
+
/** Custom user ID to include */
|
|
96
|
+
userId?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Result from cipherText generation
|
|
100
|
+
*/
|
|
101
|
+
interface CipherTextResult {
|
|
102
|
+
/** The encrypted cipherText string */
|
|
103
|
+
cipherText: string;
|
|
104
|
+
/** Whether GPS location was successfully captured */
|
|
105
|
+
locationCaptured: boolean;
|
|
106
|
+
/** Any errors that occurred during collection (non-fatal) */
|
|
107
|
+
warnings?: string[];
|
|
108
|
+
/** Timestamp when cipherText was generated */
|
|
109
|
+
generatedAt: string;
|
|
110
|
+
/** Expiry time for the cipherText */
|
|
111
|
+
expiresAt: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Decrypted cipherText data (returned by server after validation)
|
|
115
|
+
*/
|
|
116
|
+
interface DecryptedCipherText {
|
|
117
|
+
/** Whether the cipherText is valid */
|
|
118
|
+
valid: boolean;
|
|
119
|
+
/** Validation errors if any */
|
|
120
|
+
errors?: string[];
|
|
121
|
+
/** The decrypted payload */
|
|
122
|
+
payload?: CipherTextPayload;
|
|
123
|
+
/** Extracted device UUID */
|
|
124
|
+
device_uuid?: string;
|
|
125
|
+
/** Extracted IP address (from server) */
|
|
126
|
+
ip_address?: string;
|
|
127
|
+
/** Risk assessment */
|
|
128
|
+
risk?: {
|
|
129
|
+
score: number;
|
|
130
|
+
level: 'low' | 'medium' | 'high' | 'critical';
|
|
131
|
+
factors: string[];
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Request to validate cipherText on the server
|
|
136
|
+
*/
|
|
137
|
+
interface ValidateCipherTextRequest {
|
|
138
|
+
cipher_text: string;
|
|
139
|
+
user_id: string;
|
|
140
|
+
event_type: CipherTextReason;
|
|
141
|
+
expected_ip?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Response from cipherText validation
|
|
145
|
+
*/
|
|
146
|
+
interface ValidateCipherTextResponse {
|
|
147
|
+
valid: boolean;
|
|
148
|
+
device_uuid: string;
|
|
149
|
+
ip_address: string;
|
|
150
|
+
location?: {
|
|
151
|
+
latitude: number;
|
|
152
|
+
longitude: number;
|
|
153
|
+
accuracy: number;
|
|
154
|
+
country?: string;
|
|
155
|
+
country_iso?: string;
|
|
156
|
+
city?: string;
|
|
157
|
+
region?: string;
|
|
158
|
+
};
|
|
159
|
+
device: {
|
|
160
|
+
platform: string;
|
|
161
|
+
browser?: string;
|
|
162
|
+
os?: string;
|
|
163
|
+
is_mobile: boolean;
|
|
164
|
+
is_tablet: boolean;
|
|
165
|
+
};
|
|
166
|
+
risk: {
|
|
167
|
+
score: number;
|
|
168
|
+
level: 'low' | 'medium' | 'high' | 'critical';
|
|
169
|
+
factors: string[];
|
|
170
|
+
is_vpn: boolean;
|
|
171
|
+
is_proxy: boolean;
|
|
172
|
+
is_tor: boolean;
|
|
173
|
+
};
|
|
174
|
+
errors?: string[];
|
|
175
|
+
}
|
|
24
176
|
interface VerifyIPRequest {
|
|
25
177
|
ip_address: string;
|
|
26
178
|
user_id: string;
|
|
@@ -573,6 +725,78 @@ declare class GeolocationClient extends BaseClient {
|
|
|
573
725
|
* ```
|
|
574
726
|
*/
|
|
575
727
|
checkCompliance(countryISO: string): Promise<ComplianceCheckResponse>;
|
|
728
|
+
/**
|
|
729
|
+
* Validate a cipherText generated by the frontend SDK
|
|
730
|
+
*
|
|
731
|
+
* The cipherText contains encrypted device fingerprint and optional location data.
|
|
732
|
+
* This method decrypts and validates the data, returning device info, location,
|
|
733
|
+
* and risk assessment.
|
|
734
|
+
*
|
|
735
|
+
* @param cipherText - The encrypted cipherText string from generateCipherText()
|
|
736
|
+
* @param userId - User ID associated with this verification
|
|
737
|
+
* @param eventType - Reason for verification (login, registration, etc.)
|
|
738
|
+
* @param expectedIP - Optional expected IP address for additional validation
|
|
739
|
+
* @returns Validation result with device info, location, and risk assessment
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* // Validate cipherText during login
|
|
744
|
+
* const result = await client.validateCipherText(
|
|
745
|
+
* cipherText,
|
|
746
|
+
* "user_123",
|
|
747
|
+
* "login"
|
|
748
|
+
* );
|
|
749
|
+
*
|
|
750
|
+
* if (!result.valid) {
|
|
751
|
+
* console.log("CipherText validation failed:", result.errors);
|
|
752
|
+
* return;
|
|
753
|
+
* }
|
|
754
|
+
*
|
|
755
|
+
* console.log("Device UUID:", result.device_uuid);
|
|
756
|
+
* console.log("IP Address:", result.ip_address);
|
|
757
|
+
* console.log("Risk Level:", result.risk.level);
|
|
758
|
+
*
|
|
759
|
+
* if (result.risk.is_vpn) {
|
|
760
|
+
* console.log("VPN detected");
|
|
761
|
+
* }
|
|
762
|
+
* ```
|
|
763
|
+
*/
|
|
764
|
+
validateCipherText(cipherText: string, userId: string, eventType: CipherTextReason, expectedIP?: string): Promise<ValidateCipherTextResponse>;
|
|
765
|
+
/**
|
|
766
|
+
* Validate cipherText and verify IP in a single call
|
|
767
|
+
*
|
|
768
|
+
* Combines cipherText validation with IP verification for complete
|
|
769
|
+
* location and device verification in one request.
|
|
770
|
+
*
|
|
771
|
+
* @param cipherText - The encrypted cipherText string
|
|
772
|
+
* @param ipAddress - Client IP address
|
|
773
|
+
* @param userId - User ID
|
|
774
|
+
* @param eventType - Event type (login, registration, etc.)
|
|
775
|
+
* @returns Combined validation and verification result
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```typescript
|
|
779
|
+
* const result = await client.validateAndVerify(
|
|
780
|
+
* cipherText,
|
|
781
|
+
* clientIP,
|
|
782
|
+
* "user_123",
|
|
783
|
+
* "registration"
|
|
784
|
+
* );
|
|
785
|
+
*
|
|
786
|
+
* if (!result.ciphertext_valid) {
|
|
787
|
+
* throw new Error("Device verification failed");
|
|
788
|
+
* }
|
|
789
|
+
*
|
|
790
|
+
* if (result.location.is_blocked) {
|
|
791
|
+
* throw new Error("Location not allowed");
|
|
792
|
+
* }
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
validateAndVerify(cipherText: string, ipAddress: string, userId: string, eventType: CipherTextReason): Promise<{
|
|
796
|
+
ciphertext_valid: boolean;
|
|
797
|
+
ciphertext_result: ValidateCipherTextResponse;
|
|
798
|
+
location: LocationVerification;
|
|
799
|
+
}>;
|
|
576
800
|
/**
|
|
577
801
|
* Get location history for a user
|
|
578
802
|
*
|
|
@@ -881,4 +1105,4 @@ declare class GeolocationClient extends BaseClient {
|
|
|
881
1105
|
captureLocation(token: string, capture: LocationCaptureRequest): Promise<LocationCaptureResponse>;
|
|
882
1106
|
}
|
|
883
1107
|
|
|
884
|
-
export { type AlertStatus as A, type
|
|
1108
|
+
export { type UseLocationCaptureOptions as $, type AlertStatus as A, type GeolocationClientConfig as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type UseGeolocationOptions as E, type UseGeolocationResult as F, GeolocationClient as G, type UseAlertsOptions as H, type UseAlertsResult as I, type JurisdictionConfig as J, type LocationRequestStatus as K, type LocationVerification as L, type LocationRequestChannel as M, type LocationRequest as N, type CreateLocationRequestRequest as O, type LocationRequestResult as P, type LocationRequestFilters as Q, type LocationRequestListResponse as R, type ResendLocationRequestRequest as S, type LocationCaptureRequest as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type WiFiNetwork as W, type LocationShareInfo as X, type LocationCaptureResponse as Y, type UseLocationRequestsOptions as Z, type UseLocationRequestsResult as _, type CipherTextReason as a, type UseLocationCaptureResult as a0, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type ValidateCipherTextResponse as e, type VerifyIPRequest as f, type GeoIPResult as g, type GeofenceEvaluation as h, type DeviceFingerprint as i, type DeviceTrustResult as j, type ComplianceCheckResponse as k, type AlertSeverity as l, type AlertType as m, type GeolocationAlert as n, type AlertFilters as o, type AlertListResponse as p, type DashboardMetrics as q, type CreateJurisdictionRequest as r, type GeofenceRuleType as s, type GeofenceAction as t, type GeofenceRule as u, type CreateGeofenceRuleRequest as v, type UpdateGeofenceRuleRequest as w, type UpdateDeviceTrustRequest as x, type GeolocationRecord as y, type APIError as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceFingerprintRequest, L as LocationVerification,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DeviceFingerprintRequest, L as LocationVerification, N as LocationRequest, J as JurisdictionConfig, Q as LocationRequestFilters, R as LocationRequestListResponse, G as GeolocationClient } from '../client-fisRnxD5.mjs';
|
|
2
|
+
export { O as CreateLocationRequestRequest, T as LocationCaptureRequest, Y as LocationCaptureResponse, M as LocationRequestChannel, P as LocationRequestResult, K as LocationRequestStatus, X as LocationShareInfo, S as ResendLocationRequestRequest } from '../client-fisRnxD5.mjs';
|
|
3
3
|
import { CustomerProfile, RiskProfileClient } from '../risk-profile/index.mjs';
|
|
4
4
|
import { g as EntityType, C as CGSConfig, P as PaginationParams } from '../types-DxnfRzF_.mjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DeviceFingerprintRequest, L as LocationVerification,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DeviceFingerprintRequest, L as LocationVerification, N as LocationRequest, J as JurisdictionConfig, Q as LocationRequestFilters, R as LocationRequestListResponse, G as GeolocationClient } from '../client-K-qkyEBM.js';
|
|
2
|
+
export { O as CreateLocationRequestRequest, T as LocationCaptureRequest, Y as LocationCaptureResponse, M as LocationRequestChannel, P as LocationRequestResult, K as LocationRequestStatus, X as LocationShareInfo, S as ResendLocationRequestRequest } from '../client-K-qkyEBM.js';
|
|
3
3
|
import { CustomerProfile, RiskProfileClient } from '../risk-profile/index.js';
|
|
4
4
|
import { g as EntityType, C as CGSConfig, P as PaginationParams } from '../types-DxnfRzF_.js';
|
|
5
5
|
|
package/dist/compliance/index.js
CHANGED
|
@@ -296,6 +296,115 @@ var GeolocationClient = class extends BaseClient {
|
|
|
296
296
|
}
|
|
297
297
|
);
|
|
298
298
|
}
|
|
299
|
+
// ============================================================================
|
|
300
|
+
// CipherText Validation
|
|
301
|
+
// ============================================================================
|
|
302
|
+
/**
|
|
303
|
+
* Validate a cipherText generated by the frontend SDK
|
|
304
|
+
*
|
|
305
|
+
* The cipherText contains encrypted device fingerprint and optional location data.
|
|
306
|
+
* This method decrypts and validates the data, returning device info, location,
|
|
307
|
+
* and risk assessment.
|
|
308
|
+
*
|
|
309
|
+
* @param cipherText - The encrypted cipherText string from generateCipherText()
|
|
310
|
+
* @param userId - User ID associated with this verification
|
|
311
|
+
* @param eventType - Reason for verification (login, registration, etc.)
|
|
312
|
+
* @param expectedIP - Optional expected IP address for additional validation
|
|
313
|
+
* @returns Validation result with device info, location, and risk assessment
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```typescript
|
|
317
|
+
* // Validate cipherText during login
|
|
318
|
+
* const result = await client.validateCipherText(
|
|
319
|
+
* cipherText,
|
|
320
|
+
* "user_123",
|
|
321
|
+
* "login"
|
|
322
|
+
* );
|
|
323
|
+
*
|
|
324
|
+
* if (!result.valid) {
|
|
325
|
+
* console.log("CipherText validation failed:", result.errors);
|
|
326
|
+
* return;
|
|
327
|
+
* }
|
|
328
|
+
*
|
|
329
|
+
* console.log("Device UUID:", result.device_uuid);
|
|
330
|
+
* console.log("IP Address:", result.ip_address);
|
|
331
|
+
* console.log("Risk Level:", result.risk.level);
|
|
332
|
+
*
|
|
333
|
+
* if (result.risk.is_vpn) {
|
|
334
|
+
* console.log("VPN detected");
|
|
335
|
+
* }
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
async validateCipherText(cipherText, userId, eventType, expectedIP) {
|
|
339
|
+
const request = {
|
|
340
|
+
cipher_text: cipherText,
|
|
341
|
+
user_id: userId,
|
|
342
|
+
event_type: eventType,
|
|
343
|
+
expected_ip: expectedIP
|
|
344
|
+
};
|
|
345
|
+
return this.requestWithRetry(
|
|
346
|
+
"/api/v1/geo/validate-ciphertext",
|
|
347
|
+
{
|
|
348
|
+
method: "POST",
|
|
349
|
+
body: JSON.stringify(request)
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Validate cipherText and verify IP in a single call
|
|
355
|
+
*
|
|
356
|
+
* Combines cipherText validation with IP verification for complete
|
|
357
|
+
* location and device verification in one request.
|
|
358
|
+
*
|
|
359
|
+
* @param cipherText - The encrypted cipherText string
|
|
360
|
+
* @param ipAddress - Client IP address
|
|
361
|
+
* @param userId - User ID
|
|
362
|
+
* @param eventType - Event type (login, registration, etc.)
|
|
363
|
+
* @returns Combined validation and verification result
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```typescript
|
|
367
|
+
* const result = await client.validateAndVerify(
|
|
368
|
+
* cipherText,
|
|
369
|
+
* clientIP,
|
|
370
|
+
* "user_123",
|
|
371
|
+
* "registration"
|
|
372
|
+
* );
|
|
373
|
+
*
|
|
374
|
+
* if (!result.ciphertext_valid) {
|
|
375
|
+
* throw new Error("Device verification failed");
|
|
376
|
+
* }
|
|
377
|
+
*
|
|
378
|
+
* if (result.location.is_blocked) {
|
|
379
|
+
* throw new Error("Location not allowed");
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
async validateAndVerify(cipherText, ipAddress, userId, eventType) {
|
|
384
|
+
const cipherTextResult = await this.validateCipherText(
|
|
385
|
+
cipherText,
|
|
386
|
+
userId,
|
|
387
|
+
eventType,
|
|
388
|
+
ipAddress
|
|
389
|
+
);
|
|
390
|
+
const locationResult = await this.verifyIP({
|
|
391
|
+
ip_address: ipAddress,
|
|
392
|
+
user_id: userId,
|
|
393
|
+
event_type: eventType,
|
|
394
|
+
device_fingerprint: cipherTextResult.valid && cipherTextResult.device ? {
|
|
395
|
+
device_id: cipherTextResult.device_uuid,
|
|
396
|
+
user_agent: "",
|
|
397
|
+
platform: cipherTextResult.device.platform,
|
|
398
|
+
browser: cipherTextResult.device.browser,
|
|
399
|
+
os: cipherTextResult.device.os
|
|
400
|
+
} : void 0
|
|
401
|
+
});
|
|
402
|
+
return {
|
|
403
|
+
ciphertext_valid: cipherTextResult.valid,
|
|
404
|
+
ciphertext_result: cipherTextResult,
|
|
405
|
+
location: locationResult
|
|
406
|
+
};
|
|
407
|
+
}
|
|
299
408
|
/**
|
|
300
409
|
* Get location history for a user
|
|
301
410
|
*
|