BitCaptchaClient class
Low-level API client used by the widgets: fetches challenges, submits encrypted answers, runs the invisible check.
Pass your own instance to a widget to share it or inject an http.Client.
Constructors
- BitCaptchaClient({required String apiBase, required String captchaId, Client? httpClient, String sdkKey = kBitCaptchaSdkKey})
Properties
Methods
-
check(
{required String token, required double distance, required List< List< trail, required int durationMs, String pointer = 'touch', Map<num> >String, dynamic> env = const {}}) → Future<BitCaptchaCheckResult> -
Checks a slide puzzle.
distancein logical pixels;trailist_ms, x, yrelative to the touch-down point;envcarries device hints. -
checkText(
{required String token, required List< List< clicks, List<num> >List< trail = const [], int durationMs = 0, String pointer = 'touch', Map<num> >String, dynamic> env = const {}}) → Future<BitCaptchaCheckResult> -
Checks a click challenge.
clicksare the orderedx, ytaps in logical pixels inside the image. -
close(
) → void -
fetchChallenge(
) → Future< BitCaptchaChallenge> - Fetches a slide puzzle challenge.
-
fetchTextChallenge(
{bool enhanced = true, bool icon = false}) → Future< BitCaptchaTextChallenge> -
Fetches a text click (
iconfalse) or icon click (icontrue) challenge. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sense(
{String? token, List< List< trail = const [], int durationMs = 0, String pointer = 'touch', Map<num> >String, dynamic> env = const {}}) → Future<BitCaptchaSenseResult> - Invisible check, step two: sends the encrypted pre-tap signals with the token from senseInit (without one the server hands out a puzzle straight away). Returns a pass with a ticket, or a fallback challenge.
-
senseInit(
{String? prev}) → Future< (String, int)> -
Invisible check, step one: asks the server for a one-time nonce; the server times "shown to tapped" from now.
Returns (token, seconds valid); hand the token to sense on tap.
Pass the previous unused nonce as
prevto renew it while keeping the original "shown" moment. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
encryptPayload(
String token, String sdkKey, Map< String, dynamic> payload) → Future<String> - AES-256-GCM: key = SHA-256(token + sdkKey), 12-byte iv, AAD = token, output base64(iv || ct || tag).
-
outSpec(
) → Map< String, dynamic> - Image spec sent with every fetch: 1× screens skip the 2× image, and WebP is a third smaller than JPEG. The server renders to it without changing geometry; dpr is 1 or 2.