refactor(drm): hand the server key batch to one installer as a KeyBatch value

This commit is contained in:
imSp4rky
2026-12-02 20:05:08 -07:00
parent fef6898823
commit 46a3bc0ad2
20 changed files with 379 additions and 265 deletions
+5 -3
View File
@@ -9,6 +9,7 @@ import pytest
from tests.core.key_resolver import MemoryVault, key_table, resolver, vaults_of
from unshackle.core.drm import key_resolution
from unshackle.core.drm.key_resolution import ContentKeyResolver
from unshackle.core.title_source import HeldKeys, KeyBatch
from unshackle.core.vault import RateLimited, vault_session
from unshackle.core.vaults import Vaults
from unshackle.vaults.API import API, Exceptions
@@ -97,8 +98,8 @@ class BatchDRM(SimpleNamespace):
SERVER = SimpleNamespace(
resolve_server_keys=lambda title: [d.content_keys.update(d.batch) for t in title.tracks for d in t.drm],
vault_source=lambda kid, key: None,
batch_keys=lambda title: KeyBatch({t.id: HeldKeys(t.drm[0].batch, own_drm=True) for t in title.tracks}),
server_vault=None,
)
@@ -106,7 +107,8 @@ def batch_title(*batches: dict[UUID, str], kids: list[UUID] | None = None) -> Si
"""A title with one track per batch, whose DRM names ``kids`` (every KID of its batch by default)."""
return SimpleNamespace(
tracks=[
SimpleNamespace(drm=[BatchDRM(kids=kids or list(keys), content_keys={}, batch=keys)]) for keys in batches
SimpleNamespace(id=str(i), drm=[BatchDRM(kids=kids or list(keys), content_keys={}, batch=keys)])
for i, keys in enumerate(batches)
]
)