diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2022-01-09 17:04:16 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-09 17:04:16 +0530 |
| commit | 1738879fb3ba1b2c2d0ca7933c861bf99ae32535 (patch) | |
| tree | 42b339b07e3c45922310afd01e8ce357f99beeb6 /app/src/main/java/dev/msfjarvis/aps/injection/crypto/KeyManagerModule.kt | |
| parent | 799f1393e49955d05f68b81af26d6cfaf9beadfd (diff) | |
| download | HardenedPass-1738879fb3ba1b2c2d0ca7933c861bf99ae32535.tar.gz HardenedPass-1738879fb3ba1b2c2d0ca7933c861bf99ae32535.zip | |
Integrate PGPainless backend into the UI properly (#1647)
Diffstat (limited to 'app/src/main/java/dev/msfjarvis/aps/injection/crypto/KeyManagerModule.kt')
| -rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/injection/crypto/KeyManagerModule.kt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/crypto/KeyManagerModule.kt b/app/src/main/java/dev/msfjarvis/aps/injection/crypto/KeyManagerModule.kt new file mode 100644 index 00000000..0bc1c43d --- /dev/null +++ b/app/src/main/java/dev/msfjarvis/aps/injection/crypto/KeyManagerModule.kt @@ -0,0 +1,38 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +package dev.msfjarvis.aps.injection.crypto + +import android.content.Context +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.android.qualifiers.ApplicationContext +import dagger.hilt.components.SingletonComponent +import dev.msfjarvis.aps.crypto.PGPKeyManager +import javax.inject.Qualifier +import kotlinx.coroutines.Dispatchers + +@Module +@InstallIn(SingletonComponent::class) +object KeyManagerModule { + @Provides + fun providePGPKeyManager( + @PGPKeyDir keyDir: String, + ): PGPKeyManager { + return PGPKeyManager( + keyDir, + Dispatchers.IO, + ) + } + + @Provides + @PGPKeyDir + fun providePGPKeyDir(@ApplicationContext context: Context): String { + return context.filesDir.resolve("pgp_keys").absolutePath + } +} + +@Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class PGPKeyDir |
