pssh-tools
Advanced tools
Comparing version 1.1.0 to 1.2.0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -10,3 +14,3 @@ if (k2 === undefined) k2 = k; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +17,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -60,3 +60,3 @@ "use strict"; | ||
const constructProXML4 = (keyPair, licenseUrl, keySeed, checksum = true) => { | ||
const key = exports.encodeKey(keyPair, keySeed); | ||
const key = (0, exports.encodeKey)(keyPair, keySeed); | ||
const xmlArray = ['<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0">']; | ||
@@ -81,3 +81,3 @@ xmlArray.push('<DATA>'); | ||
const keyIds = keyPairs.map((k) => { | ||
return exports.encodeKey(k, keySeed); | ||
return (0, exports.encodeKey)(k, keySeed); | ||
}); | ||
@@ -148,5 +148,6 @@ const xmlArray = ['<?xml version="1.0" encoding="UTF-8"?>']; | ||
}; | ||
return tools.getPsshHeader(requestData); | ||
const psshHeader = tools.getPsshHeader(requestData); | ||
return psshHeader; | ||
}; | ||
exports.encodePssh = (request) => { | ||
const encodePssh = (request) => { | ||
if (request.dataOnly) { | ||
@@ -157,10 +158,13 @@ return getPsshData(request); | ||
}; | ||
exports.decodeData = (data) => { | ||
exports.encodePssh = encodePssh; | ||
const decodeData = (data) => { | ||
return tools.decodePsshData(tools.system.PLAYREADY.name, data); | ||
}; | ||
exports.decodeKey = (keyData) => { | ||
exports.decodeData = decodeData; | ||
const decodeKey = (keyData) => { | ||
const keyBuffer = Buffer.from(keyData, 'base64'); | ||
return swapEndian(keyBuffer.toString('hex')).toString('hex'); | ||
}; | ||
exports.encodeKey = (keyPair, keySeed = '') => { | ||
exports.decodeKey = decodeKey; | ||
const encodeKey = (keyPair, keySeed = '') => { | ||
if (keySeed && keySeed.length) { | ||
@@ -180,2 +184,3 @@ return generateContentKey(keyPair.kid, keySeed); | ||
}; | ||
exports.encodeKey = encodeKey; | ||
//# sourceMappingURL=playready.js.map |
@@ -33,3 +33,3 @@ "use strict"; | ||
}; | ||
exports.getPsshHeader = (request) => { | ||
const getPsshHeader = (request) => { | ||
const pssh = []; | ||
@@ -78,3 +78,4 @@ const keyIds = request.keyIds || []; | ||
}; | ||
exports.decodePssh = (data) => { | ||
exports.getPsshHeader = getPsshHeader; | ||
const decodePssh = (data) => { | ||
const result = {}; | ||
@@ -205,2 +206,3 @@ const decodedData = Buffer.from(data, 'base64'); | ||
}; | ||
exports.decodePssh = decodePssh; | ||
const decodeWVData = (psshData) => { | ||
@@ -250,3 +252,3 @@ // cenc header | ||
}; | ||
exports.decodePsshData = (targetSystem, data) => { | ||
const decodePsshData = (targetSystem, data) => { | ||
const dataBuffer = Buffer.from(data, 'base64'); | ||
@@ -261,2 +263,3 @@ if (exports.system.WIDEVINE.name === targetSystem) { | ||
}; | ||
exports.decodePsshData = decodePsshData; | ||
//# sourceMappingURL=tools.js.map |
@@ -48,5 +48,6 @@ "use strict"; | ||
}; | ||
return tools.getPsshHeader(requestData); | ||
const psshHeader = tools.getPsshHeader(requestData); | ||
return psshHeader; | ||
}; | ||
exports.encodePssh = (request) => { | ||
const encodePssh = (request) => { | ||
if (request.dataOnly) { | ||
@@ -57,5 +58,7 @@ return getPsshData(request); | ||
}; | ||
exports.decodeData = (data) => { | ||
exports.encodePssh = encodePssh; | ||
const decodeData = (data) => { | ||
return tools.decodePsshData(tools.system.WIDEVINE.name, data); | ||
}; | ||
exports.decodeData = decodeData; | ||
//# sourceMappingURL=widevine.js.map |
/// <reference types="node" /> | ||
declare type Omit<K, KEY extends keyof K> = Pick<K, Exclude<keyof K, KEY>>; | ||
type Omit<K, KEY extends keyof K> = Pick<K, Exclude<keyof K, KEY>>; | ||
export interface WidevineEncodeConfig { | ||
@@ -11,3 +11,3 @@ contentId: string; | ||
} | ||
export declare type WidevineDataEncodeConfig = Omit<WidevineEncodeConfig, 'dataOnly'>; | ||
export type WidevineDataEncodeConfig = Omit<WidevineEncodeConfig, 'dataOnly'>; | ||
export interface KeyPair { | ||
@@ -25,3 +25,3 @@ kid: string; | ||
} | ||
export declare type PlayReadyDataEncodeConfig = Omit<PlayReadyEncodeConfig, 'dataOnly'>; | ||
export type PlayReadyDataEncodeConfig = Omit<PlayReadyEncodeConfig, 'dataOnly'>; | ||
export interface HeaderConfig { | ||
@@ -43,3 +43,3 @@ systemId: string; | ||
} | ||
export declare type PsshData = PlayReadyData | WidevineData; | ||
export type PsshData = PlayReadyData | WidevineData; | ||
export interface DecodeResult { | ||
@@ -46,0 +46,0 @@ keyIds?: string[]; |
{ | ||
"name": "pssh-tools", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Tools to generate PSSH Data and PSSH Box", | ||
@@ -25,18 +25,18 @@ "main": "dist/src/index.js", | ||
"dependencies": { | ||
"protobufjs": "^6.10.2" | ||
"protobufjs": "^7.2.4" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@types/node": "^13.13.45", | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"ava": "^3.15.0", | ||
"eslint": "^7.20.0", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.2", | ||
"@types/node": "^20.4.5", | ||
"@typescript-eslint/eslint-plugin": "^6.2.0", | ||
"@typescript-eslint/parser": "^6.2.0", | ||
"ava": "^5.3.1", | ||
"eslint": "^8.45.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"nyc": "^15.1.0", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.9" | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -43,0 +43,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50271
622
+ Addedlong@5.2.4(transitive)
+ Addedprotobufjs@7.4.0(transitive)
- Removed@types/long@4.0.2(transitive)
- Removedlong@4.0.0(transitive)
- Removedprotobufjs@6.11.4(transitive)
Updatedprotobufjs@^7.2.4