commonMain.at.asitplus.wallet.lib.oidvci.CodeService.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vck-openid Show documentation
Show all versions of vck-openid Show documentation
Kotlin Multiplatform library implementing the W3C VC Data Model, with OpenId protocol implementations
The newest version!
package at.asitplus.wallet.lib.oidvci
import com.benasher44.uuid.uuid4
interface CodeService {
fun provideCode(): String
fun verifyCode(it: String): Boolean
}
class DefaultCodeService : CodeService {
private val validCodes = mutableListOf()
override fun provideCode(): String {
return uuid4().toString().also { validCodes += it }
}
override fun verifyCode(it: String): Boolean {
return validCodes.remove(it)
}
}