@arcjet/analyze
Advanced tools
Comparing version 1.0.0-alpha.17 to 1.0.0-alpha.18
@@ -27,3 +27,3 @@ // @generated by wasm2module - DO NOT EDIT | ||
const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABBgFgAn9/AAMDAgAABAUBcAECAgcUAwEwAAABMQABCCRpbXBvcnRzAQAKGQILACAAIAFBABEAAAsLACAAIAFBAREAAAsALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIwMS4wAGcEbmFtZQATEndpdC1jb21wb25lbnQ6c2hpbQFLAgAjaW5kaXJlY3QtYXJjamV0OmpzLXJlcS9sb2dnZXItZGVidWcBI2luZGlyZWN0LWFyY2pldDpqcy1yZXEvbG9nZ2VyLWVycm9y"; | ||
const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABBgFgAn9/AAMDAgAABAUBcAECAgcUAwEwAAABMQABCCRpbXBvcnRzAQAKGQILACAAIAFBABEAAAsLACAAIAFBAREAAAsALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIxMC4wAGcEbmFtZQATEndpdC1jb21wb25lbnQ6c2hpbQFLAgAjaW5kaXJlY3QtYXJjamV0OmpzLXJlcS9sb2dnZXItZGVidWcBI2luZGlyZWN0LWFyY2pldDpqcy1yZXEvbG9nZ2VyLWVycm9y"; | ||
/** | ||
@@ -30,0 +30,0 @@ * Returns a WebAssembly.Module for an Arcjet Wasm binary, decoded from a base64 |
@@ -27,3 +27,3 @@ // @generated by wasm2module - DO NOT EDIT | ||
const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABBgFgAn9/AAIaAwABMAAAAAExAAAACCRpbXBvcnRzAXABAgIJCAEAQQALAgABAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMDEuMAAcBG5hbWUAFRR3aXQtY29tcG9uZW50OmZpeHVwcw=="; | ||
const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABBgFgAn9/AAIaAwABMAAAAAExAAAACCRpbXBvcnRzAXABAgIJCAEAQQALAgABAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMTAuMAAcBG5hbWUAFRR3aXQtY29tcG9uZW50OmZpeHVwcw=="; | ||
/** | ||
@@ -30,0 +30,0 @@ * Returns a WebAssembly.Module for an Arcjet Wasm binary, decoded from a base64 |
@@ -1,5 +0,6 @@ | ||
import type { ArcjetLogger } from "@arcjet/protocol"; | ||
import type { ArcjetLogger, ArcjetRequestDetails } from "@arcjet/protocol"; | ||
import type { EmailValidationConfig, BotDetectionResult, BotType } from "./wasm/arcjet_analyze_js_req.component.js"; | ||
interface AnalyzeContext { | ||
log: ArcjetLogger; | ||
characteristics: string[]; | ||
} | ||
@@ -23,7 +24,8 @@ export { type EmailValidationConfig, type BotType, | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
*/ | ||
export declare function generateFingerprint(context: AnalyzeContext, ip: string): Promise<string>; | ||
export declare function generateFingerprint(context: AnalyzeContext, request: Partial<ArcjetRequestDetails>): Promise<string>; | ||
export declare function isValidEmail(context: AnalyzeContext, candidate: string, options?: EmailValidationConfig): Promise<boolean>; | ||
export declare function detectBot(context: AnalyzeContext, headers: string, patterns_add: string, patterns_remove: string): Promise<BotDetectionResult>; |
@@ -40,30 +40,11 @@ import { instantiate } from './wasm/arcjet_analyze_js_req.component.js'; | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
*/ | ||
async function generateFingerprint(context, ip) { | ||
if (ip == "") { | ||
return ""; | ||
} | ||
async function generateFingerprint(context, request) { | ||
const analyze = await init(context); | ||
if (typeof analyze !== "undefined") { | ||
return analyze.generateFingerprint(ip); | ||
return analyze.generateFingerprint(JSON.stringify(request), context.characteristics); | ||
} | ||
if (hasSubtleCryptoDigest()) { | ||
// Fingerprint v1 is just the IP address | ||
const fingerprintRaw = `fp_1_${ip}`; | ||
// Based on MDN example at | ||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string | ||
// Encode the raw fingerprint into a utf-8 Uint8Array | ||
const fingerprintUint8 = new TextEncoder().encode(fingerprintRaw); | ||
// Hash the message with SHA-256 | ||
const fingerprintArrayBuffer = await crypto.subtle.digest("SHA-256", fingerprintUint8); | ||
// Convert the ArrayBuffer to a byte array | ||
const fingerprintArray = Array.from(new Uint8Array(fingerprintArrayBuffer)); | ||
// Convert the bytes to a hex string | ||
const fingerprint = fingerprintArray | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
return fingerprint; | ||
} | ||
return ""; | ||
@@ -94,21 +75,3 @@ } | ||
} | ||
function hasSubtleCryptoDigest() { | ||
if (typeof crypto === "undefined") { | ||
return false; | ||
} | ||
if (!("subtle" in crypto)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle === "undefined") { | ||
return false; | ||
} | ||
if (!("digest" in crypto.subtle)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle.digest !== "function") { | ||
return false; | ||
} | ||
return true; | ||
} | ||
export { detectBot, generateFingerprint, isValidEmail }; |
@@ -1,2 +0,2 @@ | ||
import type { ArcjetLogger } from "@arcjet/protocol"; | ||
import type { ArcjetLogger, ArcjetRequestDetails } from "@arcjet/protocol"; | ||
@@ -17,2 +17,3 @@ import * as core from "./wasm/arcjet_analyze_js_req.component.js"; | ||
log: ArcjetLogger; | ||
characteristics: string[]; | ||
} | ||
@@ -76,3 +77,4 @@ | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
@@ -82,36 +84,11 @@ */ | ||
context: AnalyzeContext, | ||
ip: string, | ||
request: Partial<ArcjetRequestDetails>, | ||
): Promise<string> { | ||
if (ip == "") { | ||
return ""; | ||
} | ||
const analyze = await init(context); | ||
if (typeof analyze !== "undefined") { | ||
return analyze.generateFingerprint(ip); | ||
} | ||
if (hasSubtleCryptoDigest()) { | ||
// Fingerprint v1 is just the IP address | ||
const fingerprintRaw = `fp_1_${ip}`; | ||
// Based on MDN example at | ||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string | ||
// Encode the raw fingerprint into a utf-8 Uint8Array | ||
const fingerprintUint8 = new TextEncoder().encode(fingerprintRaw); | ||
// Hash the message with SHA-256 | ||
const fingerprintArrayBuffer = await crypto.subtle.digest( | ||
"SHA-256", | ||
fingerprintUint8, | ||
return analyze.generateFingerprint( | ||
JSON.stringify(request), | ||
context.characteristics, | ||
); | ||
// Convert the ArrayBuffer to a byte array | ||
const fingerprintArray = Array.from(new Uint8Array(fingerprintArrayBuffer)); | ||
// Convert the bytes to a hex string | ||
const fingerprint = fingerprintArray | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
return fingerprint; | ||
} | ||
@@ -155,22 +132,1 @@ | ||
} | ||
function hasSubtleCryptoDigest() { | ||
if (typeof crypto === "undefined") { | ||
return false; | ||
} | ||
if (!("subtle" in crypto)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle === "undefined") { | ||
return false; | ||
} | ||
if (!("digest" in crypto.subtle)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle.digest !== "function") { | ||
return false; | ||
} | ||
return true; | ||
} |
@@ -1,5 +0,6 @@ | ||
import type { ArcjetLogger } from "@arcjet/protocol"; | ||
import type { ArcjetLogger, ArcjetRequestDetails } from "@arcjet/protocol"; | ||
import type { EmailValidationConfig, BotDetectionResult, BotType } from "./wasm/arcjet_analyze_js_req.component.js"; | ||
interface AnalyzeContext { | ||
log: ArcjetLogger; | ||
characteristics: string[]; | ||
} | ||
@@ -23,7 +24,8 @@ export { type EmailValidationConfig, type BotType, | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
*/ | ||
export declare function generateFingerprint(context: AnalyzeContext, ip: string): Promise<string>; | ||
export declare function generateFingerprint(context: AnalyzeContext, request: Partial<ArcjetRequestDetails>): Promise<string>; | ||
export declare function isValidEmail(context: AnalyzeContext, candidate: string, options?: EmailValidationConfig): Promise<boolean>; | ||
export declare function detectBot(context: AnalyzeContext, headers: string, patterns_add: string, patterns_remove: string): Promise<BotDetectionResult>; |
45
index.js
@@ -52,30 +52,11 @@ import { instantiate } from './wasm/arcjet_analyze_js_req.component.js'; | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
*/ | ||
async function generateFingerprint(context, ip) { | ||
if (ip == "") { | ||
return ""; | ||
} | ||
async function generateFingerprint(context, request) { | ||
const analyze = await init(context); | ||
if (typeof analyze !== "undefined") { | ||
return analyze.generateFingerprint(ip); | ||
return analyze.generateFingerprint(JSON.stringify(request), context.characteristics); | ||
} | ||
if (hasSubtleCryptoDigest()) { | ||
// Fingerprint v1 is just the IP address | ||
const fingerprintRaw = `fp_1_${ip}`; | ||
// Based on MDN example at | ||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string | ||
// Encode the raw fingerprint into a utf-8 Uint8Array | ||
const fingerprintUint8 = new TextEncoder().encode(fingerprintRaw); | ||
// Hash the message with SHA-256 | ||
const fingerprintArrayBuffer = await crypto.subtle.digest("SHA-256", fingerprintUint8); | ||
// Convert the ArrayBuffer to a byte array | ||
const fingerprintArray = Array.from(new Uint8Array(fingerprintArrayBuffer)); | ||
// Convert the bytes to a hex string | ||
const fingerprint = fingerprintArray | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
return fingerprint; | ||
} | ||
return ""; | ||
@@ -106,21 +87,3 @@ } | ||
} | ||
function hasSubtleCryptoDigest() { | ||
if (typeof crypto === "undefined") { | ||
return false; | ||
} | ||
if (!("subtle" in crypto)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle === "undefined") { | ||
return false; | ||
} | ||
if (!("digest" in crypto.subtle)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle.digest !== "function") { | ||
return false; | ||
} | ||
return true; | ||
} | ||
export { detectBot, generateFingerprint, isValidEmail }; |
60
index.ts
@@ -1,2 +0,2 @@ | ||
import type { ArcjetLogger } from "@arcjet/protocol"; | ||
import type { ArcjetLogger, ArcjetRequestDetails } from "@arcjet/protocol"; | ||
@@ -17,2 +17,3 @@ import * as core from "./wasm/arcjet_analyze_js_req.component.js"; | ||
log: ArcjetLogger; | ||
characteristics: string[]; | ||
} | ||
@@ -90,3 +91,4 @@ | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
@@ -96,36 +98,11 @@ */ | ||
context: AnalyzeContext, | ||
ip: string, | ||
request: Partial<ArcjetRequestDetails>, | ||
): Promise<string> { | ||
if (ip == "") { | ||
return ""; | ||
} | ||
const analyze = await init(context); | ||
if (typeof analyze !== "undefined") { | ||
return analyze.generateFingerprint(ip); | ||
} | ||
if (hasSubtleCryptoDigest()) { | ||
// Fingerprint v1 is just the IP address | ||
const fingerprintRaw = `fp_1_${ip}`; | ||
// Based on MDN example at | ||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string | ||
// Encode the raw fingerprint into a utf-8 Uint8Array | ||
const fingerprintUint8 = new TextEncoder().encode(fingerprintRaw); | ||
// Hash the message with SHA-256 | ||
const fingerprintArrayBuffer = await crypto.subtle.digest( | ||
"SHA-256", | ||
fingerprintUint8, | ||
return analyze.generateFingerprint( | ||
JSON.stringify(request), | ||
context.characteristics, | ||
); | ||
// Convert the ArrayBuffer to a byte array | ||
const fingerprintArray = Array.from(new Uint8Array(fingerprintArrayBuffer)); | ||
// Convert the bytes to a hex string | ||
const fingerprint = fingerprintArray | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
return fingerprint; | ||
} | ||
@@ -169,22 +146,1 @@ | ||
} | ||
function hasSubtleCryptoDigest() { | ||
if (typeof crypto === "undefined") { | ||
return false; | ||
} | ||
if (!("subtle" in crypto)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle === "undefined") { | ||
return false; | ||
} | ||
if (!("digest" in crypto.subtle)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle.digest !== "function") { | ||
return false; | ||
} | ||
return true; | ||
} |
{ | ||
"name": "@arcjet/analyze", | ||
"version": "1.0.0-alpha.17", | ||
"version": "1.0.0-alpha.18", | ||
"description": "Arcjet local analysis engine", | ||
@@ -54,8 +54,8 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@arcjet/protocol": "1.0.0-alpha.17" | ||
"@arcjet/protocol": "1.0.0-alpha.18" | ||
}, | ||
"devDependencies": { | ||
"@arcjet/eslint-config": "1.0.0-alpha.17", | ||
"@arcjet/rollup-config": "1.0.0-alpha.17", | ||
"@arcjet/tsconfig": "1.0.0-alpha.17", | ||
"@arcjet/eslint-config": "1.0.0-alpha.18", | ||
"@arcjet/rollup-config": "1.0.0-alpha.18", | ||
"@arcjet/tsconfig": "1.0.0-alpha.18", | ||
"@bytecodealliance/jco": "1.2.4", | ||
@@ -66,3 +66,3 @@ "@jest/globals": "29.7.0", | ||
"jest": "29.7.0", | ||
"typescript": "5.4.5" | ||
"typescript": "5.5.2" | ||
}, | ||
@@ -69,0 +69,0 @@ "publishConfig": { |
@@ -31,3 +31,3 @@ /** | ||
detectBot(headers: string, patternsAdd: string, patternsRemove: string): BotDetectionResult, | ||
generateFingerprint(ip: string): string, | ||
generateFingerprint(request: string, characteristics: string[]): string, | ||
isValidEmail(candidate: string, options: EmailValidationConfig | undefined): boolean, | ||
@@ -34,0 +34,0 @@ } |
@@ -166,11 +166,21 @@ function clampGuest(i, min, max) { | ||
function generateFingerprint(arg0) { | ||
function generateFingerprint(arg0, arg1) { | ||
var ptr0 = utf8Encode(arg0, realloc0, memory0); | ||
var len0 = utf8EncodedLen; | ||
const ret = exports1['generate-fingerprint'](ptr0, len0); | ||
var ptr1 = dataView(memory0).getInt32(ret + 0, true); | ||
var len1 = dataView(memory0).getInt32(ret + 4, true); | ||
var result1 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr1, len1)); | ||
var vec2 = arg1; | ||
var len2 = vec2.length; | ||
var result2 = realloc0(0, 0, 4, len2 * 8); | ||
for (let i = 0; i < vec2.length; i++) { | ||
const e = vec2[i]; | ||
const base = result2 + i * 8;var ptr1 = utf8Encode(e, realloc0, memory0); | ||
var len1 = utf8EncodedLen; | ||
dataView(memory0).setInt32(base + 4, len1, true); | ||
dataView(memory0).setInt32(base + 0, ptr1, true); | ||
} | ||
const ret = exports1['generate-fingerprint'](ptr0, len0, result2, len2); | ||
var ptr3 = dataView(memory0).getInt32(ret + 0, true); | ||
var len3 = dataView(memory0).getInt32(ret + 4, true); | ||
var result3 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr3, len3)); | ||
postReturn1(ret); | ||
return result1; | ||
return result3; | ||
} | ||
@@ -177,0 +187,0 @@ |
@@ -1,5 +0,6 @@ | ||
import type { ArcjetLogger } from "@arcjet/protocol"; | ||
import type { ArcjetLogger, ArcjetRequestDetails } from "@arcjet/protocol"; | ||
import type { EmailValidationConfig, BotDetectionResult, BotType } from "./wasm/arcjet_analyze_js_req.component.js"; | ||
interface AnalyzeContext { | ||
log: ArcjetLogger; | ||
characteristics: string[]; | ||
} | ||
@@ -23,7 +24,8 @@ export { type EmailValidationConfig, type BotType, | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
*/ | ||
export declare function generateFingerprint(context: AnalyzeContext, ip: string): Promise<string>; | ||
export declare function generateFingerprint(context: AnalyzeContext, request: Partial<ArcjetRequestDetails>): Promise<string>; | ||
export declare function isValidEmail(context: AnalyzeContext, candidate: string, options?: EmailValidationConfig): Promise<boolean>; | ||
export declare function detectBot(context: AnalyzeContext, headers: string, patterns_add: string, patterns_remove: string): Promise<BotDetectionResult>; |
@@ -40,30 +40,11 @@ import { instantiate } from './wasm/arcjet_analyze_js_req.component.js'; | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
*/ | ||
async function generateFingerprint(context, ip) { | ||
if (ip == "") { | ||
return ""; | ||
} | ||
async function generateFingerprint(context, request) { | ||
const analyze = await init(context); | ||
if (typeof analyze !== "undefined") { | ||
return analyze.generateFingerprint(ip); | ||
return analyze.generateFingerprint(JSON.stringify(request), context.characteristics); | ||
} | ||
if (hasSubtleCryptoDigest()) { | ||
// Fingerprint v1 is just the IP address | ||
const fingerprintRaw = `fp_1_${ip}`; | ||
// Based on MDN example at | ||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string | ||
// Encode the raw fingerprint into a utf-8 Uint8Array | ||
const fingerprintUint8 = new TextEncoder().encode(fingerprintRaw); | ||
// Hash the message with SHA-256 | ||
const fingerprintArrayBuffer = await crypto.subtle.digest("SHA-256", fingerprintUint8); | ||
// Convert the ArrayBuffer to a byte array | ||
const fingerprintArray = Array.from(new Uint8Array(fingerprintArrayBuffer)); | ||
// Convert the bytes to a hex string | ||
const fingerprint = fingerprintArray | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
return fingerprint; | ||
} | ||
return ""; | ||
@@ -94,21 +75,3 @@ } | ||
} | ||
function hasSubtleCryptoDigest() { | ||
if (typeof crypto === "undefined") { | ||
return false; | ||
} | ||
if (!("subtle" in crypto)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle === "undefined") { | ||
return false; | ||
} | ||
if (!("digest" in crypto.subtle)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle.digest !== "function") { | ||
return false; | ||
} | ||
return true; | ||
} | ||
export { detectBot, generateFingerprint, isValidEmail }; |
@@ -1,2 +0,2 @@ | ||
import type { ArcjetLogger } from "@arcjet/protocol"; | ||
import type { ArcjetLogger, ArcjetRequestDetails } from "@arcjet/protocol"; | ||
@@ -17,2 +17,3 @@ import * as core from "./wasm/arcjet_analyze_js_req.component.js"; | ||
log: ArcjetLogger; | ||
characteristics: string[]; | ||
} | ||
@@ -76,3 +77,4 @@ | ||
* across multiple requests. | ||
* @param ip - The IP address of the client. | ||
* @param context - The Arcjet Analyze context. | ||
* @param request - The request to fingerprint. | ||
* @returns A SHA-256 string fingerprint. | ||
@@ -82,36 +84,11 @@ */ | ||
context: AnalyzeContext, | ||
ip: string, | ||
request: Partial<ArcjetRequestDetails>, | ||
): Promise<string> { | ||
if (ip == "") { | ||
return ""; | ||
} | ||
const analyze = await init(context); | ||
if (typeof analyze !== "undefined") { | ||
return analyze.generateFingerprint(ip); | ||
} | ||
if (hasSubtleCryptoDigest()) { | ||
// Fingerprint v1 is just the IP address | ||
const fingerprintRaw = `fp_1_${ip}`; | ||
// Based on MDN example at | ||
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string | ||
// Encode the raw fingerprint into a utf-8 Uint8Array | ||
const fingerprintUint8 = new TextEncoder().encode(fingerprintRaw); | ||
// Hash the message with SHA-256 | ||
const fingerprintArrayBuffer = await crypto.subtle.digest( | ||
"SHA-256", | ||
fingerprintUint8, | ||
return analyze.generateFingerprint( | ||
JSON.stringify(request), | ||
context.characteristics, | ||
); | ||
// Convert the ArrayBuffer to a byte array | ||
const fingerprintArray = Array.from(new Uint8Array(fingerprintArrayBuffer)); | ||
// Convert the bytes to a hex string | ||
const fingerprint = fingerprintArray | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
return fingerprint; | ||
} | ||
@@ -155,22 +132,1 @@ | ||
} | ||
function hasSubtleCryptoDigest() { | ||
if (typeof crypto === "undefined") { | ||
return false; | ||
} | ||
if (!("subtle" in crypto)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle === "undefined") { | ||
return false; | ||
} | ||
if (!("digest" in crypto.subtle)) { | ||
return false; | ||
} | ||
if (typeof crypto.subtle.digest !== "function") { | ||
return false; | ||
} | ||
return true; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5917470
10281
+ Added@arcjet/protocol@1.0.0-alpha.18(transitive)
- Removed@arcjet/protocol@1.0.0-alpha.17(transitive)