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 in SharedPreferences. If a Context is passed to the constructor, the shared preferences created will always be in Context.MODE_PRIVATE.
  • Field Details

    • DEFAULT_PREF_NAME

      public static final String DEFAULT_PREF_NAME
      Default name used for the shared preferences store
      See Also:
  • Constructor Details

    • SharedPreferencesKeyStore

      public SharedPreferencesKeyStore(@NonNull Context context)
      Creates a new store that persists the KeySetIds in a Context.MODE_PRIVATE shared preferences using the DEFAULT_PREF_NAME
      Parameters:
      context - the context
    • SharedPreferencesKeyStore

      public SharedPreferencesKeyStore(@NonNull Context context, @NonNull String name)
      Creates a new store that persists the KeySetIds in a Context.MODE_PRIVATE shared preferences using the given name.
      Parameters:
      context - the context
      name - 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 Details

    • getLicenseKeysCount

      public int getLicenseKeysCount()
      Description copied from class: KeyStore
      Get count of stored license keys
      Specified by:
      getLicenseKeysCount in class KeyStore
      Returns:
      count of stored keys