MediaKeysStorageBackend Class

The storage of the persistent key sessions of Encrypted Media Extensions (https://w3c.github.io/encrypted-media/#session-storage): the data of the persistent-license sessions (their keys, or their record of license destruction), stored by update() and remove() and read by load() (see BrowsingContextOptions.MediaKeysStorage).

public abstract class MediaKeysStorageBackend

Remarks

The data is partitioned by storage key: the origin parameter is the serialization of the storage key of the document (its origin, and the top-level site of a third-party context), so that a session is only visible to the documents of its origin in the same partition. The data contains key material: a persistent backend should protect it as the browsers protect their licenses.

The methods can be called from the threads of several browsing contexts: an implementation must be thread-safe.

Constructors

NameDescription
MediaKeysStorageBackend()

MediaKeysStorageBackend()

protected MediaKeysStorageBackend()

No documentation is available.

Methods

NameDescription
Delete(string, string, string)Removes the data of a session.
Exists(string, string, string)Returns whether data is stored for a session: the session IDs of the persistent sessions are unique within an origin over time.
Load(string, string, string)Returns the data of a session, or null when no data is stored for the session.
Save(string, string, string, ReadOnlySpan<byte>)Stores the data of a session, replacing the previous data.

Delete(string, string, string)

Removes the data of a session.

public abstract bool Delete(string origin, string keySystem, string sessionId)

Parameters

origin string
The serialization of the storage key of the document.
keySystem string
The key system.
sessionId string
The session ID.

Returns

bool True when data was removed.

Exists(string, string, string)

MediaKeysStorageBackend.cs

Returns whether data is stored for a session: the session IDs of the persistent sessions are unique within an origin over time.

public virtual bool Exists(string origin, string keySystem, string sessionId)

Parameters

origin string
The serialization of the storage key of the document.
keySystem string
The key system.
sessionId string
The session ID.

Returns

bool

Load(string, string, string)

Returns the data of a session, or null when no data is stored for the session.

public abstract byte[]? Load(string origin, string keySystem, string sessionId)

Parameters

origin string
The serialization of the storage key of the document.
keySystem string
The key system (e.g. org.w3.clearkey).
sessionId string
The session ID.

Returns

byte[]?

Save(string, string, string, ReadOnlySpan<byte>)

Stores the data of a session, replacing the previous data.

public abstract void Save(string origin, string keySystem, string sessionId, ReadOnlySpan<byte> data)

Parameters

origin string
The serialization of the storage key of the document.
keySystem string
The key system.
sessionId string
The session ID.
data ReadOnlySpan<byte>
The data of the session.