hls.js 1.5.9-0.canary.10273 → 1.5.9-0.canary.10276
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hls.js +9 -7
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +9 -7
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +9 -7
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +9 -7
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +2 -2
- package/src/crypt/decrypter.ts +13 -6
- package/src/crypt/fast-aes-key.ts +2 -2
package/package.json
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
"micromatch": "4.0.5",
|
117
117
|
"mocha": "10.4.0",
|
118
118
|
"node-fetch": "3.3.2",
|
119
|
-
"npm-run-all2": "6.
|
119
|
+
"npm-run-all2": "6.2.0",
|
120
120
|
"prettier": "3.2.5",
|
121
121
|
"promise-polyfill": "8.3.0",
|
122
122
|
"rollup": "4.17.2",
|
@@ -130,5 +130,5 @@
|
|
130
130
|
"url-toolkit": "2.2.5",
|
131
131
|
"wrangler": "3.57.1"
|
132
132
|
},
|
133
|
-
"version": "1.5.9-0.canary.
|
133
|
+
"version": "1.5.9-0.canary.10276"
|
134
134
|
}
|
package/src/crypt/decrypter.ts
CHANGED
@@ -38,7 +38,7 @@ export default class Decrypter {
|
|
38
38
|
/* no-op */
|
39
39
|
}
|
40
40
|
}
|
41
|
-
this.useSoftware = this.subtle
|
41
|
+
this.useSoftware = !this.subtle;
|
42
42
|
}
|
43
43
|
|
44
44
|
destroy() {
|
@@ -155,20 +155,22 @@ export default class Decrypter {
|
|
155
155
|
iv: ArrayBuffer,
|
156
156
|
aesMode: DecrypterAesMode,
|
157
157
|
): Promise<ArrayBuffer> {
|
158
|
-
const subtle = this.subtle;
|
159
158
|
if (this.key !== key || !this.fastAesKey) {
|
159
|
+
if (!this.subtle) {
|
160
|
+
return Promise.resolve(this.onWebCryptoError(data, key, iv, aesMode));
|
161
|
+
}
|
160
162
|
this.key = key;
|
161
|
-
this.fastAesKey = new FastAESKey(subtle, key, aesMode);
|
163
|
+
this.fastAesKey = new FastAESKey(this.subtle, key, aesMode);
|
162
164
|
}
|
163
165
|
return this.fastAesKey
|
164
166
|
.expandKey()
|
165
167
|
.then((aesKey: CryptoKey) => {
|
166
168
|
// decrypt using web crypto
|
167
|
-
if (!subtle) {
|
169
|
+
if (!this.subtle) {
|
168
170
|
return Promise.reject(new Error('web crypto not initialized'));
|
169
171
|
}
|
170
172
|
this.logOnce('WebCrypto AES decrypt');
|
171
|
-
const crypto = new AESCrypto(subtle, new Uint8Array(iv), aesMode);
|
173
|
+
const crypto = new AESCrypto(this.subtle, new Uint8Array(iv), aesMode);
|
172
174
|
return crypto.decrypt(data.buffer, aesKey);
|
173
175
|
})
|
174
176
|
.catch((err) => {
|
@@ -180,7 +182,12 @@ export default class Decrypter {
|
|
180
182
|
});
|
181
183
|
}
|
182
184
|
|
183
|
-
private onWebCryptoError(
|
185
|
+
private onWebCryptoError(
|
186
|
+
data: Uint8Array,
|
187
|
+
key: ArrayBuffer,
|
188
|
+
iv: ArrayBuffer,
|
189
|
+
aesMode: DecrypterAesMode,
|
190
|
+
): ArrayBuffer | never {
|
184
191
|
const enableSoftwareAES = this.enableSoftwareAES;
|
185
192
|
if (enableSoftwareAES) {
|
186
193
|
this.useSoftware = true;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { DecrypterAesMode } from './decrypter-aes-mode';
|
2
2
|
|
3
3
|
export default class FastAESKey {
|
4
|
-
private subtle:
|
4
|
+
private subtle: SubtleCrypto;
|
5
5
|
private key: ArrayBuffer;
|
6
6
|
private aesMode: DecrypterAesMode;
|
7
7
|
|
8
|
-
constructor(subtle, key, aesMode: DecrypterAesMode) {
|
8
|
+
constructor(subtle: SubtleCrypto, key, aesMode: DecrypterAesMode) {
|
9
9
|
this.subtle = subtle;
|
10
10
|
this.key = key;
|
11
11
|
this.aesMode = aesMode;
|