Skip to content

Commit e893f62

Browse files
committed
nit readme updates
1 parent 3e97607 commit e893f62

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,12 @@ Set `action` to one of the following:
516516
- after - append to specific node (use the `referenceNode` property)
517517

518518
```javascript
519-
var SignedXml = require("xml-crypto").SignedXml,
520-
fs = require("fs");
519+
const SignedXml = require("xml-crypto").SignedXml;
520+
const fs = require("fs");
521521

522-
var xml = "<library>" + "<book>" + "<name>Harry Potter</name>" + "</book>" + "</library>";
522+
const xml = "<library>" + "<book>" + "<name>Harry Potter</name>" + "</book>" + "</library>";
523523

524-
var sig = new SignedXml({ privateKey: fs.readFileSync("client.pem") });
524+
const sig = new SignedXml({ privateKey: fs.readFileSync("client.pem") });
525525
sig.addReference({
526526
xpath: "//*[local-name(.)='book']",
527527
digestAlgorithm: "http://www.w3.org/2000/09/xmldsig#sha1",
@@ -530,7 +530,7 @@ sig.addReference({
530530
sig.canonicalizationAlgorithm = "http://www.w3.org/2001/10/xml-exc-c14n#";
531531
sig.signatureAlgorithm = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
532532
sig.computeSignature(xml, {
533-
location: { reference: "//*[local-name(.)='book']", action: "after" }, //This will place the signature after the book element
533+
location: { reference: "//*[local-name(.)='book']", action: "after" }, // This will place the signature after the book element
534534
});
535535
```
536536

@@ -539,10 +539,10 @@ sig.computeSignature(xml, {
539539
Use the `objects` option when creating a SignedXml instance to add custom Objects to the signature.
540540

541541
```javascript
542-
var SignedXml = require("xml-crypto").SignedXml,
543-
fs = require("fs");
542+
const SignedXml = require("xml-crypto").SignedXml;
543+
const fs = require("fs");
544544

545-
var xml = "<library>" + "<book>" + "<name>Harry Potter</name>" + "</book>" + "</library>";
545+
const xml = "<library>" + "<book>" + "<name>Harry Potter</name>" + "</book>" + "</library>";
546546

547547
const sig = new SignedXml({
548548
privateKey: fs.readFileSync("client.pem"),
@@ -562,7 +562,7 @@ const sig = new SignedXml({
562562
// Add a reference to the Object element
563563
sig.addReference({
564564
xpath: "//*[@Id='Object1']",
565-
digestAlgorithm: "http://www.w3.org/2000/09/xmldsig#sha1",
565+
digestAlgorithm: "http://www.w3.org/2001/04/xmlenc#sha256",
566566
transforms: ["http://www.w3.org/2001/10/xml-exc-c14n#"],
567567
});
568568

0 commit comments

Comments
 (0)