Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change library name #18

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 30 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Ackee Security
# Ackee Guardian

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.ackeecz/security-bom)](https://central.sonatype.com/artifact/io.github.ackeecz/security-bom)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.ackeecz/guardian-bom)](https://central.sonatype.com/artifact/io.github.ackeecz/guardian-bom)

## Overview

Ackee Security is a library focusing on a security-related logic. In [Ackee](https://www.ackee.cz/)
we mainly use it to share some common security-related implementations across our projects, but it
The galaxy has the Guardians of the Galaxy to fend off galactic threats and save us from cosmic chaos.
But who’s watching over your apps, shielding them from malicious attackers and software mischief?

Enter **Ackee Guardian** – your app's fearless defender, standing strong against the dark forces of bugs,
vulnerabilities, and threats. Just as the Guardians of the Galaxy protect the universe, Ackee Guardian
ensures your Android app stays secure and your users stay safe.

Ackee Guardian focuses on a security-related logic. In [Ackee](https://www.ackee.cz/)
we use it to share some common security implementations across our projects, but it
contains useful logic suited for anyone's needs. More specifically, you can use it as a 100%
compatible replacement for [Jetpack Security Crypto](https://developer.android.com/reference/kotlin/androidx/security/crypto/package-summary)
library and there is more!
Expand All @@ -21,7 +28,7 @@ Library consists of several modules:

### Core

Contains basic core security-related logic like `MasterKey` class (rewritten from Jetpack Security)
Contains basic core security logic like `MasterKey` class (rewritten from Jetpack Security)
that is used by other modules to encrypt the data. You don't have to depend on this module directly,
if you use `datastore` modules or `jetpack`.

Expand Down Expand Up @@ -98,9 +105,9 @@ pairs that made unnecessary extra encryptions/decryptions under the hood.
used in Jetpack Security, that also had some synchronization issues, that were fixed in later releases.
- Since one of the major issues of Jetpack Security was an outdated Tink library, which makes all the
crypto operations and Jetpack Security was basically just a thin abstraction over it, we wanted to
try to prevent the same issues in the future and so we decided to force clients of Ackee Security library
try to prevent the same issues in the future and so we decided to force clients of Ackee Guardian library
to depend on Tink explicitly. This allows clients to have a better control over updates, independent
of Ackee Security updates.
of Ackee Guardian updates.
- Fix several bugs discovered in `EncryptedSharedPreferences` during covering the logic by tests:
- If you saved empty string `Set`, you didn't get it back by using `getStringSet`, but you got
default value passed in parameter instead.
Expand All @@ -120,22 +127,22 @@ of Ackee Security updates.

Add the following dependencies to your `libs.versions.toml`, depending on what you need. You should
always use BOM to be sure to get binary compatible dependencies. If you need only `jetpack` features,
just declare BOM and `io.github.ackeecz:security-jetpack`. If you need only particular DataStore,
then declare BOM and particular DataStore dependency, e.g. `io.github.ackeecz:security-datastore`.
You don't need to declare `io.github.ackeecz:security-core` dependency, unless you depend only on
just declare BOM and `io.github.ackeecz:guardian-jetpack`. If you need only particular DataStore,
then declare BOM and particular DataStore dependency, e.g. `io.github.ackeecz:guardian-datastore`.
You don't need to declare `io.github.ackeecz:guardian-core` dependency, unless you depend only on
`core` without any DataStore or `jetpack` modules.

```toml
[versions]
ackee-security-bom = "SPECIFY_VERSION"
ackee-guardian-bom = "SPECIFY_VERSION"
tink = "SPECIFY_VERSION"

[libraries]
ackee-security-bom = { module = "io.github.ackeecz:security-bom", version.ref = "ackee-security-bom" }
ackee-security-core = { module = "io.github.ackeecz:security-core" }
ackee-security-datastore = { module = "io.github.ackeecz:security-datastore" }
ackee-security-datastore-preferences = { module = "io.github.ackeecz:security-datastore-preferences" }
ackee-security-jetpack = { module = "io.github.ackeecz:security-jetpack" }
ackee-guardian-bom = { module = "io.github.ackeecz:guardian-bom", version.ref = "ackee-guardian-bom" }
ackee-guardian-core = { module = "io.github.ackeecz:guardian-core" }
ackee-guardian-datastore = { module = "io.github.ackeecz:guardian-datastore" }
ackee-guardian-datastore-preferences = { module = "io.github.ackeecz:guardian-datastore-preferences" }
ackee-guardian-jetpack = { module = "io.github.ackeecz:guardian-jetpack" }

tink-android = { module = "com.google.crypto.tink:tink-android", version.ref = "tink" }
```
Expand All @@ -146,20 +153,20 @@ Then specify dependencies in your `build.gradle.kts`:
dependencies {

// Always use BOM
implementation(platform(libs.ackee.security.bom))
implementation(platform(libs.ackee.guardian.bom))
// Optional core dependency. Needed to be specified only if you do not use any other artifact
// and want to use core in your app.
implementation(libs.ackee.security.core)
implementation(libs.ackee.guardian.core)
// For encrypted DataStore
implementation(libs.ackee.security.datastore)
implementation(libs.ackee.guardian.datastore)
// For encrypted preferences DataStore
implementation(libs.ackee.security.datastore.preferences)
implementation(libs.ackee.guardian.datastore.preferences)
// For Jetpack Security port
implementation(libs.ackee.security.jetpack)
implementation(libs.ackee.guardian.jetpack)

// Dependency on Tink must be included explicitly. This allows clients of Ackee Security library
// Dependency on Tink must be included explicitly. This allows clients of Ackee Guardian library
// to control the version of Tink themselves, being able to keep it up-to-date as much as possible
// and not depend on Ackee Security releases.
// and not depend on Ackee Guardian releases.
implementation(libs.tink.android)
}
```
Expand Down
28 changes: 14 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import io.github.ackeecz.security.properties.LibraryProperties
import io.github.ackeecz.guardian.properties.LibraryProperties

plugins {
alias(libs.plugins.ackeecz.security.android.application)
alias(libs.plugins.ackeecz.security.testing)
alias(libs.plugins.ackeecz.security.testing.android)
alias(libs.plugins.ackeecz.security.testing.protobuf)
alias(libs.plugins.ackeecz.guardian.android.application)
alias(libs.plugins.ackeecz.guardian.testing)
alias(libs.plugins.ackeecz.guardian.testing.android)
alias(libs.plugins.ackeecz.guardian.testing.protobuf)
}

android {
namespace = "io.github.ackeecz.security.sample"
namespace = "io.github.ackeecz.guardian.sample"

defaultConfig {
applicationId = "io.github.ackeecz.security"
applicationId = "io.github.ackeecz.guardian"
}
}

@Suppress("UseTomlInstead")
dependencies {

val bomVersion = LibraryProperties(project).bomArtifactProperties.version
implementation(platform("io.github.ackeecz:security-bom:$bomVersion"))
implementation("io.github.ackeecz:security-core")
implementation("io.github.ackeecz:security-datastore")
implementation("io.github.ackeecz:security-datastore-preferences")
implementation("io.github.ackeecz:security-jetpack")
implementation(platform("io.github.ackeecz:guardian-bom:$bomVersion"))
implementation("io.github.ackeecz:guardian-core")
implementation("io.github.ackeecz:guardian-datastore")
implementation("io.github.ackeecz:guardian-datastore-preferences")
implementation("io.github.ackeecz:guardian-jetpack")

// Dependency on Tink must be included explicitly and should be even with explicit version. This
// allows clients of Ackee Security library to control the version of Tink themselves, being
// able to keep it up-to-date as much as possible and not depend on Ackee Security releases.
// allows clients of Ackee Guardian library to control the version of Tink themselves, being
// able to keep it up-to-date as much as possible and not depend on Ackee Guardian releases.
implementation(libs.tink.android)

testImplementation(libs.bouncyCastle.bcpkix)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">Ackee Security</string>
</resources>
<string name="app_name">Ackee Guardian</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.ackeecz.security.sample
package io.github.ackeecz.guardian.sample

import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.github.ackeecz.security.sample.junit.rule.AndroidFakeKeyStoreRule
import io.github.ackeecz.guardian.sample.junit.rule.AndroidFakeKeyStoreRule
import org.junit.Rule
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.ackeecz.security.sample
package io.github.ackeecz.guardian.sample

import io.github.ackeecz.security.core.MasterKey
import io.github.ackeecz.guardian.core.MasterKey
import kotlinx.coroutines.test.runTest
import org.junit.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.ackeecz.security.sample
package io.github.ackeecz.guardian.sample

import android.content.Context
import androidx.datastore.core.CorruptionException
Expand All @@ -8,11 +8,11 @@ import androidx.datastore.core.Serializer
import androidx.datastore.dataStoreFile
import androidx.test.core.app.ApplicationProvider
import com.google.protobuf.InvalidProtocolBufferException
import io.github.ackeecz.security.core.MasterKey
import io.github.ackeecz.security.datastore.core.DataStoreCryptoParams
import io.github.ackeecz.security.datastore.core.DataStoreEncryptionScheme
import io.github.ackeecz.security.datastore.createEncrypted
import io.github.ackeecz.security.datastore.encryptedDataStore
import io.github.ackeecz.guardian.core.MasterKey
import io.github.ackeecz.guardian.datastore.core.DataStoreCryptoParams
import io.github.ackeecz.guardian.datastore.core.DataStoreEncryptionScheme
import io.github.ackeecz.guardian.datastore.createEncrypted
import io.github.ackeecz.guardian.datastore.encryptedDataStore
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.ackeecz.security.sample
package io.github.ackeecz.guardian.sample

import android.content.Context
import androidx.datastore.core.DataStore
Expand All @@ -9,11 +9,11 @@ import androidx.datastore.preferences.core.preferencesOf
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStoreFile
import androidx.test.core.app.ApplicationProvider
import io.github.ackeecz.security.core.MasterKey
import io.github.ackeecz.security.datastore.core.DataStoreCryptoParams
import io.github.ackeecz.security.datastore.core.DataStoreEncryptionScheme
import io.github.ackeecz.security.datastore.preferences.createEncrypted
import io.github.ackeecz.security.datastore.preferences.encryptedPreferencesDataStore
import io.github.ackeecz.guardian.core.MasterKey
import io.github.ackeecz.guardian.datastore.core.DataStoreCryptoParams
import io.github.ackeecz.guardian.datastore.core.DataStoreEncryptionScheme
import io.github.ackeecz.guardian.datastore.preferences.createEncrypted
import io.github.ackeecz.guardian.datastore.preferences.encryptedPreferencesDataStore
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.ackeecz.security.sample
package io.github.ackeecz.guardian.sample

import android.content.Context
import android.content.SharedPreferences
import androidx.test.core.app.ApplicationProvider
import io.github.ackeecz.security.core.MasterKey
import io.github.ackeecz.security.jetpack.EncryptedFile
import io.github.ackeecz.security.jetpack.EncryptedSharedPreferences
import io.github.ackeecz.security.jetpack.adaptToSharedPreferences
import io.github.ackeecz.security.sample.junit.rule.CoroutineRule
import io.github.ackeecz.guardian.core.MasterKey
import io.github.ackeecz.guardian.jetpack.EncryptedFile
import io.github.ackeecz.guardian.jetpack.EncryptedSharedPreferences
import io.github.ackeecz.guardian.jetpack.adaptToSharedPreferences
import io.github.ackeecz.guardian.sample.junit.rule.CoroutineRule
import io.kotest.matchers.maps.shouldHaveSize
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.test.UnconfinedTestDispatcher
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.ackeecz.security.sample.junit.rule
package io.github.ackeecz.guardian.sample.junit.rule

import android.security.keystore.KeyGenParameterSpec
import org.bouncycastle.asn1.x500.X500Name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.ackeecz.security.sample.junit.rule
package io.github.ackeecz.guardian.sample.junit.rule

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.StandardTestDispatcher
Expand Down
2 changes: 1 addition & 1 deletion app/src/test/proto/test_data.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

option java_package = "io.github.ackeecz.security.sample";
option java_package = "io.github.ackeecz.guardian.sample";
option java_multiple_files = true;

message TestData {
Expand Down
4 changes: 2 additions & 2 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import io.github.ackeecz.security.verification.task.VerifyBomVersionTask
import io.github.ackeecz.guardian.verification.task.VerifyBomVersionTask

plugins {
`java-platform`
alias(libs.plugins.ackeecz.security.publishing)
alias(libs.plugins.ackeecz.guardian.publishing)
}

dependencies {
Expand Down
20 changes: 10 additions & 10 deletions build-logic/logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,47 @@ dependencies {
gradlePlugin {
plugins {
plugin(
dependency = libs.plugins.ackeecz.security.android.application,
dependency = libs.plugins.ackeecz.guardian.android.application,
pluginClassSimpleName = "AndroidApplicationPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.android.library,
dependency = libs.plugins.ackeecz.guardian.android.library,
pluginClassSimpleName = "AndroidLibraryPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.preflightchecks,
dependency = libs.plugins.ackeecz.guardian.preflightchecks,
pluginClassSimpleName = "RegisterPreflightChecksPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.publishing,
dependency = libs.plugins.ackeecz.guardian.publishing,
pluginClassSimpleName = "PublishingPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.testfixtures,
dependency = libs.plugins.ackeecz.guardian.testfixtures,
pluginClassSimpleName = "TestFixturesPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.testing.asProvider(),
dependency = libs.plugins.ackeecz.guardian.testing.asProvider(),
pluginClassSimpleName = "TestingPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.testing.android,
dependency = libs.plugins.ackeecz.guardian.testing.android,
pluginClassSimpleName = "TestingAndroidPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.testing.protobuf,
dependency = libs.plugins.ackeecz.guardian.testing.protobuf,
pluginClassSimpleName = "TestingProtobufPlugin",
)

plugin(
dependency = libs.plugins.ackeecz.security.tink,
dependency = libs.plugins.ackeecz.guardian.tink,
pluginClassSimpleName = "TinkPlugin",
)
}
Expand All @@ -89,6 +89,6 @@ private fun NamedDomainObjectContainer<PluginDeclaration>.plugin(
val pluginId = dependency.get().pluginId
register(pluginId) {
id = pluginId
implementationClass = "io.github.ackeecz.security.plugin.$pluginClassSimpleName"
implementationClass = "io.github.ackeecz.guardian.plugin.$pluginClassSimpleName"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.ackeecz.security.plugin
package io.github.ackeecz.guardian.plugin

import io.github.ackeecz.security.util.Constants
import io.github.ackeecz.guardian.util.Constants
import org.gradle.api.Plugin
import org.gradle.api.Project

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.ackeecz.security.plugin
package io.github.ackeecz.guardian.plugin

import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.ackeecz.security.plugin
package io.github.ackeecz.guardian.plugin

import com.android.build.gradle.BaseExtension
import io.github.ackeecz.security.util.Constants
import io.github.ackeecz.guardian.util.Constants
import org.gradle.api.Plugin
import org.gradle.api.Project

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.ackeecz.security.plugin
package io.github.ackeecz.guardian.plugin

import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.Plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.ackeecz.security.plugin
package io.github.ackeecz.guardian.plugin

import io.github.ackeecz.security.util.Constants
import io.github.ackeecz.guardian.util.Constants
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType
Expand Down
Loading
Loading