mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-29 13:27:46 +00:00
fix(crypto/age): init
This commit is contained in:
parent
dcc7d1e0ee
commit
ae7487e76f
18
crypto/age/build.gradle.kts
Normal file
18
crypto/age/build.gradle.kts
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
plugins { id("com.github.android-password-store.kotlin-jvm-library") }
|
||||
|
||||
dependencies {
|
||||
api(projects.crypto.common)
|
||||
implementation(libs.androidx.annotation)
|
||||
implementation(libs.aps.kage)
|
||||
implementation(libs.dagger.hilt.core)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.thirdparty.kotlinResult)
|
||||
implementation(libs.thirdparty.kotlinResult.coroutines)
|
||||
testImplementation(libs.bundles.testDependencies)
|
||||
testImplementation(libs.kotlinx.coroutines.test)
|
||||
testImplementation(libs.testing.testparameterinjector)
|
||||
}
|
59
crypto/age/lint-baseline.xml
Normal file
59
crypto/age/lint-baseline.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<issues format="6" by="lint 8.5.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.5.2)" variant="all" version="8.5.2">
|
||||
|
||||
<issue
|
||||
id="StopShip"
|
||||
message="`TODO` call found; points to code which must be fixed prior to release"
|
||||
errorLine1=" TODO("Not yet implemented")"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/kotlin/app/passwordstore/crypto/AgeKeyManager.kt"
|
||||
line="9"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StopShip"
|
||||
message="`TODO` call found; points to code which must be fixed prior to release"
|
||||
errorLine1=" TODO("Not yet implemented")"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/kotlin/app/passwordstore/crypto/AgeKeyManager.kt"
|
||||
line="13"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StopShip"
|
||||
message="`TODO` call found; points to code which must be fixed prior to release"
|
||||
errorLine1=" TODO("Not yet implemented")"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/kotlin/app/passwordstore/crypto/AgeKeyManager.kt"
|
||||
line="17"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StopShip"
|
||||
message="`TODO` call found; points to code which must be fixed prior to release"
|
||||
errorLine1=" TODO("Not yet implemented")"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/kotlin/app/passwordstore/crypto/AgeKeyManager.kt"
|
||||
line="21"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="StopShip"
|
||||
message="`TODO` call found; points to code which must be fixed prior to release"
|
||||
errorLine1=" TODO("Not yet implemented")"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/kotlin/app/passwordstore/crypto/AgeKeyManager.kt"
|
||||
line="25"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
</issues>
|
@ -0,0 +1,18 @@
|
||||
package app.passwordstore.crypto
|
||||
|
||||
/** [CryptoOptions] implementation for [kage.Age] decryption operations. */
|
||||
public class AgeDecryptOptions private constructor(private val values: Map<String, Boolean>) :
|
||||
CryptoOptions {
|
||||
|
||||
override fun isOptionEnabled(option: String): Boolean {
|
||||
return values.getOrDefault(option, false)
|
||||
}
|
||||
|
||||
/** Builder for [AgeDecryptOptions]. */
|
||||
public class Builder {
|
||||
/** Build the final [AgeDecryptOptions] object. */
|
||||
public fun build(): AgeDecryptOptions {
|
||||
return AgeDecryptOptions(emptyMap())
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package app.passwordstore.crypto
|
||||
|
||||
/** [CryptoOptions] implementation for [kage.Age] encryption operations. */
|
||||
public class AgeEncryptOptions private constructor(private val values: Map<String, Boolean>) :
|
||||
CryptoOptions {
|
||||
|
||||
override fun isOptionEnabled(option: String): Boolean {
|
||||
return values.getOrDefault(option, false)
|
||||
}
|
||||
|
||||
/** Builder for [AgeEncryptOptions]. */
|
||||
public class Builder {
|
||||
/** Build the final [AgeEncryptOptions] object. */
|
||||
public fun build(): AgeEncryptOptions {
|
||||
return AgeEncryptOptions(emptyMap())
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package app.passwordstore.crypto
|
||||
|
||||
import kage.Identity
|
||||
import kage.Recipient
|
||||
|
||||
/** Sealed hierarchy for the types of keys that [kage.Age] expects. */
|
||||
public sealed interface AgeKey {
|
||||
|
||||
/** The public key in [kage.Age], wrapping a [kage.Recipient]. */
|
||||
@JvmInline public value class Public(public val recipient: Recipient) : AgeKey
|
||||
|
||||
/** The private key in [kage.Age], wrapping a [kage.Identity]. */
|
||||
@JvmInline public value class Private(public val identity: Identity) : AgeKey
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package app.passwordstore.crypto
|
||||
|
||||
import com.github.michaelbull.result.Result
|
||||
|
||||
/** [KeyManager] implementation for [kage.Age]-based keys. */
|
||||
public class AgeKeyManager : KeyManager<AgeKey, String> {
|
||||
|
||||
override suspend fun addKey(key: AgeKey, replace: Boolean): Result<AgeKey, Throwable> {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override suspend fun removeKey(identifier: String): Result<Unit, Throwable> {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override suspend fun getKeyById(id: String): Result<AgeKey, Throwable> {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override suspend fun getAllKeys(): Result<List<AgeKey>, Throwable> {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override suspend fun getKeyId(key: AgeKey): String? {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ androidx-recyclerview = "androidx.recyclerview:recyclerview:1.4.0-alpha02"
|
||||
androidx-recyclerviewSelection = "androidx.recyclerview:recyclerview-selection:1.2.0-alpha01"
|
||||
androidx-security = "androidx.security:security-crypto-ktx:1.1.0-alpha06"
|
||||
androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
|
||||
aps-kage = "com.github.android-password-store:kage:0.2.0"
|
||||
aps-sublimeFuzzy = "com.github.android-password-store:sublime-fuzzy:2.3.4"
|
||||
aps-zxingAndroidEmbedded = "com.github.android-password-store:zxing-android-embedded:4.2.1"
|
||||
build-agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
|
||||
|
@ -88,6 +88,8 @@ include("coroutine-utils")
|
||||
|
||||
include("crypto:common")
|
||||
|
||||
include("crypto:age")
|
||||
|
||||
include("crypto:pgpainless")
|
||||
|
||||
include("format:common")
|
||||
|
Loading…
x
Reference in New Issue
Block a user