i didn't find any non-canonicals:
var Client = require('ssb-client')
var pull = require('pull-stream')
Client((err, client) => {
if (err) throw err
pull(
client.createLogStream(),
pull.drain(
check_msg,
(err) => {
if (err) throw err
client.close()
}
)
)
})
function check_msg(msg) {
if (msg.value.previous != null && !is_canonic(msg.value.previous.slice(1, 45))) {
throw `non-canonic previous: ${key}`;
}
if (!is_canonic(msg.value.author.slice(1, 45))) {
throw `non-canonic author: ${key}`;
}
if (!is_canonic(msg.value.signature.slice(0, 88))) {
throw `non-canonic signature: ${key}`
}
if (typeof msg.value.content === "string" && !is_canonic(msg.value.content.slice(0, msg.value.content.indexOf(".box")))) {
throw `non-canonic private message: ${key}`
}
}
function is_canonic(str) {
return Buffer.from(str, "base64").toString("base64") === str;
}
took 23.24s user 5.16s system 43% cpu 1:05.70 total
time