Browse Source

start network abstracter

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
f31951bfb9
  1. 12
      api/controllers/chats.ts
  2. 4
      api/controllers/confirmations.ts
  3. 3
      api/controllers/invoices.ts
  4. 9
      api/controllers/media.ts
  5. 3
      api/controllers/messages.ts
  6. 3
      api/controllers/payment.ts
  7. 3
      api/controllers/subscriptions.ts
  8. 66
      api/helpers.ts
  9. 93
      api/network.ts
  10. 3
      api/utils/lightning.ts
  11. 14
      api/utils/msg.ts
  12. 4
      api/utils/tribes.ts
  13. 2
      app.ts
  14. 12
      dist/api/controllers/chats.js
  15. 2
      dist/api/controllers/chats.js.map
  16. 4
      dist/api/controllers/confirmations.js
  17. 3
      dist/api/controllers/invoices.js
  18. 2
      dist/api/controllers/invoices.js.map
  19. 9
      dist/api/controllers/media.js
  20. 2
      dist/api/controllers/media.js.map
  21. 3
      dist/api/controllers/messages.js
  22. 2
      dist/api/controllers/messages.js.map
  23. 3
      dist/api/controllers/payment.js
  24. 2
      dist/api/controllers/payment.js.map
  25. 3
      dist/api/controllers/subscriptions.js
  26. 2
      dist/api/controllers/subscriptions.js.map
  27. 51
      dist/api/helpers.js
  28. 2
      dist/api/helpers.js.map
  29. 88
      dist/api/network.js
  30. 1
      dist/api/network.js.map
  31. 3
      dist/api/utils/lightning.js
  32. 2
      dist/api/utils/lightning.js.map
  33. 4
      dist/api/utils/tribes.js
  34. 2
      dist/api/utils/tribes.js.map
  35. 2
      dist/app.js
  36. 2
      dist/app.js.map

12
api/controllers/chats.ts

@ -2,6 +2,7 @@ import { models } from '../models'
import * as jsonUtils from '../utils/json' import * as jsonUtils from '../utils/json'
import { success, failure } from '../utils/res' import { success, failure } from '../utils/res'
import * as helpers from '../helpers' import * as helpers from '../helpers'
import * as network from '../network'
import * as socket from '../utils/socket' import * as socket from '../utils/socket'
import { sendNotification } from '../hub' import { sendNotification } from '../hub'
import * as md5 from 'md5' import * as md5 from 'md5'
@ -36,6 +37,8 @@ async function mute(req, res) {
success(res, jsonUtils.chatToJson(chat)) success(res, jsonUtils.chatToJson(chat))
} }
// just add self here if tribes
// or can u add contacts as members?
async function createGroupChat(req, res) { async function createGroupChat(req, res) {
const { const {
name, name,
@ -72,7 +75,7 @@ async function createGroupChat(req, res) {
chatParams = createGroupChatParams(owner, contact_ids, members, name) chatParams = createGroupChatParams(owner, contact_ids, members, name)
} }
helpers.sendMessage({ network.sendMessage({
chat: { ...chatParams, members }, chat: { ...chatParams, members },
sender: owner, sender: owner,
type: constants.message_types.group_create, type: constants.message_types.group_create,
@ -127,7 +130,7 @@ async function addGroupMembers(req, res) {
success(res, jsonUtils.chatToJson(chat)) success(res, jsonUtils.chatToJson(chat))
helpers.sendMessage({ // send ONLY to new members network.sendMessage({ // send ONLY to new members
chat: { ...chat.dataValues, contactIds:contact_ids, members }, chat: { ...chat.dataValues, contactIds:contact_ids, members },
sender: owner, sender: owner,
type: constants.message_types.group_invite, type: constants.message_types.group_invite,
@ -140,7 +143,7 @@ const deleteChat = async (req, res) => {
const owner = await models.Contact.findOne({ where: { isOwner: true } }) const owner = await models.Contact.findOne({ where: { isOwner: true } })
const chat = await models.Chat.findOne({ where: { id } }) const chat = await models.Chat.findOne({ where: { id } })
helpers.sendMessage({ network.sendMessage({
chat, chat,
sender: owner, sender: owner,
message: {}, message: {},
@ -203,6 +206,7 @@ async function receiveGroupLeave(payload) {
// here: can only join if enough $$$! // here: can only join if enough $$$!
// forward to all over mqtt // forward to all over mqtt
// add to ChatMember table
async function receiveGroupJoin(payload) { async function receiveGroupJoin(payload) {
console.log('=> receiveGroupJoin') console.log('=> receiveGroupJoin')
const { sender_pub_key, chat_uuid, chat_members } = await helpers.parseReceiveParams(payload) const { sender_pub_key, chat_uuid, chat_members } = await helpers.parseReceiveParams(payload)
@ -337,7 +341,7 @@ async function receiveGroupCreateOrInvite(payload) {
if (payload.type === constants.message_types.group_invite) { if (payload.type === constants.message_types.group_invite) {
const owner = await models.Contact.findOne({ where: { isOwner: true } }) const owner = await models.Contact.findOne({ where: { isOwner: true } })
helpers.sendMessage({ network.sendMessage({
chat: { chat: {
...chat.dataValues, members: { ...chat.dataValues, members: {
[owner.publicKey]: { [owner.publicKey]: {

4
api/controllers/confirmations.ts

@ -2,13 +2,13 @@ import lock from '../utils/lock'
import {models} from '../models' import {models} from '../models'
import * as socket from '../utils/socket' import * as socket from '../utils/socket'
import * as jsonUtils from '../utils/json' import * as jsonUtils from '../utils/json'
import * as helpers from '../helpers' import * as network from '../network'
import * as path from 'path' import * as path from 'path'
const constants = require(path.join(__dirname,'../../config/constants.json')) const constants = require(path.join(__dirname,'../../config/constants.json'))
export function sendConfirmation({ chat, sender, msg_id }) { export function sendConfirmation({ chat, sender, msg_id }) {
helpers.sendMessage({ network.sendMessage({
chat, chat,
sender, sender,
message: {id:msg_id}, message: {id:msg_id},

3
api/controllers/invoices.ts

@ -8,6 +8,7 @@ import { sendNotification } from '../hub'
import { success } from '../utils/res' import { success } from '../utils/res'
import {sendConfirmation} from './confirmations' import {sendConfirmation} from './confirmations'
import * as path from 'path' import * as path from 'path'
import * as network from '../network'
const constants = require(path.join(__dirname,'../../config/constants.json')) const constants = require(path.join(__dirname,'../../config/constants.json'))
@ -140,7 +141,7 @@ const createInvoice = async (req, res) => {
}) })
success(res, jsonUtils.messageToJson(message, chat)) success(res, jsonUtils.messageToJson(message, chat))
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.invoice, type: constants.message_types.invoice,

9
api/controllers/media.ts

@ -13,6 +13,7 @@ import * as zbase32 from '../utils/zbase32'
import * as schemas from './schemas' import * as schemas from './schemas'
import {sendConfirmation} from './confirmations' import {sendConfirmation} from './confirmations'
import * as path from 'path' import * as path from 'path'
import * as network from '../network'
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(path.join(__dirname,'../../config/app.json'))[env] const config = require(path.join(__dirname,'../../config/app.json'))[env]
@ -115,7 +116,7 @@ const sendAttachmentMessage = async (req, res) => {
mediaKey: media_key_map, mediaKey: media_key_map,
mediaType: mediaType, mediaType: mediaType,
} }
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.attachment, type: constants.message_types.attachment,
@ -183,7 +184,7 @@ const purchase = async (req, res) => {
const msg={ const msg={
amount, mediaToken:media_token, id:message.id, amount, mediaToken:media_token, id:message.id,
} }
helpers.sendMessage({ network.sendMessage({
chat: {...chat.dataValues, contactIds:[contact_id]}, chat: {...chat.dataValues, contactIds:[contact_id]},
sender: owner, sender: owner,
type: constants.message_types.purchase, type: constants.message_types.purchase,
@ -258,7 +259,7 @@ const receivePurchase = async (payload) => {
} }
if (amount < price) { // didnt pay enough if (amount < price) { // didnt pay enough
return helpers.sendMessage({ // "purchase_deny" return network.sendMessage({ // "purchase_deny"
chat: {...chat.dataValues, contactIds:[sender.id]}, // only send back to sender chat: {...chat.dataValues, contactIds:[sender.id]}, // only send back to sender
sender: owner, sender: owner,
amount: amount, amount: amount,
@ -287,7 +288,7 @@ const receivePurchase = async (payload) => {
meta: {amt:amount}, meta: {amt:amount},
pubkey: sender.publicKey, pubkey: sender.publicKey,
}) })
helpers.sendMessage({ network.sendMessage({
chat: {...chat.dataValues, contactIds:[sender.id]}, // only to sender chat: {...chat.dataValues, contactIds:[sender.id]}, // only to sender
sender: owner, sender: owner,
type: constants.message_types.purchase_accept, type: constants.message_types.purchase_accept,

3
api/controllers/messages.ts

@ -8,6 +8,7 @@ import * as helpers from '../helpers'
import { success } from '../utils/res' import { success } from '../utils/res'
import {sendConfirmation} from './confirmations' import {sendConfirmation} from './confirmations'
import * as path from 'path' import * as path from 'path'
import * as network from '../network'
const constants = require(path.join(__dirname,'../../config/constants.json')) const constants = require(path.join(__dirname,'../../config/constants.json'))
@ -136,7 +137,7 @@ const sendMessage = async (req, res) => {
success(res, jsonUtils.messageToJson(message, chat)) success(res, jsonUtils.messageToJson(message, chat))
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.message, type: constants.message_types.message,

3
api/controllers/payment.ts

@ -7,6 +7,7 @@ import { success } from '../utils/res'
import * as lightning from '../utils/lightning' import * as lightning from '../utils/lightning'
import {tokenFromTerms} from '../utils/ldat' import {tokenFromTerms} from '../utils/ldat'
import * as constants from '../../config/constants.json' import * as constants from '../../config/constants.json'
import * as network from '../network'
const sendPayment = async (req, res) => { const sendPayment = async (req, res) => {
const { const {
@ -95,7 +96,7 @@ const sendPayment = async (req, res) => {
theChat = {...chat.dataValues, contactIds:contact_ids} theChat = {...chat.dataValues, contactIds:contact_ids}
if(remote_text_map) msgToSend.content = remote_text_map if(remote_text_map) msgToSend.content = remote_text_map
} }
helpers.sendMessage({ network.sendMessage({
chat: theChat, chat: theChat,
sender: owner, sender: owner,
type: constants.message_types.direct_payment, type: constants.message_types.direct_payment,

3
api/controllers/subscriptions.ts

@ -9,6 +9,7 @@ import * as helpers from '../helpers'
import * as rsa from '../crypto/rsa' import * as rsa from '../crypto/rsa'
import * as moment from 'moment' import * as moment from 'moment'
import * as path from 'path' import * as path from 'path'
import * as network from '../network'
const constants = require(path.join(__dirname,'../../config/constants.json')) const constants = require(path.join(__dirname,'../../config/constants.json'))
@ -121,7 +122,7 @@ async function sendSubscriptionPayment(sub, isFirstMessage) {
const contact = await models.Contact.findByPk(sub.contactId) const contact = await models.Contact.findByPk(sub.contactId)
const enc = rsa.encrypt(contact.contactKey, text) const enc = rsa.encrypt(contact.contactKey, text)
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.direct_payment, type: constants.message_types.direct_payment,

66
api/helpers.ts

@ -1,7 +1,6 @@
import { models } from './models' import { models } from './models'
import * as md5 from 'md5' import * as md5 from 'md5'
import * as LND from './utils/lightning' import * as network from './network'
import {personalizeMessage} from './utils/msg'
const constants = require('../config/constants.json'); const constants = require('../config/constants.json');
@ -76,47 +75,6 @@ const sendContactKeys = async (args) => {
} }
} }
const sendMessage = async (params) => {
const { type, chat, message, sender, amount, success, failure } = params
const m = newmsg(type, chat, sender, message)
const contactIds = typeof chat.contactIds==='string' ? JSON.parse(chat.contactIds) : chat.contactIds
let yes:any = null
let no:any = null
console.log('all contactIds',contactIds)
await asyncForEach(contactIds, async contactId => {
if (contactId == sender.id) {
return
}
console.log('-> sending to contact #', contactId)
const contact = await models.Contact.findOne({ where: { id: contactId } })
const destkey = contact.publicKey
const finalMsg = await personalizeMessage(m, contactId, destkey)
const opts = {
dest: destkey,
data: JSON.stringify(finalMsg),
amt: amount || 3,
}
try {
const r = await LND.keysendMessage(opts)
yes = r
} catch (e) {
console.log("KEYSEND ERROR", e)
no = e
}
})
if(yes){
if(success) success(yes)
} else {
if(failure) failure(no)
}
}
const performKeysendMessage = async ({ destination_key, amount, msg, success, failure }) => { const performKeysendMessage = async ({ destination_key, amount, msg, success, failure }) => {
const opts = { const opts = {
dest: destination_key, dest: destination_key,
@ -124,7 +82,7 @@ const performKeysendMessage = async ({ destination_key, amount, msg, success, fa
amt: Math.max(amount, 3) amt: Math.max(amount, 3)
} }
try { try {
const r = await LND.keysendMessage(opts) const r = await network.signAndSend(opts)
console.log("=> external keysend") console.log("=> external keysend")
if (success) success(r) if (success) success(r)
} catch (e) { } catch (e) {
@ -206,7 +164,6 @@ async function parseReceiveParams(payload) {
export { export {
findOrCreateChat, findOrCreateChat,
sendMessage,
sendContactKeys, sendContactKeys,
findOrCreateContactByPubkey, findOrCreateContactByPubkey,
findOrCreateChatByUUID, findOrCreateChatByUUID,
@ -221,25 +178,6 @@ async function asyncForEach(array, callback) {
} }
} }
function newmsg(type, chat, sender, message){
return {
type: type,
chat: {
uuid: chat.uuid,
...chat.name && { name: chat.name },
...chat.type && { type: chat.type },
...chat.members && { members: chat.members },
...chat.groupKey && { groupKey: chat.groupKey },
...chat.host && { host: chat.host }
},
message: message,
// sender: {
// pub_key: sender.publicKey,
// // ...sender.contactKey && {contact_key: sender.contactKey}
// }
}
}
function newkeyexchangemsg(type, sender){ function newkeyexchangemsg(type, sender){
return { return {
type: type, type: type,

93
api/network.ts

@ -0,0 +1,93 @@
import { models } from './models'
import * as LND from './utils/lightning'
import {personalizeMessage} from './utils/msg'
// const constants = require('../config/constants.json');
/*
Abstracts between lightning network and MQTT depending on Chat type and sender
*/
export function signAndSend(opts){
return new Promise(async function(resolve, reject) {
if(!opts.data || typeof opts.data!=='object') {
return reject('object plz')
}
let data = JSON.stringify(opts.data)
// SIGN HERE and append sig
const sig = await LND.signAscii(data)
data = data + sig
// if tribe
// if owner pub to mqtt
// else keysend to owner ONLY
// else:
LND.keysendMessage({...opts,data})
})
}
export async function sendMessage(params) {
const { type, chat, message, sender, amount, success, failure } = params
const m = newmsg(type, chat, sender, message)
const contactIds = typeof chat.contactIds==='string' ? JSON.parse(chat.contactIds) : chat.contactIds
let yes:any = null
let no:any = null
console.log('all contactIds',contactIds)
await asyncForEach(contactIds, async contactId => {
if (contactId == sender.id) {
return
}
console.log('-> sending to contact #', contactId)
const contact = await models.Contact.findOne({ where: { id: contactId } })
const destkey = contact.publicKey
const finalMsg = await personalizeMessage(m, contactId, destkey)
const opts = {
dest: destkey,
data: finalMsg,
amt: Math.max(amount, 3)
}
try {
const r = await signAndSend(opts)
yes = r
} catch (e) {
console.log("KEYSEND ERROR", e)
no = e
}
})
if(yes){
if(success) success(yes)
} else {
if(failure) failure(no)
}
}
function newmsg(type, chat, sender, message){
return {
type: type,
chat: {
uuid: chat.uuid,
...chat.name && { name: chat.name },
...chat.type && { type: chat.type },
...chat.members && { members: chat.members },
...chat.groupKey && { groupKey: chat.groupKey },
...chat.host && { host: chat.host }
},
message: message,
// sender: {
// pub_key: sender.publicKey,
// // ...sender.contactKey && {contact_key: sender.contactKey}
// }
}
}
async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}

3
api/utils/lightning.ts

@ -141,9 +141,6 @@ async function keysendMessage(opts) {
if(!opts.data || typeof opts.data!=='string') { if(!opts.data || typeof opts.data!=='string') {
return reject('string plz') return reject('string plz')
} }
// SIGN HERE and append sig
const sig = await signAscii(opts.data)
opts.data = opts.data + sig
if(opts.data.length<MAX_MSG_LENGTH){ if(opts.data.length<MAX_MSG_LENGTH){
try { try {

14
api/utils/msg.ts

@ -18,6 +18,17 @@ function removeRecipientFromChatMembers(full:{[k:string]:any}, destkey){
return fillchatmsg(full, {members}) return fillchatmsg(full, {members})
} }
function removeAllNonAdminMembersIfTribe(full:{[k:string]:any}, destkey){
return full
// const c = full && full.chat
// if (!(c && c.members)) return full
// if (!(typeof c.members==='object')) return full
// const members = {...c.members}
// if(members[destkey]) delete members[destkey]
// return fillchatmsg(full, {members})
}
function addInMediaKey(full:{[k:string]:any}, contactId){ function addInMediaKey(full:{[k:string]:any}, contactId){
const m = full && full.message const m = full && full.message
if (!(m && m.mediaKey)) return full if (!(m && m.mediaKey)) return full
@ -53,7 +64,8 @@ async function personalizeMessage(m,contactId,destkey){
const cloned = JSON.parse(JSON.stringify(m)) const cloned = JSON.parse(JSON.stringify(m))
const msg = addInRemoteText(cloned, contactId) const msg = addInRemoteText(cloned, contactId)
const cleanMsg = removeRecipientFromChatMembers(msg, destkey) const cleanMsg = removeRecipientFromChatMembers(msg, destkey)
const msgWithMediaKey = addInMediaKey(cleanMsg, contactId) const cleanerMsg = removeAllNonAdminMembersIfTribe(msg, destkey)
const msgWithMediaKey = addInMediaKey(cleanerMsg, contactId)
const finalMsg = await finishTermsAndReceipt(msgWithMediaKey, destkey) const finalMsg = await finishTermsAndReceipt(msgWithMediaKey, destkey)
return finalMsg return finalMsg
} }

4
api/utils/tribes.ts

@ -20,12 +20,12 @@ export async function connect() {
}) })
client.on('connect', function () { client.on('connect', function () {
console.log("MQTT CLIENT CONNECTED!") console.log("[tribes] connected!")
// subscribe to all public groups here // subscribe to all public groups here
// that you are NOT admin of (dont sub to your own!) // that you are NOT admin of (dont sub to your own!)
}) })
client.on('close', function () { client.on('close', function () {
console.log("MQTT CLOSED") //console.log("MQTT CLOSED")
}) })
} }

2
app.ts

@ -29,7 +29,7 @@ async function connectToLND(){
console.log(`=> [lnd] connecting... attempt #${i}`) console.log(`=> [lnd] connecting... attempt #${i}`)
try { try {
await controllers.iniGrpcSubscriptions() await controllers.iniGrpcSubscriptions()
mainSetup() await mainSetup()
tribes.connect() tribes.connect()
} catch(e) { } catch(e) {
setTimeout(async()=>{ // retry each 2 secs setTimeout(async()=>{ // retry each 2 secs

12
dist/api/controllers/chats.js

@ -13,6 +13,7 @@ const models_1 = require("../models");
const jsonUtils = require("../utils/json"); const jsonUtils = require("../utils/json");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const helpers = require("../helpers"); const helpers = require("../helpers");
const network = require("../network");
const socket = require("../utils/socket"); const socket = require("../utils/socket");
const hub_1 = require("../hub"); const hub_1 = require("../hub");
const md5 = require("md5"); const md5 = require("md5");
@ -44,6 +45,8 @@ function mute(req, res) {
}); });
} }
exports.mute = mute; exports.mute = mute;
// just add self here if tribes
// or can u add contacts as members?
function createGroupChat(req, res) { function createGroupChat(req, res) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { name, contact_ids, is_tribe, is_listed, } = req.body; const { name, contact_ids, is_tribe, is_listed, } = req.body;
@ -71,7 +74,7 @@ function createGroupChat(req, res) {
else { else {
chatParams = createGroupChatParams(owner, contact_ids, members, name); chatParams = createGroupChatParams(owner, contact_ids, members, name);
} }
helpers.sendMessage({ network.sendMessage({
chat: Object.assign(Object.assign({}, chatParams), { members }), chat: Object.assign(Object.assign({}, chatParams), { members }),
sender: owner, sender: owner,
type: constants.message_types.group_create, type: constants.message_types.group_create,
@ -126,7 +129,7 @@ function addGroupMembers(req, res) {
} }
})); }));
res_1.success(res, jsonUtils.chatToJson(chat)); res_1.success(res, jsonUtils.chatToJson(chat));
helpers.sendMessage({ network.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: contact_ids, members }), chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: contact_ids, members }),
sender: owner, sender: owner,
type: constants.message_types.group_invite, type: constants.message_types.group_invite,
@ -139,7 +142,7 @@ const deleteChat = (req, res) => __awaiter(void 0, void 0, void 0, function* ()
const { id } = req.params; const { id } = req.params;
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const chat = yield models_1.models.Chat.findOne({ where: { id } }); const chat = yield models_1.models.Chat.findOne({ where: { id } });
helpers.sendMessage({ network.sendMessage({
chat, chat,
sender: owner, sender: owner,
message: {}, message: {},
@ -198,6 +201,7 @@ function receiveGroupLeave(payload) {
exports.receiveGroupLeave = receiveGroupLeave; exports.receiveGroupLeave = receiveGroupLeave;
// here: can only join if enough $$$! // here: can only join if enough $$$!
// forward to all over mqtt // forward to all over mqtt
// add to ChatMember table
function receiveGroupJoin(payload) { function receiveGroupJoin(payload) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
console.log('=> receiveGroupJoin'); console.log('=> receiveGroupJoin');
@ -325,7 +329,7 @@ function receiveGroupCreateOrInvite(payload) {
hub_1.sendNotification(chat, chat_name, 'group'); hub_1.sendNotification(chat, chat_name, 'group');
if (payload.type === constants.message_types.group_invite) { if (payload.type === constants.message_types.group_invite) {
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
helpers.sendMessage({ network.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { members: { chat: Object.assign(Object.assign({}, chat.dataValues), { members: {
[owner.publicKey]: { [owner.publicKey]: {
key: owner.contactKey, key: owner.contactKey,

2
dist/api/controllers/chats.js.map

File diff suppressed because one or more lines are too long

4
dist/api/controllers/confirmations.js

@ -13,11 +13,11 @@ const lock_1 = require("../utils/lock");
const models_1 = require("../models"); const models_1 = require("../models");
const socket = require("../utils/socket"); const socket = require("../utils/socket");
const jsonUtils = require("../utils/json"); const jsonUtils = require("../utils/json");
const helpers = require("../helpers"); const network = require("../network");
const path = require("path"); const path = require("path");
const constants = require(path.join(__dirname, '../../config/constants.json')); const constants = require(path.join(__dirname, '../../config/constants.json'));
function sendConfirmation({ chat, sender, msg_id }) { function sendConfirmation({ chat, sender, msg_id }) {
helpers.sendMessage({ network.sendMessage({
chat, chat,
sender, sender,
message: { id: msg_id }, message: { id: msg_id },

3
dist/api/controllers/invoices.js

@ -19,6 +19,7 @@ const hub_1 = require("../hub");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const confirmations_1 = require("./confirmations"); const confirmations_1 = require("./confirmations");
const path = require("path"); const path = require("path");
const network = require("../network");
const constants = require(path.join(__dirname, '../../config/constants.json')); const constants = require(path.join(__dirname, '../../config/constants.json'));
const payInvoice = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const payInvoice = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const lightning = yield lightning_1.loadLightning(); const lightning = yield lightning_1.loadLightning();
@ -125,7 +126,7 @@ const createInvoice = (req, res) => __awaiter(void 0, void 0, void 0, function*
updatedAt: new Date(timestamp) updatedAt: new Date(timestamp)
}); });
res_1.success(res, jsonUtils.messageToJson(message, chat)); res_1.success(res, jsonUtils.messageToJson(message, chat));
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.invoice, type: constants.message_types.invoice,

2
dist/api/controllers/invoices.js.map

File diff suppressed because one or more lines are too long

9
dist/api/controllers/media.js

@ -24,6 +24,7 @@ const zbase32 = require("../utils/zbase32");
const schemas = require("./schemas"); const schemas = require("./schemas");
const confirmations_1 = require("./confirmations"); const confirmations_1 = require("./confirmations");
const path = require("path"); const path = require("path");
const network = require("../network");
const env = process.env.NODE_ENV || 'development'; const env = process.env.NODE_ENV || 'development';
const config = require(path.join(__dirname, '../../config/app.json'))[env]; const config = require(path.join(__dirname, '../../config/app.json'))[env];
const constants = require(path.join(__dirname, '../../config/constants.json')); const constants = require(path.join(__dirname, '../../config/constants.json'));
@ -103,7 +104,7 @@ const sendAttachmentMessage = (req, res) => __awaiter(void 0, void 0, void 0, fu
mediaKey: media_key_map, mediaKey: media_key_map,
mediaType: mediaType, mediaType: mediaType,
}; };
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.attachment, type: constants.message_types.attachment,
@ -162,7 +163,7 @@ const purchase = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const msg = { const msg = {
amount, mediaToken: media_token, id: message.id, amount, mediaToken: media_token, id: message.id,
}; };
helpers.sendMessage({ network.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [contact_id] }), chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [contact_id] }),
sender: owner, sender: owner,
type: constants.message_types.purchase, type: constants.message_types.purchase,
@ -230,7 +231,7 @@ const receivePurchase = (payload) => __awaiter(void 0, void 0, void 0, function*
price = 0; price = 0;
} }
if (amount < price) { // didnt pay enough if (amount < price) { // didnt pay enough
return helpers.sendMessage({ return network.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [sender.id] }), chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [sender.id] }),
sender: owner, sender: owner,
amount: amount, amount: amount,
@ -258,7 +259,7 @@ const receivePurchase = (payload) => __awaiter(void 0, void 0, void 0, function*
meta: { amt: amount }, meta: { amt: amount },
pubkey: sender.publicKey, pubkey: sender.publicKey,
}); });
helpers.sendMessage({ network.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [sender.id] }), chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [sender.id] }),
sender: owner, sender: owner,
type: constants.message_types.purchase_accept, type: constants.message_types.purchase_accept,

2
dist/api/controllers/media.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/messages.js

@ -19,6 +19,7 @@ const helpers = require("../helpers");
const res_1 = require("../utils/res"); const res_1 = require("../utils/res");
const confirmations_1 = require("./confirmations"); const confirmations_1 = require("./confirmations");
const path = require("path"); const path = require("path");
const network = require("../network");
const constants = require(path.join(__dirname, '../../config/constants.json')); const constants = require(path.join(__dirname, '../../config/constants.json'));
const getMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const getMessages = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const dateToReturn = req.query.date; const dateToReturn = req.query.date;
@ -121,7 +122,7 @@ const sendMessage = (req, res) => __awaiter(void 0, void 0, void 0, function* ()
// console.log(msg) // console.log(msg)
const message = yield models_1.models.Message.create(msg); const message = yield models_1.models.Message.create(msg);
res_1.success(res, jsonUtils.messageToJson(message, chat)); res_1.success(res, jsonUtils.messageToJson(message, chat));
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.message, type: constants.message_types.message,

2
dist/api/controllers/messages.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/payment.js

@ -18,6 +18,7 @@ const res_1 = require("../utils/res");
const lightning = require("../utils/lightning"); const lightning = require("../utils/lightning");
const ldat_1 = require("../utils/ldat"); const ldat_1 = require("../utils/ldat");
const constants = require("../../config/constants.json"); const constants = require("../../config/constants.json");
const network = require("../network");
const sendPayment = (req, res) => __awaiter(void 0, void 0, void 0, function* () { const sendPayment = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const { amount, chat_id, contact_id, destination_key, media_type, muid, text, remote_text, dimensions, remote_text_map, contact_ids, } = req.body; const { amount, chat_id, contact_id, destination_key, media_type, muid, text, remote_text, dimensions, remote_text_map, contact_ids, } = req.body;
console.log('[send payment]', req.body); console.log('[send payment]', req.body);
@ -87,7 +88,7 @@ const sendPayment = (req, res) => __awaiter(void 0, void 0, void 0, function* ()
if (remote_text_map) if (remote_text_map)
msgToSend.content = remote_text_map; msgToSend.content = remote_text_map;
} }
helpers.sendMessage({ network.sendMessage({
chat: theChat, chat: theChat,
sender: owner, sender: owner,
type: constants.message_types.direct_payment, type: constants.message_types.direct_payment,

2
dist/api/controllers/payment.js.map

File diff suppressed because one or more lines are too long

3
dist/api/controllers/subscriptions.js

@ -20,6 +20,7 @@ const helpers = require("../helpers");
const rsa = require("../crypto/rsa"); const rsa = require("../crypto/rsa");
const moment = require("moment"); const moment = require("moment");
const path = require("path"); const path = require("path");
const network = require("../network");
const constants = require(path.join(__dirname, '../../config/constants.json')); const constants = require(path.join(__dirname, '../../config/constants.json'));
// store all current running jobs in memory // store all current running jobs in memory
let jobs = {}; let jobs = {};
@ -126,7 +127,7 @@ function sendSubscriptionPayment(sub, isFirstMessage) {
const text = msgForSubPayment(owner, sub, isFirstMessage, forMe); const text = msgForSubPayment(owner, sub, isFirstMessage, forMe);
const contact = yield models_1.models.Contact.findByPk(sub.contactId); const contact = yield models_1.models.Contact.findByPk(sub.contactId);
const enc = rsa.encrypt(contact.contactKey, text); const enc = rsa.encrypt(contact.contactKey, text);
helpers.sendMessage({ network.sendMessage({
chat: chat, chat: chat,
sender: owner, sender: owner,
type: constants.message_types.direct_payment, type: constants.message_types.direct_payment,

2
dist/api/controllers/subscriptions.js.map

File diff suppressed because one or more lines are too long

51
dist/api/helpers.js

@ -11,8 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("./models"); const models_1 = require("./models");
const md5 = require("md5"); const md5 = require("md5");
const LND = require("./utils/lightning"); const network = require("./network");
const msg_1 = require("./utils/msg");
const constants = require('../config/constants.json'); const constants = require('../config/constants.json');
const findOrCreateChat = (params) => __awaiter(void 0, void 0, void 0, function* () { const findOrCreateChat = (params) => __awaiter(void 0, void 0, void 0, function* () {
const { chat_id, owner_id, recipient_id } = params; const { chat_id, owner_id, recipient_id } = params;
@ -83,45 +82,6 @@ const sendContactKeys = (args) => __awaiter(void 0, void 0, void 0, function* ()
} }
}); });
exports.sendContactKeys = sendContactKeys; exports.sendContactKeys = sendContactKeys;
const sendMessage = (params) => __awaiter(void 0, void 0, void 0, function* () {
const { type, chat, message, sender, amount, success, failure } = params;
const m = newmsg(type, chat, sender, message);
const contactIds = typeof chat.contactIds === 'string' ? JSON.parse(chat.contactIds) : chat.contactIds;
let yes = null;
let no = null;
console.log('all contactIds', contactIds);
yield asyncForEach(contactIds, (contactId) => __awaiter(void 0, void 0, void 0, function* () {
if (contactId == sender.id) {
return;
}
console.log('-> sending to contact #', contactId);
const contact = yield models_1.models.Contact.findOne({ where: { id: contactId } });
const destkey = contact.publicKey;
const finalMsg = yield msg_1.personalizeMessage(m, contactId, destkey);
const opts = {
dest: destkey,
data: JSON.stringify(finalMsg),
amt: amount || 3,
};
try {
const r = yield LND.keysendMessage(opts);
yes = r;
}
catch (e) {
console.log("KEYSEND ERROR", e);
no = e;
}
}));
if (yes) {
if (success)
success(yes);
}
else {
if (failure)
failure(no);
}
});
exports.sendMessage = sendMessage;
const performKeysendMessage = ({ destination_key, amount, msg, success, failure }) => __awaiter(void 0, void 0, void 0, function* () { const performKeysendMessage = ({ destination_key, amount, msg, success, failure }) => __awaiter(void 0, void 0, void 0, function* () {
const opts = { const opts = {
dest: destination_key, dest: destination_key,
@ -129,7 +89,7 @@ const performKeysendMessage = ({ destination_key, amount, msg, success, failure
amt: Math.max(amount, 3) amt: Math.max(amount, 3)
}; };
try { try {
const r = yield LND.keysendMessage(opts); const r = yield network.signAndSend(opts);
console.log("=> external keysend"); console.log("=> external keysend");
if (success) if (success)
success(r); success(r);
@ -224,13 +184,6 @@ function asyncForEach(array, callback) {
} }
}); });
} }
function newmsg(type, chat, sender, message) {
return {
type: type,
chat: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ uuid: chat.uuid }, chat.name && { name: chat.name }), chat.type && { type: chat.type }), chat.members && { members: chat.members }), chat.groupKey && { groupKey: chat.groupKey }), chat.host && { host: chat.host }),
message: message,
};
}
function newkeyexchangemsg(type, sender) { function newkeyexchangemsg(type, sender) {
return { return {
type: type, type: type,

2
dist/api/helpers.js.map

File diff suppressed because one or more lines are too long

88
dist/api/network.js

@ -0,0 +1,88 @@
"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 models_1 = require("./models");
const LND = require("./utils/lightning");
const msg_1 = require("./utils/msg");
// const constants = require('../config/constants.json');
/*
Abstracts between lightning network and MQTT depending on Chat type and sender
*/
function signAndSend(opts) {
return new Promise(function (resolve, reject) {
return __awaiter(this, void 0, void 0, function* () {
if (!opts.data || typeof opts.data !== 'string') {
return reject('string plz');
}
// SIGN HERE and append sig
const sig = yield LND.signAscii(opts.data);
opts.data = opts.data + sig;
LND.keysendMessage(opts);
});
});
}
exports.signAndSend = signAndSend;
function sendMessage(params) {
return __awaiter(this, void 0, void 0, function* () {
const { type, chat, message, sender, amount, success, failure } = params;
const m = newmsg(type, chat, sender, message);
const contactIds = typeof chat.contactIds === 'string' ? JSON.parse(chat.contactIds) : chat.contactIds;
let yes = null;
let no = null;
console.log('all contactIds', contactIds);
yield asyncForEach(contactIds, (contactId) => __awaiter(this, void 0, void 0, function* () {
if (contactId == sender.id) {
return;
}
console.log('-> sending to contact #', contactId);
const contact = yield models_1.models.Contact.findOne({ where: { id: contactId } });
const destkey = contact.publicKey;
const finalMsg = yield msg_1.personalizeMessage(m, contactId, destkey);
const opts = {
dest: destkey,
data: JSON.stringify(finalMsg),
amt: amount || 3,
};
try {
const r = yield signAndSend(opts);
yes = r;
}
catch (e) {
console.log("KEYSEND ERROR", e);
no = e;
}
}));
if (yes) {
if (success)
success(yes);
}
else {
if (failure)
failure(no);
}
});
}
exports.sendMessage = sendMessage;
function newmsg(type, chat, sender, message) {
return {
type: type,
chat: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ uuid: chat.uuid }, chat.name && { name: chat.name }), chat.type && { type: chat.type }), chat.members && { members: chat.members }), chat.groupKey && { groupKey: chat.groupKey }), chat.host && { host: chat.host }),
message: message,
};
}
function asyncForEach(array, callback) {
return __awaiter(this, void 0, void 0, function* () {
for (let index = 0; index < array.length; index++) {
yield callback(array[index], index, array);
}
});
}
//# sourceMappingURL=network.js.map

1
dist/api/network.js.map

@ -0,0 +1 @@
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../api/network.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAiC;AACjC,yCAAwC;AACxC,qCAA8C;AAE9C,yDAAyD;AAEzD;;EAEE;AAEF,SAAgB,WAAW,CAAC,IAAI;IAC/B,OAAO,IAAI,OAAO,CAAC,UAAe,OAAO,EAAE,MAAM;;YAChD,IAAG,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAG,QAAQ,EAAE;gBAC7C,OAAO,MAAM,CAAC,YAAY,CAAC,CAAA;aAC3B;YACD,2BAA2B;YAC3B,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;YAG3B,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QACzB,CAAC;KAAA,CAAC,CAAA;AACH,CAAC;AAZD,kCAYC;AAED,SAAsB,WAAW,CAAC,MAAM;;QACvC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;QACxE,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,M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;YACN,IAAG,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,CAAA;SACxB;aAAM;YACN,IAAG,OAAO;gBAAE,OAAO,CAAC,EAAE,CAAC,CAAA;SACvB;IACF,CAAC;CAAA;AAvCD,kCAuCC;AAED,SAAS,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO;IAC1C,OAAO;QACN,IAAI,EAAE,IAAI;QACV,IAAI,0EACH,IAAI,EAAE,IAAI,CAAC,IAAI,IACZ,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAChC,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAChC,IAAI,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GACzC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAC5C,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CACnC;QACD,OAAO,EAAE,OAAO;KAKhB,CAAA;AACF,CAAC;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QAC1C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAChD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC7C;IACF,CAAC;CAAA"}

3
dist/api/utils/lightning.js

@ -154,9 +154,6 @@ function keysendMessage(opts) {
if (!opts.data || typeof opts.data !== 'string') { if (!opts.data || typeof opts.data !== 'string') {
return reject('string plz'); return reject('string plz');
} }
// SIGN HERE and append sig
const sig = yield signAscii(opts.data);
opts.data = opts.data + sig;
if (opts.data.length < MAX_MSG_LENGTH) { if (opts.data.length < MAX_MSG_LENGTH) {
try { try {
const res = yield keysend(opts); const res = yield keysend(opts);

2
dist/api/utils/lightning.js.map

File diff suppressed because one or more lines are too long

4
dist/api/utils/tribes.js

@ -26,12 +26,12 @@ function connect() {
password: pwd, password: pwd,
}); });
client.on('connect', function () { client.on('connect', function () {
console.log("MQTT CLIENT CONNECTED!"); console.log("[tribes] connected!");
// subscribe to all public groups here // subscribe to all public groups here
// that you are NOT admin of (dont sub to your own!) // that you are NOT admin of (dont sub to your own!)
}); });
client.on('close', function () { client.on('close', function () {
console.log("MQTT CLOSED"); //console.log("MQTT CLOSED")
}); });
}); });
} }

2
dist/api/utils/tribes.js.map

@ -1 +1 @@
{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../../api/utils/tribes.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,iCAAgC;AAChC,qCAAoC;AACpC,mCAAkC;AAClC,6BAA4B;AAC5B,6BAA4B;AAE5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAA;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzE,SAAsB,OAAO;;QACzB,MAAM,GAAG,GAAG,MAAM,kBAAkB,EAAE,CAAA;QACtC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;QAEhC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAC,SAAS,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QAEvE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,EAAC;YACtD,QAAQ,EAAC,IAAI,CAAC,eAAe;YAC7B,QAAQ,EAAC,GAAG;SACf,CAAC,CAAA;QAEF,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE;YACjB,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;YACrC,sCAAsC;YAC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ED,SAAgB,OAAO;IACnB,OAAO,MAAM,CAAC,WAAW,IAAI,EAAE,CAAA;AACnC,CAAC;AAFD,0BAEC;AAED,SAAS,SAAS,CAAC,GAAG;IAClB,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACzE,CAAC"}

2
dist/app.js

@ -36,7 +36,7 @@ function connectToLND() {
console.log(`=> [lnd] connecting... attempt #${i}`); console.log(`=> [lnd] connecting... attempt #${i}`);
try { try {
yield controllers.iniGrpcSubscriptions(); yield controllers.iniGrpcSubscriptions();
mainSetup(); yield mainSetup();
tribes.connect(); tribes.connect();
} }
catch (e) { catch (e) {

2
dist/app.js.map

@ -1 +1 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAkC;AAClC,0CAAyC;AACzC,iCAAgC;AAChC,8CAA6C;AAC7C,iCAAgC;AAChC,6BAA4B;AAC5B,yCAAmC;AACnC,+CAAuC;AACvC,mCAAkE;AAClE,6CAA0D;AAC1D,iDAAgD;AAChD,6CAA4C;AAC5C,6CAA4C;AAE5C,IAAI,MAAM,GAAQ,IAAI,CAAA;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AACtC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,YAAY,CAAA;AAEjD,IAAI,CAAC,GAAG,CAAC,CAAA;AAET,eAAe;AACf,YAAY,EAAE,CAAA;AAEd,SAAe,YAAY;;QAC1B,CAAC,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