mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-21 01:39:19 +00:00
feat: add config base free instead of user profile
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
package org.thoughtcrime.securesms.dependencies;
|
||||
|
||||
public interface InjectableType {
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package org.thoughtcrime.securesms.dependencies
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ActivityRetainedComponent
|
||||
import dagger.hilt.android.scopes.ActivityRetainedScoped
|
||||
import network.loki.messenger.libsession_util.UserProfile
|
||||
import org.thoughtcrime.securesms.ApplicationContext
|
||||
import org.thoughtcrime.securesms.crypto.KeyPairUtilities
|
||||
|
||||
@Module
|
||||
@InstallIn(ActivityRetainedComponent::class)
|
||||
abstract class SessionUtilModule {
|
||||
|
||||
private fun maybeUserEdSecretKey(context: ApplicationContext): ByteArray? {
|
||||
val edKey = KeyPairUtilities.getUserED25519KeyPair(context) ?: return null
|
||||
return edKey.secretKey.asBytes
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ActivityRetainedScoped
|
||||
fun provideUser(context: ApplicationContext): UserProfile {
|
||||
val key = maybeUserEdSecretKey(context)
|
||||
return UserProfile.newInstance(key ?: byteArrayOf())
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user