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

apiBase String
final
captchaId String
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sdkKey String
final

Methods

check({required String token, required double distance, required List<List<num>> trail, required int durationMs, String pointer = 'touch', Map<String, dynamic> env = const {}}) Future<BitCaptchaCheckResult>
Checks a slide puzzle. distance in logical pixels; trail is t_ms, x, y relative to the touch-down point; env carries device hints.
checkText({required String token, required List<List<num>> clicks, List<List<num>> trail = const [], int durationMs = 0, String pointer = 'touch', Map<String, dynamic> env = const {}}) Future<BitCaptchaCheckResult>
Checks a click challenge. clicks are the ordered x, y taps 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 (icon false) or icon click (icon true) challenge.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sense({String? token, List<List<num>> trail = const [], int durationMs = 0, String pointer = 'touch', Map<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 prev to 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.