Skip to content

Commit

Permalink
more linting and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbarth committed Jun 8, 2023
1 parent fd3c0e0 commit 79b3920
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 222 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"curly": "warn",
"eqeqeq": ["warn", "smart"],
"no-var": "warn",
"prefer-const":"warn"
"prefer-const": "warn"
}
}
}
1 change: 0 additions & 1 deletion lib/enveloped-signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ EnvelopedSignature.prototype.getAlgorithmName = function () {
};

exports.EnvelopedSignature = EnvelopedSignature;

1 change: 0 additions & 1 deletion lib/exclusive-canonicalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,3 @@ ExclusiveCanonicalizationWithComments.prototype.getAlgorithmName = function () {

exports.ExclusiveCanonicalization = ExclusiveCanonicalization;
exports.ExclusiveCanonicalizationWithComments = ExclusiveCanonicalizationWithComments;

2 changes: 0 additions & 2 deletions lib/signed-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,6 @@ SignedXml.prototype.getSignedXml = function () {
return this.signedXml;
};


exports.SignedXml = SignedXml;
exports.StringKeyInfo = StringKeyInfo;
exports.FileKeyInfo = FileKeyInfo;

68 changes: 34 additions & 34 deletions test/signature-integration-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@ var xpath = require("xpath"),
var expect = require("chai").expect;

describe("Signature integration tests", function () {
function verifySignature(xml, expected, xpath) {
var sig = new SignedXml();
sig.signingKey = fs.readFileSync("./test/static/client.pem");
sig.keyInfo = null;

xpath.map(function (n) {
sig.addReference(n);
});

sig.computeSignature(xml);
var signed = sig.getSignedXml();

//fs.writeFileSync("./test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/signedExample.xml", signed)
var expectedContent = fs.readFileSync(expected).toString();
expect(signed, "signature xml different than expected").to.equal(expectedContent);
/*
var spawn = require('child_process').spawn
var proc = spawn('./test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.exe', ['verify'])
proc.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
proc.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
proc.on('exit', function (code) {
test.equal(0, code, "signature validation failed")
test.done()
});
*/
}

it("verify signature", function () {
var xml =
'<root><x xmlns="ns"></x><y z_attr="value" a_attr1="foo"></y><z><ns:w ns:attr="value" xmlns:ns="myns"></ns:w></z></root>';
Expand Down Expand Up @@ -188,37 +222,3 @@ describe("Signature integration tests", function () {
).to.equal(2);
});
});

function verifySignature(xml, expected, xpath) {
var sig = new SignedXml();
sig.signingKey = fs.readFileSync("./test/static/client.pem");
sig.keyInfo = null;

xpath.map(function (n) {
sig.addReference(n);
});

sig.computeSignature(xml);
var signed = sig.getSignedXml();

//fs.writeFileSync("./test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/signedExample.xml", signed)
var expectedContent = fs.readFileSync(expected).toString();
expect(signed, "signature xml different than expected").to.equal(expectedContent);
/*
var spawn = require('child_process').spawn
var proc = spawn('./test/validators/XmlCryptoUtilities/XmlCryptoUtilities/bin/Debug/XmlCryptoUtilities.exe', ['verify'])
proc.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
proc.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
proc.on('exit', function (code) {
test.equal(0, code, "signature validation failed")
test.done()
});
*/
}
Loading

0 comments on commit 79b3920

Please sign in to comment.