SecureTokenStorage class
Stores the access and refresh token in the platform secure storage (Keychain / EncryptedSharedPreferences).
Token values are never logged.
Constructors
- SecureTokenStorage(SecureStorageRepository _storage, {String namespace = 'sbk'})
-
Throws ArgumentError when
namespaceis blank.
Properties
- accessTokenKey → String
-
Storage key of the access token.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- namespace → String
-
Prefix of the storage keys, so several token sets can coexist.
final
- refreshTokenKey → String
-
Storage key of the refresh token.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearAccessToken(
) → Future< SecurityResult< void> > -
clearRefreshToken(
) → Future< SecurityResult< void> > -
clearTokens(
) → Future< SecurityResult< void> > - Removes both tokens. Both deletes are always attempted; the first failure (if any) is returned.
-
getAccessToken(
) → Future< SecurityResult< String?> > -
The stored access token, or
nullwhen there is none. -
getRefreshToken(
) → Future< SecurityResult< String?> > -
The stored refresh token, or
nullwhen there is none. -
hasAccessToken(
) → Future< SecurityResult< bool> > - Whether an access token is stored. Read failures are returned as such.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
saveAccessToken(
String token) → Future< SecurityResult< void> > -
saveRefreshToken(
String token) → Future< SecurityResult< void> > -
saveTokens(
{required String accessToken, String? refreshToken}) → Future< SecurityResult< void> > - Saves the access token and, when given, the refresh token.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited