From 90f51544b7d411f084c3591eff653bc71df5854f Mon Sep 17 00:00:00 2001 From: Vladislav Hristov Date: Mon, 4 Jun 2018 15:30:33 +0300 Subject: [PATCH] update dependencies --- lib/Signer.js | 7 ++++--- package.json | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Signer.js b/lib/Signer.js index 21cccfc..8db089b 100644 --- a/lib/Signer.js +++ b/lib/Signer.js @@ -3,7 +3,7 @@ const crypto = require('crypto'); const { DOMParser, XMLSerializer } = require('xmldom'); -const select = require('xpath.js'); +const xpath = require('xpath'); 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 // 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(''); console.log('digest', 'contentToDigest', contentToDigest); @@ -88,7 +88,8 @@ module.exports = class Signer { console.log('sign =>'); 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'); } diff --git a/package.json b/package.json index 927344a..dd27479 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,9 @@ "moment": "^2.22.1", "node-rsa": "^0.4.2", "request": "^2.87.0", - "xml-c14n": "0.0.6", "xml-crypto": "^0.10.1", "xmldom": "^0.1.27", - "xpath": "0.0.27", - "xpath.js": "^1.1.0" + "xpath": "0.0.27" }, "devDependencies": { "eslint": "^4.19.1",