AuthDatabase constructor

AuthDatabase({
  1. Future<void> onInitialize(
    1. AuthDatabase database
    )?,
  2. Future<void> onLoad(
    1. AuthDatabase database
    )?,
  3. Future<void> onSaved(
    1. AuthDatabase database
    )?,
  4. Future<void> onSendRegisteredEmail(
    1. String email,
    2. String password,
    3. Locale locale
    )?,
  5. Future<void> onSendEmailLink(
    1. String email,
    2. String url,
    3. Locale locale
    )?,
  6. Future<String> onSendSMS(
    1. String phoneNumber,
    2. String code,
    3. Locale locale
    )?,
  7. Future<String> onResetPassword(
    1. String newPassword,
    2. Locale locale
    )?,
  8. Future<bool> onVerify(
    1. String email,
    2. Locale locale
    )?,
  9. String resetPassword = "01234567",
  10. String? debugSmsCode,
  11. String? debugUserId,
  12. Locale defaultLocale = const Locale("en", "US"),
})

A database for managing authentication information locally.

It is used for testing authentication, for example.

It is possible to implement settings during initialization with onInitialize.

You can describe the process of restoring authentication information with tryRestoreAuth in onLoad, and when there is a change in authentication, you can save the information with onSaved.

This also allows authentication information to be stored locally within the terminal.

It is possible to test each email and SMS sending process with onSendRegisteredEmail, onSendEmailLink, onSendSMS, onResetPassword and onVerify.

The password to be reset when reset is executed can be specified in resetPassword.

ローカルで認証情報を管理するためのデータベース。

認証をテストする際などに利用します。

onInitializeで初期化時の設定を実装することが可能です。

onLoadtryRestoreAuthで認証情報を復元する際の処理を記述することができ、認証に変更があった場合、onSavedで情報を保存することができます。

これにより、端末ローカル内に認証情報を保存することも可能です。

onSendRegisteredEmailonSendEmailLinkonSendSMSonResetPasswordonVerifyで各メールやSMSの送信処理をテストすることが可能です。

resetが実行された場合リセットされるパスワードをresetPasswordで指定することが可能です。

Implementation

AuthDatabase({
  this.onInitialize,
  this.onLoad,
  this.onSaved,
  this.onSendRegisteredEmail,
  this.onSendEmailLink,
  this.onSendSMS,
  this.onResetPassword,
  this.onVerify,
  this.resetPassword = "01234567",
  this.debugSmsCode,
  this.debugUserId,
  this.defaultLocale = const Locale("en", "US"),
});