@azure/msal-node 1.7.0 → 1.8.0

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.
@@ -141,7 +141,7 @@ class HttpClient {
141
141
  url: url,
142
142
 
143
143
  /* istanbul ignore next */
144
- data: options && options.body || "",
144
+ data: options && options.body || Constants$1.EMPTY_STRING,
145
145
  timeout: cancellationToken,
146
146
 
147
147
  /* istanbul ignore next */
@@ -186,23 +186,23 @@ class NetworkUtils {
186
186
  * Licensed under the MIT License.
187
187
  */
188
188
  const DEFAULT_AUTH_OPTIONS = {
189
- clientId: "",
189
+ clientId: Constants$1.EMPTY_STRING,
190
190
  authority: Constants$1.DEFAULT_AUTHORITY,
191
- clientSecret: "",
192
- clientAssertion: "",
191
+ clientSecret: Constants$1.EMPTY_STRING,
192
+ clientAssertion: Constants$1.EMPTY_STRING,
193
193
  clientCertificate: {
194
- thumbprint: "",
195
- privateKey: "",
196
- x5c: ""
194
+ thumbprint: Constants$1.EMPTY_STRING,
195
+ privateKey: Constants$1.EMPTY_STRING,
196
+ x5c: Constants$1.EMPTY_STRING
197
197
  },
198
198
  knownAuthorities: [],
199
- cloudDiscoveryMetadata: "",
200
- authorityMetadata: "",
199
+ cloudDiscoveryMetadata: Constants$1.EMPTY_STRING,
200
+ authorityMetadata: Constants$1.EMPTY_STRING,
201
201
  clientCapabilities: [],
202
202
  protocolMode: ProtocolMode.AAD,
203
203
  azureCloudOptions: {
204
204
  azureCloudInstance: AzureCloudInstance.None,
205
- tenant: ""
205
+ tenant: Constants$1.EMPTY_STRING
206
206
  }
207
207
  };
208
208
  const DEFAULT_CACHE_OPTIONS = {};
@@ -215,7 +215,13 @@ const DEFAULT_LOGGER_OPTIONS = {
215
215
  const DEFAULT_SYSTEM_OPTIONS = {
216
216
  loggerOptions: DEFAULT_LOGGER_OPTIONS,
217
217
  networkClient: /*#__PURE__*/NetworkUtils.getNetworkClient(),
218
- proxyUrl: ""
218
+ proxyUrl: Constants$1.EMPTY_STRING
219
+ };
220
+ const DEFAULT_TELEMETRY_OPTIONS = {
221
+ application: {
222
+ appName: Constants$1.EMPTY_STRING,
223
+ appVersion: Constants$1.EMPTY_STRING
224
+ }
219
225
  };
220
226
  /**
221
227
  * Sets the default options when not explicitly configured from app developer
@@ -223,6 +229,7 @@ const DEFAULT_SYSTEM_OPTIONS = {
223
229
  * @param auth - Authentication options
224
230
  * @param cache - Cache options
225
231
  * @param system - System options
232
+ * @param telemetry - Telemetry options
226
233
  *
227
234
  * @returns Configuration
228
235
  * @public
@@ -231,7 +238,8 @@ const DEFAULT_SYSTEM_OPTIONS = {
231
238
  function buildAppConfiguration({
232
239
  auth,
233
240
  cache,
234
- system
241
+ system,
242
+ telemetry
235
243
  }) {
236
244
  return {
237
245
  auth: { ...DEFAULT_AUTH_OPTIONS,
@@ -242,6 +250,9 @@ function buildAppConfiguration({
242
250
  },
243
251
  system: { ...DEFAULT_SYSTEM_OPTIONS,
244
252
  ...system
253
+ },
254
+ telemetry: { ...DEFAULT_TELEMETRY_OPTIONS,
255
+ ...telemetry
245
256
  }
246
257
  };
247
258
  }
@@ -256,7 +267,7 @@ class GuidGenerator {
256
267
  * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
257
268
  * uuidv4 generates guids from cryprtographically-string random
258
269
  */
259
- static generateGuid() {
270
+ generateGuid() {
260
271
  return v4();
261
272
  }
262
273
  /**
@@ -265,7 +276,7 @@ class GuidGenerator {
265
276
  */
266
277
 
267
278
 
268
- static isGuid(guid) {
279
+ isGuid(guid) {
269
280
  const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
270
281
  return regexGuid.test(guid);
271
282
  }
@@ -293,7 +304,7 @@ class EncodingUtils {
293
304
 
294
305
 
295
306
  static base64EncodeUrl(str, encoding) {
296
- return EncodingUtils.base64Encode(str, encoding).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
307
+ return EncodingUtils.base64Encode(str, encoding).replace(/=/g, Constants$1.EMPTY_STRING).replace(/\+/g, "-").replace(/\//g, "_");
297
308
  }
298
309
  /**
299
310
  * 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
@@ -388,7 +399,7 @@ class PkceGenerator {
388
399
  charArr.push(CharSet.CV_CHARSET[index]);
389
400
  }
390
401
 
391
- const verifier = charArr.join("");
402
+ const verifier = charArr.join(Constants$1.EMPTY_STRING);
392
403
  return EncodingUtils.base64EncodeUrl(verifier);
393
404
  }
394
405
  /**
@@ -417,6 +428,7 @@ class CryptoProvider {
417
428
  constructor() {
418
429
  // Browser crypto needs to be validated first before any other classes can be set.
419
430
  this.pkceGenerator = new PkceGenerator();
431
+ this.guidGenerator = new GuidGenerator();
420
432
  this.hashUtils = new HashUtils();
421
433
  }
422
434
  /**
@@ -426,7 +438,7 @@ class CryptoProvider {
426
438
 
427
439
 
428
440
  createNewGuid() {
429
- return GuidGenerator.generateGuid();
441
+ return this.guidGenerator.generateGuid();
430
442
  }
431
443
  /**
432
444
  * Encodes input string to base64.
@@ -1586,7 +1598,7 @@ class TokenCache {
1586
1598
 
1587
1599
  /* eslint-disable header/header */
1588
1600
  const name = "@azure/msal-node";
1589
- const version = "1.7.0";
1601
+ const version = "1.8.0";
1590
1602
 
1591
1603
  /*
1592
1604
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1825,9 +1837,10 @@ class ClientApplication {
1825
1837
  libraryInfo: {
1826
1838
  sku: Constants.MSAL_SKU,
1827
1839
  version: version,
1828
- cpu: process.arch || "",
1829
- os: process.platform || ""
1840
+ cpu: process.arch || Constants$1.EMPTY_STRING,
1841
+ os: process.platform || Constants$1.EMPTY_STRING
1830
1842
  },
1843
+ telemetry: this.config.telemetry,
1831
1844
  persistencePlugin: this.config.cache.cachePlugin,
1832
1845
  serializableCache: this.tokenCache
1833
1846
  };
@@ -2105,7 +2118,7 @@ class ClientAssertion {
2105
2118
 
2106
2119
  while ((matches = regexToFindCerts.exec(publicCertificate)) !== null) {
2107
2120
  // matches[1] represents the first parens capture group in the regex.
2108
- certs.push(matches[1].replace(/\n/, ""));
2121
+ certs.push(matches[1].replace(/\n/, Constants$1.EMPTY_STRING));
2109
2122
  }
2110
2123
 
2111
2124
  return certs;
@@ -2214,8 +2227,8 @@ class ConfidentialClientApplication extends ClientApplication {
2214
2227
  const clientSecretNotEmpty = !StringUtils.isEmpty(configuration.auth.clientSecret);
2215
2228
  const clientAssertionNotEmpty = !StringUtils.isEmpty(configuration.auth.clientAssertion);
2216
2229
  const certificate = configuration.auth.clientCertificate || {
2217
- thumbprint: "",
2218
- privateKey: ""
2230
+ thumbprint: Constants$1.EMPTY_STRING,
2231
+ privateKey: Constants$1.EMPTY_STRING
2219
2232
  };
2220
2233
  const certificateNotEmpty = !StringUtils.isEmpty(certificate.thumbprint) || !StringUtils.isEmpty(certificate.privateKey); // Check that at most one credential is set on the application
2221
2234