Hive Cookie Store

coverage_badge style: very good analysis License: MIT

A cookie store implementation for the cookie_jar package that uses Hive for persistence and encryption. This package uses the hive package to securely store and retrieve cookies from the local storage.

Features 📋

  • Secure: Cookies are encrypted and stored in the local storage.
  • Persistence: Cookies are persisted across app restarts.
  • Customizable: You can customize the encryption key and the encryption algorithm.
  • Efficient: Hive is a fast and efficient NoSQL database.
  • Cross-platform: Works on Android, iOS, macOS, Windows, Linux, and Web.

Installation 💻

❗ In order to start using Hive Cookie Store you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

dart pub add hive_cookie_store

Usage 🚀

If you want to use the HiveCookieStore as a persistent cookie store for the CookieJar you can do so like this:

import 'package:hive_cookie_store/hive_cookie_store.dart';

Future<void> initPersistentCookieJar() {
  final cipher = await EncryptionHelper.generateCipher(key: 'testKey');

  final storage = HiveCookieStorage(
    boxName: 'box',
    encryptionCipher: cipher,
  );

  // use the storage with the [HiveCookieJar]

  final jar = HiveCookieJar(
    storage: storage,
    ignoreExpires: true,
  );

  // or use the storage directly with the [PersistCookieJar]

  final persistJar = PersistCookieJar(
    storage: storage,
    ignoreExpires: true,
  );

  //... use `jar` with your Http or Dio instance
}

Contributing 🤝

To contribute the package, please follow these steps:

  1. Fork the repository.

  2. Create a new branch:

    git checkout -b feature-branch
    
  3. Make your changes and commit them:

    git commit -m "Description of your changes"
    
  4. Push to the branch:

    git push origin feature-branch
    
  5. Create a pull request.


Libraries