@azure/msal-browser 3.5.0 → 3.5.1-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.
- package/dist/app/IPublicClientApplication.d.ts +51 -51
- package/dist/app/IPublicClientApplication.mjs +102 -102
- package/dist/app/PublicClientApplication.d.ts +268 -268
- package/dist/app/PublicClientApplication.mjs +333 -333
- package/dist/app/PublicClientNext.d.ts +273 -273
- package/dist/app/PublicClientNext.mjs +351 -351
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +62 -62
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +254 -254
- package/dist/broker/nativeBroker/NativeRequest.d.ts +44 -44
- package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +7 -7
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +11 -11
- package/dist/cache/AsyncMemoryStorage.d.ts +51 -51
- package/dist/cache/AsyncMemoryStorage.mjs +132 -132
- package/dist/cache/BrowserCacheManager.d.ts +383 -383
- package/dist/cache/BrowserCacheManager.mjs +1262 -1262
- package/dist/cache/BrowserStorage.d.ts +11 -11
- package/dist/cache/BrowserStorage.mjs +32 -32
- package/dist/cache/CryptoKeyStore.d.ts +18 -18
- package/dist/cache/CryptoKeyStore.mjs +40 -40
- package/dist/cache/DatabaseStorage.d.ts +56 -56
- package/dist/cache/DatabaseStorage.mjs +190 -190
- package/dist/cache/IAsyncMemoryStorage.d.ts +27 -27
- package/dist/cache/ITokenCache.d.ts +11 -11
- package/dist/cache/IWindowStorage.d.ts +27 -27
- package/dist/cache/MemoryStorage.d.ts +11 -11
- package/dist/cache/MemoryStorage.mjs +31 -31
- package/dist/cache/TokenCache.d.ts +77 -77
- package/dist/cache/TokenCache.mjs +224 -224
- package/dist/config/Configuration.d.ts +206 -206
- package/dist/config/Configuration.mjs +128 -128
- package/dist/controllers/ControllerFactory.d.ts +4 -4
- package/dist/controllers/ControllerFactory.mjs +29 -29
- package/dist/controllers/IController.d.ts +61 -61
- package/dist/controllers/NestedAppAuthController.d.ts +95 -95
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +335 -333
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +407 -407
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +1293 -1291
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +87 -87
- package/dist/controllers/UnknownOperatingContextController.mjs +264 -264
- package/dist/crypto/BrowserCrypto.d.ts +44 -44
- package/dist/crypto/BrowserCrypto.mjs +93 -93
- package/dist/crypto/CryptoOps.d.ts +63 -63
- package/dist/crypto/CryptoOps.mjs +145 -145
- package/dist/crypto/PkceGenerator.d.ts +8 -8
- package/dist/crypto/PkceGenerator.mjs +54 -54
- package/dist/crypto/SignedHttpRequest.d.ts +30 -30
- package/dist/crypto/SignedHttpRequest.mjs +39 -39
- package/dist/encode/Base64Decode.d.ts +9 -9
- package/dist/encode/Base64Decode.mjs +36 -36
- package/dist/encode/Base64Encode.d.ts +19 -19
- package/dist/encode/Base64Encode.mjs +43 -43
- package/dist/error/BrowserAuthError.d.ts +250 -250
- package/dist/error/BrowserAuthError.mjs +258 -258
- package/dist/error/BrowserAuthErrorCodes.d.ts +45 -45
- package/dist/error/BrowserAuthErrorCodes.mjs +49 -49
- package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
- package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
- package/dist/error/NativeAuthError.d.ts +29 -29
- package/dist/error/NativeAuthError.mjs +60 -60
- package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
- package/dist/error/NativeAuthErrorCodes.mjs +6 -6
- package/dist/error/NestedAppAuthError.d.ts +14 -14
- package/dist/error/NestedAppAuthError.mjs +23 -23
- package/dist/event/EventHandler.d.ts +41 -41
- package/dist/event/EventHandler.mjs +119 -119
- package/dist/event/EventMessage.d.ts +25 -25
- package/dist/event/EventMessage.mjs +68 -68
- package/dist/event/EventType.d.ts +28 -28
- package/dist/event/EventType.mjs +31 -31
- package/dist/index.d.ts +39 -39
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +54 -54
- package/dist/interaction_client/BaseInteractionClient.mjs +152 -152
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts +140 -140
- package/dist/interaction_client/NativeInteractionClient.mjs +548 -548
- package/dist/interaction_client/PopupClient.d.ts +105 -105
- package/dist/interaction_client/PopupClient.mjs +432 -432
- package/dist/interaction_client/RedirectClient.d.ts +49 -49
- package/dist/interaction_client/RedirectClient.mjs +311 -311
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
- package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
- package/dist/interaction_client/SilentCacheClient.d.ts +24 -24
- package/dist/interaction_client/SilentCacheClient.mjs +61 -61
- package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
- package/dist/interaction_client/SilentIframeClient.mjs +96 -96
- package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
- package/dist/interaction_client/SilentRefreshClient.mjs +43 -43
- package/dist/interaction_client/StandardInteractionClient.d.ts +54 -54
- package/dist/interaction_client/StandardInteractionClient.mjs +222 -222
- package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
- package/dist/interaction_handler/InteractionHandler.mjs +93 -93
- package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
- package/dist/interaction_handler/RedirectHandler.mjs +134 -134
- package/dist/interaction_handler/SilentHandler.d.ts +13 -13
- package/dist/interaction_handler/SilentHandler.mjs +133 -133
- package/dist/naa/AccountInfo.d.ts +11 -12
- package/dist/naa/AccountInfo.d.ts.map +1 -1
- package/dist/naa/AccountRequests.d.ts +9 -9
- package/dist/naa/AuthBridge.d.ts +5 -5
- package/dist/naa/BridgeCapabilities.d.ts +3 -3
- package/dist/naa/BridgeError.d.ts +9 -9
- package/dist/naa/BridgeError.d.ts.map +1 -1
- package/dist/naa/BridgeError.mjs +7 -7
- package/dist/naa/BridgeError.mjs.map +1 -1
- package/dist/naa/BridgeProxy.d.ts +72 -71
- package/dist/naa/BridgeProxy.d.ts.map +1 -1
- package/dist/naa/BridgeProxy.mjs +152 -149
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeRequest.d.ts +6 -6
- package/dist/naa/BridgeRequestEnvelope.d.ts +13 -13
- package/dist/naa/BridgeResponseEnvelope.d.ts +10 -10
- package/dist/naa/BridgeStatusCode.d.ts +10 -10
- package/dist/naa/BridgeStatusCode.mjs +15 -15
- package/dist/naa/IBridgeProxy.d.ts +12 -10
- package/dist/naa/IBridgeProxy.d.ts.map +1 -1
- package/dist/naa/InitializeBridgeResponse.d.ts +6 -6
- package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -1
- package/dist/naa/TokenRequest.d.ts +19 -21
- package/dist/naa/TokenRequest.d.ts.map +1 -1
- package/dist/naa/TokenResponse.d.ts +15 -16
- package/dist/naa/TokenResponse.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +23 -25
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +142 -170
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/INavigationClient.d.ts +16 -16
- package/dist/navigation/NavigationClient.d.ts +22 -22
- package/dist/navigation/NavigationClient.mjs +40 -40
- package/dist/navigation/NavigationOptions.d.ts +12 -12
- package/dist/network/FetchClient.d.ts +26 -26
- package/dist/network/FetchClient.mjs +99 -99
- package/dist/operatingcontext/BaseOperatingContext.d.ts +40 -40
- package/dist/operatingcontext/BaseOperatingContext.mjs +44 -44
- package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +32 -32
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +85 -82
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/UnknownOperatingContext.mjs +42 -42
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +3 -3
- package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
- package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
- package/dist/request/ClearCacheRequest.d.ts +10 -10
- package/dist/request/EndSessionPopupRequest.d.ts +18 -18
- package/dist/request/EndSessionRequest.d.ts +15 -15
- package/dist/request/PopupRequest.d.ts +34 -34
- package/dist/request/PopupWindowAttributes.d.ts +15 -15
- package/dist/request/RedirectRequest.d.ts +35 -35
- package/dist/request/SilentRequest.d.ts +32 -32
- package/dist/request/SsoSilentRequest.d.ts +29 -29
- package/dist/response/AuthenticationResult.d.ts +4 -4
- package/dist/response/ResponseHandler.d.ts +7 -7
- package/dist/response/ResponseHandler.mjs +36 -36
- package/dist/telemetry/BrowserPerformanceClient.d.ts +36 -36
- package/dist/telemetry/BrowserPerformanceClient.mjs +125 -125
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
- package/dist/utils/BrowserConstants.d.ts +176 -176
- package/dist/utils/BrowserConstants.mjs +204 -204
- package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
- package/dist/utils/BrowserProtocolUtils.mjs +21 -21
- package/dist/utils/BrowserUtils.d.ts +56 -56
- package/dist/utils/BrowserUtils.mjs +125 -125
- package/lib/msal-browser.cjs +17920 -17926
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +17920 -17926
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +59 -59
- package/package.json +102 -102
- package/src/controllers/NestedAppAuthController.ts +8 -3
- package/src/controllers/StandardController.ts +3 -1
- package/src/naa/AccountInfo.ts +3 -4
- package/src/naa/BridgeError.ts +4 -4
- package/src/naa/BridgeProxy.ts +6 -2
- package/src/naa/IBridgeProxy.ts +2 -0
- package/src/naa/InitializeBridgeResponse.ts +1 -1
- package/src/naa/TokenRequest.ts +0 -2
- package/src/naa/TokenResponse.ts +1 -2
- package/src/naa/mapping/NestedAppAuthAdapter.ts +72 -80
- package/src/operatingcontext/TeamsAppOperatingContext.ts +4 -1
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.5.0 2023-11-
|
|
1
|
+
/*! @azure/msal-browser v3.5.1-beta.0 2023-11-14 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
4
4
|
import { PerformanceEvents } from '@azure/msal-common';
|
|
5
5
|
import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.mjs';
|
|
6
6
|
import { cryptoNonExistent } from '../error/BrowserAuthErrorCodes.mjs';
|
|
7
7
|
|
|
8
|
-
/*
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* This file defines functions used by the browser library to perform cryptography operations such as
|
|
14
|
-
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
18
|
-
*/
|
|
19
|
-
// RSA KeyGen Algorithm
|
|
20
|
-
const PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
21
|
-
// SHA-256 hashing algorithm
|
|
22
|
-
const S256_HASH_ALG = "SHA-256";
|
|
23
|
-
// MOD length for PoP tokens
|
|
24
|
-
const MODULUS_LENGTH = 2048;
|
|
25
|
-
// Public Exponent
|
|
26
|
-
const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
27
|
-
const keygenAlgorithmOptions = {
|
|
28
|
-
name: PKCS1_V15_KEYGEN_ALG,
|
|
29
|
-
hash: S256_HASH_ALG,
|
|
30
|
-
modulusLength: MODULUS_LENGTH,
|
|
31
|
-
publicExponent: PUBLIC_EXPONENT,
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Check whether browser crypto is available.
|
|
35
|
-
*/
|
|
36
|
-
function validateCryptoAvailable(logger) {
|
|
37
|
-
if ("crypto" in window) {
|
|
38
|
-
logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
logger.error("BrowserCrypto: crypto interface is unavailable");
|
|
42
|
-
throw createBrowserAuthError(cryptoNonExistent);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
47
|
-
* @param dataString
|
|
48
|
-
*/
|
|
49
|
-
async function sha256Digest(dataString, performanceClient, correlationId) {
|
|
50
|
-
performanceClient?.addQueueMeasurement(PerformanceEvents.Sha256Digest, correlationId);
|
|
51
|
-
const encoder = new TextEncoder();
|
|
52
|
-
const data = encoder.encode(dataString);
|
|
53
|
-
return window.crypto.subtle.digest(S256_HASH_ALG, data);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Populates buffer with cryptographically random values.
|
|
57
|
-
* @param dataBuffer
|
|
58
|
-
*/
|
|
59
|
-
function getRandomValues(dataBuffer) {
|
|
60
|
-
return window.crypto.getRandomValues(dataBuffer);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Creates a new random GUID
|
|
64
|
-
* @returns
|
|
65
|
-
*/
|
|
66
|
-
function createNewGuid() {
|
|
67
|
-
return window.crypto.randomUUID();
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Generates a keypair based on current keygen algorithm config.
|
|
71
|
-
* @param extractable
|
|
72
|
-
* @param usages
|
|
73
|
-
*/
|
|
74
|
-
async function generateKeyPair(extractable, usages) {
|
|
75
|
-
return window.crypto.subtle.generateKey(keygenAlgorithmOptions, extractable, usages);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Export key as Json Web Key (JWK)
|
|
79
|
-
* @param key
|
|
80
|
-
*/
|
|
81
|
-
async function exportJwk(key) {
|
|
82
|
-
return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
86
|
-
* @param key
|
|
87
|
-
* @param extractable
|
|
88
|
-
* @param usages
|
|
89
|
-
*/
|
|
90
|
-
async function importJwk(key, extractable, usages) {
|
|
91
|
-
return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, keygenAlgorithmOptions, extractable, usages);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Signs given data with given key
|
|
95
|
-
* @param key
|
|
96
|
-
* @param data
|
|
97
|
-
*/
|
|
98
|
-
async function sign(key, data) {
|
|
99
|
-
return window.crypto.subtle.sign(keygenAlgorithmOptions, key, data);
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* This file defines functions used by the browser library to perform cryptography operations such as
|
|
14
|
+
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
18
|
+
*/
|
|
19
|
+
// RSA KeyGen Algorithm
|
|
20
|
+
const PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
21
|
+
// SHA-256 hashing algorithm
|
|
22
|
+
const S256_HASH_ALG = "SHA-256";
|
|
23
|
+
// MOD length for PoP tokens
|
|
24
|
+
const MODULUS_LENGTH = 2048;
|
|
25
|
+
// Public Exponent
|
|
26
|
+
const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
27
|
+
const keygenAlgorithmOptions = {
|
|
28
|
+
name: PKCS1_V15_KEYGEN_ALG,
|
|
29
|
+
hash: S256_HASH_ALG,
|
|
30
|
+
modulusLength: MODULUS_LENGTH,
|
|
31
|
+
publicExponent: PUBLIC_EXPONENT,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Check whether browser crypto is available.
|
|
35
|
+
*/
|
|
36
|
+
function validateCryptoAvailable(logger) {
|
|
37
|
+
if ("crypto" in window) {
|
|
38
|
+
logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
logger.error("BrowserCrypto: crypto interface is unavailable");
|
|
42
|
+
throw createBrowserAuthError(cryptoNonExistent);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
47
|
+
* @param dataString
|
|
48
|
+
*/
|
|
49
|
+
async function sha256Digest(dataString, performanceClient, correlationId) {
|
|
50
|
+
performanceClient?.addQueueMeasurement(PerformanceEvents.Sha256Digest, correlationId);
|
|
51
|
+
const encoder = new TextEncoder();
|
|
52
|
+
const data = encoder.encode(dataString);
|
|
53
|
+
return window.crypto.subtle.digest(S256_HASH_ALG, data);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Populates buffer with cryptographically random values.
|
|
57
|
+
* @param dataBuffer
|
|
58
|
+
*/
|
|
59
|
+
function getRandomValues(dataBuffer) {
|
|
60
|
+
return window.crypto.getRandomValues(dataBuffer);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new random GUID
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
function createNewGuid() {
|
|
67
|
+
return window.crypto.randomUUID();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Generates a keypair based on current keygen algorithm config.
|
|
71
|
+
* @param extractable
|
|
72
|
+
* @param usages
|
|
73
|
+
*/
|
|
74
|
+
async function generateKeyPair(extractable, usages) {
|
|
75
|
+
return window.crypto.subtle.generateKey(keygenAlgorithmOptions, extractable, usages);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Export key as Json Web Key (JWK)
|
|
79
|
+
* @param key
|
|
80
|
+
*/
|
|
81
|
+
async function exportJwk(key) {
|
|
82
|
+
return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
86
|
+
* @param key
|
|
87
|
+
* @param extractable
|
|
88
|
+
* @param usages
|
|
89
|
+
*/
|
|
90
|
+
async function importJwk(key, extractable, usages) {
|
|
91
|
+
return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, keygenAlgorithmOptions, extractable, usages);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Signs given data with given key
|
|
95
|
+
* @param key
|
|
96
|
+
* @param data
|
|
97
|
+
*/
|
|
98
|
+
async function sign(key, data) {
|
|
99
|
+
return window.crypto.subtle.sign(keygenAlgorithmOptions, key, data);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export { createNewGuid, exportJwk, generateKeyPair, getRandomValues, importJwk, sha256Digest, sign, validateCryptoAvailable };
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { ICrypto, IPerformanceClient, Logger, ShrOptions, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common";
|
|
2
|
-
export type CachedKeyPair = {
|
|
3
|
-
publicKey: CryptoKey;
|
|
4
|
-
privateKey: CryptoKey;
|
|
5
|
-
requestMethod?: string;
|
|
6
|
-
requestUri?: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
10
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
11
|
-
*/
|
|
12
|
-
export declare class CryptoOps implements ICrypto {
|
|
13
|
-
private logger;
|
|
14
|
-
/**
|
|
15
|
-
* CryptoOps can be used in contexts outside a PCA instance,
|
|
16
|
-
* meaning there won't be a performance manager available.
|
|
17
|
-
*/
|
|
18
|
-
private performanceClient;
|
|
19
|
-
private static POP_KEY_USAGES;
|
|
20
|
-
private static EXTRACTABLE;
|
|
21
|
-
private cache;
|
|
22
|
-
constructor(logger: Logger, performanceClient?: IPerformanceClient);
|
|
23
|
-
/**
|
|
24
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
25
|
-
* @returns string (GUID)
|
|
26
|
-
*/
|
|
27
|
-
createNewGuid(): string;
|
|
28
|
-
/**
|
|
29
|
-
* Encodes input string to base64.
|
|
30
|
-
* @param input
|
|
31
|
-
*/
|
|
32
|
-
base64Encode(input: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Decodes input string from base64.
|
|
35
|
-
* @param input
|
|
36
|
-
*/
|
|
37
|
-
base64Decode(input: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Generates a keypair, stores it and returns a thumbprint
|
|
40
|
-
* @param request
|
|
41
|
-
*/
|
|
42
|
-
getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
45
|
-
* @param kid
|
|
46
|
-
*/
|
|
47
|
-
removeTokenBindingKey(kid: string): Promise<boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Removes all cryptographic keys from IndexedDB storage
|
|
50
|
-
*/
|
|
51
|
-
clearKeystore(): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
54
|
-
* @param payload
|
|
55
|
-
* @param kid
|
|
56
|
-
*/
|
|
57
|
-
signJwt(payload: SignedHttpRequest, kid: string, shrOptions?: ShrOptions, correlationId?: string): Promise<string>;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the SHA-256 hash of an input string
|
|
60
|
-
* @param plainText
|
|
61
|
-
*/
|
|
62
|
-
hashString(plainText: string): Promise<string>;
|
|
63
|
-
}
|
|
1
|
+
import { ICrypto, IPerformanceClient, Logger, ShrOptions, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common";
|
|
2
|
+
export type CachedKeyPair = {
|
|
3
|
+
publicKey: CryptoKey;
|
|
4
|
+
privateKey: CryptoKey;
|
|
5
|
+
requestMethod?: string;
|
|
6
|
+
requestUri?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
10
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
11
|
+
*/
|
|
12
|
+
export declare class CryptoOps implements ICrypto {
|
|
13
|
+
private logger;
|
|
14
|
+
/**
|
|
15
|
+
* CryptoOps can be used in contexts outside a PCA instance,
|
|
16
|
+
* meaning there won't be a performance manager available.
|
|
17
|
+
*/
|
|
18
|
+
private performanceClient;
|
|
19
|
+
private static POP_KEY_USAGES;
|
|
20
|
+
private static EXTRACTABLE;
|
|
21
|
+
private cache;
|
|
22
|
+
constructor(logger: Logger, performanceClient?: IPerformanceClient);
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
25
|
+
* @returns string (GUID)
|
|
26
|
+
*/
|
|
27
|
+
createNewGuid(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Encodes input string to base64.
|
|
30
|
+
* @param input
|
|
31
|
+
*/
|
|
32
|
+
base64Encode(input: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Decodes input string from base64.
|
|
35
|
+
* @param input
|
|
36
|
+
*/
|
|
37
|
+
base64Decode(input: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Generates a keypair, stores it and returns a thumbprint
|
|
40
|
+
* @param request
|
|
41
|
+
*/
|
|
42
|
+
getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
45
|
+
* @param kid
|
|
46
|
+
*/
|
|
47
|
+
removeTokenBindingKey(kid: string): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Removes all cryptographic keys from IndexedDB storage
|
|
50
|
+
*/
|
|
51
|
+
clearKeystore(): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
54
|
+
* @param payload
|
|
55
|
+
* @param kid
|
|
56
|
+
*/
|
|
57
|
+
signJwt(payload: SignedHttpRequest, kid: string, shrOptions?: ShrOptions, correlationId?: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the SHA-256 hash of an input string
|
|
60
|
+
* @param plainText
|
|
61
|
+
*/
|
|
62
|
+
hashString(plainText: string): Promise<string>;
|
|
63
|
+
}
|
|
64
64
|
//# sourceMappingURL=CryptoOps.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.5.0 2023-11-
|
|
1
|
+
/*! @azure/msal-browser v3.5.1-beta.0 2023-11-14 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { PerformanceEvents, JoseHeader } from '@azure/msal-common';
|
|
4
4
|
import { base64Encode, urlEncode, urlEncodeArr } from '../encode/Base64Encode.mjs';
|
|
@@ -8,150 +8,150 @@ import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
|
8
8
|
import { CryptoKeyStore } from '../cache/CryptoKeyStore.mjs';
|
|
9
9
|
import { cryptoKeyNotFound } from '../error/BrowserAuthErrorCodes.mjs';
|
|
10
10
|
|
|
11
|
-
/*
|
|
12
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13
|
-
* Licensed under the MIT License.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
17
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
18
|
-
*/
|
|
19
|
-
class CryptoOps {
|
|
20
|
-
constructor(logger, performanceClient) {
|
|
21
|
-
this.logger = logger;
|
|
22
|
-
// Browser crypto needs to be validated first before any other classes can be set.
|
|
23
|
-
validateCryptoAvailable(logger);
|
|
24
|
-
this.cache = new CryptoKeyStore(this.logger);
|
|
25
|
-
this.performanceClient = performanceClient;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
29
|
-
* @returns string (GUID)
|
|
30
|
-
*/
|
|
31
|
-
createNewGuid() {
|
|
32
|
-
return createNewGuid();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Encodes input string to base64.
|
|
36
|
-
* @param input
|
|
37
|
-
*/
|
|
38
|
-
base64Encode(input) {
|
|
39
|
-
return base64Encode(input);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Decodes input string from base64.
|
|
43
|
-
* @param input
|
|
44
|
-
*/
|
|
45
|
-
base64Decode(input) {
|
|
46
|
-
return base64Decode(input);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Generates a keypair, stores it and returns a thumbprint
|
|
50
|
-
* @param request
|
|
51
|
-
*/
|
|
52
|
-
async getPublicKeyThumbprint(request) {
|
|
53
|
-
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
54
|
-
// Generate Keypair
|
|
55
|
-
const keyPair = await generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);
|
|
56
|
-
// Generate Thumbprint for Public Key
|
|
57
|
-
const publicKeyJwk = await exportJwk(keyPair.publicKey);
|
|
58
|
-
const pubKeyThumprintObj = {
|
|
59
|
-
e: publicKeyJwk.e,
|
|
60
|
-
kty: publicKeyJwk.kty,
|
|
61
|
-
n: publicKeyJwk.n,
|
|
62
|
-
};
|
|
63
|
-
const publicJwkString = getSortedObjectString(pubKeyThumprintObj);
|
|
64
|
-
const publicJwkHash = await this.hashString(publicJwkString);
|
|
65
|
-
// Generate Thumbprint for Private Key
|
|
66
|
-
const privateKeyJwk = await exportJwk(keyPair.privateKey);
|
|
67
|
-
// Re-import private key to make it unextractable
|
|
68
|
-
const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"]);
|
|
69
|
-
// Store Keypair data in keystore
|
|
70
|
-
await this.cache.asymmetricKeys.setItem(publicJwkHash, {
|
|
71
|
-
privateKey: unextractablePrivateKey,
|
|
72
|
-
publicKey: keyPair.publicKey,
|
|
73
|
-
requestMethod: request.resourceRequestMethod,
|
|
74
|
-
requestUri: request.resourceRequestUri,
|
|
75
|
-
});
|
|
76
|
-
if (publicKeyThumbMeasurement) {
|
|
77
|
-
publicKeyThumbMeasurement.end({
|
|
78
|
-
success: true,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return publicJwkHash;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
85
|
-
* @param kid
|
|
86
|
-
*/
|
|
87
|
-
async removeTokenBindingKey(kid) {
|
|
88
|
-
await this.cache.asymmetricKeys.removeItem(kid);
|
|
89
|
-
const keyFound = await this.cache.asymmetricKeys.containsKey(kid);
|
|
90
|
-
return !keyFound;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Removes all cryptographic keys from IndexedDB storage
|
|
94
|
-
*/
|
|
95
|
-
async clearKeystore() {
|
|
96
|
-
return await this.cache.clear();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
100
|
-
* @param payload
|
|
101
|
-
* @param kid
|
|
102
|
-
*/
|
|
103
|
-
async signJwt(payload, kid, shrOptions, correlationId) {
|
|
104
|
-
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
105
|
-
const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);
|
|
106
|
-
if (!cachedKeyPair) {
|
|
107
|
-
throw createBrowserAuthError(cryptoKeyNotFound);
|
|
108
|
-
}
|
|
109
|
-
// Get public key as JWK
|
|
110
|
-
const publicKeyJwk = await exportJwk(cachedKeyPair.publicKey);
|
|
111
|
-
const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
|
|
112
|
-
// Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
|
|
113
|
-
const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
|
|
114
|
-
// Generate header
|
|
115
|
-
const shrHeader = JoseHeader.getShrHeaderString({
|
|
116
|
-
...shrOptions?.header,
|
|
117
|
-
alg: publicKeyJwk.alg,
|
|
118
|
-
kid: encodedKeyIdThumbprint,
|
|
119
|
-
});
|
|
120
|
-
const encodedShrHeader = urlEncode(shrHeader);
|
|
121
|
-
// Generate payload
|
|
122
|
-
payload.cnf = {
|
|
123
|
-
jwk: JSON.parse(publicKeyJwkString),
|
|
124
|
-
};
|
|
125
|
-
const encodedPayload = urlEncode(JSON.stringify(payload));
|
|
126
|
-
// Form token string
|
|
127
|
-
const tokenString = `${encodedShrHeader}.${encodedPayload}`;
|
|
128
|
-
// Sign token
|
|
129
|
-
const encoder = new TextEncoder();
|
|
130
|
-
const tokenBuffer = encoder.encode(tokenString);
|
|
131
|
-
const signatureBuffer = await sign(cachedKeyPair.privateKey, tokenBuffer);
|
|
132
|
-
const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
133
|
-
const signedJwt = `${tokenString}.${encodedSignature}`;
|
|
134
|
-
if (signJwtMeasurement) {
|
|
135
|
-
signJwtMeasurement.end({
|
|
136
|
-
success: true,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return signedJwt;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Returns the SHA-256 hash of an input string
|
|
143
|
-
* @param plainText
|
|
144
|
-
*/
|
|
145
|
-
async hashString(plainText) {
|
|
146
|
-
const hashBuffer = await sha256Digest(plainText);
|
|
147
|
-
const hashBytes = new Uint8Array(hashBuffer);
|
|
148
|
-
return urlEncodeArr(hashBytes);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
152
|
-
CryptoOps.EXTRACTABLE = true;
|
|
153
|
-
function getSortedObjectString(obj) {
|
|
154
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
11
|
+
/*
|
|
12
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13
|
+
* Licensed under the MIT License.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
17
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
18
|
+
*/
|
|
19
|
+
class CryptoOps {
|
|
20
|
+
constructor(logger, performanceClient) {
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
// Browser crypto needs to be validated first before any other classes can be set.
|
|
23
|
+
validateCryptoAvailable(logger);
|
|
24
|
+
this.cache = new CryptoKeyStore(this.logger);
|
|
25
|
+
this.performanceClient = performanceClient;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
29
|
+
* @returns string (GUID)
|
|
30
|
+
*/
|
|
31
|
+
createNewGuid() {
|
|
32
|
+
return createNewGuid();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Encodes input string to base64.
|
|
36
|
+
* @param input
|
|
37
|
+
*/
|
|
38
|
+
base64Encode(input) {
|
|
39
|
+
return base64Encode(input);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Decodes input string from base64.
|
|
43
|
+
* @param input
|
|
44
|
+
*/
|
|
45
|
+
base64Decode(input) {
|
|
46
|
+
return base64Decode(input);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Generates a keypair, stores it and returns a thumbprint
|
|
50
|
+
* @param request
|
|
51
|
+
*/
|
|
52
|
+
async getPublicKeyThumbprint(request) {
|
|
53
|
+
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
54
|
+
// Generate Keypair
|
|
55
|
+
const keyPair = await generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);
|
|
56
|
+
// Generate Thumbprint for Public Key
|
|
57
|
+
const publicKeyJwk = await exportJwk(keyPair.publicKey);
|
|
58
|
+
const pubKeyThumprintObj = {
|
|
59
|
+
e: publicKeyJwk.e,
|
|
60
|
+
kty: publicKeyJwk.kty,
|
|
61
|
+
n: publicKeyJwk.n,
|
|
62
|
+
};
|
|
63
|
+
const publicJwkString = getSortedObjectString(pubKeyThumprintObj);
|
|
64
|
+
const publicJwkHash = await this.hashString(publicJwkString);
|
|
65
|
+
// Generate Thumbprint for Private Key
|
|
66
|
+
const privateKeyJwk = await exportJwk(keyPair.privateKey);
|
|
67
|
+
// Re-import private key to make it unextractable
|
|
68
|
+
const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"]);
|
|
69
|
+
// Store Keypair data in keystore
|
|
70
|
+
await this.cache.asymmetricKeys.setItem(publicJwkHash, {
|
|
71
|
+
privateKey: unextractablePrivateKey,
|
|
72
|
+
publicKey: keyPair.publicKey,
|
|
73
|
+
requestMethod: request.resourceRequestMethod,
|
|
74
|
+
requestUri: request.resourceRequestUri,
|
|
75
|
+
});
|
|
76
|
+
if (publicKeyThumbMeasurement) {
|
|
77
|
+
publicKeyThumbMeasurement.end({
|
|
78
|
+
success: true,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return publicJwkHash;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
85
|
+
* @param kid
|
|
86
|
+
*/
|
|
87
|
+
async removeTokenBindingKey(kid) {
|
|
88
|
+
await this.cache.asymmetricKeys.removeItem(kid);
|
|
89
|
+
const keyFound = await this.cache.asymmetricKeys.containsKey(kid);
|
|
90
|
+
return !keyFound;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Removes all cryptographic keys from IndexedDB storage
|
|
94
|
+
*/
|
|
95
|
+
async clearKeystore() {
|
|
96
|
+
return await this.cache.clear();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
100
|
+
* @param payload
|
|
101
|
+
* @param kid
|
|
102
|
+
*/
|
|
103
|
+
async signJwt(payload, kid, shrOptions, correlationId) {
|
|
104
|
+
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
105
|
+
const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);
|
|
106
|
+
if (!cachedKeyPair) {
|
|
107
|
+
throw createBrowserAuthError(cryptoKeyNotFound);
|
|
108
|
+
}
|
|
109
|
+
// Get public key as JWK
|
|
110
|
+
const publicKeyJwk = await exportJwk(cachedKeyPair.publicKey);
|
|
111
|
+
const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
|
|
112
|
+
// Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
|
|
113
|
+
const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
|
|
114
|
+
// Generate header
|
|
115
|
+
const shrHeader = JoseHeader.getShrHeaderString({
|
|
116
|
+
...shrOptions?.header,
|
|
117
|
+
alg: publicKeyJwk.alg,
|
|
118
|
+
kid: encodedKeyIdThumbprint,
|
|
119
|
+
});
|
|
120
|
+
const encodedShrHeader = urlEncode(shrHeader);
|
|
121
|
+
// Generate payload
|
|
122
|
+
payload.cnf = {
|
|
123
|
+
jwk: JSON.parse(publicKeyJwkString),
|
|
124
|
+
};
|
|
125
|
+
const encodedPayload = urlEncode(JSON.stringify(payload));
|
|
126
|
+
// Form token string
|
|
127
|
+
const tokenString = `${encodedShrHeader}.${encodedPayload}`;
|
|
128
|
+
// Sign token
|
|
129
|
+
const encoder = new TextEncoder();
|
|
130
|
+
const tokenBuffer = encoder.encode(tokenString);
|
|
131
|
+
const signatureBuffer = await sign(cachedKeyPair.privateKey, tokenBuffer);
|
|
132
|
+
const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
133
|
+
const signedJwt = `${tokenString}.${encodedSignature}`;
|
|
134
|
+
if (signJwtMeasurement) {
|
|
135
|
+
signJwtMeasurement.end({
|
|
136
|
+
success: true,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return signedJwt;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns the SHA-256 hash of an input string
|
|
143
|
+
* @param plainText
|
|
144
|
+
*/
|
|
145
|
+
async hashString(plainText) {
|
|
146
|
+
const hashBuffer = await sha256Digest(plainText);
|
|
147
|
+
const hashBytes = new Uint8Array(hashBuffer);
|
|
148
|
+
return urlEncodeArr(hashBytes);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
152
|
+
CryptoOps.EXTRACTABLE = true;
|
|
153
|
+
function getSortedObjectString(obj) {
|
|
154
|
+
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export { CryptoOps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IPerformanceClient, Logger, PkceCodes } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* This file defines APIs to generate PKCE codes and code verifiers.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Generates PKCE Codes. See the RFC for more information: https://tools.ietf.org/html/rfc7636
|
|
7
|
-
*/
|
|
8
|
-
export declare function generatePkceCodes(performanceClient: IPerformanceClient, logger: Logger, correlationId: string): Promise<PkceCodes>;
|
|
1
|
+
import { IPerformanceClient, Logger, PkceCodes } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* This file defines APIs to generate PKCE codes and code verifiers.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generates PKCE Codes. See the RFC for more information: https://tools.ietf.org/html/rfc7636
|
|
7
|
+
*/
|
|
8
|
+
export declare function generatePkceCodes(performanceClient: IPerformanceClient, logger: Logger, correlationId: string): Promise<PkceCodes>;
|
|
9
9
|
//# sourceMappingURL=PkceGenerator.d.ts.map
|