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

SQLite storage adapter for portico_auth_roles, portico_auth_credentials, and portico_auth_tokens.

Portico Auth Storage (SQLite) #

Portico Auth Storage Sqlite License: MIT

Description of the image

SQLite persistence layer for Portico Auth credentials, roles, and tokens. This package provides a robust storage solution using SQLite, ensuring your authentication data is persisted reliably across server restarts.

Features #

  • Performant: Uses sqflite_common_ffi for efficient and reliable database operations on desktop and server platforms.
  • Modular Adapters: Separate adapters for managing AuthCredentialsManager, AuthRoles, and AuthTokens metadata.
  • Automatic Schema Management: Handles table creation, indexes, and initialization automatically upon startup.
  • Thread-Safe: Designed to handle concurrent access safely within a single process.

Getting started #

Add this package to your pubspec.yaml:

dependencies:
  portico_auth_storage_sqlite: ^1.0.0

Interactive Web Simulator #

Experience the full capabilities of the Portico Auth ecosystem without setting up a backend. The Web Simulator runs the entire stack (Client, Server, and Storage) directly in your browser.

Usage #

1. Initialize Database #

Tip

You can use an in-memory database for testing or a file-based database for production.

import 'package:portico_auth_storage_sqlite/portico_auth_storage_sqlite.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';

void main() async {
  // Initialize FFI for desktop/server
  sqfliteFfiInit();
  final db = await databaseFactoryFfi.openDatabase('auth_service.db');

  // Initialize specific storage components
  final tokenStorage = AuthTokensSqlite(db);
  await tokenStorage.initialize();

  final credentialStorage = AuthCredentialsSqlite(db);
  await credentialStorage.initialize();

  final roleStorage = AuthRolesSqlite(db);
  await roleStorage.initialize();
}

2. Use with Portico Auth Managers #

Pass the storage adapters to your managers.

final credentials = AuthCredentialsManager(storage: credentialStorage);
final roleManager = AuthRoleManager(roleStorage);
final tokenManager = AuthTokensManager(
  signingKey,
  encryptingKey,
  tokenStorage,
  // ...
);

Examples #

1
likes
160
points
59
downloads

Publisher

verified publishermcdole.org

Weekly Downloads

SQLite storage adapter for portico_auth_roles, portico_auth_credentials, and portico_auth_tokens.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

meta, path, portico_auth_credentials, portico_auth_roles, portico_auth_tokens, sqflite_common_ffi, sqlite3

More

Packages that depend on portico_auth_storage_sqlite