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

18 lines
539 B
JavaScript

export class Key {
constructor(key_id, key_type, cipher_type, key) {
this.key_id = this._swapEndianess(key_id);
this.key_type = key_type;
this.cipher_type = cipher_type;
this.key = key;
}
_swapEndianess(uuidBytes) {
return new Uint8Array([
uuidBytes[3], uuidBytes[2], uuidBytes[1], uuidBytes[0],
uuidBytes[5], uuidBytes[4],
uuidBytes[7], uuidBytes[6],
uuidBytes[8], uuidBytes[9],
...uuidBytes.slice(10, 16)
]);
}
}