Compare commits

..

2 Commits

Author SHA1 Message Date
1ce19a653c fix: #50 trim tag content on decryption with custom key.
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-11 22:58:15 +01:00
1c7ab83ab9 fix: #50 audio ext mp4 -> m4a 2023-10-11 22:41:33 +01:00
3 changed files with 11 additions and 8 deletions

View File

@ -21,7 +21,7 @@
"@chakra-ui/react": "^2.8.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@jixun/libparakeet": "0.2.1",
"@jixun/libparakeet": "0.3.0",
"@reduxjs/toolkit": "^1.9.7",
"framer-motion": "^10.16.4",
"immer": "^10.0.3",

View File

@ -33,8 +33,8 @@ dependencies:
specifier: ^11.11.0
version: 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.28)(react@18.2.0)
'@jixun/libparakeet':
specifier: 0.2.1
version: 0.2.1
specifier: 0.3.0
version: 0.3.0
'@reduxjs/toolkit':
specifier: ^1.9.7
version: 1.9.7(react-redux@8.1.3)(react@18.2.0)
@ -2861,8 +2861,8 @@ packages:
'@sinclair/typebox': 0.27.8
dev: true
/@jixun/libparakeet@0.2.1:
resolution: {integrity: sha512-OZRx72yKfRs8ZRZcNPAOBEAz9/v3jXK5V6ue4WomcW6HhNZy7JjdXZOF7lHqMgfB47d1CyLNJbaT0r0tiKGjbA==}
/@jixun/libparakeet@0.3.0:
resolution: {integrity: sha512-SG26GY0BeyH36yZcwghgzIXupfnAVH1WT/Gb8YhVRgqWXVenmtsCxEy4B0fUdscTJu28THjM0vNXCAvj5s9MBA==}
dev: false
/@jridgewell/gen-mapping@0.3.3:

View File

@ -16,7 +16,7 @@ class DecryptCommandHandler {
label: string,
private parakeet: Parakeet,
private buffer: ArrayBuffer,
private options: DecryptCommandOptions
private options: DecryptCommandOptions,
) {
this.label = `DecryptCommandHandler(${label})`;
}
@ -59,10 +59,13 @@ class DecryptCommandHandler {
const decrypted = await this.log(`decrypt (${crypto.cryptoName})`, () => crypto.decrypt(this.buffer, this.options));
// Check if we had a successful decryption
const audioExt = crypto.overrideExtension ?? (await this.detectAudioExtension(decrypted));
let audioExt = crypto.overrideExtension ?? (await this.detectAudioExtension(decrypted));
if (crypto.checkByDecryptHeader && audioExt === 'bin') {
return null;
}
if (audioExt.toLowerCase() === 'mp4') {
audioExt = 'm4a';
}
return { decrypted: URL.createObjectURL(toBlob(decrypted)), ext: audioExt };
}
@ -82,7 +85,7 @@ class DecryptCommandHandler {
// Check by decrypt max first 8MiB
const decryptedBuffer = await this.log(`${crypto.cryptoName}/decrypt-header-test`, async () =>
toArrayBuffer(await crypto.decrypt(this.buffer.slice(0, TEST_FILE_HEADER_LEN), this.options))
toArrayBuffer(await crypto.decrypt(this.buffer.slice(0, TEST_FILE_HEADER_LEN), this.options)),
);
return this.parakeet.detectAudioExtension(decryptedBuffer) !== 'bin';