baxcloud_verify_sdk 1.0.0
baxcloud_verify_sdk: ^1.0.0 copied to clipboard
BaxCloud Verify SDK for Flutter — SMS OTP verification via BaxVerify
BaxCloud Verify SDK for Flutter #
SMS OTP verification for iOS and Android apps via BaxVerify.
Installation #
dependencies:
baxcloud_verify_sdk: ^1.0.0
flutter pub get
Quick Start #
import 'package:baxcloud_verify_sdk/baxcloud_verify_sdk.dart';
final verify = BaxCloudVerifyClient(
config: BaxCloudVerifyConfig(
projectId: 'your-project-id',
apiKey: 'your-baxverify-api-key',
debug: true,
),
);
// Send OTP
final sent = await verify.sendOtp(
SendOtpOptions(phone: '+14155552671', purpose: BaxVerifyOtpPurpose.login),
);
print('Code expires in ${sent.expiresInSeconds}s');
// Verify OTP
final result = await verify.verifyOtp(
VerifyOtpOptions(phone: '+14155552671', code: '123456'),
);
print('Verified: ${result.verified}');
Prerequisites #
- Enable BaxVerify on your BaxCloud project (Dashboard → Project → BaxVerify).
- Create an API key with the BaxVerify scope enabled.
- Complete BaxVerify setup: rent a phone number and/or register a Sender ID.
API Reference #
| Method | Description |
|---|---|
sendOtp(SendOtpOptions) |
Send SMS verification code |
verifyOtp(VerifyOtpOptions) |
Verify a code |
getStats({days}) |
Usage stats (sent, verified, failed) |
listLogs({phone, status, page}) |
Paginated delivery logs |
Authentication #
All requests use:
Authorization: Bearer <api_key>
X-Project-Id: <project_id>
Base URL: https://api.baxcloud.tech/v1
Error Handling #
try {
await verify.verifyOtp(VerifyOtpOptions(phone: '+14155552671', code: '000000'));
} on BaxVerifyException catch (e) {
print('${e.statusCode}: ${e.message}');
}
Documentation #
License #
See LICENSE.