Files
Vineless/jsplayready/device.js
2025-07-02 21:04:47 +09:00

26 lines
1009 B
JavaScript

import { BinaryReader } from "./utils.js";
export class Device {
constructor(bytes) {
this._reader = new BinaryReader(bytes);
this._reader.readBytes(3);
this.version = this._reader.readUint8();
switch (this.version) {
case 2:
this.group_certificate_len = this._reader.readUint32();
this.group_certificate = this._reader.readBytes(this.group_certificate_len);
this.encryption_key = this._reader.readBytes(96);
this.signing_key = this._reader.readBytes(96);
break;
case 3:
this.group_key = this._reader.readBytes(96);
this.encryption_key = this._reader.readBytes(96);
this.signing_key = this._reader.readBytes(96);
this.group_certificate_len = this._reader.readUint32();
this.group_certificate = this._reader.readBytes(this.group_certificate_len);
break;
}
}
}