From e55f15ae3be0bcf59eb9be468fe090e76439e105 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Fri, 29 May 2020 12:20:35 -0700 Subject: [PATCH] logz --- api/network/modify.ts | 4 +++- dist/api/network/modify.js | 3 +++ dist/api/network/modify.js.map | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/network/modify.ts b/api/network/modify.ts index 14f55f5..1c371a2 100644 --- a/api/network/modify.ts +++ b/api/network/modify.ts @@ -35,6 +35,7 @@ export async function modifyPayloadAndSaveMediaKey(payload, chat, sender) { const newKey = crypto.randomBytes(20).toString('hex') const encImgBuffer = RNCryptor.Encrypt(imgBuf, newKey) + console.log('encImgBuffer.length',encImgBuffer.length,typeof encImgBuffer) // var encImgBuffer = Buffer.from(encImg,'base64'); @@ -55,6 +56,7 @@ export async function modifyPayloadAndSaveMediaKey(payload, chat, sender) { }) let json = await resp.json() + console.log('json.muid',json.muid) if(!json.muid) return payload // PUT NEW TERMS, to finish in personalizeMessage @@ -89,7 +91,7 @@ export async function modifyPayloadAndSaveMediaKey(payload, chat, sender) { // sender: sender.id, // the og sender // createdAt: date, // }) - + console.log('{mediaTerms,mediaKey:encKey}',{mediaTerms,mediaKey:encKey}) return fillmsg(payload, {mediaTerms,mediaKey:encKey}) // key is re-encrypted later } catch(e) { console.log("[modify] error", e) diff --git a/dist/api/network/modify.js b/dist/api/network/modify.js index 9a61e49..938594e 100644 --- a/dist/api/network/modify.js +++ b/dist/api/network/modify.js @@ -40,6 +40,7 @@ function modifyPayloadAndSaveMediaKey(payload, chat, sender) { const imgBuf = RNCryptor.Decrypt(buf.toString('base64'), decMediaKey); const newKey = crypto.randomBytes(20).toString('hex'); const encImgBuffer = RNCryptor.Encrypt(imgBuf, newKey); + console.log('encImgBuffer.length', encImgBuffer.length, typeof encImgBuffer); // var encImgBuffer = Buffer.from(encImg,'base64'); const form = new FormData(); form.append('file', encImgBuffer, { @@ -54,6 +55,7 @@ function modifyPayloadAndSaveMediaKey(payload, chat, sender) { body: form }); let json = yield resp.json(); + console.log('json.muid', json.muid); if (!json.muid) return payload; // PUT NEW TERMS, to finish in personalizeMessage @@ -86,6 +88,7 @@ function modifyPayloadAndSaveMediaKey(payload, chat, sender) { // sender: sender.id, // the og sender // createdAt: date, // }) + console.log('{mediaTerms,mediaKey:encKey}', { mediaTerms, mediaKey: encKey }); return fillmsg(payload, { mediaTerms, mediaKey: encKey }); // key is re-encrypted later } catch (e) { diff --git a/dist/api/network/modify.js.map b/dist/api/network/modify.js.map index 83eadf2..b341416 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,oCAAmC;AACnC,wCAAuC;AACvC,qCAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,sCAAqC;AACrC,qCAAqC;AACrC,uCAAsC;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,SAAsB,4BAA4B,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM;;QACtE,IAAG,OAAO,CAAC,IAAI,KAAG,QAAQ,CAAC,UAAU,EAAE;YAErC,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAA;YACxD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAA;YACvD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAA;YACxD,IAAG,CAAC,EAAE,IAAI,CAAC,GAAG;gBAAE,OAAO,OAAO,CAAA;YAE9B,MAAM,KAAK,GAAG,gBAAS,CA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gBACpB,gBAAgB;gBAChB,yDAAyD;gBACzD,iBAAiB;gBACjB,wCAAwC;gBACxC,qBAAqB;gBACrB,KAAK;gBAEL,OAAO,OAAO,CAAC,OAAO,EAAE,EAAC,UAAU,EAAC,QAAQ,EAAC,MAAM,EAAC,CAAC,CAAA,CAAC,4BAA4B;aACnF;YAAC,OAAM,CAAC,EAAE;gBACT,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAA;gBAChC,OAAO,OAAO,CAAA;aACf;YACD,sCAAsC;SACvC;aAAM;YACL,OAAO,OAAO,CAAA;SACf;IACH,CAAC;CAAA;AAxFD,oEAwFC;AAED,SAAS,OAAO,CAAC,IAAI,EAAE,KAAK;IAC3B,uCACI,IAAI,KAAE,OAAO,kCACZ,IAAI,CAAC,OAAO,GACZ,KAAK,KAET;AACF,CAAC;AAED,6BAA6B;AAC7B,0DAA0D;AAC1D,IAAI"} \ No newline at end of file +{"version":3,"file":"modify.js","sourceRoot":"","sources":["../../../api/network/modify.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,oCAAmC;AACnC,wCAAuC;AACvC,qCAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,sCAAqC;AACrC,qCAAqC;AACrC,uCAAsC;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,SAAsB,4BAA4B,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM;;QACtE,IAAG,OAAO,CAAC,IAAI,KAAG,QAAQ,CAAC,UAAU,EAAE;YAErC,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAA;YACxD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAA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