encrypted_prefs 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new60

EncryptedPrefs

Description

Default shared prefrences in android comes with limitations. Developers cant save objects to it, neither are those encrypted. This is to make the storage much more easy, you can now save the models to local storage by calling a single function. And guess what, its also encrypted! Zero boilerplate!



Installation

For installation you may see: https://pub.dartlang.org/packages/encrypted_prefs

How to use

Add serialization/deserialization technique to your object

/// Sample class used for storing locally
class User {
  final String username;
  final String password;

  User(this.username, this.password);

  bool operator == (user) => user is User && user.username == username && user.password == password;

  /// Serializing technique
  User.fromJson(Map<String, dynamic> json)
      : username = json['Username'],
        password = json['Password'];

  /// And deserializing
  Map<String, dynamic> toJson() => {
        'Username': username,
        'Password': password,
      };
}

Generate a secure key and keep it in the safe place.

/// You can generate encryption key using EncryptedPrefs encryptionKey = await prefs.generateRandomKey();


Extend your adapter with FlagChatAdapter and pass context to the adapter

class ChatAdapter(context: Context, private var list: ArrayList<Any>) : FlagChatAdapter(context)


# Store and retrieve objets with encryption
Its one liner code
To encrypt and save, you just need to call set method

/// Save data in local storage with your object against key and encryption key await prefs.set("User", user, encryptionKey);


To get the decrypted object all you need to do is following

/// Retrieve your data from local storage with your key, encryption key and the serialization technique you are using prefs.get("User", encryptionKey, (json) => User.fromJson(json)).then((value) { if (user == value) { /// Do whatever you want :) } });


# Yes! Is it async
Yes! ```EncryptedPrefs``` are created by using the best technique and approaches availabe.
This is async and you dont have to worry about anything.

# Contributions

Pull requests are welcome! The best contributions will consist of substitutions or configurations for classes/methods known to block the main thread during a typical app lifecycle.

I would love to know if you are using FlagChatAdapter in your app, send an email to Salmaan Ahmed

[0.0.1]

initial release.

example/README.md

example

Smooth rating bar example project.

Getting Started

Check out the example source code from here.

Use this package as a library

1. Depend on it

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


dependencies:
  encrypted_prefs: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:encrypted_prefs/encrypted_prefs.dart';
  
Version Uploaded Documentation Archive
1.0.0 Dec 21, 2018 Go to the documentation of encrypted_prefs 1.0.0 Download encrypted_prefs 1.0.0 archive
0.0.2 Dec 21, 2018 Go to the documentation of encrypted_prefs 0.0.2 Download encrypted_prefs 0.0.2 archive
0.0.1 Dec 21, 2018 Go to the documentation of encrypted_prefs 0.0.1 Download encrypted_prefs 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
20
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.10
  • Flutter: 1.1.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

8 out of 8 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
encrypt ^1.0.0+1 1.0.0+1
flutter 0.0.0
flutter_string_encryption ^0.2.0 0.2.0
shared_preferences ^0.4.3 0.4.3
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
pointycastle 1.0.0
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test