Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prashantsolanki3/Secure-Pref-Manager
Secure Preference Manager for android. It uses various Encryption to protect your application's Shared Preferences.
https://github.com/prashantsolanki3/Secure-Pref-Manager
android encryption hide-preferences security sharedpreferences
Last synced: 5 days ago
JSON representation
Secure Preference Manager for android. It uses various Encryption to protect your application's Shared Preferences.
- Host: GitHub
- URL: https://github.com/prashantsolanki3/Secure-Pref-Manager
- Owner: prashantsolanki3
- License: apache-2.0
- Created: 2015-11-05T18:11:06.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-08T16:10:53.000Z (about 8 years ago)
- Last Synced: 2024-04-25T22:34:57.063Z (8 months ago)
- Topics: android, encryption, hide-preferences, security, sharedpreferences
- Language: Java
- Homepage: https://prashantsolanki3.github.io/Secure-Pref-Manager/
- Size: 140 KB
- Stars: 70
- Watchers: 4
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android - Secure Preference Manager - Secure Preference Manager for android. It uses various Encryption to protect your application's Shared Preferences. (Libraries / Utility)
- awesome-android-libraries - Secure-Pref-Manager
- awesome-android - Secure Preference Manager - Secure Preference Manager for android. It uses various Encryption to protect your application's Shared Preferences. (Libraries / Utility)
README
# Secure-Pref-Manager
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Secure%20Preference%20Manager-brightgreen.svg?style=flat-square)](http://android-arsenal.com/details/1/2747)
[![Travis CI](https://travis-ci.org/prashantsolanki3/Secure-Pref-Manager.svg)](https://travis-ci.org/prashantsolanki3/Secure-Pref-Manager)
##Secure Preference Manager is a simple Library to help you protect your Shared Preferences.
Secure Preference Manager for android. It uses various encryption techniques to protect your application's Shared Preferences.##Setup
Add jitpack to your project’s repositories.```
repositories {
// ...
maven { url "https://jitpack.io" }
}
```Then add Secure-Pref-Manager to your Module’s dependencies
```
dependencies {
compile 'com.github.prashantsolanki3:Secure-Pref-Manager:0.25'
}
```##Usage
###Initialize SecurePrefManager anywhere before using it.
* Basic Initialization
```
new SecurePrefManagerInit.Initializer(getApplicationContext())
.initialize();
```* Recommended Initialization
* AES Encryption by Default.
* Auto Generated Key.```
new SecurePrefManagerInit.Initializer(getApplicationContext())
.useEncryption(true)
.initialize();
```* Advance Initialization: Only if you wanna add Custom Encryption Methods.
```
new SecurePrefManagerInit.Initializer(getApplicationContext())
.useEncryption(true)
.setCustomEncryption(new Encryptor(getApplicationContext()) {
@Override
public String encrypt(String s) throws Exception {
// Your Encryption Algorithm
return encryptedString;
}@Override
public String decrypt(String s) throws Exception {
// Your Decryption Algorithm
return decryptedString;
}
})
.initialize();
```### Adding and Retrieving Preferences
* Adding
```
SecurePrefManager.with(this)
.set("user_name")
.value("LoremIpsum")
.go();
```* Retrieving
```
String userName = SecurePrefManager.with(this)
.get("user_name")
.defaultValue("unknown")
.go();
```### Hide Preferences from 3rd Party applications (EXPERIMENTAL)
* Unhide Preferences when the activity starts
```
@Override
protected void onStart() {
super.onStart();
SecurePrefManager.with(getApplicationContext())
.unhide(new HidePreferences.PreferenceUpdateListener() {
@Override
public void onFailure() {
Log.d("unhiding", "Failed");
}@Override
public void onProgress(int p, int max) {
Log.d("unhiding", "Progress: " + p + "/" + max);
}@Override
public void onSuccess() {
Log.d("unhiding", "Success");
}
});
}
```
* Hide preferences when leaving the activity```
@Override
protected void onPause() {
SecurePrefManager.with(getApplicationContext())
.hide(new HidePreferences.PreferenceUpdateListener() {
@Override
public void onFailure() {}
@Override
public void onProgress(int p, int max) {}
@Override
public void onSuccess() {}
});
}
```### Have Fun!