A simple string (only) masking algorithm that hides a readable string value inside a data capsule using a generated key. Generated data capsules will only be opened using the same key that was used to create them.
To use this plugin:
Add data capsule in your project's pubspec.yaml
dependencies:
datacapsule: ^1.0.1
See the `example` directory for a complete sample code on using data capsule.
Import it inside your code
import 'package:datacapsule/datacapsule.dart';
Instantiate the data capsule class
DataCapsule _capsule = DataCapsule();
There are 5 methods you can use to pack and unpack data capsules
precription(); // Gets a prescription key. As much as possible, you have to keep this somewhere safe.
pack(String data, String prescription); // Packs a string into a data capsule.
unpack(String data, String prescription); // Unpacks a string into a data capsule.
packList(List<String> data, String prescription); // Packs a list of strings into a data capsule.
unpackList(List<String> data, String prescription); // Unpacks a a list strings into a data capsule.
Added home page
Added example code.
Initial release.
example/example.dart
import 'package:datacapsule/datacapsule.dart' as capsule;
class DataCapsule_Examples {
/// Initialize the data capsule class.
capsule.DataCapsule _capsule = capsule.DataCapsule();
/// Sample method to generate a data capsule.
void GenerateCapsule() {
/// * Must get a prescription key before performing any methods of DataCapsule.s
///
/// * A prescription key will be used to encrypt and decrypt. The idea is to create an algorithm
/// * that will hide a readable string inside a data capsule using a prescription key and opening the
/// * data capsule to get the original readable string would require the same key.
///
/// ! If you try to decrypt a string using a different key from what was used to encrypt it,
/// ! the returned string will be different from the original string.
/// Get the prescription key
String _prescription = _capsule.prescription();
/// Pack the string inside a data capsule
String _encryptedString = _capsule.pack(
"I am a string to be placed inside a data capsule.", _prescription);
print(_encryptedString);
/// Unpack the data capsule using the same prescription key that was used for packing.
print(_capsule.unpack(_encryptedString, _prescription));
}
}
Add this to your package's pubspec.yaml file:
dependencies:
datacapsule: ^1.0.2
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:datacapsule/datacapsule.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
1.0.2 | Dec 9, 2018 |
|
|
1.0.1 | Sep 25, 2018 |
|
|
1.0.0 | Sep 25, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
0
|
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]
|
50
|
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
package:datacapsule/datacapsule.dart
.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=2.0.0 <3.0.0 |