CredentialStorage

class CredentialStorage(context: Context)

Secure credential storage backed by EncryptedSharedPreferences.

Keys and values are encrypted using AES-256 with the master key stored in the Android Keystore — plain-text credentials never touch disk.

Inject this class wherever credentials need to be saved or read. The SDK itself never touches this class; it reads credentials on demand via io.rekast.sdk.network.interfaces.CredentialProvider.

Constructors

Link copied to clipboard
constructor(context: Context)

Functions

Link copied to clipboard

Removes all persisted access token fields.

Link copied to clipboard

Returns the stored access token, or an empty string if it has expired or was never set.

Link copied to clipboard

Returns the stored API key, or an empty string if it was never set.

Link copied to clipboard

Returns the stored auth_req_id, or an empty string if it has expired or was never set.

Link copied to clipboard

Returns the stored login hint, or an empty string if it was never set.

Link copied to clipboard

Returns the stored OAuth2 access token, or an empty string if it has expired or was never set.

Link copied to clipboard
fun saveAccessToken(token: ERROR CLASS: Symbol not found for AccessToken??)

Persists the Bearer access token along with its expiry time and token type.

Link copied to clipboard
fun saveApiKey(apiKey: String)

Persists the API key obtained from the MTN MoMo sandbox/production portal.

Link copied to clipboard

Persists the auth_req_id from a backchannel authorization response along with its expiry.

Link copied to clipboard
fun saveLoginHint(loginHint: String)

Persists the login hint used in backchannel (CIBA) authorization requests.

Link copied to clipboard
fun saveOauthAccessToken(token: ERROR CLASS: Symbol not found for Oauth2AccessToken??)

Persists the OAuth2 access token, its expiry, token type, scope, and refresh token.