Author

Topic: Signature verification bookmarklet for group buy operators (Read 747 times)

sr. member
Activity: 378
Merit: 255
Quoting tlr's approach from another thread:

there is something I could use, and others too...
I need a browser plugin (let's start with chrome) that reads my message in the inbox, detects a signed message and tells me whether it's verified or not... copy/paste is wasting most of my time...  in this plugin I could setup an template/expression to tell it what pattern to look for when viewing a message in the inbox, things like ---start---, ---end--- etc...
thoughts? any takers?

Hah rethaw beat me to it by a few minutes, but mine's easier to use (if you can get people to send PMs with a specific format). It will iterate through your PMs looking for the format defined by the regex, then color the background green or red based on whether the signature is valid.

Code:
javascript:(function(){var REGEX, load;REGEX = /--\s*start\n(1[a-zA-Z0-9]+)\n--\n((?:.|\n)+)\n--\n([a-zA-Z0-9\+\/\=]+)\n/;load = function(url, callback) {  var script;  script = document.createElement("script");  script.onload = callback;  script.src = url;  return document.body.appendChild(script);};load("https://raw.github.com/brainwallet/brainwallet.github.com/master/js/bitcoinjs-min.js", function() {  return load("https://raw.github.com/brainwallet/brainwallet.github.com/master/js/bitcoinsig.js", function() {    var address, match, message, messageNode, messages, result, signature, _, _i, _len, _results;    messages = document.querySelectorAll(".personalmessage");    _results = [];    for (_i = 0, _len = messages.length; _i < _len; _i++) {      messageNode = messages[_i];      if (!((match = messageNode.innerText.match(REGEX)))) continue;      _ = match[0], address = match[1], message = match[2], signature = match[3];      result = verify_message(signature, message);      _results.push(messageNode.style.backgroundColor = address === result ? "green" : "red");    }    return _results;  });});})()

Source: https://gist.github.com/anonymous/5883309

The current format is the following:

Code:
-- start
ADDRESS
--
MESSAGE
--
SIGNATURE
-- end

I'm happy to write a regex for whatever format you want though.
sr. member
Activity: 378
Merit: 255
This bookmarklet uses brainwallet and bitcoinjs-lib to perform client side message verification. A user running a group buy spends a lot of time copy pasting across windows to verify signatures and asked for something to make it easier.

If you go here there's a little page to drag the bookmarklet above to the address bar.

http://bl.ocks.org/david4096/raw/5883334/

Directions:

1) Copy message to verify.
2) Select signature.
3) Click bookmarklet, paste message.
4) Output is written to alert and javascript console.

This has been tested in Chrome.
Jump to: