xml-crypto-next 7.0.3 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/c14n-canonicalization-2.d.ts +37 -0
- package/build/c14n-canonicalization-2.d.ts.map +1 -0
- package/build/c14n-canonicalization-2.js +228 -0
- package/build/c14n-canonicalization.d.ts +48 -0
- package/build/c14n-canonicalization.d.ts.map +1 -0
- package/{lib → build}/c14n-canonicalization.js +95 -75
- package/{lib → build}/enveloped-signature.d.ts +1 -1
- package/build/enveloped-signature.d.ts.map +1 -0
- package/{lib → build}/enveloped-signature.js +4 -9
- package/build/exclusive-canonicalization.d.ts +57 -0
- package/build/exclusive-canonicalization.d.ts.map +1 -0
- package/{lib → build}/exclusive-canonicalization.js +116 -102
- package/{lib → build}/hash-algorithms.d.ts +5 -1
- package/build/hash-algorithms.d.ts.map +1 -0
- package/build/hash-algorithms.js +70 -0
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +23 -0
- package/build/signature-algorithms.d.ts +244 -0
- package/build/signature-algorithms.d.ts.map +1 -0
- package/build/signature-algorithms.js +480 -0
- package/{lib → build}/signed-xml.d.ts +2 -2
- package/build/signed-xml.d.ts.map +1 -0
- package/{lib → build}/signed-xml.js +143 -102
- package/{lib → build}/types.d.ts +43 -6
- package/build/types.d.ts.map +1 -0
- package/{lib → build}/types.js +1 -5
- package/{lib → build}/utils.d.ts +34 -4
- package/build/utils.d.ts.map +1 -0
- package/{lib → build}/utils.js +189 -62
- package/build/xmldsig2-transform.d.ts +18 -0
- package/build/xmldsig2-transform.d.ts.map +1 -0
- package/build/xmldsig2-transform.js +65 -0
- package/package.json +74 -73
- package/types/c14n-canonicalization-2.d.ts +38 -0
- package/types/c14n-canonicalization-2.d.ts.map +1 -0
- package/types/c14n-canonicalization.d.ts +49 -0
- package/types/c14n-canonicalization.d.ts.map +1 -0
- package/types/enveloped-signature.d.ts +8 -0
- package/types/enveloped-signature.d.ts.map +1 -0
- package/types/exclusive-canonicalization.d.ts +58 -0
- package/types/exclusive-canonicalization.d.ts.map +1 -0
- package/types/hash-algorithms.d.ts +26 -0
- package/types/hash-algorithms.d.ts.map +1 -0
- package/types/index.d.ts +10 -0
- package/types/index.d.ts.map +1 -0
- package/types/signature-algorithms.d.ts +112 -0
- package/types/signature-algorithms.d.ts.map +1 -0
- package/types/signed-xml.d.ts +237 -0
- package/types/signed-xml.d.ts.map +1 -0
- package/types/src/c14n-canonicalization-2.d.ts +38 -0
- package/types/src/c14n-canonicalization-2.d.ts.map +1 -0
- package/types/src/c14n-canonicalization.d.ts +49 -0
- package/types/src/c14n-canonicalization.d.ts.map +1 -0
- package/types/src/enveloped-signature.d.ts +8 -0
- package/types/src/enveloped-signature.d.ts.map +1 -0
- package/types/src/exclusive-canonicalization.d.ts +58 -0
- package/types/src/exclusive-canonicalization.d.ts.map +1 -0
- package/types/src/hash-algorithms.d.ts +26 -0
- package/types/src/hash-algorithms.d.ts.map +1 -0
- package/types/src/index.d.ts +10 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/signature-algorithms.d.ts +245 -0
- package/types/src/signature-algorithms.d.ts.map +1 -0
- package/types/src/signed-xml.d.ts +237 -0
- package/types/src/signed-xml.d.ts.map +1 -0
- package/types/src/types.d.ts +182 -0
- package/types/src/types.d.ts.map +1 -0
- package/types/src/utils.d.ts +96 -0
- package/types/src/utils.d.ts.map +1 -0
- package/types/src/xmldsig2-transform.d.ts +19 -0
- package/types/src/xmldsig2-transform.d.ts.map +1 -0
- package/types/types.d.ts +182 -0
- package/types/types.d.ts.map +1 -0
- package/types/utils.d.ts +96 -0
- package/types/utils.d.ts.map +1 -0
- package/types/xmldsig2-transform.d.ts +19 -0
- package/types/xmldsig2-transform.d.ts.map +1 -0
- package/lib/c14n-canonicalization.d.ts +0 -39
- package/lib/c14n-canonicalization.js.map +0 -1
- package/lib/enveloped-signature.js.map +0 -1
- package/lib/exclusive-canonicalization.d.ts +0 -38
- package/lib/exclusive-canonicalization.js.map +0 -1
- package/lib/hash-algorithms.js +0 -84
- package/lib/hash-algorithms.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -28
- package/lib/index.js.map +0 -1
- package/lib/signature-algorithms.d.ts +0 -112
- package/lib/signature-algorithms.js +0 -304
- package/lib/signature-algorithms.js.map +0 -1
- package/lib/signed-xml.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/utils.js.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CanonicalizationOrTransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, NamespacePrefix, RenderedNamespace, XmlVersion } from "./types.ts";
|
|
2
|
+
export declare class C14nCanonicalization implements CanonicalizationOrTransformationAlgorithm {
|
|
3
|
+
protected includeComments: boolean;
|
|
4
|
+
protected xmlVersion: XmlVersion;
|
|
5
|
+
constructor(xmlVersion?: XmlVersion);
|
|
6
|
+
attrCompare(a: Attr, b: Attr): number;
|
|
7
|
+
nsCompare(a: {
|
|
8
|
+
prefix: string;
|
|
9
|
+
namespaceURI: string;
|
|
10
|
+
}, b: {
|
|
11
|
+
prefix: string;
|
|
12
|
+
namespaceURI: string;
|
|
13
|
+
}): number;
|
|
14
|
+
renderAttrs(node: Node): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create the string of all namespace declarations that should appear on this element
|
|
17
|
+
*/
|
|
18
|
+
renderNs(node: Element, prefixesInScope: string[], defaultNs: string, defaultNsForPrefix: Record<string, string>, ancestorNamespaces: NamespacePrefix[]): RenderedNamespace;
|
|
19
|
+
/**
|
|
20
|
+
* Process inner nodes with optimized string building
|
|
21
|
+
*/
|
|
22
|
+
processInner(node: Node, prefixesInScope: string[], defaultNs: string, defaultNsForPrefix: Record<string, string>, ancestorNamespaces: NamespacePrefix[]): string;
|
|
23
|
+
renderComment(node: Comment): string;
|
|
24
|
+
/**
|
|
25
|
+
* Perform canonicalization of the given node
|
|
26
|
+
*/
|
|
27
|
+
process(node: Node, options: CanonicalizationOrTransformationAlgorithmProcessOptions): string;
|
|
28
|
+
getAlgorithmName(): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* C14n with comments support
|
|
32
|
+
*/
|
|
33
|
+
export declare class C14nCanonicalizationWithComments extends C14nCanonicalization {
|
|
34
|
+
constructor(xmlVersion?: XmlVersion);
|
|
35
|
+
getAlgorithmName(): string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* XML 1.1 specific C14n canonicalization
|
|
39
|
+
*/
|
|
40
|
+
export declare class C14nCanonicalizationXml11 extends C14nCanonicalization {
|
|
41
|
+
constructor();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* XML 1.1 C14n with comments support
|
|
45
|
+
*/
|
|
46
|
+
export declare class C14nCanonicalizationWithCommentsXml11 extends C14nCanonicalizationWithComments {
|
|
47
|
+
constructor();
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=c14n-canonicalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c14n-canonicalization.d.ts","sourceRoot":"","sources":["../src/c14n-canonicalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yCAAyC,EACzC,uDAAuD,EACvD,eAAe,EACf,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAOpB,qBAAa,oBAAqB,YAAW,yCAAyC;IACpF,SAAS,CAAC,eAAe,UAAS;IAClC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAS;gBAE7B,UAAU,CAAC,EAAE,UAAU;IAOnC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM;IAoBrC,SAAS,CAAC,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAO3G,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAiC/B;;OAEG;IACH,QAAQ,CACN,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,kBAAkB,EAAE,eAAe,EAAE,GACpC,iBAAiB;IA+EpB;;OAEG;IACH,YAAY,CACV,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,kBAAkB,EAAE,eAAe,EAAE,GACpC,MAAM;IAsDT,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAwCpC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uDAAuD,GAAG,MAAM;IAoB7F,gBAAgB;CAGjB;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,oBAAoB;gBAC5D,UAAU,CAAC,EAAE,UAAU;IAKnC,gBAAgB;CAGjB;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,oBAAoB;;CAIlE;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,gCAAgC;;CAI1F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CanonicalizationOrTransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, CanonicalizationOrTransformAlgorithmType } from "./types.ts";
|
|
2
|
+
export declare class EnvelopedSignature implements CanonicalizationOrTransformationAlgorithm {
|
|
3
|
+
protected includeComments: boolean;
|
|
4
|
+
constructor();
|
|
5
|
+
process(node: Node, options: CanonicalizationOrTransformationAlgorithmProcessOptions): Node;
|
|
6
|
+
getAlgorithmName(): CanonicalizationOrTransformAlgorithmType;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=enveloped-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enveloped-signature.d.ts","sourceRoot":"","sources":["../src/enveloped-signature.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yCAAyC,EACzC,uDAAuD,EACvD,wCAAwC,EACzC,MAAM,YAAY,CAAC;AAEpB,qBAAa,kBAAmB,YAAW,yCAAyC;IAClF,SAAS,CAAC,eAAe,UAAS;;IAMlC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uDAAuD,GAAG,IAAI;IAyC3F,gBAAgB,IAAI,wCAAwC;CAG7D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CanonicalizationOrTransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, XmlVersion } from "./types.ts";
|
|
2
|
+
export declare class ExclusiveCanonicalization implements CanonicalizationOrTransformationAlgorithm {
|
|
3
|
+
protected includeComments: boolean;
|
|
4
|
+
protected xmlVersion: XmlVersion;
|
|
5
|
+
constructor(xmlVersion?: XmlVersion);
|
|
6
|
+
attrCompare(a: Attr, b: Attr): number;
|
|
7
|
+
nsCompare(a: {
|
|
8
|
+
prefix: string;
|
|
9
|
+
namespaceURI: string;
|
|
10
|
+
}, b: {
|
|
11
|
+
prefix: string;
|
|
12
|
+
namespaceURI: string;
|
|
13
|
+
}): number;
|
|
14
|
+
renderAttrs(node: Node): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create the string of all namespace declarations
|
|
17
|
+
*/
|
|
18
|
+
renderNs(node: Element, prefixesInScope: Array<{
|
|
19
|
+
prefix: string;
|
|
20
|
+
namespaceURI: string;
|
|
21
|
+
}>, defaultNs: string, defaultNsForPrefix: Record<string, string>, inclusiveNamespacesPrefixList: string[]): {
|
|
22
|
+
rendered: string;
|
|
23
|
+
newDefaultNs: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Process inner nodes with optimized string building
|
|
27
|
+
*/
|
|
28
|
+
processInner(node: Node, prefixesInScope: Array<{
|
|
29
|
+
prefix: string;
|
|
30
|
+
namespaceURI: string;
|
|
31
|
+
}>, defaultNs: string, defaultNsForPrefix: Record<string, string>, inclusiveNamespacesPrefixList: string[]): string;
|
|
32
|
+
renderComment(node: Comment): string;
|
|
33
|
+
/**
|
|
34
|
+
* Perform canonicalization of the given element node
|
|
35
|
+
*/
|
|
36
|
+
process(elem: Element, options: CanonicalizationOrTransformationAlgorithmProcessOptions): string;
|
|
37
|
+
getAlgorithmName(): string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Exclusive C14n with comments support
|
|
41
|
+
*/
|
|
42
|
+
export declare class ExclusiveCanonicalizationWithComments extends ExclusiveCanonicalization {
|
|
43
|
+
constructor(xmlVersion?: XmlVersion);
|
|
44
|
+
getAlgorithmName(): string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* XML 1.1 specific Exclusive C14n
|
|
48
|
+
*/
|
|
49
|
+
export declare class ExclusiveCanonicalizationXml11 extends ExclusiveCanonicalization {
|
|
50
|
+
constructor();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* XML 1.1 Exclusive C14n with comments support
|
|
54
|
+
*/
|
|
55
|
+
export declare class ExclusiveCanonicalizationWithCommentsXml11 extends ExclusiveCanonicalizationWithComments {
|
|
56
|
+
constructor();
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=exclusive-canonicalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclusive-canonicalization.d.ts","sourceRoot":"","sources":["../src/exclusive-canonicalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yCAAyC,EACzC,uDAAuD,EAEvD,UAAU,EACX,MAAM,YAAY,CAAC;AAuBpB,qBAAa,yBAA0B,YAAW,yCAAyC;IACzF,SAAS,CAAC,eAAe,UAAS;IAClC,SAAS,CAAC,UAAU,EAAE,UA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;CAGjB;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,yBAAyB;;CAI5E;AAED;;GAEG;AACH,qBAAa,0CAA2C,SAAQ,qCAAqC;;CAIpG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HashAlgorithm } from "./types.ts";
|
|
2
|
+
export declare class Sha1 implements HashAlgorithm {
|
|
3
|
+
getHash: (xml: any) => string;
|
|
4
|
+
getAlgorithmName: () => string;
|
|
5
|
+
}
|
|
6
|
+
export declare class Sha224 implements HashAlgorithm {
|
|
7
|
+
getHash: (xml: any) => string;
|
|
8
|
+
getAlgorithmName: () => string;
|
|
9
|
+
}
|
|
10
|
+
export declare class Sha256 implements HashAlgorithm {
|
|
11
|
+
getHash: (xml: any) => string;
|
|
12
|
+
getAlgorithmName: () => string;
|
|
13
|
+
}
|
|
14
|
+
export declare class Sha384 implements HashAlgorithm {
|
|
15
|
+
getHash: (xml: any) => string;
|
|
16
|
+
getAlgorithmName: () => string;
|
|
17
|
+
}
|
|
18
|
+
export declare class Sha512 implements HashAlgorithm {
|
|
19
|
+
getHash: (xml: any) => string;
|
|
20
|
+
getAlgorithmName: () => string;
|
|
21
|
+
}
|
|
22
|
+
export declare class Shake256 implements HashAlgorithm {
|
|
23
|
+
getHash: (xml: any) => string;
|
|
24
|
+
getAlgorithmName: () => string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=hash-algorithms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash-algorithms.d.ts","sourceRoot":"","sources":["../src/hash-algorithms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,qBAAa,IAAK,YAAW,aAAa;IACxC,OAAO,GAAa,QAAG,YAKrB;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,MAAO,YAAW,aAAa;IAC1C,OAAO,GAAa,QAAG,YAKrB;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,MAAO,YAAW,aAAa;IAC1C,OAAO,GAAa,QAAG,YAKrB;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,MAAO,YAAW,aAAa;IAC1C,OAAO,GAAa,QAAG,YAKrB;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,MAAO,YAAW,aAAa;IAC1C,OAAO,GAAa,QAAG,YAKrB;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,QAAS,YAAW,aAAa;IAG5C,OAAO,GAAa,QAAG,YAOrB;IAEF,gBAAgB,eAEd;CACH"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { C14nCanonicalization, C14nCanonicalizationWithComments, C14nCanonicalizationXml11, C14nCanonicalizationWithCommentsXml11, } from "./c14n-canonicalization";
|
|
2
|
+
export { C14nCanonicalization2, C14nCanonicalization2WithComments, } from "./c14n-canonicalization-2";
|
|
3
|
+
export { ExclusiveCanonicalization, ExclusiveCanonicalizationWithComments, ExclusiveCanonicalizationXml11, ExclusiveCanonicalizationWithCommentsXml11, } from "./exclusive-canonicalization";
|
|
4
|
+
export { XmlDsig2Transform } from "./xmldsig2-transform";
|
|
5
|
+
export { SignedXml } from "./signed-xml";
|
|
6
|
+
export * from "./types";
|
|
7
|
+
export * from "./utils";
|
|
8
|
+
export { Sha1, Sha224, Sha256, Sha384, Sha512, Shake256 } from "./hash-algorithms";
|
|
9
|
+
export { RsaSha1, RsaSha224, RsaSha256, RsaSha384, RsaSha512, RsaSha256Mgf1, RsaSha384Mgf1, RsaSha512Mgf1, EcdsaSha1, EcdsaSha224, EcdsaSha256, EcdsaSha384, EcdsaSha512, DsaSha1, DsaSha256, Ed25519, Ed448, HmacSha1, HmacSha224, HmacSha256, HmacSha384, HmacSha512, } from "./signature-algorithms";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,yBAAyB,EACzB,qCAAqC,GACtC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,qCAAqC,EACrC,8BAA8B,EAC9B,0CAA0C,GAC3C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EAEL,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EAET,aAAa,EACb,aAAa,EACb,aAAa,EAEb,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EAEX,OAAO,EACP,SAAS,EAET,OAAO,EACP,KAAK,EAEL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type SignatureAlgorithm } from "./types";
|
|
2
|
+
export declare class RsaSha1 implements SignatureAlgorithm {
|
|
3
|
+
getSignature: any;
|
|
4
|
+
verifySignature: any;
|
|
5
|
+
getAlgorithmName: () => string;
|
|
6
|
+
}
|
|
7
|
+
export declare class RsaSha224 implements SignatureAlgorithm {
|
|
8
|
+
getSignature: any;
|
|
9
|
+
verifySignature: any;
|
|
10
|
+
getAlgorithmName: () => string;
|
|
11
|
+
}
|
|
12
|
+
export declare class RsaSha256 implements SignatureAlgorithm {
|
|
13
|
+
getSignature: any;
|
|
14
|
+
verifySignature: any;
|
|
15
|
+
getAlgorithmName: () => string;
|
|
16
|
+
}
|
|
17
|
+
export declare class RsaSha384 implements SignatureAlgorithm {
|
|
18
|
+
getSignature: any;
|
|
19
|
+
verifySignature: any;
|
|
20
|
+
getAlgorithmName: () => string;
|
|
21
|
+
}
|
|
22
|
+
export declare class RsaSha512 implements SignatureAlgorithm {
|
|
23
|
+
getSignature: any;
|
|
24
|
+
verifySignature: any;
|
|
25
|
+
getAlgorithmName: () => string;
|
|
26
|
+
}
|
|
27
|
+
export declare class RsaSha256Mgf1 implements SignatureAlgorithm {
|
|
28
|
+
getSignature: any;
|
|
29
|
+
verifySignature: any;
|
|
30
|
+
getAlgorithmName: () => string;
|
|
31
|
+
}
|
|
32
|
+
export declare class RsaSha384Mgf1 implements SignatureAlgorithm {
|
|
33
|
+
getSignature: any;
|
|
34
|
+
verifySignature: any;
|
|
35
|
+
getAlgorithmName: () => string;
|
|
36
|
+
}
|
|
37
|
+
export declare class RsaSha512Mgf1 implements SignatureAlgorithm {
|
|
38
|
+
getSignature: any;
|
|
39
|
+
verifySignature: any;
|
|
40
|
+
getAlgorithmName: () => string;
|
|
41
|
+
}
|
|
42
|
+
export declare class EcdsaSha1 implements SignatureAlgorithm {
|
|
43
|
+
getSignature: any;
|
|
44
|
+
verifySignature: any;
|
|
45
|
+
getAlgorithmName: () => string;
|
|
46
|
+
}
|
|
47
|
+
export declare class EcdsaSha224 implements SignatureAlgorithm {
|
|
48
|
+
getSignature: any;
|
|
49
|
+
verifySignature: any;
|
|
50
|
+
getAlgorithmName: () => string;
|
|
51
|
+
}
|
|
52
|
+
export declare class EcdsaSha256 implements SignatureAlgorithm {
|
|
53
|
+
getSignature: any;
|
|
54
|
+
verifySignature: any;
|
|
55
|
+
getAlgorithmName: () => string;
|
|
56
|
+
}
|
|
57
|
+
export declare class EcdsaSha384 implements SignatureAlgorithm {
|
|
58
|
+
getSignature: any;
|
|
59
|
+
verifySignature: any;
|
|
60
|
+
getAlgorithmName: () => string;
|
|
61
|
+
}
|
|
62
|
+
export declare class EcdsaSha512 implements SignatureAlgorithm {
|
|
63
|
+
getSignature: any;
|
|
64
|
+
verifySignature: any;
|
|
65
|
+
getAlgorithmName: () => string;
|
|
66
|
+
}
|
|
67
|
+
export declare class DsaSha1 implements SignatureAlgorithm {
|
|
68
|
+
getSignature: any;
|
|
69
|
+
verifySignature: any;
|
|
70
|
+
getAlgorithmName: () => string;
|
|
71
|
+
}
|
|
72
|
+
export declare class DsaSha256 implements SignatureAlgorithm {
|
|
73
|
+
getSignature: any;
|
|
74
|
+
verifySignature: any;
|
|
75
|
+
getAlgorithmName: () => string;
|
|
76
|
+
}
|
|
77
|
+
export declare class Ed25519 implements SignatureAlgorithm {
|
|
78
|
+
getSignature: any;
|
|
79
|
+
verifySignature: any;
|
|
80
|
+
getAlgorithmName: () => string;
|
|
81
|
+
}
|
|
82
|
+
export declare class Ed448 implements SignatureAlgorithm {
|
|
83
|
+
getSignature: any;
|
|
84
|
+
verifySignature: any;
|
|
85
|
+
getAlgorithmName: () => string;
|
|
86
|
+
}
|
|
87
|
+
export declare class HmacSha1 implements SignatureAlgorithm {
|
|
88
|
+
getSignature: any;
|
|
89
|
+
verifySignature: any;
|
|
90
|
+
getAlgorithmName: () => string;
|
|
91
|
+
}
|
|
92
|
+
export declare class HmacSha224 implements SignatureAlgorithm {
|
|
93
|
+
getSignature: any;
|
|
94
|
+
verifySignature: any;
|
|
95
|
+
getAlgorithmName: () => string;
|
|
96
|
+
}
|
|
97
|
+
export declare class HmacSha256 implements SignatureAlgorithm {
|
|
98
|
+
getSignature: any;
|
|
99
|
+
verifySignature: any;
|
|
100
|
+
getAlgorithmName: () => string;
|
|
101
|
+
}
|
|
102
|
+
export declare class HmacSha384 implements SignatureAlgorithm {
|
|
103
|
+
getSignature: any;
|
|
104
|
+
verifySignature: any;
|
|
105
|
+
getAlgorithmName: () => string;
|
|
106
|
+
}
|
|
107
|
+
export declare class HmacSha512 implements SignatureAlgorithm {
|
|
108
|
+
getSignature: any;
|
|
109
|
+
verifySignature: any;
|
|
110
|
+
getAlgorithmName: () => string;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=signature-algorithms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature-algorithms.d.ts","sourceRoot":"","sources":["../src/signature-algorithms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAkC,MAAM,SAAS,CAAC;AAMlF,qBAAa,OAAQ,YAAW,kBAAkB;IAChD,YAAY,MAQV;IAEF,eAAe,MAQb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,SAAU,YAAW,kBAAkB;IAClD,YAAY,MAOV;IAEF,eAAe,MAOb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,SAAU,YAAW,kBAAkB;IAClD,YAAY,MAQV;IAEF,eAAe,MAQb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,SAAU,YAAW,kBAAkB;IAClD,YAAY,MAOV;IAEF,eAAe,MAOb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,SAAU,YAAW,kBAAkB;IAClD,YAAY,MAQV;IAEF,eAAe,MAQb;IAEF,gBAAgB,eAEd;CACH;AAMD,qBAAa,aAAc,YAAW,kBAAkB;IACtD,YAAY,MAkBV;IAEF,eAAe,MAmBb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,aAAc,YAAW,kBAAkB;IACtD,YAAY,MAkBV;IAEF,eAAe,MAmBb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,aAAc,YAAW,kBAAkB;IACtD,YAAY,MAkBV;IAEF,eAAe,MAmBb;IAEF,gBAAgB,eAEd;CACH;AAMD,qBAAa,SAAU,YAAW,kBAAkB;IAClD,YAAY,MAOV;IAEF,eAAe,MAOb;IAEF,gBAAgB,eAEd;CACH;AAED,qBAAa,WAAY,YAAW,kBAAkB;IACpD,YAAY,MAOV;IAEF,eAAe,MAOb;IAEF,gBAAgB,eAEd;CAC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TransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, ComputeSignatureOptions, ErrorFirstCallback, GetKeyInfoContentArgs, HashAlgorithm, HashAlgorithmType, ObjectAttributes, Reference, SignatureAlgorithm, SignatureAlgorithmType, SignedXmlOptions } from "./types";
|
|
2
|
+
import * as crypto from "crypto";
|
|
3
|
+
export declare class SignedXml {
|
|
4
|
+
idMode?: "wssecurity";
|
|
5
|
+
idAttributes: string[];
|
|
6
|
+
/**
|
|
7
|
+
* A {@link Buffer} or pem encoded {@link String} containing your private key
|
|
8
|
+
*/
|
|
9
|
+
privateKey?: crypto.KeyLike;
|
|
10
|
+
publicCert?: crypto.KeyLike;
|
|
11
|
+
/**
|
|
12
|
+
* One of the supported signature algorithms.
|
|
13
|
+
* @see {@link SignatureAlgorithmType}
|
|
14
|
+
*/
|
|
15
|
+
signatureAlgorithm?: SignatureAlgorithmType;
|
|
16
|
+
/**
|
|
17
|
+
* Rules used to convert an XML document into its canonical form.
|
|
18
|
+
*/
|
|
19
|
+
canonicalizationAlgorithm?: CanonicalizationAlgorithmType;
|
|
20
|
+
/**
|
|
21
|
+
* It specifies a list of namespace prefixes that should be considered "inclusive" during the canonicalization process.
|
|
22
|
+
*/
|
|
23
|
+
inclusiveNamespacesPrefixList: string[];
|
|
24
|
+
namespaceResolver: XPathNSResolver;
|
|
25
|
+
implicitTransforms: ReadonlyArray<CanonicalizationOrTransformAlgorithmType>;
|
|
26
|
+
keyInfoAttributes: {
|
|
27
|
+
[attrName: string]: string;
|
|
28
|
+
};
|
|
29
|
+
getKeyInfoContent: typeof SignedXml.getKeyInfoContent;
|
|
30
|
+
getCertFromKeyInfo: typeof SignedXml.getCertFromKeyInfo;
|
|
31
|
+
objects?: Array<{
|
|
32
|
+
content: string;
|
|
33
|
+
attributes?: ObjectAttributes;
|
|
34
|
+
}>;
|
|
35
|
+
private id;
|
|
36
|
+
private signedXml;
|
|
37
|
+
private signatureXml;
|
|
38
|
+
private signatureNode;
|
|
39
|
+
private signatureValue;
|
|
40
|
+
private originalXmlWithIds;
|
|
41
|
+
private keyInfo;
|
|
42
|
+
/**
|
|
43
|
+
* Contains the references that were signed.
|
|
44
|
+
* @see {@link Reference}
|
|
45
|
+
*/
|
|
46
|
+
private references;
|
|
47
|
+
/**
|
|
48
|
+
* Contains the canonicalized XML of the references that were validly signed.
|
|
49
|
+
*
|
|
50
|
+
* This populates with the canonical XML of the reference only after
|
|
51
|
+
* verifying the signature is cryptographically authentic.
|
|
52
|
+
*/
|
|
53
|
+
private signedReferences;
|
|
54
|
+
/**
|
|
55
|
+
* To add a new transformation algorithm create a new class that implements the {@link TransformationAlgorithm} interface, and register it here. More info: {@link https://github.com/node-saml/xml-crypto#customizing-algorithms|Customizing Algorithms}
|
|
56
|
+
*/
|
|
57
|
+
CanonicalizationAlgorithms: Record<CanonicalizationOrTransformAlgorithmType, new () => CanonicalizationOrTransformationAlgorithm>;
|
|
58
|
+
/**
|
|
59
|
+
* To add a new hash algorithm create a new class that implements the {@link HashAlgorithm} interface, and register it here. More info: {@link https://github.com/node-saml/xml-crypto#customizing-algorithms|Customizing Algorithms}
|
|
60
|
+
*/
|
|
61
|
+
HashAlgorithms: Record<HashAlgorithmType, new () => HashAlgorithm>;
|
|
62
|
+
/**
|
|
63
|
+
* To add a new signature algorithm create a new class that implements the {@link SignatureAlgorithm} interface, and register it here. More info: {@link https://github.com/node-saml/xml-crypto#customizing-algorithms|Customizing Algorithms}
|
|
64
|
+
*/
|
|
65
|
+
SignatureAlgorithms: Record<SignatureAlgorithmType, new () => SignatureAlgorithm>;
|
|
66
|
+
static defaultNsForPrefix: {
|
|
67
|
+
ds: string;
|
|
68
|
+
};
|
|
69
|
+
static noop: () => any;
|
|
70
|
+
/**
|
|
71
|
+
* The SignedXml constructor provides an abstraction for sign and verify xml documents. The object is constructed using
|
|
72
|
+
* @param options {@link SignedXmlOptions}
|
|
73
|
+
*/
|
|
74
|
+
constructor(options?: SignedXmlOptions);
|
|
75
|
+
/**
|
|
76
|
+
* Due to key-confusion issues, it's risky to have both hmac
|
|
77
|
+
* and digital signature algorithms enabled at the same time.
|
|
78
|
+
* This enables HMAC and disables other signing algorithms.
|
|
79
|
+
*/
|
|
80
|
+
enableHMAC(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Builds the contents of a KeyInfo element as an XML string.
|
|
83
|
+
*
|
|
84
|
+
* For example, if the value of the prefix argument is 'foo', then
|
|
85
|
+
* the resultant XML string will be "<foo:X509Data></foo:X509Data>"
|
|
86
|
+
*
|
|
87
|
+
* @return an XML string representation of the contents of a KeyInfo element, or `null` if no `KeyInfo` element should be included
|
|
88
|
+
*/
|
|
89
|
+
static getKeyInfoContent({ publicCert, prefix }: GetKeyInfoContentArgs): string | null;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the value of the signing certificate based on the contents of the
|
|
92
|
+
* specified KeyInfo.
|
|
93
|
+
*
|
|
94
|
+
* @param keyInfo KeyInfo element (@see https://www.w3.org/TR/2008/REC-xmldsig-core-20080610/#sec-X509Data)
|
|
95
|
+
* @return the signing certificate as a string in PEM format
|
|
96
|
+
*/
|
|
97
|
+
static getCertFromKeyInfo(keyInfo?: Node | null): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Validates the signature of the provided XML document synchronously using the configured key info provider.
|
|
100
|
+
*
|
|
101
|
+
* @param xml The XML document containing the signature to be validated.
|
|
102
|
+
* @returns `true` if the signature is valid
|
|
103
|
+
* @throws Error if no key info resolver is provided.
|
|
104
|
+
*/
|
|
105
|
+
checkSignature(xml: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Validates the signature of the provided XML document synchronously using the configured key info provider.
|
|
108
|
+
*
|
|
109
|
+
* @param xml The XML document containing the signature to be validated.
|
|
110
|
+
* @param callback Callback function to handle the validation result asynchronously.
|
|
111
|
+
* @throws Error if the last parameter is provided and is not a function, or if no key info resolver is provided.
|
|
112
|
+
*/
|
|
113
|
+
checkSignature(xml: string, callback: (error: Error | null, isValid?: boolean) => void): void;
|
|
114
|
+
private getCanonSignedInfoXml;
|
|
115
|
+
private getCanonReferenceXml;
|
|
116
|
+
private calculateSignatureValue;
|
|
117
|
+
private findSignatureAlgorithm;
|
|
118
|
+
private findCanonicalizationAlgorithm;
|
|
119
|
+
private findHashAlgorithm;
|
|
120
|
+
validateElementAgainstReferences(elemOrXpath: Element | string, doc: Document): Reference;
|
|
121
|
+
private validateReference;
|
|
122
|
+
findSignatures(doc: Node): Node[];
|
|
123
|
+
/**
|
|
124
|
+
* Loads the signature information from the provided XML node or string.
|
|
125
|
+
*
|
|
126
|
+
* @param signatureNode The XML node or string representing the signature.
|
|
127
|
+
*/
|
|
128
|
+
loadSignature(signatureNode: Node | string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Load the reference xml node to a model
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
private loadReference;
|
|
134
|
+
/**
|
|
135
|
+
* Adds a reference to the signature.
|
|
136
|
+
*
|
|
137
|
+
* @param xpath The XPath expression to select the XML nodes to be referenced.
|
|
138
|
+
* @param transforms An array of transform algorithms to be applied to the selected nodes.
|
|
139
|
+
* @param digestAlgorithm The digest algorithm to use for computing the digest value.
|
|
140
|
+
* @param uri The URI identifier for the reference. If empty, an empty URI will be used.
|
|
141
|
+
* @param digestValue The expected digest value for the reference.
|
|
142
|
+
* @param inclusiveNamespacesPrefixList The prefix list for inclusive namespace canonicalization.
|
|
143
|
+
* @param isEmptyUri Indicates whether the URI is empty. Defaults to `false`.
|
|
144
|
+
* @param id An optional `Id` attribute for the reference.
|
|
145
|
+
* @param type An optional `Type` attribute for the reference.
|
|
146
|
+
*/
|
|
147
|
+
addReference({ xpath, transforms, digestAlgorithm, uri, digestValue, inclusiveNamespacesPrefixList, isEmptyUri, id, type, }: Partial<Reference> & Pick<Reference, "xpath">): void;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the list of references.
|
|
150
|
+
*/
|
|
151
|
+
getReferences(): Reference[];
|
|
152
|
+
getSignedReferences(): string[];
|
|
153
|
+
/**
|
|
154
|
+
* Compute the signature of the given XML (using the already defined settings).
|
|
155
|
+
*
|
|
156
|
+
* @param xml The XML to compute the signature for.
|
|
157
|
+
* @param callback A callback function to handle the signature computation asynchronously.
|
|
158
|
+
* @returns void
|
|
159
|
+
* @throws TypeError If the xml can not be parsed.
|
|
160
|
+
*/
|
|
161
|
+
computeSignature(xml: string): void;
|
|
162
|
+
/**
|
|
163
|
+
* Compute the signature of the given XML (using the already defined settings).
|
|
164
|
+
*
|
|
165
|
+
* @param xml The XML to compute the signature for.
|
|
166
|
+
* @param callback A callback function to handle the signature computation asynchronously.
|
|
167
|
+
* @returns void
|
|
168
|
+
* @throws TypeError If the xml can not be parsed.
|
|
169
|
+
*/
|
|
170
|
+
computeSignature(xml: string, callback: ErrorFirstCallback<SignedXml>): void;
|
|
171
|
+
/**
|
|
172
|
+
* Compute the signature of the given XML (using the already defined settings).
|
|
173
|
+
*
|
|
174
|
+
* @param xml The XML to compute the signature for.
|
|
175
|
+
* @param opts An object containing options for the signature computation.
|
|
176
|
+
* @returns If no callback is provided, returns `this` (the instance of SignedXml).
|
|
177
|
+
* @throws TypeError If the xml can not be parsed, or Error if there were invalid options passed.
|
|
178
|
+
*/
|
|
179
|
+
computeSignature(xml: string, options: ComputeSignatureOptions): void;
|
|
180
|
+
/**
|
|
181
|
+
* Compute the signature of the given XML (using the already defined settings).
|
|
182
|
+
*
|
|
183
|
+
* @param xml The XML to compute the signature for.
|
|
184
|
+
* @param opts An object containing options for the signature computation.
|
|
185
|
+
* @param callback A callback function to handle the signature computation asynchronously.
|
|
186
|
+
* @returns void
|
|
187
|
+
* @throws TypeError If the xml can not be parsed, or Error if there were invalid options passed.
|
|
188
|
+
*/
|
|
189
|
+
computeSignature(xml: string, options: ComputeSignatureOptions, callback: ErrorFirstCallback<SignedXml>): void;
|
|
190
|
+
/**
|
|
191
|
+
* Adds all references to the SignedInfo after the signature placeholder is inserted.
|
|
192
|
+
*/
|
|
193
|
+
private addAllReferences;
|
|
194
|
+
private getKeyInfo;
|
|
195
|
+
/**
|
|
196
|
+
* Creates XML for Object elements to be included in the signature
|
|
197
|
+
*
|
|
198
|
+
* @param prefix Optional namespace prefix
|
|
199
|
+
* @returns XML string with Object elements or empty string if none
|
|
200
|
+
*/
|
|
201
|
+
private getObjects;
|
|
202
|
+
getCanonXml(transforms: Reference["transforms"], node: Node, options?: CanonicalizationOrTransformationAlgorithmProcessOptions): string;
|
|
203
|
+
/**
|
|
204
|
+
* Ensure an element has Id attribute. If not create it with unique value.
|
|
205
|
+
* Work with both normal and wssecurity Id flavour
|
|
206
|
+
*/
|
|
207
|
+
private ensureHasId;
|
|
208
|
+
/**
|
|
209
|
+
* Create the SignedInfo element
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
212
|
+
private createSignedInfo;
|
|
213
|
+
/**
|
|
214
|
+
* Create the Signature element
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
private createSignature;
|
|
218
|
+
/**
|
|
219
|
+
* Returns just the signature part, must be called only after {@link computeSignature}
|
|
220
|
+
*
|
|
221
|
+
* @returns The signature XML.
|
|
222
|
+
*/
|
|
223
|
+
getSignatureXml(): string;
|
|
224
|
+
/**
|
|
225
|
+
* Returns the original xml with Id attributes added on relevant elements (required for validation), must be called only after {@link computeSignature}
|
|
226
|
+
*
|
|
227
|
+
* @returns The original XML with IDs.
|
|
228
|
+
*/
|
|
229
|
+
getOriginalXmlWithIds(): string;
|
|
230
|
+
/**
|
|
231
|
+
* Returns the original xml document with the signature in it, must be called only after {@link computeSignature}
|
|
232
|
+
*
|
|
233
|
+
* @returns The signed XML.
|
|
234
|
+
*/
|
|
235
|
+
getSignedXml(): string;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=signed-xml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-xml.d.ts","sourceRoot":"","sources":["../src/signed-xml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6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,MAAM;IAI/B;;;;OAIG;IACH,YAAY,IAAI,MAAM;CAGvB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CanonicalizationOrTransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, NamespacePrefix, RenderedNamespace, XmlVersion } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical XML 2.0
|
|
4
|
+
* @see https://www.w3.org/TR/xml-c14n2/
|
|
5
|
+
*
|
|
6
|
+
* Key differences from C14N 1.1:
|
|
7
|
+
* - Inheritable attributes are handled differently
|
|
8
|
+
* - XML base attributes are inherited
|
|
9
|
+
* - XML language attributes are inherited
|
|
10
|
+
* - Default attributes are handled per XML spec
|
|
11
|
+
*/
|
|
12
|
+
export declare class C14nCanonicalization2 implements CanonicalizationOrTransformationAlgorithm {
|
|
13
|
+
protected includeComments: boolean;
|
|
14
|
+
protected xmlVersion: XmlVersion;
|
|
15
|
+
constructor(xmlVersion?: XmlVersion, includeComments?: boolean);
|
|
16
|
+
attrCompare(a: Attr, b: Attr): number;
|
|
17
|
+
nsCompare(a: {
|
|
18
|
+
prefix: string;
|
|
19
|
+
namespaceURI: string;
|
|
20
|
+
}, b: {
|
|
21
|
+
prefix: string;
|
|
22
|
+
namespaceURI: string;
|
|
23
|
+
}): number;
|
|
24
|
+
renderAttrs(node: Node): string;
|
|
25
|
+
renderNs(node: Element, prefixesInScope: string[], defaultNs: string, defaultNsForPrefix: Record<string, string>, ancestorNamespaces: NamespacePrefix[]): RenderedNamespace;
|
|
26
|
+
processInner(node: Node, prefixesInScope: string[], defaultNs: string, defaultNsForPrefix: Record<string, string>, ancestorNamespaces: NamespacePrefix[]): string;
|
|
27
|
+
renderComment(node: Comment): string;
|
|
28
|
+
process(node: Node, options: CanonicalizationOrTransformationAlgorithmProcessOptions): string;
|
|
29
|
+
getAlgorithmName(): string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Canonical XML 2.0 with comments
|
|
33
|
+
*/
|
|
34
|
+
export declare class C14nCanonicalization2WithComments extends C14nCanonicalization2 {
|
|
35
|
+
constructor(xmlVersion?: XmlVersion);
|
|
36
|
+
getAlgorithmName(): string;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=c14n-canonicalization-2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c14n-canonicalization-2.d.ts","sourceRoot":"","sources":["../../src/c14n-canonicalization-2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yCAAyC,EACzC,uDAAuD,EACvD,eAAe,EACf,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;GASG;AACH,qBAAa,qBAAsB,YAAW,yCAAyC;IACrF,SAAS,CAAC,eAAe,UAAS;IAClC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAS;gBAE7B,UAAU,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,OAAO;IAO9D,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM;IAoBrC,SAAS,CAAC,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAO3G,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAiC/B,QAAQ,CACN,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,kBAAkB,EAAE,eAAe,EAAE,GACpC,iBAAiB;IA2EpB,YAAY,CACV,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,kBAAkB,EAAE,eAAe,EAAE,GACpC,MAAM;IAoDT,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAwCpC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uDAAuD,GAAG,MAAM;IAoB7F,gBAAgB;CAGjB;AAED;;GAEG;AACH,qBAAa,iCAAkC,SAAQ,qBAAqB;gBAC9D,UAAU,CAAC,EAAE,UAAU;IAInC,gBAAgB;CAGjB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CanonicalizationOrTransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, NamespacePrefix, RenderedNamespace, XmlVersion } from "./types.ts";
|
|
2
|
+
export declare class C14nCanonicalization implements CanonicalizationOrTransformationAlgorithm {
|
|
3
|
+
protected includeComments: boolean;
|
|
4
|
+
protected xmlVersion: XmlVersion;
|
|
5
|
+
constructor(xmlVersion?: XmlVersion);
|
|
6
|
+
attrCompare(a: Attr, b: Attr): number;
|
|
7
|
+
nsCompare(a: {
|
|
8
|
+
prefix: string;
|
|
9
|
+
namespaceURI: string;
|
|
10
|
+
}, b: {
|
|
11
|
+
prefix: string;
|
|
12
|
+
namespaceURI: string;
|
|
13
|
+
}): number;
|
|
14
|
+
renderAttrs(node: Node): string;
|
|
15
|
+
/**
|
|
16
|
+
* Create the string of all namespace declarations that should appear on this element
|
|
17
|
+
*/
|
|
18
|
+
renderNs(node: Element, prefixesInScope: string[], defaultNs: string, defaultNsForPrefix: Record<string, string>, ancestorNamespaces: NamespacePrefix[]): RenderedNamespace;
|
|
19
|
+
/**
|
|
20
|
+
* Process inner nodes with optimized string building
|
|
21
|
+
*/
|
|
22
|
+
processInner(node: Node, prefixesInScope: string[], defaultNs: string, defaultNsForPrefix: Record<string, string>, ancestorNamespaces: NamespacePrefix[]): string;
|
|
23
|
+
renderComment(node: Comment): string;
|
|
24
|
+
/**
|
|
25
|
+
* Perform canonicalization of the given node
|
|
26
|
+
*/
|
|
27
|
+
process(node: Node, options: CanonicalizationOrTransformationAlgorithmProcessOptions): string;
|
|
28
|
+
getAlgorithmName(): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* C14n with comments support
|
|
32
|
+
*/
|
|
33
|
+
export declare class C14nCanonicalizationWithComments extends C14nCanonicalization {
|
|
34
|
+
constructor(xmlVersion?: XmlVersion);
|
|
35
|
+
getAlgorithmName(): string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* XML 1.1 specific C14n canonicalization
|
|
39
|
+
*/
|
|
40
|
+
export declare class C14nCanonicalizationXml11 extends C14nCanonicalization {
|
|
41
|
+
constructor();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* XML 1.1 C14n with comments support
|
|
45
|
+
*/
|
|
46
|
+
export declare class C14nCanonicalizationWithCommentsXml11 extends C14nCanonicalizationWithComments {
|
|
47
|
+
constructor();
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=c14n-canonicalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c14n-canonicalization.d.ts","sourceRoot":"","sources":["../../src/c14n-canonicalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yCAAyC,EACzC,uDAAuD,EACvD,eAAe,EACf,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAOpB,qBAAa,oBAAqB,YAAW,yCAAyC;IACpF,SAAS,CAAC,eAAe,UAAS;IAClC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAS;gBAE7B,UAAU,CAAC,EAAE,UAAU;IAOnC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM;IAoBrC,SAAS,CAAC,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAO3G,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAiC/B;;OAEG;IACH,QAAQ,CACN,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,kBAAkB,EAAE,eAAe,EAAE,GACpC,iBAAiB;IA+EpB;;OAEG;IACH,YAAY,CACV,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,kBAAkB,EAAE,eAAe,EAAE,GACpC,MAAM;IAsDT,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAwCpC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uDAAuD,GAAG,MAAM;IAoB7F,gBAAgB;CAGjB;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,oBAAoB;gBAC5D,UAAU,CAAC,EAAE,UAAU;IAKnC,gBAAgB;CAGjB;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,oBAAoB;;CAIlE;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,gCAAgC;;CAI1F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CanonicalizationOrTransformationAlgorithm, CanonicalizationOrTransformationAlgorithmProcessOptions, CanonicalizationOrTransformAlgorithmType } from "./types.ts";
|
|
2
|
+
export declare class EnvelopedSignature implements CanonicalizationOrTransformationAlgorithm {
|
|
3
|
+
protected includeComments: boolean;
|
|
4
|
+
constructor();
|
|
5
|
+
process(node: Node, options: CanonicalizationOrTransformationAlgorithmProcessOptions): Node;
|
|
6
|
+
getAlgorithmName(): CanonicalizationOrTransformAlgorithmType;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=enveloped-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enveloped-signature.d.ts","sourceRoot":"","sources":["../../src/enveloped-signature.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yCAAyC,EACzC,uDAAuD,EACvD,wCAAwC,EACzC,MAAM,YAAY,CAAC;AAEpB,qBAAa,kBAAmB,YAAW,yCAAyC;IAClF,SAAS,CAAC,eAAe,UAAS;;IAMlC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uDAAuD,GAAG,IAAI;IAyC3F,gBAAgB,IAAI,wCAAwC;CAG7D"}
|