log
This commit is contained in:
parent
f96114b7fc
commit
3d685eb714
1 changed files with 80 additions and 67 deletions
|
|
@ -120,6 +120,8 @@ const notifyIncomingsListeners = () => {
|
|||
/** @type {Set<string>} */
|
||||
const pubFeedPairsWithIncomingListeners = new Set()
|
||||
|
||||
let subbed = false
|
||||
|
||||
/**
|
||||
* @param {IncomingsListener} cb
|
||||
*/
|
||||
|
|
@ -129,6 +131,7 @@ const onIncoming = cb => {
|
|||
const user = require('../../Mediator').getUser()
|
||||
const SEA = require('../../Mediator').mySEA
|
||||
|
||||
if (!subbed) {
|
||||
user.get(Key.USER_TO_INCOMING).open(uti => {
|
||||
if (typeof uti !== 'object' || uti === null) {
|
||||
return
|
||||
|
|
@ -138,7 +141,10 @@ const onIncoming = cb => {
|
|||
if (typeof encFeed !== 'string') {
|
||||
return
|
||||
}
|
||||
const ourSecret = await SEA.secret(await Utils.pubToEpub(pub), user._.sea)
|
||||
const ourSecret = await SEA.secret(
|
||||
await Utils.pubToEpub(pub),
|
||||
user._.sea
|
||||
)
|
||||
const mySecret = await Utils.mySecret()
|
||||
|
||||
const feed = await SEA.decrypt(encFeed, mySecret)
|
||||
|
|
@ -199,12 +205,19 @@ const onIncoming = cb => {
|
|||
}
|
||||
)
|
||||
|
||||
console.log('--------------------------------')
|
||||
console.log(`msgs: ${JSON.stringify(msgs)}`)
|
||||
console.log('--------------------------------')
|
||||
|
||||
notifyIncomingsListeners()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
subbed = true
|
||||
}
|
||||
|
||||
return () => {
|
||||
incomingsListeners.delete(cb)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue