kashi_auth 1.0.0 copy "kashi_auth: ^1.0.0" to clipboard
kashi_auth: ^1.0.0 copied to clipboard

Flutter sign-in for kashi APIs, with one-time codes, password, Google, Sign in with Apple and passkeys, a Cupertino sign-in screen, passkey management and a biometric app lock.

example/example.md

kashi_auth example #

KSignIn shows every provider the server enables and the app supplies an adapter for. Pass adapters only for the providers you've configured; omit google/apple/passkeys to hide them.

import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:kashi_auth/kashi_auth.dart';
import 'package:kashi_core/kashi_core.dart';

void main() {
  runApp(
    ProviderScope(
      overrides: [
        kashiConfigProvider.overrideWithValue(
          const KashiConfig(baseUrl: 'https://api.example.com/v1'),
        ),
      ],
      child: const MyApp(),
    ),
  );
}

class MyApp extends ConsumerWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final auth = ref.watch(authControllerProvider);
    return CupertinoApp(
      home: switch (auth.status) {
        AuthStatus.signedIn => const HomeScreen(),
        _ => const CupertinoPageScaffold(
            child: KSignIn(title: 'Sign in to Acme'),
          ),
      },
    );
  }
}

Guard a screen behind biometrics with KBiometricGate (bring your own local_auth call), and let users manage their passkeys with KPasskeySettings:

KBiometricGate(
  reason: 'Unlock Acme',
  authenticate: (reason) => LocalAuthentication().authenticate(
    localizedReason: reason,
  ),
  child: const AccountScreen(),
);
0
likes
0
points
226
downloads

Publisher

verified publishersoftwareseva.org

Weekly Downloads

Flutter sign-in for kashi APIs, with one-time codes, password, Google, Sign in with Apple and passkeys, a Cupertino sign-in screen, passkey management and a biometric app lock.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_riverpod, kashi_core, kashi_ui

More

Packages that depend on kashi_auth