SudoUserClient

interface SudoUserClient

Interface encapsulating a library of functions for calling Sudo Platform identity service, managing keys, performing cryptographic operations.

Inheritors

Types

Link copied to clipboard
class Builder(context: Context)

Builder used to construct SudoUserClient.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val version: String

Checksum's for each file are generated and are used to create a checksum that is used when publishing to maven central. In order to retry a failed publish without needing to change any functionality, we need a way to generate a different checksum for the source code. We can change the value of this property which will generate a different checksum for publishing and allow us to retry. The value of version doesn't need to be kept up-to-date with the version of the code.

Functions

Link copied to clipboard
abstract fun clearAuthTokens()

Clears cached authentication tokens.

Link copied to clipboard
abstract suspend fun deregister()

De-registers a user.

Link copied to clipboard

Deregisters an existing sign in status observer.

Link copied to clipboard
abstract fun getAccessToken(): String?

Returns the access token cached from the last sign-in.

Link copied to clipboard
abstract fun getCredentialsProvider(): CognitoCredentialsProvider

Returns a credentials provider that can be used for authenticating into various services provided by Sudo Platform.

Link copied to clipboard
abstract fun getIdToken(): String?

Returns the ID token cached from the last sign-in.

Link copied to clipboard
abstract fun getLogins(): Map<String, String>

Returns the logins to use for accessing other Sudo Platform services. You must be signed in to get logins.

Link copied to clipboard
abstract fun getRefreshToken(): String?

Returns the refresh token cached from the last sign-in.

Link copied to clipboard
abstract fun getRefreshTokenExpiry(): Date?

Returns the refresh token expiry cached from the last sign-in.

Link copied to clipboard
abstract fun getSubject(): String?

Returns the subject of the user associated with this client. Note: This is an internal method used by other Sudo platform SDKs.

Link copied to clipboard
abstract fun getTokenExpiry(): Date?

Returns the ID and access token expiry cached from the last sign-in.

Link copied to clipboard
abstract fun getUserClaim(name: String): Any?

Returns the specified claim associated with the user's identity.

Link copied to clipboard
abstract fun getUserName(): String?

Returns the user name associated with this client. The username maybe needed to contact the support team when diagnosing an issue related to a specific user.

Link copied to clipboard
abstract suspend fun globalSignOut()

Signs out the user from all devices.

Link copied to clipboard
abstract fun isRegistered(): Boolean

Indicates whether or not this client is registered with Sudo Platform backend.

Link copied to clipboard
abstract fun isSignedIn(): Boolean

Indicates whether or not this client is signed in with Sudo Platform backend. The client is considered signed in if it cached valid ID and access tokens.

Link copied to clipboard
abstract fun presentFederatedSignInUI(activity: Activity, callback: (SignInResult) -> Unit)

Presents the sign in UI for federated sign in using an external identity provider.

Link copied to clipboard
abstract fun presentFederatedSignOutUI(callback: (ApiResult) -> Unit)

Presents the sign out UI for federated sign in using an external identity provider.

Link copied to clipboard
abstract fun processFederatedSignInTokens(data: Uri, callback: (FederatedSignInResult) -> Unit)

Processes tokens from federated sign in via Android intent data pointed to by the specified URL. The tokens are passed to the app via a redirect URL with custom scheme mapped to the app.

Link copied to clipboard
abstract suspend fun refreshTokens(refreshToken: String): AuthenticationTokens

Refresh the access and ID tokens using the refresh token.

Link copied to clipboard

Registers an observer for sign in status changes.

Link copied to clipboard
abstract suspend fun registerWithAuthenticationProvider(authenticationProvider: AuthenticationProvider, registrationId: String?): String

Registers this client against the backend with an external authentication provider. Caller must implement AuthenticationProvider protocol to return appropriate authentication token required to authorize the registration request.

Link copied to clipboard
abstract suspend fun registerWithGooglePlayIntegrity(packageName: String, deviceId: String, token: String, registrationId: String?): String

Registers this client against the backend with a Google Play Integrity token.

Link copied to clipboard
abstract fun reset()

Removes all keys associated with this client and invalidates any cached authentication credentials.

Link copied to clipboard
abstract suspend fun resetUserData()

Removes all data owned by the signed-in user from Sudo Platform Services without deregistering the user. Should only be used in tests.

Link copied to clipboard
abstract fun setUserName(name: String)

Sets the user name associated with this client.

Link copied to clipboard

Sign into the backend with an external authentication provider. Caller must implement AuthenticationProvider protocol to return the appropriate authentication token associated with the external identity registered with registerWithAuthenticationProvider.

Link copied to clipboard
abstract suspend fun signInWithKey(): AuthenticationTokens

Sign into the backend using a private key. The client must have created a private/public key pair via one of the register methods.

Link copied to clipboard
abstract suspend fun signOut()

Signs out the user from this device only.