From 32326ca178fc9e530dc98e70b593bd58fc50eb87 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Fri, 15 May 2020 14:59:17 -0700 Subject: [PATCH] contact aliases in forwarded msgs --- api/helpers.ts | 4 ++ api/network/modify.ts | 1 - dist/api/helpers.js | 4 ++ dist/api/helpers.js.map | 2 +- dist/api/network/modify.js | 74 +++++++++++++++++++---- dist/api/network/modify.js.map | 2 +- dist/api/network/receive.js | 4 +- dist/api/network/receive.js.map | 2 +- dist/api/utils/rncryptor/rncryptor.js | 8 +-- dist/api/utils/rncryptor/rncryptor.js.map | 2 +- 10 files changed, 79 insertions(+), 24 deletions(-) diff --git a/api/helpers.ts b/api/helpers.ts index 3243e29..945a254 100644 --- a/api/helpers.ts +++ b/api/helpers.ts @@ -159,6 +159,10 @@ async function parseReceiveParams(payload) { ) } else { // group sender = await models.Contact.findOne({ where: { publicKey: sender_pub_key } }) + // inject a "sender" with an alias + if(!sender && chat_type == constants.chat_types.tribe){ + sender = {id:0, alias:sender_alias} + } chat = await models.Chat.findOne({ where: { uuid: chat_uuid } }) } return { owner, sender, chat, sender_pub_key, sender_alias, isTribeOwner, chat_uuid, amount, content, mediaToken, mediaKey, mediaType, chat_type, msg_id, chat_members, chat_name, chat_host, chat_key } diff --git a/api/network/modify.ts b/api/network/modify.ts index 5a17573..64c07c8 100644 --- a/api/network/modify.ts +++ b/api/network/modify.ts @@ -42,7 +42,6 @@ export async function modifyPayload(payload, chat) { if(!json.muid) return payload // PUT NEW TERMS, to finish in personalizeMessage - const amt = terms.meta&&terms.meta.amt const ttl = terms.meta&&terms.meta.ttl const mediaTerms: {[k:string]:any} = { diff --git a/dist/api/helpers.js b/dist/api/helpers.js index 3b69c4e..692acb8 100644 --- a/dist/api/helpers.js +++ b/dist/api/helpers.js @@ -173,6 +173,10 @@ function parseReceiveParams(payload) { } else { // group sender = yield models_1.models.Contact.findOne({ where: { publicKey: sender_pub_key } }); + // inject a "sender" with an alias + if (!sender && chat_type == constants.chat_types.tribe) { + sender = { id: 0, alias: sender_alias }; + } chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } }); } return { owner, sender, chat, sender_pub_key, sender_alias, isTribeOwner, chat_uuid, amount, content, mediaToken, mediaKey, mediaType, chat_type, msg_id, chat_members, chat_name, chat_host, chat_key }; diff --git a/dist/api/helpers.js.map b/dist/api/helpers.js.map index bc804bd..cef2f17 100644 --- a/dist/api/helpers.js.map +++ b/dist/api/helpers.js.map @@ -1 +1 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../api/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAiC;AACjC,2BAA0B;AAC1B,qCAAoC;AAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEtD,MAAM,gBAAgB,GAAG,CAAO,MAAM,EAAE,EAAE;IACzC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAAA;IAClD,IAAI,IAAI,CAAA;IACR,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACtB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;IAEvB,IAAI,OAAO,EAAE;QACZ,IAAI,GAAG,MAAM,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA;QAC5D,kDAAkD;KAClD;SAAM;QACN,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;QAC/C,MAAM,KAAK,GAAG,MAAM,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;QACvE,MAAM,SAAS,GAAG,MAAM,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,CAAC,CAAA;QAC/E,MA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ist/api/network/modify.js b/dist/api/network/modify.js index 6e57a4e..20d850a 100644 --- a/dist/api/network/modify.js +++ b/dist/api/network/modify.js @@ -1,22 +1,70 @@ "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", { value: true }); const path = require("path"); const rncryptor_1 = require("../utils/rncryptor"); -console.log("RNCryptor", rncryptor_1.default); +const fetch = require("node-fetch"); +const ldat_1 = require("../utils/ldat"); +const rsa = require("../crypto/rsa"); +const crypto = require("crypto"); +const Blob = require("fetch-blob"); const constants = require(path.join(__dirname, '../../config/constants.json')); const msgtypes = constants.message_types; -// `https://${ldat.host}/file/${media_token}` -function modifyPayload(payload) { - if (payload.type === msgtypes.attachment) { - console.log("MODIFY, ", payload); - // download image from mediaToken - // decrypt key - // decrypt image - // new key, re-encrypt, re-upload - // new payload - // how to link w og msg? ogMediaToken? - } - return payload; +function modifyPayload(payload, chat) { + return __awaiter(this, void 0, void 0, function* () { + if (payload.type === msgtypes.attachment) { + console.log("MODIFY, ", payload); + const mt = payload.message && payload.message.mediaToken; + const key = payload.message && payload.message.mediaKey; + const typ = payload.message && payload.message.mediaType; + if (!mt || !key) + return payload; + const terms = ldat_1.parseLDAT(mt); + if (!terms.host) + return payload; + try { + const r = yield fetch(`https://${terms.host}/file/${mt}`); + const buf = yield r.buffer(); + const decMediaKey = rsa.decrypt(chat.groupPrivateKey, key); + const imgUTF8 = rncryptor_1.default.Decrypt(decMediaKey, buf.toString()); + const newKey = crypto.randomBytes(20).toString('hex'); + const encImg = rncryptor_1.default.Encrypt(newKey, imgUTF8); + const resp = yield fetch(`https://${terms.host}/file`, { + method: 'POST', + body: new Blob([encImg], { type: typ || 'image/jpg', name: 'file', filename: 'Image.jpg' }) + }); + let json = resp.json(); + if (!json.muid) + return payload; + // PUT NEW TERMS, to finish in personalizeMessage + const amt = terms.meta && terms.meta.amt; + const ttl = terms.meta && terms.meta.ttl; + const mediaTerms = { + muid: json.muid, ttl: ttl || 31536000, + meta: Object.assign({}, amt && { amt }), + skipSigning: amt ? true : false // only sign if its free + }; + const encKey = rsa.encrypt(chat.groupKey, newKey); + return fillmsg(payload, { mediaTerms, mediaKey: encKey }); // key is re-encrypted later + } + catch (e) { + return payload; + } + // how to link w og msg? ogMediaToken? + } + return payload; + }); } exports.modifyPayload = modifyPayload; +function fillmsg(full, props) { + return Object.assign(Object.assign({}, full), { message: Object.assign(Object.assign({}, full.message), props) }); +} //# sourceMappingURL=modify.js.map \ No newline at end of file diff --git a/dist/api/network/modify.js.map b/dist/api/network/modify.js.map index b42913a..9c29fb2 100644 --- a/dist/api/network/modify.js.map +++ b/dist/api/network/modify.js.map @@ -1 +1 @@ -{"version":3,"file":"modify.js","sourceRoot":"","sources":["../../../api/network/modify.ts"],"names":[],"mappings":";;AAAA,6BAA4B;AAC5B,kDAA0C;AAE1C,OAAO,CAAC,GAAG,CAAC,WAAW,EAAC,mBAAS,CAAC,CAAA;AAElC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAC7E,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAA;AAGxC,6CAA6C;AAG7C,SAAgB,aAAa,CAAC,OAAO;IACnC,IAAG,OAAO,CAAC,IAAI,KAAG,QAAQ,CAAC,UAAU,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAEhC,iCAAiC;QACjC,cAAc;QACd,gBAAgB;QAChB,iCAAiC;QACjC,c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IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;gBACjD,OAAO,OAAO,CAAC,OAAO,EAAE,EAAC,UAAU,EAAC,QAAQ,EAAC,MAAM,EAAC,CAAC,CAAA,CAAC,4BAA4B;aACnF;YAAC,OAAM,CAAC,EAAE;gBACT,OAAO,OAAO,CAAA;aACf;YACD,sCAAsC;SACvC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA;AAjDD,sCAiDC;AAED,SAAS,OAAO,CAAC,IAAI,EAAE,KAAK;IAC3B,uCACI,IAAI,KAAE,OAAO,kCACZ,IAAI,CAAC,OAAO,GACZ,KAAK,KAET;AACF,CAAC"} \ No newline at end of file diff --git a/dist/api/network/receive.js b/dist/api/network/receive.js index 08e7934..635b4e4 100644 --- a/dist/api/network/receive.js +++ b/dist/api/network/receive.js @@ -63,15 +63,15 @@ function onReceive(payload) { } function forwardMessageToTribe(ogpayload) { return __awaiter(this, void 0, void 0, function* () { + const chat = yield models_1.models.Chat.findOne({ where: { uuid: ogpayload.chat.uuid } }); let payload; if (typesToModify.includes(ogpayload.type)) { - payload = yield modify_1.modifyPayload(ogpayload); + payload = yield modify_1.modifyPayload(ogpayload, chat); } else { payload = ogpayload; } console.log("FORWARD TO TRIBE", payload); - const chat = yield models_1.models.Chat.findOne({ where: { uuid: payload.chat.uuid } }); //const sender = await models.Contact.findOne({where:{publicKey:payload.sender.pub_key}}) const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); const type = payload.type; diff --git a/dist/api/network/receive.js.map b/dist/api/network/receive.js.map index f7d9a95..c32a895 100644 --- a/dist/api/network/receive.js.map +++ b/dist/api/network/receive.js.map @@ -1 +1 @@ -{"version":3,"file":"receive.js","sourceRoot":"","sources":["../../../api/network/receive.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,sCAAqC;AACrC,kDAA0C;AAC1C,gDAA0C;AAC1C,0CAAyC;AACzC,kDAAwE;AACxE,sCAAkC;AAClC,iCAA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ClC,cAAc;QACd,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;QACtB,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAA,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAA,EAAE;YAC7C,OAAO,IAAI,GAAG,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAA;QACjB,OAAO,OAAO,CAAA;KACd;AACF,CAAC"} \ No newline at end of file +{"version":3,"file":"receive.js","sourceRoot":"","sources":["../../../api/network/receive.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,sCAAqC;AACrC,kDAA0C;AAC1C,gDAA0C;AAC1C,0CAAyC;AACzC,kDAAwE;AACxE,sCAAkC;AAClC,iCAAkC;AAClC,qCAAsC;AAEtC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAC7E,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAA;AAExC,MAAM,cAAc,GAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChF,CAAA;AACD,MAAM,aAAa,GAAC;IACnB,QAAQ,CAAC,UAAU;CACnB,CAAA;AACD,SAAe,SAAS,CAAC,OAAO;;QAC/B,uCAAuC;QACvC,IAAI,QAAQ,GAAG,IAAI,CAAA;QACnB,MAAM,OAAO,GAAoB,EAAE,CAAA;QACnC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAA;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,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IAChB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACf,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACf,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAA,CAAC,GAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAA;IAC9D,IAAG,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,KAAG,QAAQ,CAAC,CAAC,CAAC,EAAC;QAClC,cAAc;QACd,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;QACtB,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAA,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAA,EAAE;YAC7C,OAAO,IAAI,GAAG,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAA;QACjB,OAAO,OAAO,CAAA;KACd;AACF,CAAC"} \ No newline at end of file diff --git a/dist/api/utils/rncryptor/rncryptor.js b/dist/api/utils/rncryptor/rncryptor.js index 619fd6c..485c4f1 100644 --- a/dist/api/utils/rncryptor/rncryptor.js +++ b/dist/api/utils/rncryptor/rncryptor.js @@ -38,12 +38,12 @@ RNCryptor.Encrypt = function (password, plaintext, options) { message = sjcl.bitArray.concat(message, hmac_salt); message = sjcl.bitArray.concat(message, iv); var aes = new sjcl.cipher.aes(encryption_key); - sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity."](); + // sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity."](); var encrypted = sjcl.mode.cbc.encrypt(aes, plaintext, iv); message = sjcl.bitArray.concat(message, encrypted); var hmac = new sjcl.misc.hmac(hmac_key).encrypt(message); message = sjcl.bitArray.concat(message, hmac); - return message; + return sjcl.codec.utf8String.fromBits(message); }; /* Takes password string and message (ciphertext) bitArray @@ -71,8 +71,8 @@ RNCryptor.Decrypt = function (password, message, options) { throw new sjcl.exception.corrupt("HMAC mismatch or bad password."); } var aes = new sjcl.cipher.aes(encryption_key); - sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity."](); + // sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity."](); var decrypted = sjcl.mode.cbc.decrypt(aes, ciphertext, iv); - return decrypted; + return sjcl.codec.utf8String.fromBits(decrypted); }; //# sourceMappingURL=rncryptor.js.map \ No newline at end of file diff --git a/dist/api/utils/rncryptor/rncryptor.js.map b/dist/api/utils/rncryptor/rncryptor.js.map index 0a073e1..9cad631 100644 --- a/dist/api/utils/rncryptor/rncryptor.js.map +++ b/dist/api/utils/rncryptor/rncryptor.js.map @@ -1 +1 @@ -{"version":3,"file":"rncryptor.js","sourceRoot":"","sources":["../../../../api/utils/rncryptor/rncryptor.js"],"names":[],"mappings":";;AAAA,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAE1B,IAAI,SAAS,GAAG,EAAE,CAAC;AAiGX,8BAAS;AA/FjB;;;EAGE;AAEF,SAAS,CAAC,cAAc,GAAG,UAAS,QAAQ,EAAE,IAAI;IAChD,IAAI,QAAQ,GAAG,UAAU,GAAG;QACxB,IAAI,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,E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