Skip to content
Snippets Groups Projects
Commit b60b76c5 authored by Sasha Ilieva's avatar Sasha Ilieva Committed by Zdravko Iliev
Browse files

Add check for email attachments

parent 85599572
No related branches found
No related tags found
1 merge request!39Resolve "QR Code Data Signing & Verification flow"
export = $root;
declare var $root: {};
declare var $root: any;
export = $root;
declare var $root: {};
declare var $root: any;
......@@ -74,25 +74,27 @@ const assembleQrCodeData = (head, tail) => {
return Buffer.concat([Buffer.from(head), Buffer.from(tail)]);
};
const computeQrCodeHash = (emailData) => __awaiter(void 0, void 0, void 0, function* () {
const attachments = emailData.attachments.map((attachment) => {
//TODO: check if we can use attachment hash, attachment hashAlg
if (attachment.url) {
let attachments;
if (emailData.attachments) {
attachments = emailData.attachments.map((attachment) => {
//TODO: check if we can use attachment hash, attachment hashAlg
if (attachment.url) {
return {
name: attachment.name,
size: attachment.size,
url: attachment.url,
};
}
return {
name: attachment.name,
size: attachment.size,
url: attachment.url,
};
}
return {
name: attachment.name,
size: attachment.size,
};
});
});
}
const dataForHashing = {
statusId: emailData.statusId,
sender: emailData.sender,
subject: emailData.subject,
date: emailData.date,
recipients: emailData.recipients,
attachments,
};
......
......@@ -28,7 +28,7 @@ class StatusesService {
attachmentsSignature,
messageSignatureHashingAlgorithm,
senderSystem,
qrCodeSignature
qrCodeSignature,
});
return SenderStatusObjectMessage.encode(senderStatusObjectMessage).finish();
}
......
This diff is collapsed.
......@@ -111,21 +111,24 @@ const assembleQrCodeData = (
};
const computeQrCodeHash = async (emailData: MessageData): Promise<string> => {
const attachments = emailData.attachments.map((attachment) => {
//TODO: check if we can use attachment hash, attachment hashAlg
if (attachment.url) {
let attachments;
if (emailData.attachments) {
attachments = emailData.attachments.map((attachment) => {
//TODO: check if we can use attachment hash, attachment hashAlg
if (attachment.url) {
return {
name: attachment.name,
size: attachment.size,
url: attachment.url,
};
}
return {
name: attachment.name,
size: attachment.size,
url: attachment.url,
};
}
return {
name: attachment.name,
size: attachment.size,
};
});
});
}
const dataForHashing = {
statusId: emailData.statusId,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment