Package com.castlabs.android.drm

## Class KeyStore

- java.lang.Object
- - com.castlabs.android.drm.KeyStore

- Direct Known Subclasses:
    `MemoryKeyStore`, `SharedPreferencesKeyStore`

      public abstract class KeyStore
      extends Object

  Implementations of this interface are used by the DRM Session to store and retrieve keySetIds that are used to store offline licenses. Please note that implementations of this store are not holding the license itself but the key that is used by the `MediaDrm` to restore the license if possible.
  Since:
    3.0.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `KeyStore()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(String id, DrmKeyStorage drmKeyStorage)` | Add a drm key to the storage
    `boolean` | `delete​(String id)` | Remove the stored key with the matching id NOTE: If you want to actually remove a key from the device, you should instead use `DrmLicenseLoader.remove()`.
    `Map<String,​DrmKeyStorage>` | `deleteAll()` | Remove all stored keys
    `DrmKeyStorage` | `get​(String id)` | Get a DrmKeyStorage
    `Map<String,​DrmKeyStorage>` | `getAll()` | Get all stored keys
    `abstract int` | `getLicenseKeysCount()` | Get count of stored license keys

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KeyStore

          public KeyStore()

  - ### Method Detail

    - #### add

          public final void add​(@NonNull
                                String id,
                                @NonNull
                                DrmKeyStorage drmKeyStorage)

      Add a drm key to the storage
      Parameters:
        `id` - the id to identify the asset, movie, or stream this entry belongs to
        `drmKeyStorage` - instance of `DrmKeyStorage`

    - #### get

          @Nullable
          public final DrmKeyStorage get​(@NonNull
                                         String id)

      Get a DrmKeyStorage
      Parameters:
        `id` - the id for the DrmKeyStorage to get
      Returns:
        the DrmKeyStorage

    - #### getAll

          @NonNull
          public final Map<String,​DrmKeyStorage> getAll()

      Get all stored keys
      Returns:
        A Map containing all the stored keys

    - #### deleteAll

          @NonNull
          public final Map<String,​DrmKeyStorage> deleteAll()

      Remove all stored keys
      Returns:
        A Map containing all the stored keys

    - #### delete

          public final boolean delete​(@NonNull
                                      String id)

      Remove the stored key with the matching id NOTE: If you want to actually remove a key from the device, you should instead use `DrmLicenseLoader.remove()`. If the a license is removed *only* from the `KeyStore` it will still be present in the device.
      Parameters:
        `id` - the id to be removed, used to identify the asset
      Returns:
        true of key successfully removed, false otherwise

    - #### getLicenseKeysCount

          public abstract int getLicenseKeysCount()

      Get count of stored license keys
      Returns:
        count of stored keys