Included lowercase manifest support and cleaned up whitespace

This commit is contained in:
mbhandary
2020-04-16 14:53:52 -04:00
parent 103b3fd3f6
commit f70de065a1

View File

@@ -111,7 +111,7 @@ function display_manifest(man) {
//Use these to create the message that should have been signed by the validator's private key (the attestation). //Use these to create the message that should have been signed by the validator's private key (the attestation).
//Go to the domain and verify the signature of the attestation field in the appropriate validator entry. //Go to the domain and verify the signature of the attestation field in the appropriate validator entry.
function parse_manifest() { function parse_manifest() {
const manhex = $("#manifest").val(); const manhex = $("#manifest").val().toUpperCase();;
try { try {
var man = codec.decode(manhex); var man = codec.decode(manhex);
@@ -122,23 +122,14 @@ function parse_manifest() {
return; return;
} }
let seq = man ["Sequence"]; let seq = man ["Sequence"];
let public_key_hex = man["PublicKey"]; let public_key_hex = man["PublicKey"];
let buff_pub = new Buffer(public_key_hex, "hex").toJSON().data; let buff_pub = new Buffer(public_key_hex, "hex").toJSON().data;
let public_key = addressCodec.encodeNodePublic(buff_pub); let public_key = addressCodec.encodeNodePublic(buff_pub);
let ephemeral_public_key_hex = man["SigningPubKey"]; let ephemeral_public_key_hex = man["SigningPubKey"];
let buff_eph_pub = new Buffer(ephemeral_public_key_hex, "hex").toJSON().data; let buff_eph_pub = new Buffer(ephemeral_public_key_hex, "hex").toJSON().data;
let ephemeral_public_key = addressCodec.encodeNodePublic(buff_eph_pub); let ephemeral_public_key = addressCodec.encodeNodePublic(buff_eph_pub);
try { try {
var domain = hex_to_ascii(man["Domain"]); var domain = hex_to_ascii(man["Domain"]);
} catch { } catch {
@@ -150,15 +141,12 @@ function parse_manifest() {
} }
display_manifest({"Sequence":seq, display_manifest({"Sequence":seq,
"Domain":domain, "Domain":domain,
"Master Public Key": public_key, "Master Public Key": public_key,
"Ephemeral Public Key":ephemeral_public_key}) "Ephemeral Public Key":ephemeral_public_key})
//This is the message that was signed by the validator's private key. //This is the message that was signed by the validator's private key.
let message = "[domain-attestation-blob:" + domain + ":" + public_key + "]"; let message = "[domain-attestation-blob:" + domain + ":" + public_key + "]";
const url = "https://" + domain + TOML_PATH + "?v=" + query_param++; const url = "https://" + domain + TOML_PATH + "?v=" + query_param++;