@Singleton public class AccountManagerServiceImpl extends Object
Constructor and Description |
---|
AccountManagerServiceImpl(Context context,
ContainerConfiguration configuration,
AccountPublicDbSQLHelper publicDb,
AccountPrivateDbSQLHelperFactory accountPrivateDbSQLHelperFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(AccountManagerListener listener)
Registers a listener that will be called whenever an account is opened or closed.
|
String |
generateAndSaveKeyForField(String fieldName,
boolean isPublic)
Generates random key.
|
String |
getCurrentAccountIdentifier()
Returns Id of currently authenticated user or null if not authenticated.
|
String |
getCurrentAccountSecretServiceKey(String fieldName)
Returns the internal key for a given service name.
|
String |
getCurrentAccountSecretServiceKeyIfExists(String fieldName)
Returns the internal key for a given service name, if the key exists.
|
String |
getEncryptionKeyInit() |
String |
getPassword() |
Map<String,String> |
getPrivateAccountData()
Returns custom, private data associated with currently open account.
|
boolean |
isOpen() |
void |
moveField(String oldFieldName,
String newFieldName,
boolean isPublic)
Moves value from one field to another.
|
void |
removeField(String key,
boolean isPublic)
Removes a given key (with associated value) from a custom fields map defined by scope.
|
void |
removeListener(AccountManagerListener listener)
Removes the listener added by addListener
|
String |
setField(String key,
String value,
boolean isPublic)
Sets given value for a given key in one of the custom fields map defined by scope.
|
@Inject public AccountManagerServiceImpl(Context context, ContainerConfiguration configuration, AccountPublicDbSQLHelper publicDb, AccountPrivateDbSQLHelperFactory accountPrivateDbSQLHelperFactory)
public String getEncryptionKeyInit()
public String getCurrentAccountIdentifier()
public String getPassword()
public Map<String,String> getPrivateAccountData() throws AccountManagerException
AccountManagerException
public String setField(String key, String value, boolean isPublic) throws AccountManagerException
key
- A string key under which value is persisted.value
- Custom value to be set. Must be serializable to JSON string.isPublic
- Flag determining whether field should be public or notAccountManagerException
public void removeField(String key, boolean isPublic) throws AccountManagerException
key
- A string key to be removed.isPublic
- Flag determining whether field is public or notAccountManagerException
public boolean isOpen()
public String getCurrentAccountSecretServiceKey(String fieldName) throws AccountManagerException
fieldName
- Name of field.AccountManagerException
public String getCurrentAccountSecretServiceKeyIfExists(String fieldName) throws AccountManagerException
getCurrentAccountSecretServiceKey
There is no API to modify/remove this key, because it's supposed to be constant throughout the application lifetime on a device.fieldName
- Name of field.AccountManagerException
public String generateAndSaveKeyForField(String fieldName, boolean isPublic) throws AccountManagerException
fieldName
- Name of field.AccountManagerException
public void moveField(String oldFieldName, String newFieldName, boolean isPublic) throws AccountManagerException
AccountManagerException
public void addListener(AccountManagerListener listener)
listener
- Listener objectpublic void removeListener(AccountManagerListener listener)
listener
- Listener object