Commit b1a2687e authored by inso's avatar inso
Browse files

Fix signatures handling in raw documents

parent 822d57d9
......@@ -14,7 +14,9 @@ module.exports = new function() {
raw += "Issuer: " + (json.issuer || json.pubkey) + "\n";
raw += "UniqueID: " + json.uid + '\n';
raw += "Timestamp: " + json.buid + '\n';
raw += json.sig || '';
if (json.sig) {
raw += json.sig + '\n';
}
return dos2unix(raw);
};
......@@ -25,7 +27,9 @@ module.exports = new function() {
raw += "IdtyTimestamp: " + json.idty_buid + '\n';
raw += "IdtySignature: " + json.idty_sig + '\n';
raw += "CertTimestamp: " + json.buid + '\n';
raw += json.sig || '';
if (json.sig) {
raw += json.sig + '\n';
}
return dos2unix(raw);
};
......@@ -34,7 +38,7 @@ module.exports = new function() {
raw += "IdtyUniqueID: " + json.uid + '\n';
raw += "IdtyTimestamp: " + json.buid + '\n';
raw += "IdtySignature: " + json.sig + '\n';
raw += json.revocation;
raw += json.revocation + '\n';
return dos2unix(raw);
};
......
......@@ -59,7 +59,7 @@ function GenericParser (captures, multipleLinesFields, rawerFunc) {
let endOffset = str.match(/\n$/) ? 2 : 1;
obj.signature = sp[sp.length - endOffset];
obj.hash = hashf(str).toUpperCase();
obj.raw = sp.slice(0, sp.length - 1).join('\n') + '\n';
obj.raw = sp.slice(0, sp.length - endOffset).join('\n') + '\n';
var docLF = obj.raw.replace(/\r\n/g, "\n");
if(docLF.match(/\n$/)){
captures.forEach(function (cap) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment