PublicKey from Protocol Buffer/Array Buffer

Hello, I’m working on a Bitcoin project that uses protocol buffers to transfer data via websockets between the server and the browser. It’s all going fairly well, but there is a typing issue I can’t seem to get around, which is that when I specify a “bytes” field in a message:

message key_message
{
required bytes multisig_key = 1;
}

and send it from the server, the javascript library I’m using (ProtoBuf.js) deserializes to an ArrayBuffer. This is all fine, but I can’t figure out how to turn the ArrayBuffer into a PublicKey. I’ve tried the raw constructors as well as the PublicKey.fromBuffer function and nothing seems to work.

I imagine its something simple I’m missing. Anybody have an idea what to do?

Resolved it. Just ended up turning it into a string before passing it into PublicKey’s constructor.

Interesting, when passing a string in it will convert it to a Buffer, such as:

var buffer = new Buffer(pubkeystring, 'hex');