Updated on 2026-08-14
This commit is contained in:
parent
bfd38fd000
commit
ea087aac49
21 changed files with 464 additions and 8 deletions
|
|
@ -10,6 +10,7 @@ import com.tangem.datasource.api.common.adapter.LocalDateAdapter
|
|||
import com.tangem.datasource.api.common.adapter.addStakeKitEnumFallbackAdapters
|
||||
import com.tangem.datasource.local.config.providers.models.ProviderModel
|
||||
import com.tangem.domain.models.scan.serialization.*
|
||||
import com.tangem.domain.visa.model.VisaCardActivationStatus
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
|
|
@ -34,6 +35,7 @@ class MoshiModule {
|
|||
.add(BigDecimalAdapter())
|
||||
.add(LocalDateAdapter())
|
||||
.add(DateTimeAdapter())
|
||||
.add(VisaCardActivationStatus.jsonAdapter)
|
||||
.add(KotlinJsonAdapterFactory())
|
||||
.addStakeKitEnumFallbackAdapters()
|
||||
.build()
|
||||
|
|
@ -42,8 +44,26 @@ class MoshiModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
@SdkMoshi
|
||||
fun provideSdkMoshi(sdkMoshiJsonConverter: MoshiJsonConverter): Moshi {
|
||||
return sdkMoshiJsonConverter.moshi
|
||||
fun provideSdkMoshi(): Moshi {
|
||||
val adapters = MoshiJsonConverter.getTangemSdkAdapters() +
|
||||
listOf(
|
||||
BigDecimalAdapter(),
|
||||
WalletDerivedKeysMapAdapter(),
|
||||
ScanResponseDerivedKeysMapAdapter(),
|
||||
ByteArrayKeyAdapter(),
|
||||
ExtendedPublicKeysMapAdapter(),
|
||||
CardBackupStatusAdapter(),
|
||||
DerivationPathAdapterWithMigration(),
|
||||
)
|
||||
|
||||
val typedAdapters = MoshiJsonConverter.getTangemSdkTypedAdapters()
|
||||
|
||||
return Moshi.Builder().apply {
|
||||
add(VisaCardActivationStatus.jsonAdapter)
|
||||
adapters.forEach { this.add(it) }
|
||||
typedAdapters.forEach { add(it.key, it.value) }
|
||||
add(KotlinJsonAdapterFactory())
|
||||
}.build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.tangem.datasource.local.visa
|
||||
|
||||
interface VisaOTPStorage {
|
||||
|
||||
suspend fun saveOTP(cardId: String, otp: ByteArray)
|
||||
|
||||
suspend fun getOTP(cardId: String): ByteArray?
|
||||
|
||||
suspend fun removeOTP(cardId: String)
|
||||
}
|
||||
|
||||
suspend fun VisaOTPStorage.hasSavedOTP(cardId: String): Boolean = getOTP(cardId) != null
|
||||
Loading…
Add table
Add a link
Reference in a new issue