DVDatabaseAuthProvider class

Accounts in a dv_accounts table: an id, the address, a name and a salted PBKDF2 hash of the password. The password itself is never stored.

One address is one account. The address is kept trimmed and in lower case, and the table's unique key decides between two sign-ups for the same address at once, so two web processes over one database cannot both create it.

Implemented types

Constructors

DVDatabaseAuthProvider(DVDatabaseAdapter adapter, {String table = 'dv_accounts', DVPasswordHasher? hasher, DateTime clock()?})

Properties

adapter → DVDatabaseAdapter
final
authStateChanges → Stream<AuthUser?>
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
table → String
final

Methods

anyAccount() → Future<bool>
Whether this application has any account at all, which is what makes a start a first run.
override
changeEmail(String id, String email) → Future<AuthUser>
Moves the account with id to email. Throws AuthException with AuthFailure.accountExists when another account has that address and AuthFailure.invalidEmail when it is not one.
override
changePassword(String id, String password) → Future<void>
Sets the password of the account with id. Throws AuthException with AuthFailure.weakPassword for a password the provider will not keep.
override
currentUser() → Future<AuthUser?>
override
deleteAccount(String id) → Future<void>
Removes the account with id. Its credentials no longer sign in.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
signIn(String email, String password) → Future<AuthUser?>
override
signOut() → Future<void>
The server keeps no signed-in person of its own: who is signed in is the session a request carries.
override
signUp(String email, String password, {String? name}) → Future<AuthUser?>
override
toString() → String
A string representation of this object.
inherited
userByEmail(String email) → Future<AuthUser?>
The account whose address is email, compared as the provider stores addresses, or null when there is none.
override
userById(String id) → Future<AuthUser?>
The account with id, or null when there is none.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

maximumEmailLength → const int
The longest address kept. Longer than any address a mail server delivers to (RFC 5321), and short enough to be a unique key everywhere.
minimumPasswordLength → const int