CodeService

interface CodeService(source)

Provides generation and single-use validation of short-lived codes, e.g. authorization codes, pre-authorized codes, or issuer_state values.

Every kind of code needs its own instance, so that a value valid for one purpose can not be presented for another one: at.asitplus.wallet.lib.oauth2.SimpleAuthorizationService keeps one instance per kind.

Can be implemented to provide replication across different instances of the enclosing application.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun provideCode(): String

Implementers: Generate a new random string, store it for later verification.

Link copied to clipboard
abstract suspend fun verifyAndRemove(it: String): Boolean

Implementers: Verify the value has been generated by this instance, and remove it, i.e. codes are single-use.