@azure/msal-browser 3.5.1-beta.1 → 3.7.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/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +269 -268
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +333 -333
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.d.ts +273 -273
- package/dist/app/PublicClientNext.mjs +351 -351
- package/dist/app/PublicClientNext.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +62 -62
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +254 -254
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- 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/broker/nativeBroker/NativeStatusCodes.mjs.map +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts +51 -51
- package/dist/cache/AsyncMemoryStorage.mjs +132 -132
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +395 -383
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +1283 -1263
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.d.ts +11 -11
- package/dist/cache/BrowserStorage.mjs +32 -32
- package/dist/cache/BrowserStorage.mjs.map +1 -1
- package/dist/cache/CryptoKeyStore.d.ts +18 -18
- package/dist/cache/CryptoKeyStore.mjs +40 -40
- package/dist/cache/CryptoKeyStore.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.d.ts +56 -56
- package/dist/cache/DatabaseStorage.mjs +190 -190
- package/dist/cache/DatabaseStorage.mjs.map +1 -1
- 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/MemoryStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.d.ts +77 -77
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +223 -225
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +206 -206
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +128 -128
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.d.ts +4 -4
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +29 -29
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +61 -61
- package/dist/controllers/NestedAppAuthController.d.ts +95 -95
- package/dist/controllers/NestedAppAuthController.mjs +334 -334
- 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 +1307 -1294
- 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/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +44 -44
- package/dist/crypto/BrowserCrypto.mjs +93 -93
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +63 -63
- package/dist/crypto/CryptoOps.mjs +145 -145
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +8 -8
- package/dist/crypto/PkceGenerator.mjs +54 -54
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +30 -30
- package/dist/crypto/SignedHttpRequest.mjs +39 -39
- package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
- package/dist/encode/Base64Decode.d.ts +9 -9
- package/dist/encode/Base64Decode.mjs +36 -36
- package/dist/encode/Base64Decode.mjs.map +1 -1
- package/dist/encode/Base64Encode.d.ts +19 -19
- package/dist/encode/Base64Encode.mjs +43 -43
- package/dist/encode/Base64Encode.mjs.map +1 -1
- package/dist/error/BrowserAuthError.d.ts +250 -250
- package/dist/error/BrowserAuthError.mjs +258 -258
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +45 -45
- package/dist/error/BrowserAuthErrorCodes.mjs +49 -49
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
- package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs.map +1 -1
- package/dist/error/NativeAuthError.d.ts +29 -29
- package/dist/error/NativeAuthError.mjs +60 -60
- package/dist/error/NativeAuthError.mjs.map +1 -1
- package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
- package/dist/error/NativeAuthErrorCodes.mjs +6 -6
- package/dist/error/NativeAuthErrorCodes.mjs.map +1 -1
- package/dist/error/NestedAppAuthError.d.ts +14 -14
- package/dist/error/NestedAppAuthError.mjs +23 -23
- package/dist/error/NestedAppAuthError.mjs.map +1 -1
- package/dist/event/EventHandler.d.ts +41 -41
- package/dist/event/EventHandler.mjs +119 -119
- package/dist/event/EventHandler.mjs.map +1 -1
- package/dist/event/EventMessage.d.ts +25 -25
- package/dist/event/EventMessage.mjs +68 -68
- package/dist/event/EventMessage.mjs.map +1 -1
- package/dist/event/EventType.d.ts +28 -28
- package/dist/event/EventType.mjs +31 -31
- package/dist/event/EventType.mjs.map +1 -1
- package/dist/index.d.ts +39 -39
- package/dist/index.d.ts.map +1 -1
- 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/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +140 -140
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +541 -549
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +105 -105
- package/dist/interaction_client/PopupClient.mjs +432 -432
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +49 -49
- package/dist/interaction_client/RedirectClient.mjs +311 -311
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
- package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +24 -24
- package/dist/interaction_client/SilentCacheClient.mjs +61 -61
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
- package/dist/interaction_client/SilentIframeClient.mjs +96 -96
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +47 -43
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +54 -54
- package/dist/interaction_client/StandardInteractionClient.mjs +222 -222
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
- package/dist/interaction_handler/InteractionHandler.mjs +93 -93
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
- package/dist/interaction_handler/RedirectHandler.mjs +134 -134
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +13 -13
- package/dist/interaction_handler/SilentHandler.mjs +133 -133
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/AccountInfo.d.ts +11 -11
- package/dist/naa/AuthBridge.d.ts +8 -5
- package/dist/naa/AuthBridge.d.ts.map +1 -1
- package/dist/naa/AuthResult.d.ts +7 -0
- package/dist/naa/AuthResult.d.ts.map +1 -0
- package/dist/naa/BridgeCapabilities.d.ts +3 -3
- package/dist/naa/BridgeError.d.ts +9 -9
- package/dist/naa/BridgeError.mjs +7 -7
- package/dist/naa/BridgeError.mjs.map +1 -1
- package/dist/naa/BridgeProxy.d.ts +68 -72
- package/dist/naa/BridgeProxy.d.ts.map +1 -1
- package/dist/naa/BridgeProxy.mjs +155 -152
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeRequest.d.ts +7 -6
- package/dist/naa/BridgeRequest.d.ts.map +1 -1
- package/dist/naa/BridgeRequestEnvelope.d.ts +12 -13
- package/dist/naa/BridgeRequestEnvelope.d.ts.map +1 -1
- package/dist/naa/BridgeResponseEnvelope.d.ts +13 -10
- package/dist/naa/BridgeResponseEnvelope.d.ts.map +1 -1
- package/dist/naa/BridgeStatusCode.d.ts +11 -10
- package/dist/naa/BridgeStatusCode.d.ts.map +1 -1
- package/dist/naa/BridgeStatusCode.mjs +15 -16
- package/dist/naa/BridgeStatusCode.mjs.map +1 -1
- package/dist/naa/IBridgeProxy.d.ts +10 -12
- package/dist/naa/IBridgeProxy.d.ts.map +1 -1
- package/dist/naa/{InitializeBridgeResponse.d.ts → InitContext.d.ts} +7 -7
- package/dist/naa/InitContext.d.ts.map +1 -0
- package/dist/naa/TokenRequest.d.ts +18 -19
- package/dist/naa/TokenRequest.d.ts.map +1 -1
- package/dist/naa/TokenResponse.d.ts +13 -15
- package/dist/naa/TokenResponse.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +23 -23
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +141 -141
- 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/NavigationClient.mjs.map +1 -1
- 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/network/FetchClient.mjs.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.d.ts +41 -40
- package/dist/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +96 -45
- package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
- package/dist/operatingcontext/StandardOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +32 -32
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +85 -85
- 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/operatingcontext/UnknownOperatingContext.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +4 -4
- package/dist/packageMetadata.mjs.map +1 -1
- 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/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +34 -36
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +163 -126
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs.map +1 -1
- package/dist/utils/BrowserConstants.d.ts +180 -176
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.mjs +213 -205
- package/dist/utils/BrowserConstants.mjs.map +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
- package/dist/utils/BrowserProtocolUtils.mjs +21 -21
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.d.ts +56 -56
- package/dist/utils/BrowserUtils.mjs +125 -125
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +18304 -17929
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +18304 -17929
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -68
- package/package.json +103 -102
- package/src/app/PublicClientApplication.ts +2 -1
- package/src/cache/BrowserCacheManager.ts +38 -23
- package/src/cache/DatabaseStorage.ts +1 -1
- package/src/cache/TokenCache.ts +34 -29
- package/src/config/Configuration.ts +1 -1
- package/src/controllers/ControllerFactory.ts +3 -5
- package/src/controllers/StandardController.ts +53 -26
- package/src/crypto/CryptoOps.ts +1 -1
- package/src/crypto/SignedHttpRequest.ts +1 -1
- package/src/index.ts +1 -0
- package/src/interaction_client/BaseInteractionClient.ts +2 -2
- package/src/interaction_client/NativeInteractionClient.ts +24 -20
- package/src/interaction_client/PopupClient.ts +1 -1
- package/src/interaction_client/RedirectClient.ts +3 -3
- package/src/interaction_client/SilentAuthCodeClient.ts +1 -1
- package/src/interaction_client/SilentRefreshClient.ts +8 -0
- package/src/interaction_client/StandardInteractionClient.ts +1 -1
- package/src/interaction_handler/SilentHandler.ts +2 -2
- package/src/naa/AuthBridge.ts +3 -2
- package/src/naa/AuthResult.ts +12 -0
- package/src/naa/BridgeProxy.ts +64 -71
- package/src/naa/BridgeRequest.ts +6 -2
- package/src/naa/BridgeRequestEnvelope.ts +1 -13
- package/src/naa/BridgeResponseEnvelope.ts +5 -7
- package/src/naa/BridgeStatusCode.ts +12 -10
- package/src/naa/IBridgeProxy.ts +3 -14
- package/src/naa/{InitializeBridgeResponse.ts → InitContext.ts} +1 -1
- package/src/naa/TokenRequest.ts +1 -2
- package/src/naa/TokenResponse.ts +1 -4
- package/src/naa/mapping/NestedAppAuthAdapter.ts +19 -19
- package/src/operatingcontext/BaseOperatingContext.ts +64 -7
- package/src/packageMetadata.ts +1 -1
- package/src/telemetry/BrowserPerformanceClient.ts +95 -42
- package/src/utils/BrowserConstants.ts +11 -0
- package/dist/naa/AccountRequests.d.ts +0 -10
- package/dist/naa/AccountRequests.d.ts.map +0 -1
- package/dist/naa/InitializeBridgeResponse.d.ts.map +0 -1
- package/src/naa/AccountRequests.ts +0 -16
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { IPerformanceClient, Logger } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* Check whether browser crypto is available.
|
|
4
|
-
*/
|
|
5
|
-
export declare function validateCryptoAvailable(logger: Logger): void;
|
|
6
|
-
/**
|
|
7
|
-
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
8
|
-
* @param dataString
|
|
9
|
-
*/
|
|
10
|
-
export declare function sha256Digest(dataString: string, performanceClient?: IPerformanceClient, correlationId?: string): Promise<ArrayBuffer>;
|
|
11
|
-
/**
|
|
12
|
-
* Populates buffer with cryptographically random values.
|
|
13
|
-
* @param dataBuffer
|
|
14
|
-
*/
|
|
15
|
-
export declare function getRandomValues(dataBuffer: Uint8Array): Uint8Array;
|
|
16
|
-
/**
|
|
17
|
-
* Creates a new random GUID
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
export declare function createNewGuid(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Generates a keypair based on current keygen algorithm config.
|
|
23
|
-
* @param extractable
|
|
24
|
-
* @param usages
|
|
25
|
-
*/
|
|
26
|
-
export declare function generateKeyPair(extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKeyPair>;
|
|
27
|
-
/**
|
|
28
|
-
* Export key as Json Web Key (JWK)
|
|
29
|
-
* @param key
|
|
30
|
-
*/
|
|
31
|
-
export declare function exportJwk(key: CryptoKey): Promise<JsonWebKey>;
|
|
32
|
-
/**
|
|
33
|
-
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
34
|
-
* @param key
|
|
35
|
-
* @param extractable
|
|
36
|
-
* @param usages
|
|
37
|
-
*/
|
|
38
|
-
export declare function importJwk(key: JsonWebKey, extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKey>;
|
|
39
|
-
/**
|
|
40
|
-
* Signs given data with given key
|
|
41
|
-
* @param key
|
|
42
|
-
* @param data
|
|
43
|
-
*/
|
|
44
|
-
export declare function sign(key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
1
|
+
import { IPerformanceClient, Logger } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* Check whether browser crypto is available.
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateCryptoAvailable(logger: Logger): void;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
8
|
+
* @param dataString
|
|
9
|
+
*/
|
|
10
|
+
export declare function sha256Digest(dataString: string, performanceClient?: IPerformanceClient, correlationId?: string): Promise<ArrayBuffer>;
|
|
11
|
+
/**
|
|
12
|
+
* Populates buffer with cryptographically random values.
|
|
13
|
+
* @param dataBuffer
|
|
14
|
+
*/
|
|
15
|
+
export declare function getRandomValues(dataBuffer: Uint8Array): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new random GUID
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function createNewGuid(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Generates a keypair based on current keygen algorithm config.
|
|
23
|
+
* @param extractable
|
|
24
|
+
* @param usages
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateKeyPair(extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKeyPair>;
|
|
27
|
+
/**
|
|
28
|
+
* Export key as Json Web Key (JWK)
|
|
29
|
+
* @param key
|
|
30
|
+
*/
|
|
31
|
+
export declare function exportJwk(key: CryptoKey): Promise<JsonWebKey>;
|
|
32
|
+
/**
|
|
33
|
+
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
34
|
+
* @param key
|
|
35
|
+
* @param extractable
|
|
36
|
+
* @param usages
|
|
37
|
+
*/
|
|
38
|
+
export declare function importJwk(key: JsonWebKey, extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKey>;
|
|
39
|
+
/**
|
|
40
|
+
* Signs given data with given key
|
|
41
|
+
* @param key
|
|
42
|
+
* @param data
|
|
43
|
+
*/
|
|
44
|
+
export declare function sign(key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
45
45
|
//# sourceMappingURL=BrowserCrypto.d.ts.map
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.7.0 2024-01-09 */
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserCrypto.mjs","sources":["../../src/crypto/BrowserCrypto.ts"],"sourcesContent":[null],"names":["BrowserAuthErrorCodes.cryptoNonExistent"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"BrowserCrypto.mjs","sources":["../../src/crypto/BrowserCrypto.ts"],"sourcesContent":[null],"names":["BrowserAuthErrorCodes.cryptoNonExistent"],"mappings":";;;;;;;AAAA;;;AAGG;AAaH;;;AAGG;AAEH;;AAEG;AACH;AACA,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACjD;AACA,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC;AACA,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B;AACA,MAAM,eAAe,GAAe,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEvE,MAAM,sBAAsB,GAA0B;AAClD,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,aAAa,EAAE,cAAc;AAC7B,IAAA,cAAc,EAAE,eAAe;CAClC,CAAC;AAEF;;AAEG;AACG,SAAU,uBAAuB,CAAC,MAAc,EAAA;IAClD,IAAI,QAAQ,IAAI,MAAM,EAAE;AACpB,QAAA,MAAM,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;AACtE,KAAA;AAAM,SAAA;AACH,QAAA,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;AAC/D,QAAA,MAAM,sBAAsB,CAACA,iBAAuC,CAAC,CAAC;AACzE,KAAA;AACL,CAAC;AAED;;;AAGG;AACI,eAAe,YAAY,CAC9B,UAAkB,EAClB,iBAAsC,EACtC,aAAsB,EAAA;IAEtB,iBAAiB,EAAE,mBAAmB,CAClC,iBAAiB,CAAC,YAAY,EAC9B,aAAa,CAChB,CAAC;AACF,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACxC,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAC9B,aAAa,EACb,IAAI,CACiB,CAAC;AAC9B,CAAC;AAED;;;AAGG;AACG,SAAU,eAAe,CAAC,UAAsB,EAAA;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;AACrD,CAAC;AAED;;;AAGG;SACa,aAAa,GAAA;AACzB,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED;;;;AAIG;AACI,eAAe,eAAe,CACjC,WAAoB,EACpB,MAAuB,EAAA;AAEvB,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CACnC,sBAAsB,EACtB,WAAW,EACX,MAAM,CACiB,CAAC;AAChC,CAAC;AAED;;;AAGG;AACI,eAAe,SAAS,CAAC,GAAc,EAAA;AAC1C,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CACjC,cAAc,EACd,GAAG,CACiB,CAAC;AAC7B,CAAC;AAED;;;;;AAKG;AACI,eAAe,SAAS,CAC3B,GAAe,EACf,WAAoB,EACpB,MAAuB,EAAA;AAEvB,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CACjC,cAAc,EACd,GAAG,EACH,sBAAsB,EACtB,WAAW,EACX,MAAM,CACa,CAAC;AAC5B,CAAC;AAED;;;;AAIG;AACI,eAAe,IAAI,CACtB,GAAc,EACd,IAAiB,EAAA;AAEjB,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAC5B,sBAAsB,EACtB,GAAG,EACH,IAAI,CACiB,CAAC;AAC9B;;;;"}
|
|
@@ -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
|