Package com.castlabs.android.drm
Class SharedPreferencesKeyStore
- java.lang.Object
-
- com.castlabs.android.drm.KeyStore
-
- com.castlabs.android.drm.SharedPreferencesKeyStore
-
public class SharedPreferencesKeyStore extends KeyStore
KeyStore implementation that stores keySetIds inSharedPreferences. If aContextis passed to the constructor, the shared preferences created will always be inContext.MODE_PRIVATE.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_PREF_NAMEDefault name used for the shared preferences store
-
Constructor Summary
Constructors Constructor Description SharedPreferencesKeyStore(Context context)Creates a new store that persists the KeySetIds in aContext.MODE_PRIVATEshared preferences using theDEFAULT_PREF_NAMESharedPreferencesKeyStore(Context context, String name)Creates a new store that persists the KeySetIds in aContext.MODE_PRIVATEshared preferences using the given name.SharedPreferencesKeyStore(SharedPreferences sharedPreferences)Creates a new store that uses the given shared preferences as backend.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLicenseKeysCount()Get count of stored license keys
-
-
-
Field Detail
-
DEFAULT_PREF_NAME
public static final String DEFAULT_PREF_NAME
Default name used for the shared preferences store- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SharedPreferencesKeyStore
public SharedPreferencesKeyStore(@NonNull Context context)Creates a new store that persists the KeySetIds in aContext.MODE_PRIVATEshared preferences using theDEFAULT_PREF_NAME- Parameters:
context- the context
-
SharedPreferencesKeyStore
public SharedPreferencesKeyStore(@NonNull Context context, @NonNull String name)Creates a new store that persists the KeySetIds in aContext.MODE_PRIVATEshared preferences using the given name.- Parameters:
context- the contextname- the name used to create the shared preferences
-
SharedPreferencesKeyStore
public SharedPreferencesKeyStore(@NonNull SharedPreferences sharedPreferences)Creates a new store that uses the given shared preferences as backend.- Parameters:
sharedPreferences- the backend preferences that are used to persist the entries
-
-
Method Detail
-
getLicenseKeysCount
public int getLicenseKeysCount()
Description copied from class:KeyStoreGet count of stored license keys- Specified by:
getLicenseKeysCountin classKeyStore- Returns:
- count of stored keys
-
-