Commit 53e7fdc2 authored by Alberto Inch's avatar Alberto Inch
Browse files

Dinamic attributes search.

parent 2eec52a6
......@@ -76,9 +76,15 @@ class Dsig {
throw new Error('Tag no encontrado.');
}
this.signedInfo.Reference._attributes.URI = `#${tag}`;
}/* else {
_attributes['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance';
}*/
}
if (doc[root[0]]._attributes) {
const attributes = Object.keys(doc[root[0]]._attributes);
for (let i = 0; i < attributes.length; i++) {
if (attributes[i].startsWith('xmlns:')) {
_attributes[attributes[i]] = doc[root[0]]._attributes[attributes[i]];
}
}
}
const hash = this.digest(convert.js2xml({ [root[0]]: doc[root[0]] }, this.signOpt));
this.signedInfo.Reference.DigestValue = hash;
const signedInfoXML = convert.js2xml({
......
{
"name": "pkcs12-xml",
"version": "1.0.1",
"version": "1.0.2",
"description": "Librería para firma de documentos XML con DSIG",
"main": "./lib/dsig",
"scripts": {
......
Markdown is supported
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