Skip to content
Snippets Groups Projects

Resolve "Older emails's attachments and body cannot be seen/downloaded"

4 files
+ 18
6
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -24,7 +24,7 @@ class IPFSDataRetriever {
@@ -24,7 +24,7 @@ class IPFSDataRetriever {
getDecodedContent(contentData, ipfsVersion) {
getDecodedContent(contentData, ipfsVersion) {
return __awaiter(this, void 0, void 0, function* () {
return __awaiter(this, void 0, void 0, function* () {
const rawContent = yield this.getRawContent(contentData.cid, contentData.head, ipfsVersion);
const rawContent = yield this.getRawContent(contentData.cid, contentData.head, ipfsVersion);
return this.decryptContent(rawContent, contentData.key);
return this.decryptContent(rawContent, contentData.key, ipfsVersion);
});
});
}
}
getRawContent(cid, head, ipfsVersion) {
getRawContent(cid, head, ipfsVersion) {
@@ -54,10 +54,14 @@ class IPFSDataRetriever {
@@ -54,10 +54,14 @@ class IPFSDataRetriever {
return assembledData;
return assembledData;
});
});
}
}
decryptContent(content, decryptionKey) {
decryptContent(content, decryptionKey, ipfsVersion) {
return __awaiter(this, void 0, void 0, function* () {
return __awaiter(this, void 0, void 0, function* () {
const { key, data: iv } = QrCodeDataService_1.default.decodeKeyDataPair(decryptionKey);
const { key, data: iv } = QrCodeDataService_1.default.decodeKeyDataPair(decryptionKey);
const decryptedZip = yield CryptoService_1.default.decryptAESGCM(content, (0, common_1.base64ToArrayBuffer)(key), (0, common_1.base64ToArrayBuffer)(iv), true);
const decryptedZip = yield CryptoService_1.default.decryptAESGCM(content, (0, common_1.base64ToArrayBuffer)(key), (0, common_1.base64ToArrayBuffer)(iv), true);
 
if (ipfsVersion === undefined) {
 
const decodedZip = new TextDecoder().decode(decryptedZip);
 
return (0, common_1.decompressData)(decodedZip);
 
}
const decompressed = (0, common_1.decompressData)(decryptedZip);
const decompressed = (0, common_1.decompressData)(decryptedZip);
return decompressed;
return decompressed;
});
});
Loading