yarn lint

pull/518/head
sachaaaaa 6 years ago
parent a28c581666
commit 7549c45716

@ -596,7 +596,10 @@ class LokiPublicChannelAPI {
} }
async getMessengerData(adnMessage) { async getMessengerData(adnMessage) {
if (!Array.isArray(adnMessage.annotations) || adnMessage.annotations.length === 0) { if (
!Array.isArray(adnMessage.annotations) ||
adnMessage.annotations.length === 0
) {
return false; return false;
} }
const noteValue = adnMessage.annotations[0].value; const noteValue = adnMessage.annotations[0].value;
@ -615,7 +618,7 @@ class LokiPublicChannelAPI {
// try to verify signature // try to verify signature
const { sig, sigver } = noteValue; const { sig, sigver } = noteValue;
const annoCopy = [ ...adnMessage.annotations ]; const annoCopy = [...adnMessage.annotations];
// strip out sig and sigver // strip out sig and sigver
annoCopy[0] = _.omit(annoCopy[0], ['value.sig', 'value.sigver']); annoCopy[0] = _.omit(annoCopy[0], ['value.sig', 'value.sigver']);
const verifyObj = { const verifyObj = {
@ -627,9 +630,7 @@ class LokiPublicChannelAPI {
verifyObj.reply_to = adnMessage.reply_to; verifyObj.reply_to = adnMessage.reply_to;
} }
const pubKeyBin = StringView.hexToArrayBuffer( const pubKeyBin = StringView.hexToArrayBuffer(adnMessage.user.username);
adnMessage.user.username
);
const sigBin = StringView.hexToArrayBuffer(sig); const sigBin = StringView.hexToArrayBuffer(sig);
try { try {
await libsignal.Curve.async.verifySignature( await libsignal.Curve.async.verifySignature(
@ -668,8 +669,8 @@ class LokiPublicChannelAPI {
return { return {
timestamp, timestamp,
quote, quote,
} };
} }
// get channel messages // get channel messages
async pollForMessages() { async pollForMessages() {
@ -706,7 +707,6 @@ class LokiPublicChannelAPI {
if (!res.err && res.response) { if (!res.err && res.response) {
let receivedAt = new Date().getTime(); let receivedAt = new Date().getTime();
res.response.data.reverse().forEach(async adnMessage => { res.response.data.reverse().forEach(async adnMessage => {
// still update our last received if deleted, not signed or not valid // still update our last received if deleted, not signed or not valid
this.lastGot = !this.lastGot this.lastGot = !this.lastGot
? adnMessage.id ? adnMessage.id
@ -802,7 +802,6 @@ class LokiPublicChannelAPI {
// now process any user meta data updates // now process any user meta data updates
// - update their conversation with a potentially new avatar // - update their conversation with a potentially new avatar
}); });
this.conversation.setLastRetrievedMessage(this.lastGot); this.conversation.setLastRetrievedMessage(this.lastGot);
} }

Loading…
Cancel
Save