@aientrophy/sdk 0.1.5 → 0.1.7
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/npm/index.es.js +3 -23
- package/package.json +1 -1
package/dist/npm/index.es.js
CHANGED
|
@@ -246,7 +246,6 @@ class CallbackManager {
|
|
|
246
246
|
try {
|
|
247
247
|
handler(...args);
|
|
248
248
|
} catch (err) {
|
|
249
|
-
console.error("[SecuritySDK] Callback error:", err);
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
251
|
}
|
|
@@ -335,11 +334,9 @@ class Transmitter {
|
|
|
335
334
|
this.responseHandler(responseData);
|
|
336
335
|
}
|
|
337
336
|
} catch (e) {
|
|
338
|
-
console.error("SecuritySDK: Failed to process response", e);
|
|
339
337
|
}
|
|
340
338
|
}
|
|
341
339
|
}).catch((err) => {
|
|
342
|
-
console.error("SecuritySDK: Failed to send data", err);
|
|
343
340
|
if (this.callbackManager) {
|
|
344
341
|
this.callbackManager.emit("error", {
|
|
345
342
|
code: "NETWORK_ERROR",
|
|
@@ -348,7 +345,6 @@ class Transmitter {
|
|
|
348
345
|
}
|
|
349
346
|
});
|
|
350
347
|
} catch (e) {
|
|
351
|
-
console.error("SecuritySDK: Failed to send payload", e);
|
|
352
348
|
if (this.callbackManager) {
|
|
353
349
|
this.callbackManager.emit("error", {
|
|
354
350
|
code: "PAYLOAD_ERROR",
|
|
@@ -530,11 +526,9 @@ class RapidClickDetector {
|
|
|
530
526
|
}
|
|
531
527
|
handleClick(e) {
|
|
532
528
|
const now = Date.now();
|
|
533
|
-
console.log("[RapidClickDetector] Click detected at", now);
|
|
534
529
|
this.clickHistory.push(now);
|
|
535
530
|
this.clickHistory = this.clickHistory.filter((time) => now - time <= this.THRESHOLD_TIME);
|
|
536
531
|
if (this.clickHistory.length >= this.THRESHOLD_COUNT) {
|
|
537
|
-
console.warn("[SecuritySDK] Rapid clicks detected!");
|
|
538
532
|
const target = e.target;
|
|
539
533
|
const targetInfo = {
|
|
540
534
|
tagName: target.tagName,
|
|
@@ -816,7 +810,7 @@ class WasmService {
|
|
|
816
810
|
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
817
811
|
const importObject = {
|
|
818
812
|
env: {
|
|
819
|
-
abort: () =>
|
|
813
|
+
abort: () => void 0
|
|
820
814
|
}
|
|
821
815
|
};
|
|
822
816
|
if (WebAssembly.instantiateStreaming) {
|
|
@@ -829,9 +823,7 @@ class WasmService {
|
|
|
829
823
|
}
|
|
830
824
|
this.wasmModule = this.instance.exports;
|
|
831
825
|
this.memory = this.wasmModule.memory;
|
|
832
|
-
console.log("[WasmService] Loaded successfully");
|
|
833
826
|
} catch (e) {
|
|
834
|
-
console.error("[WasmService] Failed to load", e);
|
|
835
827
|
}
|
|
836
828
|
}
|
|
837
829
|
isLoaded() {
|
|
@@ -851,7 +843,6 @@ class WasmService {
|
|
|
851
843
|
const entropy = this.wasmModule.calculateEntropy(ptr, len);
|
|
852
844
|
return entropy;
|
|
853
845
|
} catch (e) {
|
|
854
|
-
console.error("[WasmService] Error calculating entropy", e);
|
|
855
846
|
return 0;
|
|
856
847
|
}
|
|
857
848
|
}
|
|
@@ -866,7 +857,6 @@ class WasmService {
|
|
|
866
857
|
view.set(bytes);
|
|
867
858
|
return this.wasmModule.simpleHash(ptr, len);
|
|
868
859
|
} catch (e) {
|
|
869
|
-
console.error("[WasmService] Error detecting hash", e);
|
|
870
860
|
return 0;
|
|
871
861
|
}
|
|
872
862
|
}
|
|
@@ -885,7 +875,6 @@ class CanvasFingerprinter {
|
|
|
885
875
|
const fingerprint = this.generateFingerprint();
|
|
886
876
|
this.transmitter.send("fingerprint_collected", { hash: fingerprint });
|
|
887
877
|
this.hasRun = true;
|
|
888
|
-
console.log("[CanvasFingerprinter] Hash:", fingerprint);
|
|
889
878
|
}, 500);
|
|
890
879
|
}
|
|
891
880
|
generateFingerprint() {
|
|
@@ -938,16 +927,13 @@ class ChallengeHandler {
|
|
|
938
927
|
this.callbackManager = cm;
|
|
939
928
|
}
|
|
940
929
|
start() {
|
|
941
|
-
console.log("[SecuritySDK] ChallengeHandler starting...");
|
|
942
930
|
window.fetch = async (input, init) => {
|
|
943
931
|
var _a;
|
|
944
932
|
const response = await this.originalFetch(input, init);
|
|
945
933
|
if (response.status === 403) {
|
|
946
|
-
console.log("[SecuritySDK] Detailed 403 check...");
|
|
947
934
|
const cloned = response.clone();
|
|
948
935
|
try {
|
|
949
936
|
const data = await cloned.json();
|
|
950
|
-
console.log("[SecuritySDK] 403 Body:", data);
|
|
951
937
|
if (data.action === "challenge" && ((_a = data.metadata) == null ? void 0 : _a.type) === "captcha") {
|
|
952
938
|
const verdict = {
|
|
953
939
|
action: "challenge",
|
|
@@ -960,7 +946,6 @@ class ChallengeHandler {
|
|
|
960
946
|
return this.originalFetch(input, init);
|
|
961
947
|
}
|
|
962
948
|
}
|
|
963
|
-
console.warn("[SecuritySDK] Access Challenged. Showing CAPTCHA...");
|
|
964
949
|
const passed = await this.showCaptchaModal();
|
|
965
950
|
if (passed) {
|
|
966
951
|
return this.originalFetch(input, init);
|
|
@@ -1209,7 +1194,6 @@ class SecuritySDK {
|
|
|
1209
1194
|
async init(config) {
|
|
1210
1195
|
var _a, _b;
|
|
1211
1196
|
if (this.initialized) {
|
|
1212
|
-
console.warn("SecuritySDK is already initialized.");
|
|
1213
1197
|
return;
|
|
1214
1198
|
}
|
|
1215
1199
|
if (config.callbacks) {
|
|
@@ -1238,7 +1222,6 @@ class SecuritySDK {
|
|
|
1238
1222
|
}
|
|
1239
1223
|
this.initialized = true;
|
|
1240
1224
|
if (config.debug) {
|
|
1241
|
-
console.log("SecuritySDK initialized with config:", config);
|
|
1242
1225
|
}
|
|
1243
1226
|
this.callbackManager.emit("ready");
|
|
1244
1227
|
} catch (e) {
|
|
@@ -1247,7 +1230,6 @@ class SecuritySDK {
|
|
|
1247
1230
|
message: "SecuritySDK initialization failed",
|
|
1248
1231
|
details: e == null ? void 0 : e.message
|
|
1249
1232
|
});
|
|
1250
|
-
console.error("[SecuritySDK] Init failed:", e);
|
|
1251
1233
|
}
|
|
1252
1234
|
}
|
|
1253
1235
|
// Public callback API
|
|
@@ -1268,13 +1250,11 @@ class SecuritySDK {
|
|
|
1268
1250
|
this.canvasFingerprinter.start();
|
|
1269
1251
|
this.inputTracker.start();
|
|
1270
1252
|
this.invisibleInteraction.start();
|
|
1271
|
-
console.log("[SecuritySDK] Detectors started.");
|
|
1272
1253
|
}
|
|
1273
1254
|
}
|
|
1274
1255
|
const securitySDK = new SecuritySDK();
|
|
1275
1256
|
if (typeof window !== "undefined") {
|
|
1276
1257
|
window.SecuritySDK = securitySDK;
|
|
1277
|
-
console.log("[SecuritySDK-Core] Loaded and attached to window.SecuritySDK");
|
|
1278
1258
|
}
|
|
1279
1259
|
class Aientrophy {
|
|
1280
1260
|
constructor(config) {
|
|
@@ -1301,11 +1281,11 @@ class Aientrophy {
|
|
|
1301
1281
|
}
|
|
1302
1282
|
}
|
|
1303
1283
|
} catch (e) {
|
|
1304
|
-
if (this.config.debug)
|
|
1284
|
+
if (this.config.debug) ;
|
|
1305
1285
|
}
|
|
1306
1286
|
}
|
|
1307
1287
|
} catch (e) {
|
|
1308
|
-
if (this.config.debug)
|
|
1288
|
+
if (this.config.debug) ;
|
|
1309
1289
|
}
|
|
1310
1290
|
await securitySDK.init({
|
|
1311
1291
|
endpoint,
|
package/package.json
CHANGED