plugins {
    id("com.android.library")
    kotlin("android")
}

// V4.10 — Android-specific KeystoreStorage adapter.
//
// Lives as a sibling module to `:shade-android` so the JVM-only
// protocol code can keep running in CI without an Android SDK.
// This module pulls in `:shade-android` for `StorageProvider`,
// `IdentityKeyPair`, etc., and binds those types to a hardware-
// backed Android Keystore master key with biometric gating.

android {
    namespace = "no.zyon.shade.keystore"
    compileSdk = 35

    defaultConfig {
        minSdk = 28 // BiometricPrompt + StrongBox baseline
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = "17"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
        }
    }

    testOptions {
        unitTests.isReturnDefaultValues = true
    }
}

dependencies {
    // Sibling: protocol types + StorageProvider interface.
    api(project(":shade-android"))

    // androidx.biometric — fragment-safe BiometricPrompt wrapper.
    // 1.2.0-alpha05 is the latest with stable BiometricPrompt API.
    implementation("androidx.biometric:biometric:1.2.0-alpha05")

    // androidx.fragment — BiometricPrompt requires FragmentActivity.
    implementation("androidx.fragment:fragment-ktx:1.8.5")

    // Coroutines for the suspend-function StorageProvider implementation.
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")

    testImplementation("junit:junit:4.13.2")
    testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
}
