Skip to main content

secure_compressor 1.0.15 copy "secure_compressor: ^1.0.15" to clipboard
secure_compressor: ^1.0.15 copied to clipboard

This is a Dart package that provides utilities for securely encrypting, decrypting, compressing, and decompressing string data using AES encryption and gzip compression

secure-compressor #

secure_compressor is a Dart package that provides utilities for securely encrypting, decrypting, compressing, and decompressing string data using AES encryption and gzip compression.

Features #

  • Encrypt and decrypt string data using AES encryption.
  • Compress and decompress string data using gzip.
  • Combine encryption and compression for secure and efficient data storage and transmission.
  • Save encrypted and compressed data to local storage.
  • Share encrypted and compressed data to media platform device (WA, email, etc).

Installation #

Add the following to your pubspec.yaml file:


dependencies:

secure_compressor: <Latest-Version>

Then, run flutter pub get to fetch the package.

Requirements #

  • Flutter >= 3.44 and Dart >= 3.12.
  • Android Gradle Plugin 8.x or 9.x.

On AGP 8.x this plugin applies the Kotlin Gradle Plugin itself. No app Gradle changes are required.

On AGP 9+, enable built-in Kotlin so the plugin does not apply KGP and the Flutter KGP warning stays clear:

  1. In android/gradle.properties, set android.builtInKotlin=true.
  2. Migrate android/app/build.gradle or android/app/build.gradle.kts off kotlin-android, following the Flutter built-in Kotlin guide.

If an AGP 9 app still sets android.builtInKotlin=false, this plugin keeps applying KGP so the Android build continues to compile. Flutter may still warn until the app turns built-in Kotlin on. Enabling android.builtInKotlin=true needs Flutter >= 3.47.

Usages #

::: Notes :::
 - keyString must be 32 character
 - Initialization Vector (IV) [ivString] must be 16 character

Encrypt #

Encrypt a string using AES encryption:


final result = await  SecureCompressor.encrypt(data, keyString, ivString: ivString);

Compress and then encrypt a string:


final result = await  SecureCompressor.compressAndEncrypt(data, keyString, ivString: ivString);

Decrypt #

Decrypt an AES encrypted string:


final result = SecureCompressor.decrypt(encryptedData, keyString, ivString: ivString);

Decrypt and then uncompress a string:


final result = SecureCompressor.uncompressAndDecrypt(compressedAndEncryptedData, keyString, ivString: ivString);

Save Data to Local Storage #

Save data to a local file:


	SecureCompressor.saveDataToLocal(fileName, data);

Share Data to Media Platform Device (WA, email, etc) #

Share data to a media platform device:


	SecureCompressor.shareFile(fileName, data);

Generate Unix Key #

If you wanna generate unix key, you can use this function. NOTE: NEVER USE THIS FUNCTION TO ENCRYPT OR DECRYPT FROM OTHER DEVICE


	await SecureCompressor.getUnixId()

Save Primitif Data Type into Local Storage #

Save primitif data type as string, boolean, int, and double into local storage using GetStorage.

Initializes the storage helper with the given parameters first befor run the app:

    await StorageHelper.initialize(
      'YOUR_STORAGE_NAME',
      isEncryptKeyAndValue: true, // Default true
      encryptionKey: "YOUR_ENCRYPTION_KEY_MUST_BE_32_CHAR", // If null, will use unix id from devices used
      isKeyEncrypted: false, // Default false
    );

	StorageHelper.saveString('test_key', 'test_value');
    final savedData = StorageHelper.getString('test_key');

Erase data by key

	StorageHelper.eraseData('test_key',);
5
likes
140
points
286
downloads

Documentation

API reference

Publisher

verified publisheranonimeact.com

Weekly Downloads

This is a Dart package that provides utilities for securely encrypting, decrypting, compressing, and decompressing string data using AES encryption and gzip compression

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

encrypt, flutter, get_storage, path_provider, plugin_platform_interface, pointycastle

More

Packages that depend on secure_compressor

Packages that implement secure_compressor