@li0ard/widevine
v0.1.4
Published
Widevine CDM implementation in pure TypeScript
Readme
[!CAUTION]
- Project doesn't provide private key and Client ID for any purposes
- Project doesn't condone piracy or any action against the terms of the DRM systems.
- Project is for study and research only. Please don't use it for commercial purposes
Features
- Support privacy mode with Service certificates
- Support
.wvddeserialization - Strictly typed API
Installation
# from NPM
npm i @li0ard/widevine
# from JSR
bunx jsr add @li0ard/widevine Example
import { CDM, PSSH, Device, DeviceType, KeyType } from "@li0ard/widevine";
const device = Device.decode(
DeviceType.ANDROID,
Buffer.from("....", "base64"),
Buffer.from("....", "base64")
) // Device.fromWvd(....);
const cdm = new CDM(device);
const sessionId = cdm.open();
const pssh = PSSH.decode(Buffer.from("....", "base64"));
const challenge = cdm.getLicenseChallenge(sessionId, pssh);
const license = await (await fetch(`https://cwip-shaka-proxy.appspot.com/no_auth`, {
method: "POST",
body: challenge
})).arrayBuffer();
for(const key of cdm.parseLicense(sessionId, new Uint8Array(license)))
console.log(`- [${KeyType[key.type]}] ${bytesToHex(key.kid)}:${bytesToHex(key.key)}`);
cdm.close(sessionId);Links
- Widevine - Widevine (and Widevine icon) by Google
- pywidevine - An Open Source Python Implementation of Widevine CDM (greatly inspired)
