You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-6Lines changed: 45 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -258,17 +258,20 @@ The `SignedXml` constructor provides an abstraction for sign and verify xml docu
258
258
-`keyInfoAttributes` - object - default `{}` - a hash of attributes and values `attrName: value` to add to the KeyInfo node
259
259
-`getKeyInfoContent` - function - default `noop` - a function that returns the content of the KeyInfo node
260
260
-`getCertFromKeyInfo` - function - default `SignedXml.getCertFromKeyInfo` - a function that returns the certificate from the `<KeyInfo />` node
261
+
-`objects` - array - default `undefined` - an array of objects defining the content of the `<Object/>` nodes
261
262
262
263
#### API
263
264
264
265
A `SignedXml` object provides the following methods:
265
266
266
267
To sign xml documents:
267
268
268
-
-`addReference(xpath, transforms, digestAlgorithm)` - adds a reference to a xml element where:
269
+
-`addReference({ xpath, transforms, digestAlgorithm, id, type })` - adds a reference to a xml element where:
269
270
-`xpath` - a string containing a XPath expression referencing a xml element
270
271
-`transforms` - an array of [transform algorithms](#canonicalization-and-transformation-algorithms), the referenced element will be transformed for each value in the array
271
272
-`digestAlgorithm` - one of the supported [hashing algorithms](#hashing-algorithms)
273
+
-`id` - an optional `Id` attribute to add to the reference element
274
+
-`type` - the optional `Type` attribute to add to the reference element (represented as a URI)
272
275
-`computeSignature(xml, [options])` - compute the signature of the given xml where:
273
276
-`xml` - a string containing a xml document
274
277
-`options` - an object with the following properties:
@@ -513,12 +516,12 @@ Set `action` to one of the following:
513
516
- after - append to specific node (use the `referenceNode` property)
514
517
515
518
```javascript
516
-
var SignedXml =require("xml-crypto").SignedXml,
517
-
fs =require("fs");
519
+
constSignedXml=require("xml-crypto").SignedXml;
520
+
constfs=require("fs");
518
521
519
-
var xml ="<library>"+"<book>"+"<name>Harry Potter</name>"+"</book>"+"</library>";
0 commit comments