@azure/msal-node 2.0.0-alpha.1 → 2.0.0-beta.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.
Files changed (112) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +182 -182
  3. package/dist/cache/ITokenCache.d.ts +15 -15
  4. package/dist/cache/NodeStorage.d.ts +182 -182
  5. package/dist/cache/NodeStorage.esm.js +401 -401
  6. package/dist/cache/NodeStorage.js +401 -401
  7. package/dist/cache/TokenCache.d.ts +90 -90
  8. package/dist/cache/TokenCache.esm.js +269 -269
  9. package/dist/cache/TokenCache.js +269 -269
  10. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  11. package/dist/cache/distributed/DistributedCachePlugin.esm.js +26 -26
  12. package/dist/cache/distributed/DistributedCachePlugin.js +26 -26
  13. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  14. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  15. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  16. package/dist/cache/serializer/Deserializer.esm.js +175 -175
  17. package/dist/cache/serializer/Deserializer.js +175 -175
  18. package/dist/cache/serializer/Serializer.d.ts +39 -39
  19. package/dist/cache/serializer/Serializer.esm.js +134 -134
  20. package/dist/cache/serializer/Serializer.js +134 -134
  21. package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
  22. package/dist/client/ClientApplication.d.ts +142 -142
  23. package/dist/client/ClientApplication.esm.js +327 -327
  24. package/dist/client/ClientApplication.js +327 -327
  25. package/dist/client/ClientAssertion.d.ts +46 -46
  26. package/dist/client/ClientAssertion.esm.js +116 -116
  27. package/dist/client/ClientAssertion.js +116 -116
  28. package/dist/client/ClientCredentialClient.d.ts +33 -33
  29. package/dist/client/ClientCredentialClient.esm.js +157 -157
  30. package/dist/client/ClientCredentialClient.js +157 -157
  31. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  32. package/dist/client/ConfidentialClientApplication.esm.js +163 -163
  33. package/dist/client/ConfidentialClientApplication.js +163 -163
  34. package/dist/client/DeviceCodeClient.d.ts +53 -53
  35. package/dist/client/DeviceCodeClient.esm.js +207 -207
  36. package/dist/client/DeviceCodeClient.js +207 -207
  37. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  38. package/dist/client/IPublicClientApplication.d.ts +42 -42
  39. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  40. package/dist/client/OnBehalfOfClient.esm.js +204 -204
  41. package/dist/client/OnBehalfOfClient.js +204 -204
  42. package/dist/client/PublicClientApplication.d.ts +65 -65
  43. package/dist/client/PublicClientApplication.esm.js +175 -175
  44. package/dist/client/PublicClientApplication.js +175 -175
  45. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  46. package/dist/client/UsernamePasswordClient.esm.js +102 -102
  47. package/dist/client/UsernamePasswordClient.js +102 -102
  48. package/dist/config/Configuration.d.ts +105 -105
  49. package/dist/config/Configuration.esm.js +70 -70
  50. package/dist/config/Configuration.js +70 -70
  51. package/dist/crypto/CryptoProvider.d.ts +52 -52
  52. package/dist/crypto/CryptoProvider.esm.js +75 -75
  53. package/dist/crypto/CryptoProvider.js +75 -75
  54. package/dist/crypto/GuidGenerator.d.ts +14 -14
  55. package/dist/crypto/GuidGenerator.esm.js +22 -22
  56. package/dist/crypto/GuidGenerator.js +22 -22
  57. package/dist/crypto/HashUtils.d.ts +8 -8
  58. package/dist/crypto/HashUtils.esm.js +13 -13
  59. package/dist/crypto/HashUtils.js +13 -13
  60. package/dist/crypto/PkceGenerator.d.ts +22 -22
  61. package/dist/crypto/PkceGenerator.esm.js +49 -49
  62. package/dist/crypto/PkceGenerator.js +49 -49
  63. package/dist/error/NodeAuthError.d.ts +65 -65
  64. package/dist/error/NodeAuthError.esm.js +85 -85
  65. package/dist/error/NodeAuthError.js +85 -85
  66. package/dist/index.d.ts +41 -41
  67. package/dist/index.esm.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/internals.d.ts +6 -6
  70. package/dist/internals.esm.js +4 -4
  71. package/dist/internals.js +4 -4
  72. package/dist/network/HttpClient.d.ts +25 -25
  73. package/dist/network/HttpClient.esm.js +276 -276
  74. package/dist/network/HttpClient.js +276 -276
  75. package/dist/network/ILoopbackClient.d.ts +10 -10
  76. package/dist/network/LoopbackClient.d.ts +21 -21
  77. package/dist/network/LoopbackClient.esm.js +84 -84
  78. package/dist/network/LoopbackClient.js +84 -84
  79. package/dist/packageMetadata.d.ts +2 -2
  80. package/dist/packageMetadata.d.ts.map +1 -1
  81. package/dist/packageMetadata.esm.js +4 -4
  82. package/dist/packageMetadata.js +4 -4
  83. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  84. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  85. package/dist/request/ClientCredentialRequest.d.ts +14 -15
  86. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  87. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  88. package/dist/request/InteractiveRequest.d.ts +22 -22
  89. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  90. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  91. package/dist/request/SignOutRequest.d.ts +5 -5
  92. package/dist/request/SilentFlowRequest.d.ts +16 -16
  93. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  94. package/dist/utils/Constants.d.ts +96 -92
  95. package/dist/utils/Constants.d.ts.map +1 -1
  96. package/dist/utils/Constants.esm.js +89 -93
  97. package/dist/utils/Constants.esm.js.map +1 -1
  98. package/dist/utils/Constants.js +93 -93
  99. package/dist/utils/Constants.js.map +1 -1
  100. package/dist/utils/EncodingUtils.d.ts +26 -26
  101. package/dist/utils/EncodingUtils.esm.js +44 -44
  102. package/dist/utils/EncodingUtils.js +44 -44
  103. package/dist/utils/NetworkUtils.d.ts +5 -5
  104. package/dist/utils/NetworkUtils.esm.js +38 -38
  105. package/dist/utils/NetworkUtils.js +38 -38
  106. package/package.json +77 -73
  107. package/dist/msal-node.cjs.development.js +0 -2705
  108. package/dist/msal-node.cjs.development.js.map +0 -1
  109. package/dist/msal-node.cjs.production.min.js +0 -2
  110. package/dist/msal-node.cjs.production.min.js.map +0 -1
  111. package/dist/msal-node.esm.js +0 -2594
  112. package/dist/msal-node.esm.js.map +0 -1
@@ -1,79 +1,79 @@
1
- /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
1
+ /*! @azure/msal-node v2.0.0-beta.0 2023-06-19 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
5
  var msalCommon = require('@azure/msal-common');
6
6
  var HttpClient = require('../network/HttpClient.js');
7
7
 
8
- /*
9
- * Copyright (c) Microsoft Corporation. All rights reserved.
10
- * Licensed under the MIT License.
11
- */
12
- const DEFAULT_AUTH_OPTIONS = {
13
- clientId: msalCommon.Constants.EMPTY_STRING,
14
- authority: msalCommon.Constants.DEFAULT_AUTHORITY,
15
- clientSecret: msalCommon.Constants.EMPTY_STRING,
16
- clientAssertion: msalCommon.Constants.EMPTY_STRING,
17
- clientCertificate: {
18
- thumbprint: msalCommon.Constants.EMPTY_STRING,
19
- privateKey: msalCommon.Constants.EMPTY_STRING,
20
- x5c: msalCommon.Constants.EMPTY_STRING,
21
- },
22
- knownAuthorities: [],
23
- cloudDiscoveryMetadata: msalCommon.Constants.EMPTY_STRING,
24
- authorityMetadata: msalCommon.Constants.EMPTY_STRING,
25
- clientCapabilities: [],
26
- protocolMode: msalCommon.ProtocolMode.AAD,
27
- azureCloudOptions: {
28
- azureCloudInstance: msalCommon.AzureCloudInstance.None,
29
- tenant: msalCommon.Constants.EMPTY_STRING,
30
- },
31
- skipAuthorityMetadataCache: false,
32
- };
33
- const DEFAULT_CACHE_OPTIONS = {};
34
- const DEFAULT_LOGGER_OPTIONS = {
35
- loggerCallback: () => {
36
- // allow users to not set logger call back
37
- },
38
- piiLoggingEnabled: false,
39
- logLevel: msalCommon.LogLevel.Info,
40
- };
41
- const DEFAULT_SYSTEM_OPTIONS = {
42
- loggerOptions: DEFAULT_LOGGER_OPTIONS,
43
- networkClient: new HttpClient.HttpClient(),
44
- proxyUrl: msalCommon.Constants.EMPTY_STRING,
45
- customAgentOptions: {},
46
- };
47
- const DEFAULT_TELEMETRY_OPTIONS = {
48
- application: {
49
- appName: msalCommon.Constants.EMPTY_STRING,
50
- appVersion: msalCommon.Constants.EMPTY_STRING,
51
- },
52
- };
53
- /**
54
- * Sets the default options when not explicitly configured from app developer
55
- *
56
- * @param auth - Authentication options
57
- * @param cache - Cache options
58
- * @param system - System options
59
- * @param telemetry - Telemetry options
60
- *
61
- * @returns Configuration
62
- * @public
63
- */
64
- function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
65
- const systemOptions = {
66
- ...DEFAULT_SYSTEM_OPTIONS,
67
- networkClient: new HttpClient.HttpClient(system?.proxyUrl, system?.customAgentOptions),
68
- loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
69
- };
70
- return {
71
- auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
72
- broker: { ...broker },
73
- cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
74
- system: { ...systemOptions, ...system },
75
- telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
76
- };
8
+ /*
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+ const DEFAULT_AUTH_OPTIONS = {
13
+ clientId: msalCommon.Constants.EMPTY_STRING,
14
+ authority: msalCommon.Constants.DEFAULT_AUTHORITY,
15
+ clientSecret: msalCommon.Constants.EMPTY_STRING,
16
+ clientAssertion: msalCommon.Constants.EMPTY_STRING,
17
+ clientCertificate: {
18
+ thumbprint: msalCommon.Constants.EMPTY_STRING,
19
+ privateKey: msalCommon.Constants.EMPTY_STRING,
20
+ x5c: msalCommon.Constants.EMPTY_STRING,
21
+ },
22
+ knownAuthorities: [],
23
+ cloudDiscoveryMetadata: msalCommon.Constants.EMPTY_STRING,
24
+ authorityMetadata: msalCommon.Constants.EMPTY_STRING,
25
+ clientCapabilities: [],
26
+ protocolMode: msalCommon.ProtocolMode.AAD,
27
+ azureCloudOptions: {
28
+ azureCloudInstance: msalCommon.AzureCloudInstance.None,
29
+ tenant: msalCommon.Constants.EMPTY_STRING,
30
+ },
31
+ skipAuthorityMetadataCache: false,
32
+ };
33
+ const DEFAULT_CACHE_OPTIONS = {};
34
+ const DEFAULT_LOGGER_OPTIONS = {
35
+ loggerCallback: () => {
36
+ // allow users to not set logger call back
37
+ },
38
+ piiLoggingEnabled: false,
39
+ logLevel: msalCommon.LogLevel.Info,
40
+ };
41
+ const DEFAULT_SYSTEM_OPTIONS = {
42
+ loggerOptions: DEFAULT_LOGGER_OPTIONS,
43
+ networkClient: new HttpClient.HttpClient(),
44
+ proxyUrl: msalCommon.Constants.EMPTY_STRING,
45
+ customAgentOptions: {},
46
+ };
47
+ const DEFAULT_TELEMETRY_OPTIONS = {
48
+ application: {
49
+ appName: msalCommon.Constants.EMPTY_STRING,
50
+ appVersion: msalCommon.Constants.EMPTY_STRING,
51
+ },
52
+ };
53
+ /**
54
+ * Sets the default options when not explicitly configured from app developer
55
+ *
56
+ * @param auth - Authentication options
57
+ * @param cache - Cache options
58
+ * @param system - System options
59
+ * @param telemetry - Telemetry options
60
+ *
61
+ * @returns Configuration
62
+ * @public
63
+ */
64
+ function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
65
+ const systemOptions = {
66
+ ...DEFAULT_SYSTEM_OPTIONS,
67
+ networkClient: new HttpClient.HttpClient(system?.proxyUrl, system?.customAgentOptions),
68
+ loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
69
+ };
70
+ return {
71
+ auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
72
+ broker: { ...broker },
73
+ cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
74
+ system: { ...systemOptions, ...system },
75
+ telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
76
+ };
77
77
  }
78
78
 
79
79
  exports.buildAppConfiguration = buildAppConfiguration;
@@ -1,53 +1,53 @@
1
- import { ICrypto, PkceCodes } from "@azure/msal-common";
2
- /**
3
- * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
4
- * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
5
- * @public
6
- */
7
- export declare class CryptoProvider implements ICrypto {
8
- private pkceGenerator;
9
- private guidGenerator;
10
- private hashUtils;
11
- constructor();
12
- /**
13
- * Creates a new random GUID - used to populate state and nonce.
14
- * @returns string (GUID)
15
- */
16
- createNewGuid(): string;
17
- /**
18
- * Encodes input string to base64.
19
- * @param input - string to be encoded
20
- */
21
- base64Encode(input: string): string;
22
- /**
23
- * Decodes input string from base64.
24
- * @param input - string to be decoded
25
- */
26
- base64Decode(input: string): string;
27
- /**
28
- * Generates PKCE codes used in Authorization Code Flow.
29
- */
30
- generatePkceCodes(): Promise<PkceCodes>;
31
- /**
32
- * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
33
- */
34
- getPublicKeyThumbprint(): Promise<string>;
35
- /**
36
- * Removes cryptographic keypair from key store matching the keyId passed in
37
- * @param kid
38
- */
39
- removeTokenBindingKey(): Promise<boolean>;
40
- /**
41
- * Removes all cryptographic keys from Keystore
42
- */
43
- clearKeystore(): Promise<boolean>;
44
- /**
45
- * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
46
- */
47
- signJwt(): Promise<string>;
48
- /**
49
- * Returns the SHA-256 hash of an input string
50
- */
51
- hashString(plainText: string): Promise<string>;
52
- }
1
+ import { ICrypto, PkceCodes } from "@azure/msal-common";
2
+ /**
3
+ * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
4
+ * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
5
+ * @public
6
+ */
7
+ export declare class CryptoProvider implements ICrypto {
8
+ private pkceGenerator;
9
+ private guidGenerator;
10
+ private hashUtils;
11
+ constructor();
12
+ /**
13
+ * Creates a new random GUID - used to populate state and nonce.
14
+ * @returns string (GUID)
15
+ */
16
+ createNewGuid(): string;
17
+ /**
18
+ * Encodes input string to base64.
19
+ * @param input - string to be encoded
20
+ */
21
+ base64Encode(input: string): string;
22
+ /**
23
+ * Decodes input string from base64.
24
+ * @param input - string to be decoded
25
+ */
26
+ base64Decode(input: string): string;
27
+ /**
28
+ * Generates PKCE codes used in Authorization Code Flow.
29
+ */
30
+ generatePkceCodes(): Promise<PkceCodes>;
31
+ /**
32
+ * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
33
+ */
34
+ getPublicKeyThumbprint(): Promise<string>;
35
+ /**
36
+ * Removes cryptographic keypair from key store matching the keyId passed in
37
+ * @param kid
38
+ */
39
+ removeTokenBindingKey(): Promise<boolean>;
40
+ /**
41
+ * Removes all cryptographic keys from Keystore
42
+ */
43
+ clearKeystore(): Promise<boolean>;
44
+ /**
45
+ * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
46
+ */
47
+ signJwt(): Promise<string>;
48
+ /**
49
+ * Returns the SHA-256 hash of an input string
50
+ */
51
+ hashString(plainText: string): Promise<string>;
52
+ }
53
53
  //# sourceMappingURL=CryptoProvider.d.ts.map
@@ -1,84 +1,84 @@
1
- /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
1
+ /*! @azure/msal-node v2.0.0-beta.0 2023-06-19 */
2
2
  'use strict';
3
3
  import { GuidGenerator } from './GuidGenerator.esm.js';
4
4
  import { EncodingUtils } from '../utils/EncodingUtils.esm.js';
5
5
  import { PkceGenerator } from './PkceGenerator.esm.js';
6
6
  import { HashUtils } from './HashUtils.esm.js';
7
7
 
8
- /*
9
- * Copyright (c) Microsoft Corporation. All rights reserved.
10
- * Licensed under the MIT License.
11
- */
12
- /**
13
- * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
14
- * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
15
- * @public
16
- */
17
- class CryptoProvider {
18
- constructor() {
19
- // Browser crypto needs to be validated first before any other classes can be set.
20
- this.pkceGenerator = new PkceGenerator();
21
- this.guidGenerator = new GuidGenerator();
22
- this.hashUtils = new HashUtils();
23
- }
24
- /**
25
- * Creates a new random GUID - used to populate state and nonce.
26
- * @returns string (GUID)
27
- */
28
- createNewGuid() {
29
- return this.guidGenerator.generateGuid();
30
- }
31
- /**
32
- * Encodes input string to base64.
33
- * @param input - string to be encoded
34
- */
35
- base64Encode(input) {
36
- return EncodingUtils.base64Encode(input);
37
- }
38
- /**
39
- * Decodes input string from base64.
40
- * @param input - string to be decoded
41
- */
42
- base64Decode(input) {
43
- return EncodingUtils.base64Decode(input);
44
- }
45
- /**
46
- * Generates PKCE codes used in Authorization Code Flow.
47
- */
48
- generatePkceCodes() {
49
- return this.pkceGenerator.generatePkceCodes();
50
- }
51
- /**
52
- * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
53
- */
54
- getPublicKeyThumbprint() {
55
- throw new Error("Method not implemented.");
56
- }
57
- /**
58
- * Removes cryptographic keypair from key store matching the keyId passed in
59
- * @param kid
60
- */
61
- removeTokenBindingKey() {
62
- throw new Error("Method not implemented.");
63
- }
64
- /**
65
- * Removes all cryptographic keys from Keystore
66
- */
67
- clearKeystore() {
68
- throw new Error("Method not implemented.");
69
- }
70
- /**
71
- * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
72
- */
73
- signJwt() {
74
- throw new Error("Method not implemented.");
75
- }
76
- /**
77
- * Returns the SHA-256 hash of an input string
78
- */
79
- async hashString(plainText) {
80
- return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
81
- }
8
+ /*
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+ /**
13
+ * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
14
+ * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
15
+ * @public
16
+ */
17
+ class CryptoProvider {
18
+ constructor() {
19
+ // Browser crypto needs to be validated first before any other classes can be set.
20
+ this.pkceGenerator = new PkceGenerator();
21
+ this.guidGenerator = new GuidGenerator();
22
+ this.hashUtils = new HashUtils();
23
+ }
24
+ /**
25
+ * Creates a new random GUID - used to populate state and nonce.
26
+ * @returns string (GUID)
27
+ */
28
+ createNewGuid() {
29
+ return this.guidGenerator.generateGuid();
30
+ }
31
+ /**
32
+ * Encodes input string to base64.
33
+ * @param input - string to be encoded
34
+ */
35
+ base64Encode(input) {
36
+ return EncodingUtils.base64Encode(input);
37
+ }
38
+ /**
39
+ * Decodes input string from base64.
40
+ * @param input - string to be decoded
41
+ */
42
+ base64Decode(input) {
43
+ return EncodingUtils.base64Decode(input);
44
+ }
45
+ /**
46
+ * Generates PKCE codes used in Authorization Code Flow.
47
+ */
48
+ generatePkceCodes() {
49
+ return this.pkceGenerator.generatePkceCodes();
50
+ }
51
+ /**
52
+ * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
53
+ */
54
+ getPublicKeyThumbprint() {
55
+ throw new Error("Method not implemented.");
56
+ }
57
+ /**
58
+ * Removes cryptographic keypair from key store matching the keyId passed in
59
+ * @param kid
60
+ */
61
+ removeTokenBindingKey() {
62
+ throw new Error("Method not implemented.");
63
+ }
64
+ /**
65
+ * Removes all cryptographic keys from Keystore
66
+ */
67
+ clearKeystore() {
68
+ throw new Error("Method not implemented.");
69
+ }
70
+ /**
71
+ * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
72
+ */
73
+ signJwt() {
74
+ throw new Error("Method not implemented.");
75
+ }
76
+ /**
77
+ * Returns the SHA-256 hash of an input string
78
+ */
79
+ async hashString(plainText) {
80
+ return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
81
+ }
82
82
  }
83
83
 
84
84
  export { CryptoProvider };
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
1
+ /*! @azure/msal-node v2.0.0-beta.0 2023-06-19 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -7,80 +7,80 @@ var EncodingUtils = require('../utils/EncodingUtils.js');
7
7
  var PkceGenerator = require('./PkceGenerator.js');
8
8
  var HashUtils = require('./HashUtils.js');
9
9
 
10
- /*
11
- * Copyright (c) Microsoft Corporation. All rights reserved.
12
- * Licensed under the MIT License.
13
- */
14
- /**
15
- * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
16
- * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
17
- * @public
18
- */
19
- class CryptoProvider {
20
- constructor() {
21
- // Browser crypto needs to be validated first before any other classes can be set.
22
- this.pkceGenerator = new PkceGenerator.PkceGenerator();
23
- this.guidGenerator = new GuidGenerator.GuidGenerator();
24
- this.hashUtils = new HashUtils.HashUtils();
25
- }
26
- /**
27
- * Creates a new random GUID - used to populate state and nonce.
28
- * @returns string (GUID)
29
- */
30
- createNewGuid() {
31
- return this.guidGenerator.generateGuid();
32
- }
33
- /**
34
- * Encodes input string to base64.
35
- * @param input - string to be encoded
36
- */
37
- base64Encode(input) {
38
- return EncodingUtils.EncodingUtils.base64Encode(input);
39
- }
40
- /**
41
- * Decodes input string from base64.
42
- * @param input - string to be decoded
43
- */
44
- base64Decode(input) {
45
- return EncodingUtils.EncodingUtils.base64Decode(input);
46
- }
47
- /**
48
- * Generates PKCE codes used in Authorization Code Flow.
49
- */
50
- generatePkceCodes() {
51
- return this.pkceGenerator.generatePkceCodes();
52
- }
53
- /**
54
- * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
55
- */
56
- getPublicKeyThumbprint() {
57
- throw new Error("Method not implemented.");
58
- }
59
- /**
60
- * Removes cryptographic keypair from key store matching the keyId passed in
61
- * @param kid
62
- */
63
- removeTokenBindingKey() {
64
- throw new Error("Method not implemented.");
65
- }
66
- /**
67
- * Removes all cryptographic keys from Keystore
68
- */
69
- clearKeystore() {
70
- throw new Error("Method not implemented.");
71
- }
72
- /**
73
- * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
74
- */
75
- signJwt() {
76
- throw new Error("Method not implemented.");
77
- }
78
- /**
79
- * Returns the SHA-256 hash of an input string
80
- */
81
- async hashString(plainText) {
82
- return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
83
- }
10
+ /*
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License.
13
+ */
14
+ /**
15
+ * This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
16
+ * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
17
+ * @public
18
+ */
19
+ class CryptoProvider {
20
+ constructor() {
21
+ // Browser crypto needs to be validated first before any other classes can be set.
22
+ this.pkceGenerator = new PkceGenerator.PkceGenerator();
23
+ this.guidGenerator = new GuidGenerator.GuidGenerator();
24
+ this.hashUtils = new HashUtils.HashUtils();
25
+ }
26
+ /**
27
+ * Creates a new random GUID - used to populate state and nonce.
28
+ * @returns string (GUID)
29
+ */
30
+ createNewGuid() {
31
+ return this.guidGenerator.generateGuid();
32
+ }
33
+ /**
34
+ * Encodes input string to base64.
35
+ * @param input - string to be encoded
36
+ */
37
+ base64Encode(input) {
38
+ return EncodingUtils.EncodingUtils.base64Encode(input);
39
+ }
40
+ /**
41
+ * Decodes input string from base64.
42
+ * @param input - string to be decoded
43
+ */
44
+ base64Decode(input) {
45
+ return EncodingUtils.EncodingUtils.base64Decode(input);
46
+ }
47
+ /**
48
+ * Generates PKCE codes used in Authorization Code Flow.
49
+ */
50
+ generatePkceCodes() {
51
+ return this.pkceGenerator.generatePkceCodes();
52
+ }
53
+ /**
54
+ * Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
55
+ */
56
+ getPublicKeyThumbprint() {
57
+ throw new Error("Method not implemented.");
58
+ }
59
+ /**
60
+ * Removes cryptographic keypair from key store matching the keyId passed in
61
+ * @param kid
62
+ */
63
+ removeTokenBindingKey() {
64
+ throw new Error("Method not implemented.");
65
+ }
66
+ /**
67
+ * Removes all cryptographic keys from Keystore
68
+ */
69
+ clearKeystore() {
70
+ throw new Error("Method not implemented.");
71
+ }
72
+ /**
73
+ * Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
74
+ */
75
+ signJwt() {
76
+ throw new Error("Method not implemented.");
77
+ }
78
+ /**
79
+ * Returns the SHA-256 hash of an input string
80
+ */
81
+ async hashString(plainText) {
82
+ return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
83
+ }
84
84
  }
85
85
 
86
86
  exports.CryptoProvider = CryptoProvider;
@@ -1,15 +1,15 @@
1
- import { IGuidGenerator } from "@azure/msal-common";
2
- export declare class GuidGenerator implements IGuidGenerator {
3
- /**
4
- *
5
- * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
6
- * uuidv4 generates guids from cryprtographically-string random
7
- */
8
- generateGuid(): string;
9
- /**
10
- * verifies if a string is GUID
11
- * @param guid
12
- */
13
- isGuid(guid: string): boolean;
14
- }
1
+ import { IGuidGenerator } from "@azure/msal-common";
2
+ export declare class GuidGenerator implements IGuidGenerator {
3
+ /**
4
+ *
5
+ * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
6
+ * uuidv4 generates guids from cryprtographically-string random
7
+ */
8
+ generateGuid(): string;
9
+ /**
10
+ * verifies if a string is GUID
11
+ * @param guid
12
+ */
13
+ isGuid(guid: string): boolean;
14
+ }
15
15
  //# sourceMappingURL=GuidGenerator.d.ts.map
@@ -1,28 +1,28 @@
1
- /*! @azure/msal-node v2.0.0-alpha.1 2023-05-08 */
1
+ /*! @azure/msal-node v2.0.0-beta.0 2023-06-19 */
2
2
  'use strict';
3
3
  import { v4 } from 'uuid';
4
4
 
5
- /*
6
- * Copyright (c) Microsoft Corporation. All rights reserved.
7
- * Licensed under the MIT License.
8
- */
9
- class GuidGenerator {
10
- /**
11
- *
12
- * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
13
- * uuidv4 generates guids from cryprtographically-string random
14
- */
15
- generateGuid() {
16
- return v4();
17
- }
18
- /**
19
- * verifies if a string is GUID
20
- * @param guid
21
- */
22
- isGuid(guid) {
23
- 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;
24
- return regexGuid.test(guid);
25
- }
5
+ /*
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License.
8
+ */
9
+ class GuidGenerator {
10
+ /**
11
+ *
12
+ * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
13
+ * uuidv4 generates guids from cryprtographically-string random
14
+ */
15
+ generateGuid() {
16
+ return v4();
17
+ }
18
+ /**
19
+ * verifies if a string is GUID
20
+ * @param guid
21
+ */
22
+ isGuid(guid) {
23
+ 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;
24
+ return regexGuid.test(guid);
25
+ }
26
26
  }
27
27
 
28
28
  export { GuidGenerator };