@@ -92,13 +92,23 @@ function createCoreImports(detect?: DetectSensitiveInfoFunction): ImportObject {
9292 } ;
9393}
9494
95- // TODO(@wooorm-arcjet): document what is used to fingerprint.
9695/**
97- * Generate a fingerprint for the client. This is used to identify the client
98- * across multiple requests.
99- * @param context - The Arcjet Analyze context.
100- * @param request - The request to fingerprint.
101- * @returns A SHA-256 string fingerprint.
96+ * Generate a fingerprint.
97+ *
98+ * Fingerprints can be used to identify the client across multiple requests.
99+ *
100+ * This considers different things on the `request` based on the passed
101+ * `context.characteristics`.
102+ *
103+ * See [*Fingerprints* on
104+ * `docs.arcjet.com`](https://docs.arcjet.com/fingerprints/) for more info.
105+ *
106+ * @param context
107+ * Context.
108+ * @param request
109+ * Request.
110+ * @returns
111+ * Promise for a SHA-256 fingerprint.
102112 */
103113export async function generateFingerprint (
104114 context : AnalyzeContext ,
@@ -121,18 +131,29 @@ export async function generateFingerprint(
121131 return "" ;
122132}
123133
124- // TODO(@wooorm-arcjet): docs.
134+ /**
135+ * Check whether an email is valid.
136+ *
137+ * @param context
138+ * Context.
139+ * @param value
140+ * Value.
141+ * @param options
142+ * Configuration.
143+ * @returns
144+ * Promise for a result.
145+ */
125146export async function isValidEmail (
126147 context : AnalyzeContext ,
127- candidate : string ,
148+ value : string ,
128149 options : EmailValidationConfig ,
129150) : Promise < EmailValidationResult > {
130151 const { log } = context ;
131152 const coreImports = createCoreImports ( ) ;
132153 const analyze = await initializeWasm ( coreImports ) ;
133154
134155 if ( typeof analyze !== "undefined" ) {
135- return analyze . isValidEmail ( candidate , options ) ;
156+ return analyze . isValidEmail ( value , options ) ;
136157 // Ignore the `else` branch as we test in places that have WebAssembly.
137158 /* node:coverage ignore next 4 */
138159 }
@@ -141,7 +162,18 @@ export async function isValidEmail(
141162 return { blocked : [ ] , validity : "valid" } ;
142163}
143164
144- // TODO(@wooorm-arcjet): docs.
165+ /**
166+ * Detect whether a request is by a bot.
167+ *
168+ * @param context
169+ * Context.
170+ * @param request
171+ * Request.
172+ * @param options
173+ * Configuration.
174+ * @returns
175+ * Promise for a result.
176+ */
145177export async function detectBot (
146178 context : AnalyzeContext ,
147179 request : AnalyzeRequest ,
@@ -161,10 +193,27 @@ export async function detectBot(
161193 return { allowed : [ ] , denied : [ ] , spoofed : false , verified : false } ;
162194}
163195
164- // TODO(@wooorm-arcjet): docs.
196+ /**
197+ * Detect sensitive info in a value.
198+ *
199+ * @param context
200+ * Context.
201+ * @param value
202+ * Value.
203+ * @param entities
204+ * Strategy to use for detecting sensitive info;
205+ * either by denying everything and allowing certain tags or by allowing
206+ * everything and denying certain tags.
207+ * @param contextWindowSize
208+ * Number of tokens to pass to `detect`.
209+ * @param detect
210+ * Function to detect sensitive info (optional).
211+ * @returns
212+ * Promise for a result.
213+ */
165214export async function detectSensitiveInfo (
166215 context : AnalyzeContext ,
167- candidate : string ,
216+ value : string ,
168217 entities : SensitiveInfoEntities ,
169218 contextWindowSize : number ,
170219 detect ?: DetectSensitiveInfoFunction ,
@@ -175,7 +224,7 @@ export async function detectSensitiveInfo(
175224
176225 if ( typeof analyze !== "undefined" ) {
177226 const skipCustomDetect = typeof detect !== "function" ;
178- return analyze . detectSensitiveInfo ( candidate , {
227+ return analyze . detectSensitiveInfo ( value , {
179228 entities,
180229 contextWindowSize,
181230 skipCustomDetect,
0 commit comments