搜索插件、代码仓与 APP 分类

password_strength_checker 封面
插件详情v1.3.2

password_strength_checker

生成安全密码,检查泄露密码,获取强度的视觉反馈,或在需要最低密码强度时进行表单验证。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
8460
喜欢数
55
Pub 分数
150

安装插件

flutter pub add password_strength_checker

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,可帮助生成安全密码、验证其强度,并检查密码是否曾在数据泄露中被曝光。它提供实时的密码强度视觉反馈,并支持带有自定义最低强度要求的表单验证。非常适合需要强大认证的应用程序,可无缝集成到多个平台的密码输入字段中。

适合场景

  • 最小强度的表单验证
  • 实时密码强度反馈
  • 检查泄露的密码
  • 安全密码生成
  • 认证流程增强
  • 跨平台密码字段

主要特点

  • 视觉强度指示器
  • 暴露的密码检测
  • 可自定义的强度阈值
  • 密码生成工具
  • 与表单验证器集成
  • 多平台支持

适合对象

  • 身份验证屏幕
  • 用户注册表单
  • 注重安全的应用
  • 密码管理工具
  • 开发团队优先考虑安全
  • 需要遵守密码策略的应用程序

使用建议

  • 需要互联网连接进行泄露检查
  • 可能会略微增加应用大小
  • 依赖外部API进行曝光查询
  • 不适用于仅离线环境
  • 实时验证期间的性能影响
  • 需要对API失败情况进行适当的错误处理

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

password_strength_checker

License Pub Version Pub Likes Pub Points Pub Monthly Downloads GitHub code size in bytes GitHub Repo stars GitHub issues GitHub release (latest by date) GitHub top language CI

Generate secure passwords, check for exposed passwords, get visual feedback for password strength or get form validation with a minimum password strength required.

Check the strength of the password in a visual way, with an animation when the strength changes according to the settings given by the user. Use it also inside a Form to get form validation!

Features

  • Check for exposed common password using the commonDictionary, a map with 10,000 leaked passwords!
  • Use the PasswordStrengthChecker to have a visual feedback.
  • Use the PasswordStrengthFormChecker to have a built-in TextFormField inside the widget and get form validation using a minimumStrengthRequired.
  • Use the PasswordGenerator class to generate a secure random password based on the input configurations (PasswordGeneratorConfiguration).
  • Create your custom strength to create your own rules or use the PasswordStrength default enum (see Custom Strength).

Demo

Demo Form Gif Demo Gif Demo Generator Gif

Getting started

PasswordStrengthChecker

You can use the PasswordStrengthChecker to only have a visual feedback, for example:

final passNotifier = ValueNotifier<PasswordStrength?>(null);
// ...
PasswordStrengthChecker(
  strength: passNotifier,
),

See the full example here.

PasswordStrengthFormChecker

You can use the PasswordStrengthFormChecker to have a built-in TextFormField inside the widget and get form validation using a minimumStrengthRequired. For example:

PasswordStrengthFormChecker(
  minimumStrengthRequired: PasswordStrength.secure,
  onChanged: (password, notifier) {
    notifier.value = PasswordStrength.calculate(text: password);
  },
),

See the full example here.

PasswordGenerator

You can use the PasswordGeneratorclass to generate a secure random password based on the configurations. For example:

final config = PasswordGeneratorConfiguration(
  length: 32,
  minUppercase: 8,
  minSpecialChars: 8,
  // ...
);

final passwordGenerator = PasswordGenerator.fromConfig(
  configuration: config,
);

final password = passwordGenerator.generate();

See the full example here.

Custom Strength

You can use the default PasswordStrength enum to set the strength of the password, or you can create your own enum that implements PasswordStrengthItem and use it. For example:

enum CustomPassStrength implements PasswordStrengthItem {
  weak,
  medium,
  strong;

  @override
  Color get statusColor => switch (this) {
      CustomPassStrength.weak => Colors.red,
      CustomPassStrength.medium => Colors.orange,
      CustomPassStrength.strong => Colors.green,
    };

  @override
  Widget? get statusWidget => switch (this) {
      CustomPassStrength.weak => const Text('Weak'),
      CustomPassStrength.medium => const Text('Medium'),
      CustomPassStrength.strong => const Text('Strong'),
    };

  @override
  double get widthPerc => switch (this) {
      CustomPassStrength.weak => 0.15,
      CustomPassStrength.medium => 0.4,
      CustomPassStrength.strong => 0.75,
    };

  static CustomPassStrength? calculate({required String text}) {
    // Implement your custom logic here
    if (text.isEmpty) {
      return null;
    }
    // Use the [commonDictionary] to see if a password
    // is in 10,000 common exposed password list.
    if (commonDictionary[text] == true) {
      return CustomPassStrength.weak;
    }
    if (text.length < 6) {
      return CustomPassStrength.weak;
    } else if (text.length < 10) {
      return CustomPassStrength.medium;
    } else {
      return CustomPassStrength.strong;
    }
  }
}

Contribution

The project is open source and you can contribute to it here -> repository link

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Contributors


Made with ❤️ from dariowskii

所属分类

源码仓库

使用此插件的项目