samlesa 2.13.0 → 2.14.1

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.

Potentially problematic release.


This version of samlesa might be problematic. Click here for more details.

Files changed (149) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -65
  3. package/build/.idea/deployment.xml +14 -0
  4. package/{src → build}/.idea/modules.xml +1 -1
  5. package/build/.idea/workspace.xml +57 -0
  6. package/build/index.js +18 -54
  7. package/build/index.js.map +1 -1
  8. package/build/src/api.js +18 -24
  9. package/build/src/api.js.map +1 -1
  10. package/build/src/binding-post.js +337 -365
  11. package/build/src/binding-post.js.map +1 -1
  12. package/build/src/binding-redirect.js +312 -340
  13. package/build/src/binding-redirect.js.map +1 -1
  14. package/build/src/binding-simplesign.js +201 -229
  15. package/build/src/binding-simplesign.js.map +1 -1
  16. package/build/src/entity-idp.js +119 -127
  17. package/build/src/entity-idp.js.map +1 -1
  18. package/build/src/entity-sp.js +88 -96
  19. package/build/src/entity-sp.js.map +1 -1
  20. package/build/src/entity.js +193 -225
  21. package/build/src/entity.js.map +1 -1
  22. package/build/src/extractor.js +361 -369
  23. package/build/src/extractor.js.map +1 -1
  24. package/build/src/flow.js +313 -320
  25. package/build/src/flow.js.map +1 -1
  26. package/build/src/libsaml.js +693 -721
  27. package/build/src/libsaml.js.map +1 -1
  28. package/build/src/metadata-idp.js +119 -127
  29. package/build/src/metadata-idp.js.map +1 -1
  30. package/build/src/metadata-sp.js +223 -231
  31. package/build/src/metadata-sp.js.map +1 -1
  32. package/build/src/metadata.js +138 -166
  33. package/build/src/metadata.js.map +1 -1
  34. package/build/src/types.js +4 -11
  35. package/build/src/types.js.map +1 -1
  36. package/build/src/urn.js +204 -212
  37. package/build/src/urn.js.map +1 -1
  38. package/build/src/utility.js +277 -292
  39. package/build/src/utility.js.map +1 -1
  40. package/build/src/validator.js +24 -27
  41. package/build/src/validator.js.map +1 -1
  42. package/package.json +19 -14
  43. package/types/api.d.ts +15 -0
  44. package/types/api.d.ts.map +1 -0
  45. package/types/binding-post.d.ts +48 -0
  46. package/types/binding-post.d.ts.map +1 -0
  47. package/types/binding-redirect.d.ts +54 -0
  48. package/types/binding-redirect.d.ts.map +1 -0
  49. package/types/binding-simplesign.d.ts +41 -0
  50. package/types/binding-simplesign.d.ts.map +1 -0
  51. package/types/entity-idp.d.ts +38 -0
  52. package/types/entity-idp.d.ts.map +1 -0
  53. package/types/entity-sp.d.ts +38 -0
  54. package/types/entity-sp.d.ts.map +1 -0
  55. package/types/entity.d.ts +100 -0
  56. package/types/entity.d.ts.map +1 -0
  57. package/types/extractor.d.ts +26 -0
  58. package/types/extractor.d.ts.map +1 -0
  59. package/types/flow.d.ts +7 -0
  60. package/types/flow.d.ts.map +1 -0
  61. package/types/index.d.ts +11 -10
  62. package/types/index.d.ts.map +1 -0
  63. package/types/libsaml.d.ts +208 -0
  64. package/types/libsaml.d.ts.map +1 -0
  65. package/types/metadata-idp.d.ts +25 -0
  66. package/types/metadata-idp.d.ts.map +1 -0
  67. package/types/metadata-sp.d.ts +37 -0
  68. package/types/metadata-sp.d.ts.map +1 -0
  69. package/types/metadata.d.ts +58 -0
  70. package/types/metadata.d.ts.map +1 -0
  71. package/types/src/api.d.ts +15 -13
  72. package/types/src/api.d.ts.map +1 -0
  73. package/types/src/binding-post.d.ts +48 -47
  74. package/types/src/binding-post.d.ts.map +1 -0
  75. package/types/src/binding-redirect.d.ts +54 -53
  76. package/types/src/binding-redirect.d.ts.map +1 -0
  77. package/types/src/binding-simplesign.d.ts +41 -40
  78. package/types/src/binding-simplesign.d.ts.map +1 -0
  79. package/types/src/entity-idp.d.ts +38 -37
  80. package/types/src/entity-idp.d.ts.map +1 -0
  81. package/types/src/entity-sp.d.ts +38 -36
  82. package/types/src/entity-sp.d.ts.map +1 -0
  83. package/types/src/entity.d.ts +100 -101
  84. package/types/src/entity.d.ts.map +1 -0
  85. package/types/src/extractor.d.ts +26 -25
  86. package/types/src/extractor.d.ts.map +1 -0
  87. package/types/src/flow.d.ts +7 -6
  88. package/types/src/flow.d.ts.map +1 -0
  89. package/types/src/libsaml.d.ts +208 -209
  90. package/types/src/libsaml.d.ts.map +1 -0
  91. package/types/src/metadata-idp.d.ts +25 -24
  92. package/types/src/metadata-idp.d.ts.map +1 -0
  93. package/types/src/metadata-sp.d.ts +37 -36
  94. package/types/src/metadata-sp.d.ts.map +1 -0
  95. package/types/src/metadata.d.ts +58 -59
  96. package/types/src/metadata.d.ts.map +1 -0
  97. package/types/src/types.d.ts +128 -129
  98. package/types/src/types.d.ts.map +1 -0
  99. package/types/src/urn.d.ts +195 -194
  100. package/types/src/urn.d.ts.map +1 -0
  101. package/types/src/utility.d.ts +133 -134
  102. package/types/src/utility.d.ts.map +1 -0
  103. package/types/src/validator.d.ts +4 -3
  104. package/types/src/validator.d.ts.map +1 -0
  105. package/types/types.d.ts +128 -0
  106. package/types/types.d.ts.map +1 -0
  107. package/types/urn.d.ts +195 -0
  108. package/types/urn.d.ts.map +1 -0
  109. package/types/utility.d.ts +133 -0
  110. package/types/utility.d.ts.map +1 -0
  111. package/types/validator.d.ts +4 -0
  112. package/types/validator.d.ts.map +1 -0
  113. package/.editorconfig +0 -19
  114. package/.github/FUNDING.yml +0 -1
  115. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  116. package/.idea/modules.xml +0 -8
  117. package/.idea/vcs.xml +0 -6
  118. package/.pre-commit.sh +0 -15
  119. package/.snyk +0 -8
  120. package/.travis.yml +0 -29
  121. package/Makefile +0 -25
  122. package/index.d.ts +0 -10
  123. package/index.js +0 -19
  124. package/index.js.map +0 -1
  125. package/index.ts +0 -28
  126. package/qodana.yaml +0 -29
  127. package/src/.idea/src.iml +0 -12
  128. package/src/.idea/vcs.xml +0 -6
  129. package/src/api.ts +0 -36
  130. package/src/binding-post.ts +0 -348
  131. package/src/binding-redirect.ts +0 -356
  132. package/src/binding-simplesign.ts +0 -238
  133. package/src/entity-idp.ts +0 -153
  134. package/src/entity-sp.ts +0 -114
  135. package/src/entity.ts +0 -243
  136. package/src/extractor.ts +0 -392
  137. package/src/flow.ts +0 -467
  138. package/src/libsaml.ts +0 -895
  139. package/src/metadata-idp.ts +0 -146
  140. package/src/metadata-sp.ts +0 -268
  141. package/src/metadata.ts +0 -166
  142. package/src/types.ts +0 -153
  143. package/src/urn.ts +0 -211
  144. package/src/utility.ts +0 -319
  145. package/src/validator.ts +0 -39
  146. package/tsconfig.json +0 -38
  147. package/tslint.json +0 -35
  148. package/types.d.ts +0 -2
  149. /package/{.idea/samlify.iml → build/.idea/build.iml} +0 -0
@@ -1,209 +1,208 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { MetadataInterface } from './metadata.js';
4
- /**
5
- * 生成 SAML Attribute 元素(不带 XML 声明头)
6
- * @param {Array} attributeData - 属性配置数据
7
- * @returns {string} SAML Attribute XML 字符串
8
- */
9
- export interface SignatureConstructor {
10
- rawSamlMessage: string;
11
- referenceTagXPath?: string;
12
- privateKey: string;
13
- privateKeyPass?: string;
14
- signatureAlgorithm: string;
15
- signingCert: string | Buffer;
16
- isBase64Output?: boolean;
17
- signatureConfig?: any;
18
- isMessageSigned?: boolean;
19
- transformationAlgorithms?: string[];
20
- }
21
- export interface SignatureVerifierOptions {
22
- metadata?: MetadataInterface;
23
- keyFile?: string;
24
- signatureAlgorithm?: string;
25
- }
26
- export interface ExtractorResult {
27
- [key: string]: any;
28
- signature?: string | string[];
29
- issuer?: string | string[];
30
- nameID?: string;
31
- notexist?: boolean;
32
- }
33
- export interface LoginResponseAttribute {
34
- name: string;
35
- nameFormat: string;
36
- valueXsiType: string;
37
- valueTag: string;
38
- valueXmlnsXs?: string;
39
- valueXmlnsXsi?: string;
40
- type?: string | string[];
41
- }
42
- export interface LoginResponseAdditionalTemplates {
43
- attributeStatementTemplate?: AttributeStatementTemplate;
44
- attributeTemplate?: AttributeTemplate;
45
- }
46
- export interface BaseSamlTemplate {
47
- context: string;
48
- }
49
- export interface LoginResponseTemplate extends BaseSamlTemplate {
50
- attributes?: LoginResponseAttribute[];
51
- additionalTemplates?: LoginResponseAdditionalTemplates;
52
- }
53
- export interface AttributeStatementTemplate extends BaseSamlTemplate {
54
- }
55
- export interface AttributeTemplate extends BaseSamlTemplate {
56
- }
57
- export interface LoginRequestTemplate extends BaseSamlTemplate {
58
- }
59
- export interface LogoutRequestTemplate extends BaseSamlTemplate {
60
- }
61
- export interface LogoutResponseTemplate extends BaseSamlTemplate {
62
- }
63
- export type KeyUse = 'signing' | 'encryption';
64
- export interface KeyComponent {
65
- [key: string]: any;
66
- }
67
- export interface LibSamlInterface {
68
- getQueryParamByType: (type: string) => string;
69
- createXPath: (local: any, isExtractAll?: boolean) => string;
70
- replaceTagsByValue: (rawXML: string, tagValues: any) => string;
71
- attributeStatementBuilder: (attributes: LoginResponseAttribute[], attributeTemplate: AttributeTemplate, attributeStatementTemplate: AttributeStatementTemplate) => string;
72
- constructSAMLSignature: (opts: SignatureConstructor) => string;
73
- verifySignature: (xml: string, opts: SignatureVerifierOptions) => [boolean, any];
74
- createKeySection: (use: KeyUse, cert: string | Buffer) => {};
75
- constructMessageSignature: (octetString: string, key: string, passphrase?: string, isBase64?: boolean, signingAlgorithm?: string) => string;
76
- verifyMessageSignature: (metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string) => boolean;
77
- getKeyInfo: (x509Certificate: string, signatureConfig?: any) => void;
78
- encryptAssertion: (sourceEntity: any, targetEntity: any, entireXML: string) => Promise<string>;
79
- decryptAssertion: (here: any, entireXML: string) => Promise<[string, any]>;
80
- getSigningScheme: (sigAlg: string) => string | null;
81
- getDigestMethod: (sigAlg: string) => string | null;
82
- nrsaAliasMapping: any;
83
- defaultLoginRequestTemplate: LoginRequestTemplate;
84
- defaultLoginResponseTemplate: LoginResponseTemplate;
85
- defaultAttributeStatementTemplate: AttributeStatementTemplate;
86
- defaultAttributeTemplate: AttributeTemplate;
87
- defaultLogoutRequestTemplate: LogoutRequestTemplate;
88
- defaultLogoutResponseTemplate: LogoutResponseTemplate;
89
- }
90
- declare const _default: {
91
- createXPath: (local: any, isExtractAll?: boolean | undefined) => string;
92
- getQueryParamByType: (type: string) => "SAMLRequest" | "SAMLResponse";
93
- defaultLoginRequestTemplate: {
94
- context: string;
95
- };
96
- defaultLoginResponseTemplate: {
97
- context: string;
98
- attributes: never[];
99
- additionalTemplates: {
100
- attributeStatementTemplate: {
101
- context: string;
102
- };
103
- attributeTemplate: {
104
- context: string;
105
- };
106
- };
107
- };
108
- defaultAttributeStatementTemplate: {
109
- context: string;
110
- };
111
- defaultAttributeTemplate: {
112
- context: string;
113
- };
114
- defaultLogoutRequestTemplate: {
115
- context: string;
116
- };
117
- defaultLogoutResponseTemplate: {
118
- context: string;
119
- };
120
- defaultAttributeValueTemplate: {
121
- context: string;
122
- };
123
- /**
124
- * @desc Replace the tag (e.g. {tag}) inside the raw XML
125
- * @param {string} rawXML raw XML string used to do keyword replacement
126
- * @param {array} tagValues tag values
127
- * @return {string}
128
- */
129
- replaceTagsByValue(rawXML: string, tagValues: Record<string, unknown>): string;
130
- /**
131
- * @desc Helper function to build the AttributeStatement tag
132
- * @param {LoginResponseAttribute} attributes an array of attribute configuration
133
- * @param {AttributeTemplate} attributeTemplate the attribute tag template to be used
134
- * @param {AttributeStatementTemplate} attributeStatementTemplate the attributeStatement tag template to be used
135
- * @return {string}
136
- */
137
- /** For Test */
138
- attributeStatementBuilder(attributeData: any[]): string;
139
- /**
140
- * @desc Construct the XML signature for POST binding
141
- * @param {string} rawSamlMessage request/response xml string
142
- * @param {string} referenceTagXPath reference uri
143
- * @param {string} privateKey declares the private key
144
- * @param {string} passphrase passphrase of the private key [optional]
145
- * @param {string|buffer} signingCert signing certificate
146
- * @param {string} signatureAlgorithm signature algorithm
147
- * @param {string[]} transformationAlgorithms canonicalization and transformation Algorithms
148
- * @return {string} base64 encoded string
149
- */
150
- constructSAMLSignature(opts: SignatureConstructor): string;
151
- /**
152
- * @desc Verify the XML signature
153
- * @param {string} xml xml
154
- * @param {SignatureVerifierOptions} opts cert declares the X509 certificate
155
- * @return {[boolean, string | null]} - A tuple where:
156
- * - The first element is `true` if the signature is valid, `false` otherwise.
157
- * - The second element is the cryptographically authenticated assertion node as a string, or `null` if not found.
158
- */
159
- verifySignature(xml: string, opts: SignatureVerifierOptions): (string | boolean)[] | (boolean | null)[];
160
- /**
161
- * @desc Helper function to create the key section in metadata (abstraction for signing and encrypt use)
162
- * @param {string} use type of certificate (e.g. signing, encrypt)
163
- * @param {string} certString declares the certificate String
164
- * @return {object} object used in xml module
165
- */
166
- createKeySection(use: KeyUse, certString: string | Buffer): KeyComponent;
167
- /**
168
- * SAML 消息签名 (符合 SAML V2.0 绑定规范)
169
- * @param octetString - 要签名的原始数据 (OCTET STRING)
170
- * @param key - PEM 格式私钥
171
- * @param passphrase - 私钥密码 (如果有加密)
172
- * @param isBase64 - 是否返回 base64 编码 (默认 true)
173
- * @param signingAlgorithm - 签名算法 (默认 'rsa-sha256')
174
- * @returns 消息签名
175
- */
176
- constructMessageSignature(octetString: string | Buffer, key: string | Buffer, passphrase?: string | undefined, isBase64?: boolean, signingAlgorithm?: string): string | Buffer;
177
- verifyMessageSignature(metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string | undefined): boolean;
178
- /**
179
- * @desc Get the public key in string format
180
- * @param {string} x509Certificate certificate
181
- * @return {string} public key
182
- */
183
- getKeyInfo(x509Certificate: string, signatureConfig?: any): {
184
- getKeyInfo: () => string;
185
- getKey: () => string;
186
- };
187
- /**
188
- * @desc Encrypt the assertion section in Response
189
- * @param {Entity} sourceEntity source entity
190
- * @param {Entity} targetEntity target entity
191
- * @param {string} xml response in xml string format
192
- * @return {Promise} a promise to resolve the finalized xml
193
- */
194
- encryptAssertion(sourceEntity: any, targetEntity: any, xml?: string | undefined): Promise<string>;
195
- /**
196
- * @desc Decrypt the assertion section in Response
197
- * @param {string} type only accept SAMLResponse to proceed decryption
198
- * @param {Entity} here this entity
199
- * @param {Entity} from from the entity where the message is sent
200
- * @param {string} entireXML response in xml string format
201
- * @return {function} a promise to get back the entire xml with decrypted assertion
202
- */
203
- decryptAssertion(here: any, entireXML: string): Promise<[string, any]>;
204
- /**
205
- * @desc Check if the xml string is valid and bounded
206
- */
207
- isValidXml(input: string): Promise<any>;
208
- };
209
- export default _default;
1
+ import type { MetadataInterface } from './metadata.js';
2
+ /**
3
+ * 生成 SAML Attribute 元素(不带 XML 声明头)
4
+ * @param {Array} attributeData - 属性配置数据
5
+ * @returns {string} SAML Attribute XML 字符串
6
+ */
7
+ export interface SignatureConstructor {
8
+ rawSamlMessage: string;
9
+ referenceTagXPath?: string;
10
+ privateKey: string;
11
+ privateKeyPass?: string;
12
+ signatureAlgorithm: string;
13
+ signingCert: string | Buffer;
14
+ isBase64Output?: boolean;
15
+ signatureConfig?: any;
16
+ isMessageSigned?: boolean;
17
+ transformationAlgorithms?: string[];
18
+ }
19
+ export interface SignatureVerifierOptions {
20
+ metadata?: MetadataInterface;
21
+ keyFile?: string;
22
+ signatureAlgorithm?: string;
23
+ }
24
+ export interface ExtractorResult {
25
+ [key: string]: any;
26
+ signature?: string | string[];
27
+ issuer?: string | string[];
28
+ nameID?: string;
29
+ notexist?: boolean;
30
+ }
31
+ export interface LoginResponseAttribute {
32
+ name: string;
33
+ nameFormat: string;
34
+ valueXsiType: string;
35
+ valueTag: string;
36
+ valueXmlnsXs?: string;
37
+ valueXmlnsXsi?: string;
38
+ type?: string | string[];
39
+ }
40
+ export interface LoginResponseAdditionalTemplates {
41
+ attributeStatementTemplate?: AttributeStatementTemplate;
42
+ attributeTemplate?: AttributeTemplate;
43
+ }
44
+ export interface BaseSamlTemplate {
45
+ context: string;
46
+ }
47
+ export interface LoginResponseTemplate extends BaseSamlTemplate {
48
+ attributes?: LoginResponseAttribute[];
49
+ additionalTemplates?: LoginResponseAdditionalTemplates;
50
+ }
51
+ export interface AttributeStatementTemplate extends BaseSamlTemplate {
52
+ }
53
+ export interface AttributeTemplate extends BaseSamlTemplate {
54
+ }
55
+ export interface LoginRequestTemplate extends BaseSamlTemplate {
56
+ }
57
+ export interface LogoutRequestTemplate extends BaseSamlTemplate {
58
+ }
59
+ export interface LogoutResponseTemplate extends BaseSamlTemplate {
60
+ }
61
+ export type KeyUse = 'signing' | 'encryption';
62
+ export interface KeyComponent {
63
+ [key: string]: any;
64
+ }
65
+ export interface LibSamlInterface {
66
+ getQueryParamByType: (type: string) => string;
67
+ createXPath: (local: any, isExtractAll?: boolean) => string;
68
+ replaceTagsByValue: (rawXML: string, tagValues: any) => string;
69
+ attributeStatementBuilder: (attributes: LoginResponseAttribute[], attributeTemplate: AttributeTemplate, attributeStatementTemplate: AttributeStatementTemplate) => string;
70
+ constructSAMLSignature: (opts: SignatureConstructor) => string;
71
+ verifySignature: (xml: string, opts: SignatureVerifierOptions) => [boolean, any];
72
+ createKeySection: (use: KeyUse, cert: string | Buffer) => {};
73
+ constructMessageSignature: (octetString: string, key: string, passphrase?: string, isBase64?: boolean, signingAlgorithm?: string) => string;
74
+ verifyMessageSignature: (metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string) => boolean;
75
+ getKeyInfo: (x509Certificate: string, signatureConfig?: any) => void;
76
+ encryptAssertion: (sourceEntity: any, targetEntity: any, entireXML: string) => Promise<string>;
77
+ decryptAssertion: (here: any, entireXML: string) => Promise<[string, any]>;
78
+ getSigningScheme: (sigAlg: string) => string | null;
79
+ getDigestMethod: (sigAlg: string) => string | null;
80
+ nrsaAliasMapping: any;
81
+ defaultLoginRequestTemplate: LoginRequestTemplate;
82
+ defaultLoginResponseTemplate: LoginResponseTemplate;
83
+ defaultAttributeStatementTemplate: AttributeStatementTemplate;
84
+ defaultAttributeTemplate: AttributeTemplate;
85
+ defaultLogoutRequestTemplate: LogoutRequestTemplate;
86
+ defaultLogoutResponseTemplate: LogoutResponseTemplate;
87
+ }
88
+ declare const _default: {
89
+ createXPath: (local: any, isExtractAll?: boolean) => string;
90
+ getQueryParamByType: (type: string) => "SAMLRequest" | "SAMLResponse";
91
+ defaultLoginRequestTemplate: {
92
+ context: string;
93
+ };
94
+ defaultLoginResponseTemplate: {
95
+ context: string;
96
+ attributes: never[];
97
+ additionalTemplates: {
98
+ attributeStatementTemplate: {
99
+ context: string;
100
+ };
101
+ attributeTemplate: {
102
+ context: string;
103
+ };
104
+ };
105
+ };
106
+ defaultAttributeStatementTemplate: {
107
+ context: string;
108
+ };
109
+ defaultAttributeTemplate: {
110
+ context: string;
111
+ };
112
+ defaultLogoutRequestTemplate: {
113
+ context: string;
114
+ };
115
+ defaultLogoutResponseTemplate: {
116
+ context: string;
117
+ };
118
+ defaultAttributeValueTemplate: {
119
+ context: string;
120
+ };
121
+ /**
122
+ * @desc Replace the tag (e.g. {tag}) inside the raw XML
123
+ * @param {string} rawXML raw XML string used to do keyword replacement
124
+ * @param {array} tagValues tag values
125
+ * @return {string}
126
+ */
127
+ replaceTagsByValue(rawXML: string, tagValues: Record<string, unknown>): string;
128
+ /**
129
+ * @desc Helper function to build the AttributeStatement tag
130
+ * @param {LoginResponseAttribute} attributes an array of attribute configuration
131
+ * @param {AttributeTemplate} attributeTemplate the attribute tag template to be used
132
+ * @param {AttributeStatementTemplate} attributeStatementTemplate the attributeStatement tag template to be used
133
+ * @return {string}
134
+ */
135
+ /** For Test */
136
+ attributeStatementBuilder(attributeData: any[]): string;
137
+ /**
138
+ * @desc Construct the XML signature for POST binding
139
+ * @param {string} rawSamlMessage request/response xml string
140
+ * @param {string} referenceTagXPath reference uri
141
+ * @param {string} privateKey declares the private key
142
+ * @param {string} passphrase passphrase of the private key [optional]
143
+ * @param {string|buffer} signingCert signing certificate
144
+ * @param {string} signatureAlgorithm signature algorithm
145
+ * @param {string[]} transformationAlgorithms canonicalization and transformation Algorithms
146
+ * @return {string} base64 encoded string
147
+ */
148
+ constructSAMLSignature(opts: SignatureConstructor): string;
149
+ /**
150
+ * @desc Verify the XML signature
151
+ * @param {string} xml xml
152
+ * @param {SignatureVerifierOptions} opts cert declares the X509 certificate
153
+ * @return {[boolean, string | null]} - A tuple where:
154
+ * - The first element is `true` if the signature is valid, `false` otherwise.
155
+ * - The second element is the cryptographically authenticated assertion node as a string, or `null` if not found.
156
+ */
157
+ verifySignature(xml: string, opts: SignatureVerifierOptions): (string | boolean)[] | (boolean | null)[];
158
+ /**
159
+ * @desc Helper function to create the key section in metadata (abstraction for signing and encrypt use)
160
+ * @param {string} use type of certificate (e.g. signing, encrypt)
161
+ * @param {string} certString declares the certificate String
162
+ * @return {object} object used in xml module
163
+ */
164
+ createKeySection(use: KeyUse, certString: string | Buffer): KeyComponent;
165
+ /**
166
+ * SAML 消息签名 (符合 SAML V2.0 绑定规范)
167
+ * @param octetString - 要签名的原始数据 (OCTET STRING)
168
+ * @param key - PEM 格式私钥
169
+ * @param passphrase - 私钥密码 (如果有加密)
170
+ * @param isBase64 - 是否返回 base64 编码 (默认 true)
171
+ * @param signingAlgorithm - 签名算法 (默认 'rsa-sha256')
172
+ * @returns 消息签名
173
+ */
174
+ constructMessageSignature(octetString: string | Buffer, key: string | Buffer, passphrase?: string, isBase64?: boolean, signingAlgorithm?: string): string | Buffer;
175
+ verifyMessageSignature(metadata: any, octetString: string, signature: string | Buffer, verifyAlgorithm?: string): boolean;
176
+ /**
177
+ * @desc Get the public key in string format
178
+ * @param {string} x509Certificate certificate
179
+ * @return {string} public key
180
+ */
181
+ getKeyInfo(x509Certificate: string, signatureConfig?: any): {
182
+ getKeyInfo: () => string;
183
+ getKey: () => string;
184
+ };
185
+ /**
186
+ * @desc Encrypt the assertion section in Response
187
+ * @param {Entity} sourceEntity source entity
188
+ * @param {Entity} targetEntity target entity
189
+ * @param {string} xml response in xml string format
190
+ * @return {Promise} a promise to resolve the finalized xml
191
+ */
192
+ encryptAssertion(sourceEntity: any, targetEntity: any, xml?: string): Promise<string>;
193
+ /**
194
+ * @desc Decrypt the assertion section in Response
195
+ * @param {string} type only accept SAMLResponse to proceed decryption
196
+ * @param {Entity} here this entity
197
+ * @param {Entity} from from the entity where the message is sent
198
+ * @param {string} entireXML response in xml string format
199
+ * @return {function} a promise to get back the entire xml with decrypted assertion
200
+ */
201
+ decryptAssertion(here: any, entireXML: string): Promise<[string, any]>;
202
+ /**
203
+ * @desc Check if the xml string is valid and bounded
204
+ */
205
+ isValidXml(input: string): Promise<any>;
206
+ };
207
+ export default _default;
208
+ //# sourceMappingURL=libsaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libsaml.d.ts","sourceRoot":"","sources":["../../src/libsaml.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAiCrD;;;;GAIG;AAGH,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA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CAAC;IACtB,2BAA2B,EAAE,oBAAoB,CAAC;IAClD,4BAA4B,EAAE,qBAAqB,CAAC;IACpD,iCAAiC,EAAE,0BAA0B,CAAC;IAC9D,wBAAwB,EAAE,iBAAiB,CAAC;IAC5C,4BAA4B,EAAE,qBAAqB,CAAC;IACpD,6BAA6B,EAAE,sBAAsB,CAAC;CACvD;;6CAoH4C,OAAO,KAAG,MAAM;gCA5GxB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmJvC;;;;;OAKG;+BACwB,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAS9E;;;;;;OAMG;IAmCH,eAAe;6CAC0B,GAAG,EAAE,GAAG,MAAM;IAyCvD;;;;;;;;;;OAUG;iCAC0B,oBAAoB;IA+CjD;;;;;;;OAOG;yBAEkB,MAAM,QAAQ,wBAAwB;IAyL3D;;;;;OAKG;0BACmB,MAAM,cAAc,MAAM,GAAG,MAAM,GAAG,YAAY;IAuBxE;;;;;;;;OAQG;2CAGY,MAAM,GAAG,MAAM,OACvB,MAAM,GAAG,MAAM,eACP,MAAM,aACT,OAAO,qBACC,MAAM,GACvB,MAAM,GAAG,MAAM;uDA8BH,MAAM,aACR,MAAM,GAAG,MAAM,oBACR,MAAM;IAc1B;;;;OAIG;gCACyB,MAAM,oBAAmB,GAAG;;;;IAWxD;;;;;;OAMG;iEAEgD,MAAM;IAqDzD;;;;;;;OAOG;2CAC+B,MAAM;IAkCxC;;OAEG;sBACqB,MAAM;;AA4BlC,wBAAyB"}
@@ -1,24 +1,25 @@
1
- /**
2
- * @file metadata-idp.ts
3
- * @author tngan
4
- * @desc Metadata of identity provider
5
- */
6
- import Metadata, { MetadataInterface } from './metadata.js';
7
- import { MetadataIdpConstructor } from './types.js';
8
- export interface IdpMetadataInterface extends MetadataInterface {
9
- }
10
- export default function (meta: MetadataIdpConstructor): IdpMetadata;
11
- export declare class IdpMetadata extends Metadata {
12
- constructor(meta: MetadataIdpConstructor);
13
- /**
14
- * @desc Get the preference whether it wants a signed request
15
- * @return {boolean} WantAuthnRequestsSigned
16
- */
17
- isWantAuthnRequestsSigned(): boolean;
18
- /**
19
- * @desc Get the entity endpoint for single sign on service
20
- * @param {string} binding protocol binding (e.g. redirect, post)
21
- * @return {string/object} location
22
- */
23
- getSingleSignOnService(binding: string): string | object;
24
- }
1
+ /**
2
+ * @file metadata-idp.ts
3
+ * @author tngan
4
+ * @desc Metadata of identity provider
5
+ */
6
+ import Metadata, { type MetadataInterface } from './metadata.js';
7
+ import type { MetadataIdpConstructor } from './types.js';
8
+ export interface IdpMetadataInterface extends MetadataInterface {
9
+ }
10
+ export default function (meta: MetadataIdpConstructor): IdpMetadata;
11
+ export declare class IdpMetadata extends Metadata {
12
+ constructor(meta: MetadataIdpConstructor);
13
+ /**
14
+ * @desc Get the preference whether it wants a signed request
15
+ * @return {boolean} WantAuthnRequestsSigned
16
+ */
17
+ isWantAuthnRequestsSigned(): boolean;
18
+ /**
19
+ * @desc Get the entity endpoint for single sign on service
20
+ * @param {string} binding protocol binding (e.g. redirect, post)
21
+ * @return {string/object} location
22
+ */
23
+ getSingleSignOnService(binding: string): string | object;
24
+ }
25
+ //# sourceMappingURL=metadata-idp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-idp.d.ts","sourceRoot":"","sources":["../../src/metadata-idp.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AACF,OAAO,QAAQ,EAAE,EAAE,KAAM,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAQ,KAAK,EAAsB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAM9E,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;CAE9D;AAKD,MAAM,CAAC,OAAO,WAAU,IAAI,EAAE,sBAAsB,eAEnD;AAED,qBAAa,WAAY,SAAQ,QAAQ;gBAE3B,IAAI,EAAE,sBAAsB;IA6FxC;;;MAGE;IACF,yBAAyB,IAAI,OAAO;IAQpC;;;;MAIE;IACF,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;CAUzD"}
@@ -1,36 +1,37 @@
1
- /**
2
- * @file metadata-sp.ts
3
- * @author tngan
4
- * @desc Metadata of service provider
5
- */
6
- import Metadata, { MetadataInterface } from './metadata.js';
7
- import { MetadataSpConstructor } from './types.js';
8
- export interface SpMetadataInterface extends MetadataInterface {
9
- }
10
- export default function (meta: MetadataSpConstructor): SpMetadata;
11
- /**
12
- * @desc SP Metadata is for creating Service Provider, provides a set of API to manage the actions in SP.
13
- */
14
- export declare class SpMetadata extends Metadata {
15
- /**
16
- * @param {object/string} meta (either xml string or configuration in object)
17
- * @return {object} prototypes including public functions
18
- */
19
- constructor(meta: MetadataSpConstructor);
20
- /**
21
- * @desc Get the preference whether it wants a signed assertion response
22
- * @return {boolean} Wantassertionssigned
23
- */
24
- isWantAssertionsSigned(): boolean;
25
- /**
26
- * @desc Get the preference whether it signs request
27
- * @return {boolean} Authnrequestssigned
28
- */
29
- isAuthnRequestSigned(): boolean;
30
- /**
31
- * @desc Get the entity endpoint for assertion consumer service
32
- * @param {string} binding protocol binding (e.g. redirect, post)
33
- * @return {string/[string]} URL of endpoint(s)
34
- */
35
- getAssertionConsumerService(binding: string): string | string[];
36
- }
1
+ /**
2
+ * @file metadata-sp.ts
3
+ * @author tngan
4
+ * @desc Metadata of service provider
5
+ */
6
+ import Metadata, { type MetadataInterface } from './metadata.js';
7
+ import type { MetadataSpConstructor } from './types.js';
8
+ export interface SpMetadataInterface extends MetadataInterface {
9
+ }
10
+ export default function (meta: MetadataSpConstructor): SpMetadata;
11
+ /**
12
+ * @desc SP Metadata is for creating Service Provider, provides a set of API to manage the actions in SP.
13
+ */
14
+ export declare class SpMetadata extends Metadata {
15
+ /**
16
+ * @param {object/string} meta (either xml string or configuration in object)
17
+ * @return {object} prototypes including public functions
18
+ */
19
+ constructor(meta: MetadataSpConstructor);
20
+ /**
21
+ * @desc Get the preference whether it wants a signed assertion response
22
+ * @return {boolean} Wantassertionssigned
23
+ */
24
+ isWantAssertionsSigned(): boolean;
25
+ /**
26
+ * @desc Get the preference whether it signs request
27
+ * @return {boolean} Authnrequestssigned
28
+ */
29
+ isAuthnRequestSigned(): boolean;
30
+ /**
31
+ * @desc Get the entity endpoint for assertion consumer service
32
+ * @param {string} binding protocol binding (e.g. redirect, post)
33
+ * @return {string/[string]} URL of endpoint(s)
34
+ */
35
+ getAssertionConsumerService(binding: string): string | string[];
36
+ }
37
+ //# sourceMappingURL=metadata-sp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-sp.d.ts","sourceRoot":"","sources":["../../src/metadata-sp.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AACF,OAAO,QAAQ,EAAE,EAAC,KAAK,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAMxD,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;CAE7D;AAcD,MAAM,CAAC,OAAO,WAAU,IAAI,EAAE,qBAAqB,cAElD;AAED;;EAEE;AACF,qBAAa,UAAW,SAAQ,QAAQ;IAEtC;;;MAGE;gBACU,IAAI,EAAE,qBAAqB;IA2LvC;;;MAGE;IACK,sBAAsB,IAAI,OAAO;IAGxC;;;MAGE;IACK,oBAAoB,IAAI,OAAO;IAGtC;;;;MAIE;IACK,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE;CAoBvE"}