samlesa 2.12.3 → 2.12.6

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 (66) hide show
  1. package/build/index.js +54 -64
  2. package/build/index.js.map +1 -1
  3. package/build/src/api.js +24 -23
  4. package/build/src/api.js.map +1 -1
  5. package/build/src/binding-post.js +358 -368
  6. package/build/src/binding-post.js.map +1 -1
  7. package/build/src/binding-redirect.js +333 -332
  8. package/build/src/binding-redirect.js.map +1 -1
  9. package/build/src/binding-simplesign.js +222 -232
  10. package/build/src/binding-simplesign.js.map +1 -1
  11. package/build/src/entity-idp.js +132 -130
  12. package/build/src/entity-idp.js.map +1 -1
  13. package/build/src/entity-sp.js +96 -96
  14. package/build/src/entity-sp.js.map +1 -1
  15. package/build/src/entity.js +225 -235
  16. package/build/src/entity.js.map +1 -1
  17. package/build/src/extractor.js +369 -369
  18. package/build/src/extractor.js.map +1 -1
  19. package/build/src/flow.js +320 -319
  20. package/build/src/flow.js.map +1 -1
  21. package/build/src/libsaml.js +660 -641
  22. package/build/src/libsaml.js.map +1 -1
  23. package/build/src/metadata-idp.js +127 -127
  24. package/build/src/metadata-idp.js.map +1 -1
  25. package/build/src/metadata-sp.js +231 -231
  26. package/build/src/metadata-sp.js.map +1 -1
  27. package/build/src/metadata.js +166 -176
  28. package/build/src/metadata.js.map +1 -1
  29. package/build/src/types.js +11 -11
  30. package/build/src/urn.js +212 -212
  31. package/build/src/urn.js.map +1 -1
  32. package/build/src/utility.js +292 -248
  33. package/build/src/utility.js.map +1 -1
  34. package/build/src/validator.js +27 -26
  35. package/build/src/validator.js.map +1 -1
  36. package/index.d.ts +10 -10
  37. package/index.js +18 -18
  38. package/package.json +1 -5
  39. package/qodana.yaml +29 -29
  40. package/src/binding-post.ts +1 -1
  41. package/src/binding-redirect.ts +83 -64
  42. package/src/entity-idp.ts +26 -20
  43. package/src/libsaml.ts +79 -48
  44. package/src/utility.ts +147 -76
  45. package/types/index.d.ts +10 -10
  46. package/types/src/api.d.ts +13 -13
  47. package/types/src/binding-post.d.ts +46 -46
  48. package/types/src/binding-redirect.d.ts +52 -52
  49. package/types/src/binding-simplesign.d.ts +39 -39
  50. package/types/src/entity-idp.d.ts +35 -42
  51. package/types/src/entity-sp.d.ts +36 -36
  52. package/types/src/entity.d.ts +101 -99
  53. package/types/src/extractor.d.ts +25 -25
  54. package/types/src/flow.d.ts +6 -6
  55. package/types/src/libsaml.d.ts +200 -210
  56. package/types/src/metadata-idp.d.ts +24 -24
  57. package/types/src/metadata-sp.d.ts +36 -36
  58. package/types/src/metadata.d.ts +59 -57
  59. package/types/src/types.d.ts +129 -127
  60. package/types/src/urn.d.ts +194 -194
  61. package/types/src/utility.d.ts +134 -134
  62. package/types/src/validator.d.ts +3 -3
  63. package/.idea/compiler.xml +0 -6
  64. package/.idea/deployment.xml +0 -14
  65. package/.idea/jsLibraryMappings.xml +0 -6
  66. package/build/.idea/workspace.xml +0 -58
@@ -1,249 +1,293 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zipObject = zipObject;
4
- exports.flattenDeep = flattenDeep;
5
- exports.last = last;
6
- exports.uniq = uniq;
7
- exports.get = get;
8
- exports.isString = isString;
9
- exports.base64Decode = base64Decode;
10
- exports.inflateString = inflateString;
11
- exports.readPrivateKey = readPrivateKey;
12
- exports.isNonEmptyArray = isNonEmptyArray;
13
- exports.castArrayOpt = castArrayOpt;
14
- exports.notEmpty = notEmpty;
15
- /**
16
- * @file utility.ts
17
- * @author tngan
18
- * @desc Library for some common functions (e.g. de/inflation, en/decoding)
19
- */
20
- const node_forge_1 = require("node-forge");
21
- const pako_1 = require("pako");
22
- const BASE64_STR = 'base64';
23
- /**
24
- * @desc Mimic lodash.zipObject
25
- * @param arr1 {string[]}
26
- * @param arr2 {[]}
27
- */
28
- function zipObject(arr1, arr2, skipDuplicated = true) {
29
- return arr1.reduce((res, l, i) => {
30
- if (skipDuplicated) {
31
- res[l] = arr2[i];
32
- return res;
33
- }
34
- // if key exists, aggregate with array in order to get rid of duplicate key
35
- if (res[l] !== undefined) {
36
- res[l] = Array.isArray(res[l])
37
- ? res[l].concat(arr2[i])
38
- : [res[l]].concat(arr2[i]);
39
- return res;
40
- }
41
- res[l] = arr2[i];
42
- return res;
43
- }, {});
44
- }
45
- /**
46
- * @desc Alternative to lodash.flattenDeep
47
- * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
48
- * @param input {[]}
49
- */
50
- function flattenDeep(input) {
51
- return Array.isArray(input)
52
- ? input.reduce((a, b) => a.concat(flattenDeep(b)), [])
53
- : [input];
54
- }
55
- /**
56
- * @desc Alternative to lodash.last
57
- * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_last
58
- * @param input {[]}
59
- */
60
- function last(input) {
61
- return input.slice(-1)[0];
62
- }
63
- /**
64
- * @desc Alternative to lodash.uniq
65
- * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_uniq
66
- * @param input {string[]}
67
- */
68
- function uniq(input) {
69
- const set = new Set(input);
70
- return [...set];
71
- }
72
- /**
73
- * @desc Alternative to lodash.get
74
- * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get
75
- * @param obj
76
- * @param path
77
- * @param defaultValue
78
- */
79
- function get(obj, path, defaultValue) {
80
- return path.split('.')
81
- .reduce((a, c) => (a && a[c] ? a[c] : (defaultValue || null)), obj);
82
- }
83
- /**
84
- * @desc Check if the input is string
85
- * @param {any} input
86
- */
87
- function isString(input) {
88
- return typeof input === 'string';
89
- }
90
- /**
91
- * @desc Encode string with base64 format
92
- * @param {string} message plain-text message
93
- * @return {string} base64 encoded string
94
- */
95
- function base64Encode(message) {
96
- return Buffer.from(message).toString(BASE64_STR);
97
- }
98
- /**
99
- * @desc Decode string from base64 format
100
- * @param {string} base64Message encoded string
101
- * @param {boolean} isBytes determine the return value type (True: bytes False: string)
102
- * @return {bytes/string} decoded bytes/string depends on isBytes, default is {string}
103
- */
104
- function base64Decode(base64Message, isBytes) {
105
- const bytes = Buffer.from(base64Message, BASE64_STR);
106
- return Boolean(isBytes) ? bytes : bytes.toString();
107
- }
108
- /**
109
- * @desc Compress the string
110
- * @param {string} message
111
- * @return {string} compressed string
112
- */
113
- function deflateString(message) {
114
- const input = Array.prototype.map.call(message, char => char.charCodeAt(0));
115
- return Array.from((0, pako_1.deflate)(input, { raw: true }));
116
- }
117
- /**
118
- * @desc Decompress the compressed string
119
- * @param {string} compressedString
120
- * @return {string} decompressed string
121
- */
122
- function inflateString(compressedString) {
123
- const inputBuffer = Buffer.from(compressedString, BASE64_STR);
124
- const input = Array.prototype.map.call(inputBuffer.toString('binary'), char => char.charCodeAt(0));
125
- return Array.from((0, pako_1.inflate)(input, { raw: true }))
126
- .map((byte) => String.fromCharCode(byte))
127
- .join('');
128
- }
129
- /**
130
- * @desc Abstract the normalizeCerString and normalizePemString
131
- * @param {buffer} File stream or string
132
- * @param {string} String for header and tail
133
- * @return {string} A formatted certificate string
134
- */
135
- function _normalizeCerString(bin, format) {
136
- return bin.toString().replace(/\n/g, '').replace(/\r/g, '').replace(`-----BEGIN ${format}-----`, '').replace(`-----END ${format}-----`, '').replace(/ /g, '').replace(/\t/g, '');
137
- }
138
- /**
139
- * @desc Parse the .cer to string format without line break, header and footer
140
- * @param {string} certString declares the certificate contents
141
- * @return {string} certificiate in string format
142
- */
143
- function normalizeCerString(certString) {
144
- return _normalizeCerString(certString, 'CERTIFICATE');
145
- }
146
- /**
147
- * @desc Normalize the string in .pem format without line break, header and footer
148
- * @param {string} pemString
149
- * @return {string} private key in string format
150
- */
151
- function normalizePemString(pemString) {
152
- return _normalizeCerString(pemString.toString(), 'RSA PRIVATE KEY');
153
- }
154
- /**
155
- * @desc Return the complete URL
156
- * @param {object} req HTTP request
157
- * @return {string} URL
158
- */
159
- function getFullURL(req) {
160
- return `${req.protocol}://${req.get('host')}${req.originalUrl}`;
161
- }
162
- /**
163
- * @desc Parse input string, return default value if it is undefined
164
- * @param {string/boolean}
165
- * @return {boolean}
166
- */
167
- function parseString(str, defaultValue = '') {
168
- return str || defaultValue;
169
- }
170
- /**
171
- * @desc Override the object by another object (rtl)
172
- * @param {object} default object
173
- * @param {object} object applied to the default object
174
- * @return {object} result object
175
- */
176
- function applyDefault(obj1, obj2) {
177
- return Object.assign({}, obj1, obj2);
178
- }
179
- /**
180
- * @desc Get public key in pem format from the certificate included in the metadata
181
- * @param {string} x509 certificate
182
- * @return {string} public key fetched from the certificate
183
- */
184
- function getPublicKeyPemFromCertificate(x509CertificateString) {
185
- const certDerBytes = node_forge_1.util.decode64(x509CertificateString);
186
- const obj = node_forge_1.asn1.fromDer(certDerBytes);
187
- const cert = node_forge_1.pki.certificateFromAsn1(obj);
188
- return node_forge_1.pki.publicKeyToPem(cert.publicKey);
189
- }
190
- /*function getPublicKeyPemFromCertificate(x509Certificate: string): string {
191
- // 将 Base64 字符串转为 Buffer(DER 编码)
192
- const derBuffer = Buffer.from(x509Certificate, 'base64');
193
-
194
- // 解析 X.509 证书
195
- const cert = new X509Certificate(derBuffer);
196
-
197
- // 直接获取公钥的 PEM 格式
198
- console.log(cert.publicKey?.toString())
199
- console.log("这就是我的打印")
200
- return cert.publicKey?.toString();
201
- }*/
202
- /**
203
- * @desc Read private key from pem-formatted string
204
- * @param {string | Buffer} keyString pem-formatted string
205
- * @param {string} protected passphrase of the key
206
- * @return {string} string in pem format
207
- * If passphrase is used to protect the .pem content (recommend)
208
- */
209
- function readPrivateKey(keyString, passphrase, isOutputString) {
210
- return isString(passphrase) ? this.convertToString(node_forge_1.pki.privateKeyToPem(node_forge_1.pki.decryptRsaPrivateKey(String(keyString), passphrase)), isOutputString) : keyString;
211
- }
212
- /**
213
- * @desc Inline syntax sugar
214
- */
215
- function convertToString(input, isOutputString) {
216
- return Boolean(isOutputString) ? String(input) : input;
217
- }
218
- /**
219
- * @desc Check if the input is an array with non-zero size
220
- */
221
- function isNonEmptyArray(a) {
222
- return Array.isArray(a) && a.length > 0;
223
- }
224
- function castArrayOpt(a) {
225
- if (a === undefined)
226
- return [];
227
- return Array.isArray(a) ? a : [a];
228
- }
229
- function notEmpty(value) {
230
- return value !== null && value !== undefined;
231
- }
232
- const utility = {
233
- isString,
234
- base64Encode,
235
- base64Decode,
236
- deflateString,
237
- inflateString,
238
- normalizeCerString,
239
- normalizePemString,
240
- getFullURL,
241
- parseString,
242
- applyDefault,
243
- getPublicKeyPemFromCertificate,
244
- readPrivateKey,
245
- convertToString,
246
- isNonEmptyArray,
247
- };
248
- exports.default = utility;
1
+ "use strict";
2
+ /**
3
+ * @file utility.ts
4
+ * @author tngan
5
+ * @desc Library for some common functions (e.g. de/inflation, en/decoding)
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.notEmpty = exports.castArrayOpt = exports.isNonEmptyArray = exports.readPrivateKey = exports.inflateString = exports.base64Decode = exports.isString = exports.get = exports.uniq = exports.last = exports.flattenDeep = exports.zipObject = void 0;
9
+ const node_crypto_1 = require("node:crypto");
10
+ const pako_1 = require("pako");
11
+ const BASE64_STR = 'base64';
12
+ /**
13
+ * @desc Mimic lodash.zipObject
14
+ * @param arr1 {string[]}
15
+ * @param arr2 {[]}
16
+ */
17
+ function zipObject(arr1, arr2, skipDuplicated = true) {
18
+ return arr1.reduce((res, l, i) => {
19
+ if (skipDuplicated) {
20
+ res[l] = arr2[i];
21
+ return res;
22
+ }
23
+ // if key exists, aggregate with array in order to get rid of duplicate key
24
+ if (res[l] !== undefined) {
25
+ res[l] = Array.isArray(res[l])
26
+ ? res[l].concat(arr2[i])
27
+ : [res[l]].concat(arr2[i]);
28
+ return res;
29
+ }
30
+ res[l] = arr2[i];
31
+ return res;
32
+ }, {});
33
+ }
34
+ exports.zipObject = zipObject;
35
+ /**
36
+ * @desc Alternative to lodash.flattenDeep
37
+ * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
38
+ * @param input {[]}
39
+ */
40
+ function flattenDeep(input) {
41
+ return Array.isArray(input)
42
+ ? input.reduce((a, b) => a.concat(flattenDeep(b)), [])
43
+ : [input];
44
+ }
45
+ exports.flattenDeep = flattenDeep;
46
+ /**
47
+ * @desc Alternative to lodash.last
48
+ * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_last
49
+ * @param input {[]}
50
+ */
51
+ function last(input) {
52
+ return input.slice(-1)[0];
53
+ }
54
+ exports.last = last;
55
+ /**
56
+ * @desc Alternative to lodash.uniq
57
+ * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_uniq
58
+ * @param input {string[]}
59
+ */
60
+ function uniq(input) {
61
+ const set = new Set(input);
62
+ return [...set];
63
+ }
64
+ exports.uniq = uniq;
65
+ /**
66
+ * @desc Alternative to lodash.get
67
+ * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get
68
+ * @param obj
69
+ * @param path
70
+ * @param defaultValue
71
+ */
72
+ function get(obj, path, defaultValue) {
73
+ return path.split('.')
74
+ .reduce((a, c) => (a && a[c] ? a[c] : (defaultValue || null)), obj);
75
+ }
76
+ exports.get = get;
77
+ /**
78
+ * @desc Check if the input is string
79
+ * @param {any} input
80
+ */
81
+ function isString(input) {
82
+ return typeof input === 'string';
83
+ }
84
+ exports.isString = isString;
85
+ /**
86
+ * @desc Encode string with base64 format
87
+ * @param {string} message plain-text message
88
+ * @return {string} base64 encoded string
89
+ */
90
+ function base64Encode(message) {
91
+ return Buffer.from(message).toString(BASE64_STR);
92
+ }
93
+ /**
94
+ * @desc Decode string from base64 format
95
+ * @param {string} base64Message encoded string
96
+ * @param {boolean} isBytes determine the return value type (True: bytes False: string)
97
+ * @return {bytes/string} decoded bytes/string depends on isBytes, default is {string}
98
+ */
99
+ function base64Decode(base64Message, isBytes) {
100
+ const bytes = Buffer.from(base64Message, BASE64_STR);
101
+ return Boolean(isBytes) ? bytes : bytes.toString();
102
+ }
103
+ exports.base64Decode = base64Decode;
104
+ /**
105
+ * @desc Compress the string
106
+ * @param {string} message
107
+ * @return {string} compressed string
108
+ */
109
+ function deflateString(message) {
110
+ const input = Array.prototype.map.call(message, char => char.charCodeAt(0));
111
+ return Array.from((0, pako_1.deflate)(input, { raw: true }));
112
+ }
113
+ /**
114
+ * @desc Decompress the compressed string
115
+ * @param {string} compressedString
116
+ * @return {string} decompressed string
117
+ */
118
+ function inflateString(compressedString) {
119
+ const inputBuffer = Buffer.from(compressedString, BASE64_STR);
120
+ const input = Array.prototype.map.call(inputBuffer.toString('binary'), char => char.charCodeAt(0));
121
+ return Array.from((0, pako_1.inflate)(input, { raw: true }))
122
+ .map((byte) => String.fromCharCode(byte))
123
+ .join('');
124
+ }
125
+ exports.inflateString = inflateString;
126
+ /**
127
+ * @desc Abstract the normalizeCerString and normalizePemString
128
+ * @param {buffer} File stream or string
129
+ * @param {string} String for header and tail
130
+ * @return {string} A formatted certificate string
131
+ */
132
+ function _normalizeCerString(bin, format) {
133
+ return bin.toString().replace(/\n/g, '').replace(/\r/g, '').replace(`-----BEGIN ${format}-----`, '').replace(`-----END ${format}-----`, '').replace(/ /g, '').replace(/\t/g, '');
134
+ }
135
+ /**
136
+ * @desc Parse the .cer to string format without line break, header and footer
137
+ * @param {string} certString declares the certificate contents
138
+ * @return {string} certificiate in string format
139
+ */
140
+ function normalizeCerString(certString) {
141
+ return _normalizeCerString(certString, 'CERTIFICATE');
142
+ }
143
+ /**
144
+ * @desc Normalize the string in .pem format without line break, header and footer
145
+ * @param {string} pemString
146
+ * @return {string} private key in string format
147
+ */
148
+ function normalizePemString(pemString) {
149
+ return _normalizeCerString(pemString.toString(), 'RSA PRIVATE KEY');
150
+ }
151
+ /**
152
+ * @desc Return the complete URL
153
+ * @param {object} req HTTP request
154
+ * @return {string} URL
155
+ */
156
+ function getFullURL(req) {
157
+ return `${req.protocol}://${req.get('host')}${req.originalUrl}`;
158
+ }
159
+ /**
160
+ * @desc Parse input string, return default value if it is undefined
161
+ * @param {string/boolean}
162
+ * @return {boolean}
163
+ */
164
+ function parseString(str, defaultValue = '') {
165
+ return str || defaultValue;
166
+ }
167
+ /**
168
+ * @desc Override the object by another object (rtl)
169
+ * @param {object} default object
170
+ * @param {object} object applied to the default object
171
+ * @return {object} result object
172
+ */
173
+ function applyDefault(obj1, obj2) {
174
+ return Object.assign({}, obj1, obj2);
175
+ }
176
+ /**
177
+ * @desc Get public key in pem format from the certificate included in the metadata
178
+ * @param {string} x509 certificate
179
+ * @return {string} public key fetched from the certificate
180
+ */
181
+ function getPublicKeyPemFromCertificate(x509CertificateString) {
182
+ const derBuffer = Buffer.from(x509CertificateString, 'base64');
183
+ // 解析 X.509 证书
184
+ const cert2 = new node_crypto_1.X509Certificate(derBuffer);
185
+ const publicKeyObject = cert2.publicKey;
186
+ // 3. 导出为 PEM 格式
187
+ return publicKeyObject.export({
188
+ type: 'spki',
189
+ format: 'pem' // 输出 PEM 格式
190
+ });
191
+ }
192
+ /*function getPublicKeyPemFromCertificate(x509Certificate: string): string {
193
+ // 将 Base64 字符串转为 Buffer(DER 编码)
194
+ const derBuffer = Buffer.from(x509Certificate, 'base64');
195
+
196
+ // 解析 X.509 证书
197
+ const cert = new X509Certificate(derBuffer);
198
+
199
+ // 直接获取公钥的 PEM 格式
200
+ console.log(cert.publicKey?.toString())
201
+ console.log("这就是我的打印")
202
+ return cert.publicKey?.toString();
203
+ }*/
204
+ /**
205
+ * @desc Read private key from pem-formatted string
206
+ * @param {string | Buffer} keyString pem-formatted string
207
+ * @param {string} protected passphrase of the key
208
+ * @return {string} string in pem format
209
+ * If passphrase is used to protect the .pem content (recommend)
210
+ */
211
+ /**
212
+ * PEM 头尾格式校验与修复
213
+ */
214
+ function validatePEMHeaders(pem, keyType) {
215
+ const expectedHeader = `-----BEGIN ${keyType}-----`;
216
+ const expectedFooter = `-----END ${keyType}-----`;
217
+ // 自动修复不规范的 PEM 头尾
218
+ return pem
219
+ .replace(/-{5}.*PRIVATE KEY-{5}/g, '') // 清除已有头尾
220
+ .replace(/(\r\n|\n|\r)/gm, '\n') // 统一换行符
221
+ .trim() + // 清理空白
222
+ `\n${expectedHeader}\n${pem}\n${expectedFooter}\n`;
223
+ }
224
+ function readPrivateKey(keyString, passphrase, isOutputString = true) {
225
+ try {
226
+ // 统一转换为字符串格式处理
227
+ const pemKey = Buffer.isBuffer(keyString)
228
+ ? keyString.toString('utf8')
229
+ : keyString;
230
+ // 创建私钥对象 (自动处理加密)
231
+ const keyObject = (0, node_crypto_1.createPrivateKey)({
232
+ key: pemKey,
233
+ format: 'pem',
234
+ passphrase: isString(passphrase) ? passphrase : undefined,
235
+ encoding: 'utf8'
236
+ });
237
+ // 验证密钥类型为 RSA
238
+ if (keyObject.asymmetricKeyType !== 'rsa') {
239
+ throw new Error('仅支持 RSA 私钥类型');
240
+ }
241
+ // 强制转换为 PKCS#1 格式
242
+ const exported = keyObject.export({
243
+ type: 'pkcs1',
244
+ format: 'pem' // 输出为 PEM 格式
245
+ });
246
+ return isOutputString ? String(exported) : Buffer.from(exported, 'utf8');
247
+ }
248
+ catch (error) {
249
+ throw new Error(`私钥读取失败: ${error.message}`);
250
+ }
251
+ }
252
+ exports.readPrivateKey = readPrivateKey;
253
+ /**
254
+ * @desc Inline syntax sugar
255
+ */
256
+ function convertToString(input, isOutputString) {
257
+ return Boolean(isOutputString) ? String(input) : input;
258
+ }
259
+ /**
260
+ * @desc Check if the input is an array with non-zero size
261
+ */
262
+ function isNonEmptyArray(a) {
263
+ return Array.isArray(a) && a.length > 0;
264
+ }
265
+ exports.isNonEmptyArray = isNonEmptyArray;
266
+ function castArrayOpt(a) {
267
+ if (a === undefined)
268
+ return [];
269
+ return Array.isArray(a) ? a : [a];
270
+ }
271
+ exports.castArrayOpt = castArrayOpt;
272
+ function notEmpty(value) {
273
+ return value !== null && value !== undefined;
274
+ }
275
+ exports.notEmpty = notEmpty;
276
+ const utility = {
277
+ isString,
278
+ base64Encode,
279
+ base64Decode,
280
+ deflateString,
281
+ inflateString,
282
+ normalizeCerString,
283
+ normalizePemString,
284
+ getFullURL,
285
+ parseString,
286
+ applyDefault,
287
+ getPublicKeyPemFromCertificate,
288
+ readPrivateKey,
289
+ convertToString,
290
+ isNonEmptyArray,
291
+ };
292
+ exports.default = utility;
249
293
  //# sourceMappingURL=utility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../src/utility.ts"],"names":[],"mappings":";;AAkBA,8BAmBC;AAMD,kCAIC;AAMD,oBAEC;AAMD,oBAGC;AAQD,kBAGC;AAKD,4BAEC;AAeD,oCAGC;AAeD,sCAMC;AAoFD,wCAEC;AAUD,0CAEC;AAED,oCAGC;AAED,4BAEC;AApOD;;;;EAIE;AACF,2CAA6C;AAI7C,+BAAwC;AAExC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B;;;;GAIG;AACH,SAAgB,SAAS,CAAC,IAAc,EAAE,IAAW,EAAE,cAAc,GAAG,IAAI;IAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;QAE/B,IAAI,cAAc,EAAE,CAAC;YACnB,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO,GAAG,CAAC;QACb,CAAC;QACD,2EAA2E;QAC3E,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACzB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC5B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7B,OAAO,GAAG,CAAC;QACb,CAAC;QA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IACf,eAAe;CAChB,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,27 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyTime = verifyTime;
4
- function verifyTime(utcNotBefore, utcNotOnOrAfter, drift = [0, 0]) {
5
- const now = new Date();
6
- if (!utcNotBefore && !utcNotOnOrAfter) {
7
- // show warning because user intends to have time check but the document doesn't include corresponding information
8
- console.warn('You intend to have time validation however the document doesn\'t include the valid range.');
9
- return true;
10
- }
11
- let notBeforeLocal = null;
12
- let notOnOrAfterLocal = null;
13
- const [notBeforeDrift, notOnOrAfterDrift] = drift;
14
- if (utcNotBefore && !utcNotOnOrAfter) {
15
- notBeforeLocal = new Date(utcNotBefore);
16
- return +notBeforeLocal + notBeforeDrift <= +now;
17
- }
18
- if (!utcNotBefore && utcNotOnOrAfter) {
19
- notOnOrAfterLocal = new Date(utcNotOnOrAfter);
20
- return +now < +notOnOrAfterLocal + notOnOrAfterDrift;
21
- }
22
- notBeforeLocal = new Date(utcNotBefore);
23
- notOnOrAfterLocal = new Date(utcNotOnOrAfter);
24
- return (+notBeforeLocal + notBeforeDrift <= +now &&
25
- +now < +notOnOrAfterLocal + notOnOrAfterDrift);
26
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyTime = void 0;
4
+ function verifyTime(utcNotBefore, utcNotOnOrAfter, drift = [0, 0]) {
5
+ const now = new Date();
6
+ if (!utcNotBefore && !utcNotOnOrAfter) {
7
+ // show warning because user intends to have time check but the document doesn't include corresponding information
8
+ console.warn('You intend to have time validation however the document doesn\'t include the valid range.');
9
+ return true;
10
+ }
11
+ let notBeforeLocal = null;
12
+ let notOnOrAfterLocal = null;
13
+ const [notBeforeDrift, notOnOrAfterDrift] = drift;
14
+ if (utcNotBefore && !utcNotOnOrAfter) {
15
+ notBeforeLocal = new Date(utcNotBefore);
16
+ return +notBeforeLocal + notBeforeDrift <= +now;
17
+ }
18
+ if (!utcNotBefore && utcNotOnOrAfter) {
19
+ notOnOrAfterLocal = new Date(utcNotOnOrAfter);
20
+ return +now < +notOnOrAfterLocal + notOnOrAfterDrift;
21
+ }
22
+ notBeforeLocal = new Date(utcNotBefore);
23
+ notOnOrAfterLocal = new Date(utcNotOnOrAfter);
24
+ return (+notBeforeLocal + notBeforeDrift <= +now &&
25
+ +now < +notOnOrAfterLocal + notOnOrAfterDrift);
26
+ }
27
+ exports.verifyTime = verifyTime;
27
28
  //# sourceMappingURL=validator.js.map