edockit
Version:
A JavaScript library for listing, parsing, and verifying the contents and signatures of electronic documents (eDoc) and Associated Signature Containers (ASiC-E), supporting EU eIDAS standards for digital signatures and electronic seals.
52 lines (51 loc) • 2.25 kB
TypeScript
interface CanonMethod {
beforeChildren: (hasElementChildren?: boolean, hasMixedContent?: boolean) => string;
afterChildren: (hasElementChildren?: boolean, hasMixedContent?: boolean) => string;
betweenChildren: (prevIsElement?: boolean, nextIsElement?: boolean, hasMixedContent?: boolean) => string;
afterElement: () => string;
isCanonicalizationMethod?: string;
}
declare const CANONICALIZATION_METHODS: {
default: string;
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315": string;
"http://www.w3.org/2006/12/xml-c14n11": string;
"http://www.w3.org/2001/10/xml-exc-c14n#": string;
};
declare const NODE_TYPES: {
ELEMENT_NODE: number;
TEXT_NODE: number;
};
interface ExcC14NOptions {
inclusiveNamespacePrefixList?: string[];
isStartingNode?: boolean;
}
interface WhitespaceInfo {
hasMixedContent?: boolean;
hasExistingLinebreaks?: boolean;
originalContent?: Record<string, any>;
}
interface NodeWithWhitespace extends Node {
_whitespace?: WhitespaceInfo;
_originalText?: string;
}
declare class XMLCanonicalizer {
private method;
constructor(method?: CanonMethod);
static fromMethod(methodUri: string): XMLCanonicalizer;
static base64Elements: Set<string>;
setMethod(method: CanonMethod): void;
static escapeXml(text: string): string;
static collectNamespaces(node: Node, visibleNamespaces?: Map<string, string>): Map<string, string>;
static collectUsedNamespaces(node: Node, allVisibleNamespaces?: Map<string, string>, inclusivePrefixList?: string[]): Map<string, string>;
static isBase64Element(node: Node): boolean;
static analyzeWhitespace(node: Node): void;
canonicalize(node: NodeWithWhitespace, visibleNamespaces?: Map<string, string>, options?: {
isStartingNode: boolean;
}): string;
canonicalizeExclusive(node: NodeWithWhitespace, visibleNamespaces?: Map<string, string>, options?: ExcC14NOptions): string;
static c14n(node: Node): string;
static c14n11(node: Node): string;
static c14n_exc(node: Node, inclusiveNamespacePrefixList?: string[]): string;
static canonicalize(node: Node, methodUri: string, options?: any): string;
}
export { XMLCanonicalizer, CANONICALIZATION_METHODS, NODE_TYPES };