Search packages, repositories and app categories

GitHub repositorythe-kool-sk/secure_shared_preferences

secure_shared_preferences

the-kool-sk/secure_shared_preferences open-source repository details.

secure_shared_preferences project cover
Stars
5
Forks
13
Last push (UTC)
Jul 2, 2024
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

Encryption is important

pub points Pub

Features

  • Simple to use yet powerful package to encypt shared preferences in android and UserDefaults in iOS.
  • You have an option to by pass encryption just by passing a bool.
  • Supports String, int, bool, double, map and List<String>.
  • Uses advance AES-CBC-128 algorithm for encryption.
  • Encrypts both key and value.
  • Integration unit tests available here

Getting started

  1. add dependency in pubspec.yaml file secure_shared_preferences:0.0.4
  2. add import import 'package:secure_shared_preferences/secure_shared_preferences.dart';

Usage

  1. To save string data type to secure storage.
    var pref = await SecureSharedPref.getInstance();
    pref.putString("Key", "This is data I want to save to local storage", isEncrypted : true);
  1. To get string data type to secure storage.
    var pref = await SecureSharedPref.getInstance();
    pref.getString("Key", isEncrypted : true);

Additional information

Encryption flow chart

FlowChart

Usage
  1. Save :
    var pref = await SecureSharedPref.getInstance();
    await pref.putString("StringEncrypted", "This is my first string test",isEncrypted: true);
    await pref.putInt("key", 100, isEncrypted: true);
    await pref.putMap("mapKey", {"Hello":true}, isEncrypted: true);
    await pref.putDouble("doubleKey", 20.32, isEncrypted: true);
    await pref.putBool("boolKey", true,isEncrypted:  true);
    await pref.putStringList("listKey", ["S","K"], isEncrypted: true);

First parameter is the 'key' Second parameter is the value Third parameter is whether you want to encrypt this key/value or not.

  1. Fetch :
    var pref = await SecureSharedPref.getInstance();
    await pref.getString("StringEncrypted", isEncrypted: true);
    await pref.getInt("key", isEncrypted: true);
    await pref.getMap("mapKey", isEncrypted: true);
    await pref.getDouble("doubleKey", isEncrypted: true);
    await pref.getBool("boolKey",isEncrypted: true);
    await pref.getStringList("listKey", isEncrypted: true);

First parameter is the 'key' Second parameter is whether you have encrypted this key/value or not.

Suraj Kulkarni GitHub avatar
GitHub author

Suraj Kulkarni ↗

Cornerstone OndemandPune
LanguagesDartHTMLRubySwiftKotlinObjective-C

Packages published by this repository

Dependencies used

Dependency list 9 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗