shernova_core
Headless Flutter SDK for the Shernova Phone Verification API.
This is the required core package. For ready-made verification screens, add optional shernova_ui.
Migration: If you used
shernova1.x, switch toshernova_core2.x — same API, new import path.
Quick Start (new Flutter app)
Path A — Headless (recommended)
flutter create my_app
cd my_app
dart pub add shernova_core
dart pub add --dev shernova_cli
dart run shernova_cli setup --pk pk_test_YOUR_KEY --app-id YOUR_APP_UUID
Path B — With optional UI
dart pub add shernova_core shernova_ui
dart pub add --dev shernova_cli
dart run shernova_cli setup --pk pk_test_YOUR_KEY --app-id YOUR_APP_UUID --with-ui
Register Android signature
After setup, register the printed package name and SHA256 in the Shernova dashboard, or via API:
curl -X POST "https://api.shernova.com/v1/apps/YOUR_APP_ID/android-signatures" \
-H "Authorization: Bearer YOUR_DASHBOARD_JWT" \
-H "X-Shernova-Organization-Id: YOUR_ORG_ID" \
-H "Content-Type: application/json" \
-d '{"package_name":"com.example.my_app","sha256":"YOUR_64_CHAR_SHA256","label":"Debug"}'
Local API during development
| Target | --api-url value |
|---|---|
| Android emulator | http://10.0.2.2:3001 |
| Windows / iOS simulator / desktop | http://localhost:3001 |
| Production | https://api.shernova.com (default) |
dart run shernova_cli setup --pk pk_test_... --app-id ... --api-url http://10.0.2.2:3001
Headless integration (no UI package)
import 'package:shernova_core/shernova_core.dart';
import 'shernova_config.dart';
await Shernova.init(shernovaConfig);
final session = await Shernova.verify(phoneNumber: '+201012345678');
await for (final update in Shernova.watch(session.sessionId)) {
if (update.status == 'verified') {
final receipt = await Shernova.getReceipt(session.sessionId);
break;
}
}
UI language: For headless use, call Shernova.ensureLocale(Localizations.localeOf(context).languageCode) before Shernova.verify().
Optional UI (shernova_ui)
import 'package:flutter/material.dart';
import 'package:shernova_core/shernova_core.dart';
import 'package:shernova_ui/shernova_ui.dart';
import 'shernova_config.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Shernova.init(shernovaConfig);
runApp(const MyApp());
}
// … in a button handler:
await verifyPhone(
context: context,
phoneNumber: '+201012345678',
);
If your MaterialApp uses Arabic, verifyPhone() loads Arabic SDK strings automatically.
Test vs Live keys
Both use real gateways and consume credits. Call the gateway_phone_number from the same phone the user entered.
| Key prefix | Use in |
|---|---|
pk_test_ / sk_test_ |
Development / QA builds |
pk_live_ / sk_live_ |
Production / store builds |
Packages
| Package | Purpose |
|---|---|
shernova_core |
Core headless SDK (this package) — required |
shernova_ui |
Optional verification screens |
shernova_cli |
Project setup CLI |
shernova |
Deprecated — re-exports shernova_core |
Register your Android package name + SHA256 before calling Shernova.init().