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

Secure password hashing (Argon2id) and user identity management for Portico Auth.

example/main.dart

import 'package:portico_auth_credentials/portico_auth_credentials.dart';

void main() async {
  // 1. Initialize with in-memory storage for this example
  final storage = AuthCredentialsInMemoryStorage();
  final auth = AuthCredentialsManager(storage: storage);

  const userId = 'alice@example.com';
  const password = 'superSecretPassword!';

  print('--- Registration ---');
  await auth.registerUser(userId, password);
  print('User $userId registered.');

  print('\n--- Verification ---');
  try {
    final isValid = await auth.verifyCredentials(userId, password);
    print('Login successful? $isValid');
  } catch (e) {
    print('Login failed: $e');
  }

  print('\n--- Password Update ---');
  const newPassword = 'evenBetterPassword!';
  await auth.updatePassword(userId, password, newPassword);
  print('Password updated.');

  print('\n--- Re-Verification ---');
  try {
    await auth.verifyCredentials(userId, password); // Should fail
  } on InvalidCredentialsException {
    print('Old password correctly rejected.');
  }

  try {
    await auth.verifyCredentials(userId, newPassword); // Should succeed
    print('New password accepted.');
  } catch (e) {
    print('New password failed: $e');
  }
}
1
likes
160
points
73
downloads

Publisher

verified publishermcdole.org

Weekly Downloads

Secure password hashing (Argon2id) and user identity management for Portico Auth.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

clock, cryptography, meta

More

Packages that depend on portico_auth_credentials