Merge pull request #465 from shocknet/small-fixes-sep-6
Small fixes sep 6
This commit is contained in:
commit
1270ff5603
4 changed files with 21 additions and 11 deletions
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
|
@ -4,5 +4,13 @@
|
||||||
"debug.node.autoAttach": "on",
|
"debug.node.autoAttach": "on",
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"cSpell.words": ["Epub", "GUNRPC", "ISEA", "PUBKEY", "Reqs", "uuidv"]
|
"cSpell.words": [
|
||||||
|
"Epub",
|
||||||
|
"falsey",
|
||||||
|
"GUNRPC",
|
||||||
|
"ISEA",
|
||||||
|
"PUBKEY",
|
||||||
|
"Reqs",
|
||||||
|
"uuidv"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,15 +53,13 @@ const deepDecryptIfNeeded = async (value, publicKey, epubForDecryption) => {
|
||||||
if (user.is.pub === publicKey || 'me' === publicKey) {
|
if (user.is.pub === publicKey || 'me' === publicKey) {
|
||||||
sec = getMySecret()
|
sec = getMySecret()
|
||||||
} else {
|
} else {
|
||||||
sec = await SEA.secret(
|
let epub = epubForDecryption
|
||||||
await (() => {
|
|
||||||
if (epubForDecryption) {
|
if (!epub) {
|
||||||
return epubForDecryption
|
epub = await pubToEpub(publicKey)
|
||||||
}
|
}
|
||||||
return pubToEpub(publicKey)
|
|
||||||
})(),
|
sec = await SEA.secret(epub, user._.sea)
|
||||||
user._.sea
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const decrypted = SEA.decrypt(value, sec)
|
const decrypted = SEA.decrypt(value, sec)
|
||||||
|
|
|
||||||
|
|
@ -2380,7 +2380,7 @@ module.exports = async (
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
const listener = data => {
|
const listener = data => {
|
||||||
logger.info(`got res for: ${keys}`)
|
logger.info(`got res for: ${keys}`)
|
||||||
logger.info(data)
|
logger.info(data || 'falsey data (does not get logged)')
|
||||||
if (publicKeyForDecryption) {
|
if (publicKeyForDecryption) {
|
||||||
GunWriteRPC.deepDecryptIfNeeded(
|
GunWriteRPC.deepDecryptIfNeeded(
|
||||||
data,
|
data,
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ module.exports = (
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
logger.info(
|
||||||
|
'Connect event for socket with handshake: ',
|
||||||
|
socket.handshake.auth
|
||||||
|
)
|
||||||
if (!isAuthenticated()) {
|
if (!isAuthenticated()) {
|
||||||
socket.emit(Common.Constants.ErrorCode.NOT_AUTH)
|
socket.emit(Common.Constants.ErrorCode.NOT_AUTH)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue