AuthRepository

class AuthRepository(api: AuthenticationApi, prefs: SharedPreferences, executor: Executor)

Works with the API, the local data store, and FIDO2 API.

Constructors

AuthRepository
Link copied to clipboard
fun AuthRepository(api: AuthenticationApi, prefs: SharedPreferences, executor: Executor)

Types

Companion
Link copied to clipboard
object Companion

Properties

api
Link copied to clipboard
private val api: AuthenticationApi
executor
Link copied to clipboard
private val executor: Executor
fido2ApiClient
Link copied to clipboard
private var fido2ApiClient: Fido2ApiClient? = null
prefs
Link copied to clipboard
private val prefs: SharedPreferences
signInStateListeners
Link copied to clipboard
private val signInStateListeners: MutableList<(SignInState) -> Unit>

Functions

clearCredentials
Link copied to clipboard
fun clearCredentials()
Clears the credentials.
getCredentials
Link copied to clipboard
fun getCredentials(): LiveData<List<Credential>>
Retrieves the list of credential this user has registered on the server.
getSignInState
Link copied to clipboard
fun getSignInState(): LiveData<SignInState>
Returns the current sign-in state of the user.
invokeSignInStateListeners
Link copied to clipboard
private fun invokeSignInStateListeners(state: SignInState)
parseCredentials
Link copied to clipboard
private fun parseCredentials(set: Set<String>): List<Credential>
password
Link copied to clipboard
fun password(password: String, processing: MutableLiveData<Boolean>, usernameBeforePassword: MutableLiveData<Boolean>, passwordBeforeNextTask: MutableLiveData<Boolean>)
Signs in with a password.
refreshCredentials
Link copied to clipboard
private fun refreshCredentials()
registerRequest
Link copied to clipboard
fun registerRequest(processing: MutableLiveData<Boolean>): LiveData<PendingIntent?>
Starts to register a new credential to the server.
registerResponse
Link copied to clipboard
fun registerResponse(data: Intent, processing: MutableLiveData<Boolean>)
Finishes registering a new credential to the server.
removeKey
Link copied to clipboard
fun removeKey(credentialId: String, processing: MutableLiveData<Boolean>)
Removes a credential registered on the server.
setFido2APiClient
Link copied to clipboard
fun setFido2APiClient(client: Fido2ApiClient?)
signinRequest
Link copied to clipboard
fun signinRequest(processing: MutableLiveData<Boolean>): LiveData<PendingIntent?>
Starts to sign in with a FIDO2 credential.
signinResponse
Link copied to clipboard
fun signinResponse(data: Intent, processing: MutableLiveData<Boolean>, signInReady: MutableLiveData<Boolean>)
Finishes to signing in with a FIDO2 credential.
signOut
Link copied to clipboard
fun signOut()
Clears all the sign-in information.
toStringSet
Link copied to clipboard
private fun List<Credential>.toStringSet(): Set<String>
username
Link copied to clipboard
fun username(username: String, sending: MutableLiveData<Boolean>, usernameBeforePassword: MutableLiveData<Boolean>)
Sends the username to the server.