password_credential 0.1.6

  • Readme
  • Changelog
  • Example
  • Installing
  • new61

password_credential #

Flutter Plugin for Password Credentials Access.

ID and Passwords stored in Credential Management API or Smartlock are synced when user logged in Chrome or Android with same Google Account.

Example Project #

Web Example Project.

web

Android Example Project.

android

User Settings #

This section describes User-side Settings for Credentials Management System.

If the user has disabled Password Storing at System wide, or disabled per apps, the storing operations always failed with no user interaction.

If the user has disabled Auto Sign-in at System wide, the Silent Read operation always failed, and other read operation always asking user to read a password entry.

IMPORTANT:

In Android, per Apps decline settings are saved with All Google Accounts that logged in your device. The Store Permission Dialogs can be displayed, ONLY if all Google Accounts settings has not decline that app. If user cannot see any dialogs and cannot store credentials, check ALL Google Accounts Autofill Settings, and allow your app to store credentials at ALL Google Accounts.

web

android

[0.1.0] - 2020/05/30 #

  • Initial release.
  • Access Web Credentials.
  • Access Android Smartlock for Passwords.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:password_credential/entity/mediation.dart';
import 'package:provider/provider.dart';

import 'model.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
        providers: [ChangeNotifierProvider<Model>(create: (_) => Model())],
        child: Consumer<Model>(builder: (context, model, _) {
          return MaterialApp(
              debugShowCheckedModeBanner: false,
              home: Scaffold(body: Builder(builder: (context) {
                void snackbar(String message) {
                  Scaffold.of(context)
                      .showSnackBar(SnackBar(content: Text(message)));
                }

                return SafeArea(
                    child: Column(children: [
                  Container(
                      child: Column(children: [
                        Row(
                          children: [
                            Container(width: 80, child: Text("ID")),
                            Expanded(child: TextField(controller: model.idEdit))
                          ],
                        ),
                        Row(
                          children: [
                            Container(width: 80, child: Text("Password")),
                            Expanded(
                                child:
                                    TextField(controller: model.passwordEdit))
                          ],
                        ),
                      ]),
                      margin: EdgeInsets.only(left: 20, right: 20)),
                  Expanded(
                      child: ListView(children: <Widget>[
                    ListTile(
                      title: Text("Input Dummy ID/Password"),
                      onTap: () async {
                        model.idEdit.text = "my_id";
                        model.passwordEdit.text = "my_password";
                      },
                    ),
                    ListTile(
                      title: Text("Clear Inputs"),
                      onTap: () async {
                        model.idEdit.text = "";
                        model.passwordEdit.text = "";
                      },
                    ),
                    ListTile(
                      title: Text("Store(Silent)"),
                      subtitle: Text(
                          "Android: Success only when user already permitted to store the ID. Web: Silent Parameter is ignored, so operation will complete with silent for updating password or with asking user to save for new entry. Android/Web: If user denied once or disabling password saving, this operation is always failed with no asking dialogs."),
                      onTap: () async {
                        try {
                          var result = await model.store(Mediation.Silent);
                          snackbar(result.toString());
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("Store(Optional)"),
                      subtitle: Text(
                          "Android/Web: Operation will complete with silent for updating password or with asking user to save for new entry. If user denied once or disabling password saving, this operation is always failed with no asking dialogs."),
                      onTap: () async {
                        try {
                          var result = await model.store(Mediation.Optional);
                          snackbar(result.toString());
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("Store(Required)"),
                      subtitle: Text(
                          "Android: Deleting existing entry then Always asking user to permit. Web: Required Parameter is ignored, so operation will complete with silent for updating password or with asking user to save for new entry. Android/Web: If user denied once or disabling password saving, this operation is always failed with no asking dialogs."),
                      onTap: () async {
                        try {
                          var result = await model.store(Mediation.Required);
                          snackbar(result.toString());
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("Get(Silent)"),
                      subtitle: Text(
                          "Android/Web: Success only when user has already permitted to store or to read the entry. If Auto Login is disabled, this operation is always failed."),
                      onTap: () async {
                        var result = await model.get(Mediation.Silent);
                        snackbar(result.toString());
                      },
                    ),
                    ListTile(
                      title: Text("Get(Optional)"),
                      subtitle: Text(
                          "Android/Web: Success when user has already permitted to store or to read the entry, otherwise Account Selection is displayed. If Auto Login is disabled, Account Selection is always displayed."),
                      onTap: () async {
                        var result = await model.get(Mediation.Optional);
                        snackbar(result.toString());
                      },
                    ),
                    ListTile(
                      title: Text("Get(Required)"),
                      subtitle: Text(
                          "Android/Web: Always Account Selection is displayed."),
                      onTap: () async {
                        var result = await model.get(Mediation.Required);
                        snackbar(result.toString());
                      },
                    ),
                    ListTile(
                      title: Text("Delete"),
                      subtitle: Text(
                          "Android: Always Success with no interaction. Web: Success when user has already permitted to store or to read that entry."),
                      onTap: () async {
                        try {
                          await model.delete();
                          snackbar("Done");
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("hasCredentialFeature"),
                      subtitle: Text(model.hasCredentialFeature.toString()),
                    ),
                    ListTile(
                      title: Text("preventSilentAccess"),
                      subtitle: Text(
                          "Android/Web: Force to Forget user's past selection."),
                      onTap: () async {
                        await model.preventSilentAccess();
                        snackbar("Done");
                      },
                    ),
                    ListTile(
                      title: Text("openPlatformCredentialSettings"),
                      subtitle: Text(
                          "Android: Open Google Account Settings. Web: Not implemented for Chrome security reason."),
                      onTap: () async {
                        try {
                          await model.openPlatformCredentialSettings();
                          snackbar("Done");
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                  ]))
                ]));
              })));
        }));
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  password_credential: ^0.1.6

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:password_credential/credentials.dart';
import 'package:password_credential/entity/mediation.dart';
import 'package:password_credential/entity/password_credential.dart';
import 'package:password_credential/entity/result.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform ios

Because:

  • package:password_credential/credentials.dart that declares support for platforms: android, web

Package does not support Flutter platform linux

Because:

  • package:password_credential/credentials.dart that declares support for platforms: android, web

Package does not support Flutter platform macos

Because:

  • package:password_credential/credentials.dart that declares support for platforms: android, web

Package does not support Flutter platform windows

Because:

  • package:password_credential/credentials.dart that declares support for platforms: android, web

Package not compatible with SDK dart

Because:

  • password_credential that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.8.0 <3.0.0
flutter 0.0.0
flutter_web_plugins 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test