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

commonMain.at.asitplus.wallet.lib.oidvci.NonceService.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 NonceService {

    fun provideNonce(): String

    fun verifyAndRemoveNonce(it: String): Boolean

}

class DefaultNonceService : NonceService {

    private val validNonces = mutableListOf()

    override fun provideNonce(): String {
        return uuid4().toString().also { validNonces += it }
    }

    override fun verifyAndRemoveNonce(it: String): Boolean {
        return validNonces.remove(it)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy