All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.at.asitplus.wallet.lib.oidvci.CodeService.kt Maven / Gradle / Ivy

Go to download

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)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy