- Remove committed release keystore + hardcoded signing password - Load signing config from gitignored app/keystore.properties - Add single-use token guard (fail-open) to block on-device approval replay
75 lines
2.3 KiB
Kotlin
75 lines
2.3 KiB
Kotlin
import java.util.Properties
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("org.jetbrains.kotlin.android")
|
|
}
|
|
|
|
// Signing secrets live in app/keystore.properties (gitignored), never in source control.
|
|
val keystorePropsFile = rootProject.file("app/keystore.properties")
|
|
val keystoreProps = Properties().apply {
|
|
if (keystorePropsFile.exists()) keystorePropsFile.inputStream().use { load(it) }
|
|
}
|
|
|
|
android {
|
|
namespace = "me.khodak.mfa"
|
|
compileSdk = 34
|
|
|
|
defaultConfig {
|
|
applicationId = "me.khodak.mfa"
|
|
minSdk = 28
|
|
targetSdk = 34
|
|
versionCode = 3
|
|
versionName = "1.2"
|
|
}
|
|
|
|
val hasReleaseSigning = keystoreProps.getProperty("storePassword") != null
|
|
signingConfigs {
|
|
if (hasReleaseSigning) {
|
|
create("release") {
|
|
storeFile = file(keystoreProps.getProperty("storeFile", "homelab-mfa-release.keystore"))
|
|
storePassword = keystoreProps.getProperty("storePassword")
|
|
keyAlias = keystoreProps.getProperty("keyAlias")
|
|
keyPassword = keystoreProps.getProperty("keyPassword")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
// Only attach the release signing config when keystore.properties is present.
|
|
// Without it (e.g. a fresh clone), the release build stays unsigned rather than
|
|
// failing the whole configuration.
|
|
if (hasReleaseSigning) signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
debug {
|
|
applicationIdSuffix = ".debug"
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding = true
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation("androidx.core:core-ktx:1.12.0")
|
|
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
implementation("com.google.android.material:material:1.11.0")
|
|
implementation("androidx.biometric:biometric:1.1.0")
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
|
|
}
|