搜尋套件、儲存庫與 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

所屬分類

原始碼儲存庫

使用此套件的專案