@azure/msal-browser 3.1.0 → 3.3.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.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +20 -19
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +14 -6
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +18 -8
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.d.ts +274 -0
- package/dist/app/PublicClientNext.d.ts.map +1 -0
- package/dist/app/PublicClientNext.mjs +362 -0
- package/dist/app/PublicClientNext.mjs.map +1 -0
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +3 -4
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +13 -13
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +8 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts.map +1 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +16 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs.map +1 -0
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +4 -15
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +13 -69
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.mjs +7 -9
- package/dist/cache/BrowserStorage.mjs.map +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +8 -7
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -1
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +26 -19
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +3 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts +96 -0
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -0
- package/dist/controllers/NestedAppAuthController.mjs +345 -0
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -0
- package/dist/controllers/StandardController.d.ts +11 -6
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +67 -45
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +88 -0
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -0
- package/dist/controllers/UnknownOperatingContextController.mjs +275 -0
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -0
- package/dist/crypto/BrowserCrypto.d.ts +44 -49
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +77 -77
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -7
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +18 -23
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +6 -21
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +45 -46
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +18 -2
- package/dist/encode/Base64Decode.mjs.map +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.d.ts +10 -1
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +12 -3
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +1 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.d.ts +9 -46
- package/dist/error/BrowserConfigurationAuthError.d.ts.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +20 -73
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +4 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +12 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs.map +1 -0
- package/dist/error/NativeAuthError.d.ts +17 -45
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.mjs +47 -78
- package/dist/error/NativeAuthError.mjs.map +1 -1
- package/dist/error/NativeAuthErrorCodes.d.ts +3 -0
- package/dist/error/NativeAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/NativeAuthErrorCodes.mjs +11 -0
- package/dist/error/NativeAuthErrorCodes.mjs.map +1 -0
- package/dist/error/NestedAppAuthError.d.ts +15 -0
- package/dist/error/NestedAppAuthError.d.ts.map +1 -0
- package/dist/error/NestedAppAuthError.mjs +30 -0
- package/dist/error/NestedAppAuthError.mjs.map +1 -0
- package/dist/event/EventHandler.d.ts.map +1 -1
- package/dist/event/EventHandler.mjs +3 -2
- package/dist/event/EventHandler.mjs.map +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +10 -11
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +26 -13
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +5 -4
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +7 -7
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +7 -10
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +11 -18
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +27 -13
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +8 -18
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +16 -37
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +6 -9
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +3 -3
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +13 -47
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +120 -156
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/AccountInfo.d.ts +13 -0
- package/dist/naa/AccountInfo.d.ts.map +1 -0
- package/dist/naa/AccountRequests.d.ts +10 -0
- package/dist/naa/AccountRequests.d.ts.map +1 -0
- package/dist/naa/AuthBridge.d.ts +6 -0
- package/dist/naa/AuthBridge.d.ts.map +1 -0
- package/dist/naa/BridgeCapabilities.d.ts +4 -0
- package/dist/naa/BridgeCapabilities.d.ts.map +1 -0
- package/dist/naa/BridgeError.d.ts +10 -0
- package/dist/naa/BridgeError.d.ts.map +1 -0
- package/dist/naa/BridgeError.mjs +12 -0
- package/dist/naa/BridgeError.mjs.map +1 -0
- package/dist/naa/BridgeProxy.d.ts +72 -0
- package/dist/naa/BridgeProxy.d.ts.map +1 -0
- package/dist/naa/BridgeProxy.mjs +154 -0
- package/dist/naa/BridgeProxy.mjs.map +1 -0
- package/dist/naa/BridgeRequest.d.ts +7 -0
- package/dist/naa/BridgeRequest.d.ts.map +1 -0
- package/dist/naa/BridgeRequestEnvelope.d.ts +14 -0
- package/dist/naa/BridgeRequestEnvelope.d.ts.map +1 -0
- package/dist/naa/BridgeResponseEnvelope.d.ts +11 -0
- package/dist/naa/BridgeResponseEnvelope.d.ts.map +1 -0
- package/dist/naa/BridgeStatusCode.d.ts +11 -0
- package/dist/naa/BridgeStatusCode.d.ts.map +1 -0
- package/dist/naa/BridgeStatusCode.mjs +20 -0
- package/dist/naa/BridgeStatusCode.mjs.map +1 -0
- package/dist/naa/IBridgeProxy.d.ts +11 -0
- package/dist/naa/IBridgeProxy.d.ts.map +1 -0
- package/dist/naa/InitializeBridgeResponse.d.ts +7 -0
- package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -0
- package/dist/naa/TokenRequest.d.ts +22 -0
- package/dist/naa/TokenRequest.d.ts.map +1 -0
- package/dist/naa/TokenResponse.d.ts +17 -0
- package/dist/naa/TokenResponse.d.ts.map +1 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +26 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +178 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -0
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +7 -0
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +45 -4
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.d.ts +26 -0
- package/dist/operatingcontext/UnknownOperatingContext.d.ts.map +1 -0
- package/dist/operatingcontext/UnknownOperatingContext.mjs +49 -0
- package/dist/operatingcontext/UnknownOperatingContext.mjs.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +3 -3
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.d.ts +54 -53
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +114 -102
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +61 -18042
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +13593 -12505
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -65
- package/package.json +2 -2
- package/src/app/IPublicClientApplication.ts +55 -18
- package/src/app/PublicClientApplication.ts +19 -7
- package/src/app/PublicClientNext.ts +442 -0
- package/src/broker/nativeBroker/NativeMessageHandler.ts +12 -15
- package/src/broker/nativeBroker/NativeStatusCodes.ts +13 -0
- package/src/cache/BrowserCacheManager.ts +29 -103
- package/src/cache/BrowserStorage.ts +9 -11
- package/src/config/Configuration.ts +21 -8
- package/src/controllers/ControllerFactory.ts +36 -25
- package/src/controllers/IController.ts +4 -1
- package/src/controllers/NestedAppAuthController.ts +525 -0
- package/src/controllers/StandardController.ts +163 -98
- package/src/controllers/UnknownOperatingContextController.ts +383 -0
- package/src/crypto/BrowserCrypto.ts +119 -103
- package/src/crypto/CryptoOps.ts +18 -27
- package/src/crypto/PkceGenerator.ts +93 -54
- package/src/encode/Base64Decode.ts +21 -1
- package/src/error/BrowserAuthError.ts +13 -1
- package/src/error/BrowserAuthErrorCodes.ts +1 -0
- package/src/error/BrowserConfigurationAuthError.ts +33 -102
- package/src/error/BrowserConfigurationAuthErrorCodes.ts +9 -0
- package/src/error/NativeAuthError.ts +73 -101
- package/src/error/NativeAuthErrorCodes.ts +7 -0
- package/src/error/NestedAppAuthError.ts +32 -0
- package/src/event/EventHandler.ts +2 -1
- package/src/index.ts +8 -10
- package/src/interaction_client/BaseInteractionClient.ts +14 -8
- package/src/interaction_client/NativeInteractionClient.ts +48 -14
- package/src/interaction_client/PopupClient.ts +2 -1
- package/src/interaction_client/RedirectClient.ts +1 -1
- package/src/interaction_client/SilentAuthCodeClient.ts +22 -19
- package/src/interaction_client/SilentCacheClient.ts +28 -28
- package/src/interaction_client/SilentIframeClient.ts +54 -18
- package/src/interaction_client/SilentRefreshClient.ts +26 -28
- package/src/interaction_client/StandardInteractionClient.ts +37 -68
- package/src/interaction_handler/InteractionHandler.ts +20 -15
- package/src/interaction_handler/RedirectHandler.ts +6 -2
- package/src/interaction_handler/SilentHandler.ts +177 -230
- package/src/naa/AccountInfo.ts +17 -0
- package/src/naa/AccountRequests.ts +16 -0
- package/src/naa/AuthBridge.ts +16 -0
- package/src/naa/BridgeCapabilities.ts +8 -0
- package/src/naa/BridgeError.ts +18 -0
- package/src/naa/BridgeProxy.ts +230 -0
- package/src/naa/BridgeRequest.ts +12 -0
- package/src/naa/BridgeRequestEnvelope.ts +46 -0
- package/src/naa/BridgeResponseEnvelope.ts +21 -0
- package/src/naa/BridgeStatusCode.ts +15 -0
- package/src/naa/IBridgeProxy.ts +25 -0
- package/src/naa/InitializeBridgeResponse.ts +12 -0
- package/src/naa/TokenRequest.ts +26 -0
- package/src/naa/TokenResponse.ts +61 -0
- package/src/naa/mapping/NestedAppAuthAdapter.ts +252 -0
- package/src/operatingcontext/TeamsAppOperatingContext.ts +43 -3
- package/src/operatingcontext/UnknownOperatingContext.ts +48 -0
- package/src/packageMetadata.ts +1 -1
- package/src/utils/BrowserProtocolUtils.ts +3 -2
- package/src/utils/BrowserUtils.ts +133 -125
- package/dist/crypto/ISubtleCrypto.d.ts +0 -10
- package/dist/crypto/ISubtleCrypto.d.ts.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.d.ts +0 -10
- package/dist/crypto/ModernBrowserCrypto.d.ts.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.mjs +0 -31
- package/dist/crypto/ModernBrowserCrypto.mjs.map +0 -1
- package/dist/utils/BrowserStringUtils.d.ts +0 -22
- package/dist/utils/BrowserStringUtils.d.ts.map +0 -1
- package/dist/utils/BrowserStringUtils.mjs +0 -144
- package/dist/utils/BrowserStringUtils.mjs.map +0 -1
- package/src/crypto/ISubtleCrypto.ts +0 -30
- package/src/crypto/ModernBrowserCrypto.ts +0 -69
- package/src/utils/BrowserStringUtils.ts +0 -143
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { UrlString } from "@azure/msal-common";
|
|
7
7
|
import {
|
|
8
8
|
createBrowserAuthError,
|
|
9
9
|
BrowserAuthErrorCodes,
|
|
@@ -11,146 +11,154 @@ import {
|
|
|
11
11
|
import { InteractionType, BrowserConstants } from "./BrowserConstants";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Clears hash from window url.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// Full removes "#" from url
|
|
27
|
-
contentWindow.history.replaceState(
|
|
28
|
-
null,
|
|
29
|
-
Constants.EMPTY_STRING,
|
|
30
|
-
`${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`
|
|
31
|
-
);
|
|
32
|
-
}
|
|
16
|
+
export function clearHash(contentWindow: Window): void {
|
|
17
|
+
// Office.js sets history.replaceState to null
|
|
18
|
+
contentWindow.location.hash = "";
|
|
19
|
+
if (typeof contentWindow.history.replaceState === "function") {
|
|
20
|
+
// Full removes "#" from url
|
|
21
|
+
contentWindow.history.replaceState(
|
|
22
|
+
null,
|
|
23
|
+
"",
|
|
24
|
+
`${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`
|
|
25
|
+
);
|
|
33
26
|
}
|
|
27
|
+
}
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
29
|
+
/**
|
|
30
|
+
* Replaces current hash with hash from provided url
|
|
31
|
+
*/
|
|
32
|
+
export function replaceHash(url: string): void {
|
|
33
|
+
const urlParts = url.split("#");
|
|
34
|
+
urlParts.shift(); // Remove part before the hash
|
|
35
|
+
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : "";
|
|
36
|
+
}
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Returns boolean of whether the current window is in an iframe or not.
|
|
40
|
+
*/
|
|
41
|
+
export function isInIframe(): boolean {
|
|
42
|
+
return window.parent !== window;
|
|
43
|
+
}
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Returns boolean of whether or not the current window is a popup opened by msal
|
|
47
|
+
*/
|
|
48
|
+
export function isInPopup(): boolean {
|
|
49
|
+
return (
|
|
50
|
+
typeof window !== "undefined" &&
|
|
51
|
+
!!window.opener &&
|
|
52
|
+
window.opener !== window &&
|
|
53
|
+
typeof window.name === "string" &&
|
|
54
|
+
window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0
|
|
55
|
+
);
|
|
56
|
+
}
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
// #endregion
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Returns current window URL as redirect uri
|
|
62
|
+
*/
|
|
63
|
+
export function getCurrentUri(): string {
|
|
64
|
+
return window.location.href.split("?")[0].split("#")[0];
|
|
65
|
+
}
|
|
73
66
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Gets the homepage url for the current window location.
|
|
69
|
+
*/
|
|
70
|
+
export function getHomepage(): string {
|
|
71
|
+
const currentUrl = new UrlString(window.location.href);
|
|
72
|
+
const urlComponents = currentUrl.getUrlComponents();
|
|
73
|
+
return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
|
|
74
|
+
}
|
|
82
75
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
BrowserAuthErrorCodes.blockIframeReload
|
|
95
|
-
);
|
|
96
|
-
}
|
|
76
|
+
/**
|
|
77
|
+
* Throws error if we have completed an auth and are
|
|
78
|
+
* attempting another auth request inside an iframe.
|
|
79
|
+
*/
|
|
80
|
+
export function blockReloadInHiddenIframes(): void {
|
|
81
|
+
const isResponseHash = UrlString.hashContainsKnownProperties(
|
|
82
|
+
window.location.hash
|
|
83
|
+
);
|
|
84
|
+
// return an error if called from the hidden iframe created by the msal js silent calls
|
|
85
|
+
if (isResponseHash && isInIframe()) {
|
|
86
|
+
throw createBrowserAuthError(BrowserAuthErrorCodes.blockIframeReload);
|
|
97
87
|
}
|
|
88
|
+
}
|
|
98
89
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
BrowserAuthErrorCodes.redirectInIframe
|
|
117
|
-
);
|
|
118
|
-
}
|
|
90
|
+
/**
|
|
91
|
+
* Block redirect operations in iframes unless explicitly allowed
|
|
92
|
+
* @param interactionType Interaction type for the request
|
|
93
|
+
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
|
|
94
|
+
*/
|
|
95
|
+
export function blockRedirectInIframe(
|
|
96
|
+
interactionType: InteractionType,
|
|
97
|
+
allowRedirectInIframe: boolean
|
|
98
|
+
): void {
|
|
99
|
+
const isIframedApp = isInIframe();
|
|
100
|
+
if (
|
|
101
|
+
interactionType === InteractionType.Redirect &&
|
|
102
|
+
isIframedApp &&
|
|
103
|
+
!allowRedirectInIframe
|
|
104
|
+
) {
|
|
105
|
+
// If we are not in top frame, we shouldn't redirect. This is also handled by the service.
|
|
106
|
+
throw createBrowserAuthError(BrowserAuthErrorCodes.redirectInIframe);
|
|
119
107
|
}
|
|
108
|
+
}
|
|
120
109
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
BrowserAuthErrorCodes.blockNestedPopups
|
|
129
|
-
);
|
|
130
|
-
}
|
|
110
|
+
/**
|
|
111
|
+
* Block redirectUri loaded in popup from calling AcquireToken APIs
|
|
112
|
+
*/
|
|
113
|
+
export function blockAcquireTokenInPopups(): void {
|
|
114
|
+
// Popups opened by msal popup APIs are given a name that starts with "msal."
|
|
115
|
+
if (isInPopup()) {
|
|
116
|
+
throw createBrowserAuthError(BrowserAuthErrorCodes.blockNestedPopups);
|
|
131
117
|
}
|
|
118
|
+
}
|
|
132
119
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Throws error if token requests are made in non-browser environment
|
|
122
|
+
* @param isBrowserEnvironment Flag indicating if environment is a browser.
|
|
123
|
+
*/
|
|
124
|
+
export function blockNonBrowserEnvironment(
|
|
125
|
+
isBrowserEnvironment: boolean
|
|
126
|
+
): void {
|
|
127
|
+
if (!isBrowserEnvironment) {
|
|
128
|
+
throw createBrowserAuthError(
|
|
129
|
+
BrowserAuthErrorCodes.nonBrowserEnvironment
|
|
130
|
+
);
|
|
143
131
|
}
|
|
132
|
+
}
|
|
144
133
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
134
|
+
/**
|
|
135
|
+
* Throws error if initialize hasn't been called
|
|
136
|
+
* @param initialized
|
|
137
|
+
*/
|
|
138
|
+
export function blockAPICallsBeforeInitialize(initialized: boolean): void {
|
|
139
|
+
if (!initialized) {
|
|
140
|
+
throw createBrowserAuthError(
|
|
141
|
+
BrowserAuthErrorCodes.uninitializedPublicClientApplication
|
|
142
|
+
);
|
|
155
143
|
}
|
|
156
144
|
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request
|
|
148
|
+
* @param loginDomain Authority domain, including https protocol e.g. https://login.microsoftonline.com
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
export function preconnect(authority: string): void {
|
|
152
|
+
const link = document.createElement("link");
|
|
153
|
+
link.rel = "preconnect";
|
|
154
|
+
link.href = new URL(authority).origin;
|
|
155
|
+
link.crossOrigin = "anonymous";
|
|
156
|
+
document.head.appendChild(link);
|
|
157
|
+
|
|
158
|
+
// The browser will close connection if not used within a few seconds, remove element from the header after 10s
|
|
159
|
+
window.setTimeout(() => {
|
|
160
|
+
try {
|
|
161
|
+
document.head.removeChild(link);
|
|
162
|
+
} catch {}
|
|
163
|
+
}, 10000); // 10s Timeout
|
|
164
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ISubtleCrypto {
|
|
2
|
-
initPrng?(entropy: Uint8Array): void;
|
|
3
|
-
getRandomValues(dataBuffer: Uint8Array): Uint8Array;
|
|
4
|
-
generateKey(algorithm: RsaHashedKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
|
|
5
|
-
exportKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
6
|
-
importKey(keyData: JsonWebKey, algorithm: RsaHashedImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
7
|
-
sign(algorithm: AlgorithmIdentifier, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
8
|
-
digest(algorithm: AlgorithmIdentifier, data: Uint8Array): Promise<ArrayBuffer>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=ISubtleCrypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ISubtleCrypto.d.ts","sourceRoot":"","sources":["../../src/crypto/ISubtleCrypto.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;IACpD,WAAW,CACP,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,QAAQ,EAAE,GACtB,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,SAAS,CACL,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,QAAQ,EAAE,GACtB,OAAO,CAAC,SAAS,CAAC,CAAC;IACtB,IAAI,CACA,SAAS,EAAE,mBAAmB,EAC9B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,MAAM,CACF,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,UAAU,GACjB,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ISubtleCrypto } from "./ISubtleCrypto";
|
|
2
|
-
export declare class ModernBrowserCrypto implements ISubtleCrypto {
|
|
3
|
-
getRandomValues(dataBuffer: Uint8Array): Uint8Array;
|
|
4
|
-
generateKey(algorithm: RsaHashedKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
|
|
5
|
-
exportKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
6
|
-
importKey(keyData: JsonWebKey, algorithm: RsaHashedImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
7
|
-
sign(algorithm: AlgorithmIdentifier, key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
8
|
-
digest(algorithm: AlgorithmIdentifier, data: Uint8Array): Promise<ArrayBuffer>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=ModernBrowserCrypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModernBrowserCrypto.d.ts","sourceRoot":"","sources":["../../src/crypto/ModernBrowserCrypto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qBAAa,mBAAoB,YAAW,aAAa;IACrD,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;IAI7C,WAAW,CACb,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,QAAQ,EAAE,GACtB,OAAO,CAAC,aAAa,CAAC;IAQnB,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAO9C,SAAS,CACX,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,OAAO,EACpB,SAAS,EAAE,QAAQ,EAAE,GACtB,OAAO,CAAC,SAAS,CAAC;IAUf,IAAI,CACN,SAAS,EAAE,mBAAmB,EAC9B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC;IAQjB,MAAM,CACR,SAAS,EAAE,mBAAmB,EAC9B,IAAI,EAAE,UAAU,GACjB,OAAO,CAAC,WAAW,CAAC;CAM1B"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.1.0 2023-09-05 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.mjs';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
class ModernBrowserCrypto {
|
|
10
|
-
getRandomValues(dataBuffer) {
|
|
11
|
-
return window.crypto.getRandomValues(dataBuffer);
|
|
12
|
-
}
|
|
13
|
-
async generateKey(algorithm, extractable, keyUsages) {
|
|
14
|
-
return window.crypto.subtle.generateKey(algorithm, extractable, keyUsages);
|
|
15
|
-
}
|
|
16
|
-
async exportKey(key) {
|
|
17
|
-
return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
18
|
-
}
|
|
19
|
-
async importKey(keyData, algorithm, extractable, keyUsages) {
|
|
20
|
-
return window.crypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages);
|
|
21
|
-
}
|
|
22
|
-
async sign(algorithm, key, data) {
|
|
23
|
-
return window.crypto.subtle.sign(algorithm, key, data);
|
|
24
|
-
}
|
|
25
|
-
async digest(algorithm, data) {
|
|
26
|
-
return window.crypto.subtle.digest(algorithm, data);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { ModernBrowserCrypto };
|
|
31
|
-
//# sourceMappingURL=ModernBrowserCrypto.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModernBrowserCrypto.mjs","sources":["../../src/crypto/ModernBrowserCrypto.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMA;AAEA;AACI;AAIM;AAmBS,MAAA,mBACF,CAAU;AAcjB,IAAA,eACO,CAAE,UAAmB,EAAA;AAW5B,QAAA,OACF,MAAW,CAAA,MAAA,CAAA,eACX,CAAA,UAAM,CAAA,CAAA;AAOb,KAAA;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for strings in a browser. See here for implementation details:
|
|
3
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64
|
|
4
|
-
*/
|
|
5
|
-
export declare class BrowserStringUtils {
|
|
6
|
-
/**
|
|
7
|
-
* Converts string to Uint8Array
|
|
8
|
-
* @param sDOMStr
|
|
9
|
-
*/
|
|
10
|
-
static stringToUtf8Arr(sDOMStr: string): Uint8Array;
|
|
11
|
-
/**
|
|
12
|
-
* Converts Uint8Array to a string
|
|
13
|
-
* @param aBytes
|
|
14
|
-
*/
|
|
15
|
-
static utf8ArrToString(aBytes: Uint8Array): string;
|
|
16
|
-
/**
|
|
17
|
-
* Returns stringified jwk.
|
|
18
|
-
* @param jwk
|
|
19
|
-
*/
|
|
20
|
-
static getSortedObjectString(obj: object): string;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=BrowserStringUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserStringUtils.d.ts","sourceRoot":"","sources":["../../src/utils/BrowserStringUtils.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,qBAAa,kBAAkB;IAC3B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;IAkEnD;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAiDlD;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAGpD"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.1.0 2023-09-05 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { Constants } from '@azure/msal-common';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Utility functions for strings in a browser. See here for implementation details:
|
|
11
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64
|
|
12
|
-
*/
|
|
13
|
-
class BrowserStringUtils {
|
|
14
|
-
/**
|
|
15
|
-
* Converts string to Uint8Array
|
|
16
|
-
* @param sDOMStr
|
|
17
|
-
*/
|
|
18
|
-
static stringToUtf8Arr(sDOMStr) {
|
|
19
|
-
let nChr;
|
|
20
|
-
let nArrLen = 0;
|
|
21
|
-
const nStrLen = sDOMStr.length;
|
|
22
|
-
/* mapping... */
|
|
23
|
-
for (let nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {
|
|
24
|
-
nChr = sDOMStr.charCodeAt(nMapIdx);
|
|
25
|
-
nArrLen +=
|
|
26
|
-
nChr < 0x80
|
|
27
|
-
? 1
|
|
28
|
-
: nChr < 0x800
|
|
29
|
-
? 2
|
|
30
|
-
: nChr < 0x10000
|
|
31
|
-
? 3
|
|
32
|
-
: nChr < 0x200000
|
|
33
|
-
? 4
|
|
34
|
-
: nChr < 0x4000000
|
|
35
|
-
? 5
|
|
36
|
-
: 6;
|
|
37
|
-
}
|
|
38
|
-
const aBytes = new Uint8Array(nArrLen);
|
|
39
|
-
/* transcription... */
|
|
40
|
-
for (let nIdx = 0, nChrIdx = 0; nIdx < nArrLen; nChrIdx++) {
|
|
41
|
-
nChr = sDOMStr.charCodeAt(nChrIdx);
|
|
42
|
-
if (nChr < 128) {
|
|
43
|
-
/* one byte */
|
|
44
|
-
aBytes[nIdx++] = nChr;
|
|
45
|
-
}
|
|
46
|
-
else if (nChr < 0x800) {
|
|
47
|
-
/* two bytes */
|
|
48
|
-
aBytes[nIdx++] = 192 + (nChr >>> 6);
|
|
49
|
-
aBytes[nIdx++] = 128 + (nChr & 63);
|
|
50
|
-
}
|
|
51
|
-
else if (nChr < 0x10000) {
|
|
52
|
-
/* three bytes */
|
|
53
|
-
aBytes[nIdx++] = 224 + (nChr >>> 12);
|
|
54
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);
|
|
55
|
-
aBytes[nIdx++] = 128 + (nChr & 63);
|
|
56
|
-
}
|
|
57
|
-
else if (nChr < 0x200000) {
|
|
58
|
-
/* four bytes */
|
|
59
|
-
aBytes[nIdx++] = 240 + (nChr >>> 18);
|
|
60
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);
|
|
61
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);
|
|
62
|
-
aBytes[nIdx++] = 128 + (nChr & 63);
|
|
63
|
-
}
|
|
64
|
-
else if (nChr < 0x4000000) {
|
|
65
|
-
/* five bytes */
|
|
66
|
-
aBytes[nIdx++] = 248 + (nChr >>> 24);
|
|
67
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 18) & 63);
|
|
68
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);
|
|
69
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);
|
|
70
|
-
aBytes[nIdx++] = 128 + (nChr & 63);
|
|
71
|
-
} /* if (nChr <= 0x7fffffff) */
|
|
72
|
-
else {
|
|
73
|
-
/* six bytes */
|
|
74
|
-
aBytes[nIdx++] = 252 + (nChr >>> 30);
|
|
75
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 24) & 63);
|
|
76
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 18) & 63);
|
|
77
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 12) & 63);
|
|
78
|
-
aBytes[nIdx++] = 128 + ((nChr >>> 6) & 63);
|
|
79
|
-
aBytes[nIdx++] = 128 + (nChr & 63);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return aBytes;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Converts Uint8Array to a string
|
|
86
|
-
* @param aBytes
|
|
87
|
-
*/
|
|
88
|
-
static utf8ArrToString(aBytes) {
|
|
89
|
-
let sView = Constants.EMPTY_STRING;
|
|
90
|
-
for (let nPart, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {
|
|
91
|
-
nPart = aBytes[nIdx];
|
|
92
|
-
sView += String.fromCharCode(nPart > 251 && nPart < 254 && nIdx + 5 < nLen /* six bytes */
|
|
93
|
-
? /* (nPart - 252 << 30) may be not so safe in ECMAScript! So...: */
|
|
94
|
-
(nPart - 252) * 1073741824 +
|
|
95
|
-
((aBytes[++nIdx] - 128) << 24) +
|
|
96
|
-
((aBytes[++nIdx] - 128) << 18) +
|
|
97
|
-
((aBytes[++nIdx] - 128) << 12) +
|
|
98
|
-
((aBytes[++nIdx] - 128) << 6) +
|
|
99
|
-
aBytes[++nIdx] -
|
|
100
|
-
128
|
|
101
|
-
: nPart > 247 &&
|
|
102
|
-
nPart < 252 &&
|
|
103
|
-
nIdx + 4 < nLen /* five bytes */
|
|
104
|
-
? ((nPart - 248) << 24) +
|
|
105
|
-
((aBytes[++nIdx] - 128) << 18) +
|
|
106
|
-
((aBytes[++nIdx] - 128) << 12) +
|
|
107
|
-
((aBytes[++nIdx] - 128) << 6) +
|
|
108
|
-
aBytes[++nIdx] -
|
|
109
|
-
128
|
|
110
|
-
: nPart > 239 &&
|
|
111
|
-
nPart < 248 &&
|
|
112
|
-
nIdx + 3 < nLen /* four bytes */
|
|
113
|
-
? ((nPart - 240) << 18) +
|
|
114
|
-
((aBytes[++nIdx] - 128) << 12) +
|
|
115
|
-
((aBytes[++nIdx] - 128) << 6) +
|
|
116
|
-
aBytes[++nIdx] -
|
|
117
|
-
128
|
|
118
|
-
: nPart > 223 &&
|
|
119
|
-
nPart < 240 &&
|
|
120
|
-
nIdx + 2 < nLen /* three bytes */
|
|
121
|
-
? ((nPart - 224) << 12) +
|
|
122
|
-
((aBytes[++nIdx] - 128) << 6) +
|
|
123
|
-
aBytes[++nIdx] -
|
|
124
|
-
128
|
|
125
|
-
: nPart > 191 &&
|
|
126
|
-
nPart < 224 &&
|
|
127
|
-
nIdx + 1 < nLen /* two bytes */
|
|
128
|
-
? ((nPart - 192) << 6) + aBytes[++nIdx] - 128
|
|
129
|
-
: /* nPart < 127 ? */ /* one byte */
|
|
130
|
-
nPart);
|
|
131
|
-
}
|
|
132
|
-
return sView;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Returns stringified jwk.
|
|
136
|
-
* @param jwk
|
|
137
|
-
*/
|
|
138
|
-
static getSortedObjectString(obj) {
|
|
139
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export { BrowserStringUtils };
|
|
144
|
-
//# sourceMappingURL=BrowserStringUtils.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserStringUtils.mjs","sources":["../../src/utils/BrowserStringUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA;;;AAGG;AAEC;;;AAGG;AACH,MAAsB;AAkEtB;;;AAGG;AACH,IAAA,OAAO,eAAe,CAAC,OAAQ,EAAA;AAiD/B,QAAA,IAAA,IAAA,CAAA;;;AAGG;AACH,QAAA,KAA4B,IAAA,OAAA,GAAA,CAAA,EAAA,OAAM,GAAA,OAAS,EAAM,OAAA,EAAA,EAAA;AAGpD,YAAA,IAAA,GAAA,OAAA,CAAA,UAAA,CAAA,OAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface ISubtleCrypto {
|
|
7
|
-
initPrng?(entropy: Uint8Array): void;
|
|
8
|
-
getRandomValues(dataBuffer: Uint8Array): Uint8Array;
|
|
9
|
-
generateKey(
|
|
10
|
-
algorithm: RsaHashedKeyGenParams,
|
|
11
|
-
extractable: boolean,
|
|
12
|
-
keyUsages: KeyUsage[]
|
|
13
|
-
): Promise<CryptoKeyPair>;
|
|
14
|
-
exportKey(key: CryptoKey): Promise<JsonWebKey>;
|
|
15
|
-
importKey(
|
|
16
|
-
keyData: JsonWebKey,
|
|
17
|
-
algorithm: RsaHashedImportParams,
|
|
18
|
-
extractable: boolean,
|
|
19
|
-
keyUsages: KeyUsage[]
|
|
20
|
-
): Promise<CryptoKey>;
|
|
21
|
-
sign(
|
|
22
|
-
algorithm: AlgorithmIdentifier,
|
|
23
|
-
key: CryptoKey,
|
|
24
|
-
data: ArrayBuffer
|
|
25
|
-
): Promise<ArrayBuffer>;
|
|
26
|
-
digest(
|
|
27
|
-
algorithm: AlgorithmIdentifier,
|
|
28
|
-
data: Uint8Array
|
|
29
|
-
): Promise<ArrayBuffer>;
|
|
30
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { KEY_FORMAT_JWK } from "../utils/BrowserConstants";
|
|
7
|
-
import { ISubtleCrypto } from "./ISubtleCrypto";
|
|
8
|
-
|
|
9
|
-
export class ModernBrowserCrypto implements ISubtleCrypto {
|
|
10
|
-
getRandomValues(dataBuffer: Uint8Array): Uint8Array {
|
|
11
|
-
return window.crypto.getRandomValues(dataBuffer);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async generateKey(
|
|
15
|
-
algorithm: RsaHashedKeyGenParams,
|
|
16
|
-
extractable: boolean,
|
|
17
|
-
keyUsages: KeyUsage[]
|
|
18
|
-
): Promise<CryptoKeyPair> {
|
|
19
|
-
return window.crypto.subtle.generateKey(
|
|
20
|
-
algorithm,
|
|
21
|
-
extractable,
|
|
22
|
-
keyUsages
|
|
23
|
-
) as Promise<CryptoKeyPair>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async exportKey(key: CryptoKey): Promise<JsonWebKey> {
|
|
27
|
-
return window.crypto.subtle.exportKey(
|
|
28
|
-
KEY_FORMAT_JWK,
|
|
29
|
-
key
|
|
30
|
-
) as Promise<JsonWebKey>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async importKey(
|
|
34
|
-
keyData: JsonWebKey,
|
|
35
|
-
algorithm: RsaHashedImportParams,
|
|
36
|
-
extractable: boolean,
|
|
37
|
-
keyUsages: KeyUsage[]
|
|
38
|
-
): Promise<CryptoKey> {
|
|
39
|
-
return window.crypto.subtle.importKey(
|
|
40
|
-
KEY_FORMAT_JWK,
|
|
41
|
-
keyData,
|
|
42
|
-
algorithm,
|
|
43
|
-
extractable,
|
|
44
|
-
keyUsages
|
|
45
|
-
) as Promise<CryptoKey>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async sign(
|
|
49
|
-
algorithm: AlgorithmIdentifier,
|
|
50
|
-
key: CryptoKey,
|
|
51
|
-
data: ArrayBuffer
|
|
52
|
-
): Promise<ArrayBuffer> {
|
|
53
|
-
return window.crypto.subtle.sign(
|
|
54
|
-
algorithm,
|
|
55
|
-
key,
|
|
56
|
-
data
|
|
57
|
-
) as Promise<ArrayBuffer>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async digest(
|
|
61
|
-
algorithm: AlgorithmIdentifier,
|
|
62
|
-
data: Uint8Array
|
|
63
|
-
): Promise<ArrayBuffer> {
|
|
64
|
-
return window.crypto.subtle.digest(
|
|
65
|
-
algorithm,
|
|
66
|
-
data
|
|
67
|
-
) as Promise<ArrayBuffer>;
|
|
68
|
-
}
|
|
69
|
-
}
|