You are reading content from Scuttlebutt
@aljoscha %NyoXRbMzJ9tdsdoDSiMg7GsHRjQeUcU49iJQus20gmg=.sha256
Re: %5kJUD3o5u

How do you iterate over all messages your local sbot knows about? If someone who has experience with this sort of thing would like to do the check, here's a function to call for each message in your database:

function check_msg(msg) {
  if (msg.previous != null && !is_canonic(msg.previous.slice(1, 45))) {
    throw "non-canonic previous";
  }

  if (!is_canonic(msg.author.slice(1, 45))) {
    throw "non-canonic author";
  }

  if (!is_canonic(msg.signature.slice(0, 88))) {
    throw "non-canonic signature";
  }

  if (typeof msg.content === "string" && !is_canonic(msg.content.slice(0, msg.content.indexOf(".box")))) {
    throw "non-canonic private message";
  }
}

function is_canonic(str) {
  return Buffer.from(str, "base64").toString("base64") === str;
}

If it never throws, then your sbot does not know about any messages with invalid base64 encoding.

Ideally this should be done by somebody who has the feeds of @Vendan, @Vendan-Phone and @cft (those contain data not published by sbot).

CC @Dominic and @Christian Bundy, @regular (that's what you get for helping me once - I'll ping you again. Please let me know if that's not ok)

Join Scuttlebutt now