UNPKG

ec-sri-invoice-signer

Version:
24 lines (23 loc) 1.05 kB
/** * Inclusive XML canonicalization (http://www.w3.org/TR/2001/REC-xml-c14n-20010315). * * This delegates to the spec-compliant implementation shipped by `xml-crypto` * (parsing via `@xmldom/xmldom`) instead of a hand-rolled canonicalizer. * * A canonicalization target that is only a fragment of a larger document (e.g. * the SignedInfo/KeyInfo/SignedProperties sections, which live inside the * ds:Signature element and inherit its namespace declarations) references * prefixes that are declared on an ancestor rather than in the fragment itself. * A namespace-aware parser rejects such undeclared prefixes, and inclusive c14n * must in any case render those inherited namespaces on the fragment's apex * element. Both concerns are solved by declaring them on the apex before * parsing; pass them via `options.inheritedNamespaces`. */ interface Namespace { prefix?: string; uri: string; } declare const c14nCanonicalize: (xml: string, options?: { inheritedNamespaces: Namespace[]; }) => string; export { c14nCanonicalize };