Encrypted Storage
This package provides a fast and simple way to store and retrieve encrypted data usind sqflite. It uses AES encryption via encrypt to encrypt the data and flutter_secure_storage to store key and initialization vector.
Installation ๐ป
โ In order to start using Encrypted Storage you must have the Flutter SDK installed on your machine.
Add encrypted_storage to your pubspec.yaml
:
dependencies:
encrypted_storage:
Basic usage ๐
Setup DI:
@InjectableInit(
externalPackageModulesBefore: [
ExternalModule(EncryptedStoragePackageModule),
],
)
void configureDependencies() => getIt.init();
Init:
Future<void> configureEncryptedStorage() async {
final encryptedStorage = inject<EncryptedStorage>();
await encryptedStorage.init();
}
Melos magic ๐ช
Using melos makes it very easy to work with the project, so enjoy.
You can run any job interactively run running melos run
and selecting needed case or directly (e.g. melos run test
).
Bootstrap ๐
Melos takes care about dependencies of all packages, including managing of local-generated library version. So, just run:
melos bs
Codegen ๐ฆพ
This thing will run all code generators for all packages:
$ melos run codegen
Clean up ๐งน
Just run commands below to clean all, including build directories and flutter projects.
melos clean
Tests โ๏ธ
You can run all tests at one by running this command.
melos run test
Code ๐
You can run code analysis:
melos run analyze
Code format ๐๏ธ
melos run check-format
will check, melos run format
will fix dart code formatting.
melos run check-format
melos run format
Prepare to commit ๐ค๐ป
melos run check-all
will ckeck, analyze and run all tests.
melos run check-all
Conventional Commits โค๏ธ
This magic will update version and build our library automatically using commit messages and tags. Conventional Commits is a lightweight convention on top of commit messages.
Version ๐ท๏ธ
Package version control is done by melos. It runs by gh action 'Create version PR' melos version -a --yes
.
Github Secrets ๐
BOT_ACCESS_TOKEN
: Personal access token (PAT) used to fetch the repository. We should use PAT and not default GITHUB_TOKEN because "When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch, will not create a new workflow run". We want to trigger a workflow from the workflow (to run tests), so we need to use PAT. This thing is used in version
workflow.
Libraries
- encrypted_storage
- Encrypted storage
- encrypted_storage.module