Skip to content

Releases: osipxd/encrypted-datastore

v1.1.1-beta03

13 May 14:16
Compare
Choose a tag to compare
v1.1.1-beta03 Pre-release
Pre-release

Added

  • Enforce version alignment between the library and DataStore using BOM (#45)

Housekeeping

Full Changelog: v1.1.1-beta02...v1.1.1-beta03

v1.1.1-beta02

07 May 22:28
Compare
Choose a tag to compare
v1.1.1-beta02 Pre-release
Pre-release

Fixed

  • Fixed Preference DataStore saving (#38)
  • Test fixtures are excluded from publication (#32)

Housekeeping

  • Added sample application

Full Changelog: v1.1.1-beta01...v1.1.1-beta02

v1.1.1-beta01

04 May 22:00
Compare
Choose a tag to compare
v1.1.1-beta01 Pre-release
Pre-release

Caution

Preferences DataStore is broken in this version. Please, use v1.1.1-beta02 instead

DataStore 1.1.0+

Note

Ensure that the version of this library aligns with the DataStore library version used in your project.
This version should only be used with datastore:1.1.1, as it depends on new APIs introduced in that release.

Starting with version 1.1.0, DataStore has become a multiplatform library.
However, encrypted datastore is currently limited to JVM and Android targets due to dependencies on JVM-specific libraries like Tink and security-crypto.
I am actively exploring ways to add support for more targets to the library.
The research will take some time, so I've released a beta version compatible with DataStore 1.1.0 for developers not requiring multiplatform targets support.

Changes

  • Potentially breaking change: The field io.github.osipxd.datastore.encrypted.PreferencesSerializer has been hidden from the public API.
    Instead, directly use the object PreferencesSerializer, which is now publicly available starting with the datastore:1.1.0 release.
  • Added the @RestrictTo(LIBRARY_GROUP) annotation to public members that are intended for internal use only, ensuring they are not used externally.

Housekeeping

  • Added a binary compatibility validator to prevent unintentional breaks in binary compatibility

Full Changelog: v1.0.0...v1.1.1-beta01

v1.0.0

17 Apr 21:11
fc9c961
Compare
Choose a tag to compare

Delegates to create encrypted DataStores (#24)

Delegates encryptedDataStore and encryptedPreferencesDataStore were added to simplify DataStore creation.
If you have the following code:

val dataStore = DataStoreFactory.createEncrypted(serializer) {
    EncryptedFile.Builder(
        context.dataStoreFile("filename"),
        context,
        MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC),
        EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
    ).build()
}

You can simplify it using delegate for DataStore creation.

// 1. Move the field to top level of you Kotlin file and turn it to an extension on Context
// 2. Replace `DataStoreFactory.createEncrypted` with `encryptedDataStore`
val Context.dataStore by encryptedDataStore(
    fileName = "filename", // Keep file the same
    serializer = serializer,
)

Note

This only will be interchangeable if you used context.dataStoreFile(...) to create datastore file.
In case you have custom logic for master key creation, pass the created master key as a parameter masterKey to the delegate.

Dependencies

  • Target JVM 1.811
  • Kotlin 1.7.211.9.23
  • Tink 1.7.01.13.0

Housekeeping

  • Update Gradle to 8.7
  • Update AGP to 8.3.2
  • Move PreferenceDataStoreHack.java into encrypted-datastore-preferences module (#25)

Full Changelog: v1.0.0-beta01...v1.0.0

v1.0.0-beta01

26 Feb 10:10
e303776
Compare
Choose a tag to compare

Fixed

  • Fixed decryption fallback from StreamingAead to Aead by @osipxd in #16
  • Change min SDK 21 → 23 to align it with security-crypto 1.0.0

Housekeeping

  • Update Gradle to 7.6.1

Full Changelog: v1.0.0-alpha04...v1.0.0-beta01

v1.0.0-alpha04

19 Dec 19:45
b3ea4db
Compare
Choose a tag to compare

Fixed

  • Fixed the case when data can not be read if output stream was not closed in serializer (#10) by @osipxd
  • Added default value for parameter encryptionOptions in PreferenceDataStoreFactory.createEncrypted (#12) by @osipxd

Full Changelog: v1.0.0-alpha03...v1.0.0-alpha04

v1.0.0-alpha03

18 Nov 19:26
b7b4b67
Compare
Choose a tag to compare

More high-level library security-crypto-datastore

New library provides more simple and less error-prone API to create encrypted DataStores.
All Tink-related stuff hidden from you in security-crypto library, and all you should do is wrap File with EncryptedFile:

val dataStore = DataStoreFactory.createEncrypted(serializer) {
    EncryptedFile.Builder(
        context.dataStoreFile("filename"),
        context,
        MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC),
        EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
    ).build()
}

Or even simpler, if you use security-crypto-ktx:1.1.0:

val dataStore = DataStoreFactory.createEncrypted(serializer) {
    EncryptedFile(
        context = context,
        file = context.dataStoreFile("filename"),
        masterKey = MasterKey(context)
    )
}

See the Migration guide.

Streaming serializer

Introduced new extension-function Serializer.encrypted(StreamingAead) to encrypt DataStore in streaming manner.
Old extension-function with Aead is not planned to be removed yet, but for all new code it is recommended to use the new function or migrate to the security-crypto-datastore.

ATTENTION!
You can not use StreamingAead to decrypt data encrypted with Aead,
so you can not just replace Aead with StreamingAead without migration.
To not lose your previously encrypted data, you have three options:

  1. Migration - add fallback for StreamingAead using function StreamingAead.withDecryptionFallback(Aead)
  2. Do nothing - continue to use Aead
  3. Destructive migration - specify CorruptionHandler to replace old content with something else

New module encrypted-datastore-preferences

⚠️ Breaking change:

All stuff related to Preference DataStore was moved to io.github.osipxd:encrypted-datastore-preferences.
To continue use it, change the dependency module in your build script:

-implmentation("io.github.osipxd:encrypted-datastore:...")
+implmentation("io.github.osipxd:encrypted-datastore-preferences:...")

Fixed

  • Fixed crash when DataStore can not be decrypted (#1)

Dependencies

  • Kotlin 1.5.301.7.21
  • Tink 1.6.11.7.0

Housekeeping

  • Gradle 7.27.5.1
  • gradle-infrastructure 0.12.10.17
  • Migrate dependencies to version catalogs

Full Changelog: v1.0.0-alpha02...v1.0.0-alpha03

v1.0.0-alpha02

12 Oct 16:43
f65c71c
Compare
Choose a tag to compare
  • Added docs
  • Fixed publication

Full Changelog: v1.0.0-alpha01...v1.0.0-alpha02

v1.0.0-alpha01

12 Oct 16:16
a52bac1
Compare
Choose a tag to compare