update dependencies

This commit is contained in:
Vladislav Hristov 2018-06-04 15:30:33 +03:00
parent 8492d94054
commit 90f51544b7
2 changed files with 5 additions and 6 deletions

View File

@ -3,7 +3,7 @@
const crypto = require('crypto'); const crypto = require('crypto');
const { DOMParser, XMLSerializer } = require('xmldom'); const { DOMParser, XMLSerializer } = require('xmldom');
const select = require('xpath.js'); const xpath = require('xpath');
const C14n = require('xml-crypto/lib/c14n-canonicalization').C14nCanonicalization; const C14n = require('xml-crypto/lib/c14n-canonicalization').C14nCanonicalization;
@ -72,7 +72,7 @@ module.exports = class Signer {
// canonicalize the node that has authenticate='true' attribute // canonicalize the node that has authenticate='true' attribute
// const contentToDigest = select(this.doc, '//*[@authenticate="true"]') // const contentToDigest = select(this.doc, '//*[@authenticate="true"]')
const contentToDigest = select(this.doc, "//*[@authenticate='true']") const contentToDigest = xpath.select("//*[@authenticate='true']", this.doc)
.map(x => new C14n().process(x)).join(''); .map(x => new C14n().process(x)).join('');
console.log('digest', 'contentToDigest', contentToDigest); console.log('digest', 'contentToDigest', contentToDigest);
@ -88,7 +88,8 @@ module.exports = class Signer {
console.log('sign =>'); console.log('sign =>');
if (nodeSignatureValue) { if (nodeSignatureValue) {
const contentToSign = (new C14n().process(select(this.doc, '//ds:SignedInfo')[0])).replace('xmlns:ds="http://www.w3.org/2000/09/xmldsig#"', 'xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"'); const select = xpath.useNamespaces({ ds: 'http://www.w3.org/2000/09/xmldsig#' });
const contentToSign = (new C14n().process(select('//ds:SignedInfo', this.doc)[0])).replace('xmlns:ds="http://www.w3.org/2000/09/xmldsig#"', 'xmlns="urn:org:ebics:H004" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"');
nodeSignatureValue.textContent = this.client.x().key.sign(contentToSign, 'base64'); nodeSignatureValue.textContent = this.client.x().key.sign(contentToSign, 'base64');
} }

View File

@ -25,11 +25,9 @@
"moment": "^2.22.1", "moment": "^2.22.1",
"node-rsa": "^0.4.2", "node-rsa": "^0.4.2",
"request": "^2.87.0", "request": "^2.87.0",
"xml-c14n": "0.0.6",
"xml-crypto": "^0.10.1", "xml-crypto": "^0.10.1",
"xmldom": "^0.1.27", "xmldom": "^0.1.27",
"xpath": "0.0.27", "xpath": "0.0.27"
"xpath.js": "^1.1.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^4.19.1", "eslint": "^4.19.1",