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 theMediaDrm
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 storageboolean
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 useDrmLicenseLoader.remove()
.Map<String,DrmKeyStorage>
deleteAll()
Remove all stored keysDrmKeyStorage
get(String id)
Get a DrmKeyStorageMap<String,DrmKeyStorage>
getAll()
Get all stored keysabstract int
getLicenseKeysCount()
Get count of stored license keys
-
-
-
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 todrmKeyStorage
- instance ofDrmKeyStorage
-
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 useDrmLicenseLoader.remove()
. If the a license is removed *only* from theKeyStore
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
-
-