AuthConfig constructor

AuthConfig({
  1. int maxAllowedEmailSignInAttempts = 5,
  2. Duration emailSignInFailureResetTime = const Duration(minutes: 5),
  3. bool enableUserImages = true,
  4. bool importUserImagesFromGoogleSignIn = true,
  5. int userImageSize = 256,
  6. UserImageType userImageFormat = UserImageType.jpg,
  7. int userImageQuality = 70,
  8. UserImageGenerator userImageGenerator = defaultUserImageGenerator,
  9. bool userCanEditUserImage = true,
  10. bool userCanEditUserName = true,
  11. bool userCanEditFullName = false,
  12. bool userCanSeeUserName = true,
  13. bool userCanSeeFullName = true,
  14. Duration userInfoCacheLifetime = const Duration(minutes: 1),
  15. UserInfoCreationCallback? onUserWillBeCreated,
  16. UserInfoUpdateCallback? onUserCreated,
  17. UserInfoUpdateCallback? onUserUpdated,
  18. SendPasswordResetEmailCallback? sendPasswordResetEmail,
  19. SendValidationEmailCallback? sendValidationEmail,
  20. int validationCodeLength = 8,
  21. Duration passwordResetExpirationTime = const Duration(minutes: 15),
  22. bool extraSaltyHash = true,
  23. String firebaseServiceAccountKeyJson = 'config/firebase_service_account_key.json',
  24. int maxPasswordLength = 128,
  25. int minPasswordLength = 8,
  26. bool allowUnsecureRandom = false,
  27. PasswordHashGenerator passwordHashGenerator = defaultGeneratePasswordHash,
  28. PasswordHashValidator passwordHashValidator = defaultValidatePasswordHash,
})

Creates a new Auth configuration. Use the set method to replace the default settings. Defaults to config/firebase_service_account_key.json.

Implementation

AuthConfig({
  this.maxAllowedEmailSignInAttempts = 5,
  this.emailSignInFailureResetTime = const Duration(minutes: 5),
  this.enableUserImages = true,
  this.importUserImagesFromGoogleSignIn = true,
  this.userImageSize = 256,
  this.userImageFormat = UserImageType.jpg,
  this.userImageQuality = 70,
  this.userImageGenerator = defaultUserImageGenerator,
  this.userCanEditUserImage = true,
  this.userCanEditUserName = true,
  this.userCanEditFullName = false,
  this.userCanSeeUserName = true,
  this.userCanSeeFullName = true,
  this.userInfoCacheLifetime = const Duration(minutes: 1),
  this.onUserWillBeCreated,
  this.onUserCreated,
  this.onUserUpdated,
  this.sendPasswordResetEmail,
  this.sendValidationEmail,
  this.validationCodeLength = 8,
  this.passwordResetExpirationTime = const Duration(minutes: 15),
  this.extraSaltyHash = true,
  this.firebaseServiceAccountKeyJson =
      'config/firebase_service_account_key.json',
  this.maxPasswordLength = 128,
  this.minPasswordLength = 8,
  this.allowUnsecureRandom = false,
  this.passwordHashGenerator = defaultGeneratePasswordHash,
  this.passwordHashValidator = defaultValidatePasswordHash,
}) {
  if (validationCodeLength < 8) {
    stderr.writeln(
      'WARNING: Validation code length is less than 8. This makes the validation code more susceptible to brute force attacks.',
    );
  }

  if (validationCodeLength < 4) {
    throw ArgumentError.value(
      validationCodeLength,
      'validationCodeLength',
      'must be at least 4',
    );
  }
}