forked from node-saml/xml-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
101 lines (90 loc) · 3.21 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Type definitions for @node-saml/xml-crypto
// Project: https://github.com/node-saml/xml-crypto#readme
// Original definitions by: Eric Heikes <https://github.com/eheikes>
// Max Chehab <https://github.com/maxchehab>
/// <reference types="node" />
import { SelectedValue } from 'xpath';
export class HashAlgorithm {
getAlgorithmName(): string;
getHash(xml: string): string;
}
export interface Reference {
xpath: string;
transforms?: ReadonlyArray<string> | undefined;
digestAlgorithm?: string | undefined;
uri?: string | undefined;
digestValue?: string | undefined;
inclusiveNamespacesPrefixList?: string | undefined;
isEmptyUri?: boolean | undefined;
}
export class SignatureAlgorithm {
getAlgorithmName(): string;
getSignature(signedInfo: Node, signingKey: Buffer): string;
}
export class TransformationAlgorithm {
getAlgorithmName(): string;
process(node: Node): string;
}
export class SignedXml {
static CanonicalizationAlgorithms: {[uri: string]: new () => TransformationAlgorithm };
static HashAlgorithms: {[uri: string]: new () => HashAlgorithm};
static SignatureAlgorithms: {[uri: string]: new () => SignatureAlgorithm};
canonicalizationAlgorithm: string;
inclusiveNamespacesPrefixList: string;
keyInfoProvider: KeyInfo;
references: Reference[];
signatureAlgorithm: string;
signingKey: Buffer | string;
validationErrors: string[];
constructor(idMode?: string | null, options?: {
canonicalizationAlgorithm?: string | undefined
inclusiveNamespacesPrefixList?: string | undefined
idAttribute?: string | undefined
implicitTransforms?: ReadonlyArray<string> | undefined
signatureAlgorithm?: string | undefined
})
addReference(
xpath: string,
transforms?: ReadonlyArray<string>,
digestAlgorithm?: string,
uri?: string,
digestValue?: string,
inclusiveNamespacesPrefixList?: string,
isEmptyUri?: boolean
): void;
checkSignature(xml: string): boolean;
computeSignature(
xml: string,
opts?: {
prefix?: string | undefined,
attrs?: {[key: string]: any} | undefined,
location?: {
reference: string,
action: 'append' | 'prepend' | 'before' | 'after'
} | undefined,
existingPrefixes?: {[prefix: string]: string} | undefined
}
): void;
getOriginalXmlWithIds(): string;
getSignatureXml(): string;
getSignedXml(): string;
loadSignature(signatureNode: string | Node): void;
}
export interface KeyInfo {
getKey(keyInfo?: Node[] | null): Buffer;
getKeyInfo(key?: string, prefix?: string): string;
attrs?: {[key: string]: any} | undefined;
}
export class FileKeyInfo implements KeyInfo {
file: string;
constructor(file?: string);
getKey(keyInfo?: Node[] | null): Buffer;
getKeyInfo(key?: string, prefix?: string): string;
}
export class StringKeyInfo implements KeyInfo {
key: string;
constructor(key?: string);
getKey(keyInfo?: Node[] | null): Buffer;
getKeyInfo(key?: string, prefix?: string): string;
}
export function xpath(node: Node, xpath: string): SelectedValue[];