@azure/msal-browser 2.16.1 → 2.20.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/CHANGELOG.json +283 -0
- package/{changelog.md → CHANGELOG.md} +73 -1
- package/README.md +12 -4
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +35 -137
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +178 -883
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.d.ts +8 -0
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.js +16 -1
- package/dist/app/IPublicClientApplication.js.map +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +35 -41
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts +46 -0
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -0
- package/dist/cache/AsyncMemoryStorage.js +195 -0
- package/dist/cache/AsyncMemoryStorage.js.map +1 -0
- package/dist/cache/BrowserCacheManager.d.ts +19 -2
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +104 -15
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.d.ts +1 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/BrowserStorage.js.map +1 -1
- package/dist/cache/DatabaseStorage.d.ts +29 -4
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.js +151 -45
- package/dist/cache/DatabaseStorage.js.map +1 -1
- package/dist/cache/IAsyncMemoryStorage.d.ts +28 -0
- package/dist/cache/IAsyncMemoryStorage.d.ts.map +1 -0
- package/dist/cache/ITokenCache.d.ts +8 -0
- package/dist/cache/ITokenCache.d.ts.map +1 -0
- package/dist/cache/IWindowStorage.d.ts +3 -3
- package/dist/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.d.ts +3 -3
- package/dist/cache/MemoryStorage.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/MemoryStorage.js.map +1 -1
- package/dist/cache/TokenCache.d.ts +48 -0
- package/dist/cache/TokenCache.d.ts.map +1 -0
- package/dist/cache/TokenCache.js +124 -0
- package/dist/cache/TokenCache.js.map +1 -0
- package/dist/config/Configuration.js +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +3 -1
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.js +3 -2
- package/dist/crypto/BrowserCrypto.js.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +21 -6
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +67 -15
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +31 -0
- package/dist/crypto/SignedHttpRequest.d.ts.map +1 -0
- package/dist/crypto/SignedHttpRequest.js +70 -0
- package/dist/crypto/SignedHttpRequest.js.map +1 -0
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.d.ts +36 -4
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.js +51 -11
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/event/EventHandler.d.ts +13 -0
- package/dist/event/EventHandler.d.ts.map +1 -1
- package/dist/event/EventHandler.js +66 -1
- package/dist/event/EventHandler.js.map +1 -1
- package/dist/event/EventMessage.d.ts +4 -3
- package/dist/event/EventMessage.d.ts.map +1 -1
- package/dist/event/EventMessage.js +24 -5
- package/dist/event/EventMessage.js.map +1 -1
- package/dist/event/EventType.d.ts +5 -0
- package/dist/event/EventType.d.ts.map +1 -1
- package/dist/event/EventType.js +6 -1
- package/dist/event/EventType.js.map +1 -1
- package/dist/index.cjs.js +4678 -2996
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +42 -0
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -0
- package/dist/interaction_client/BaseInteractionClient.js +131 -0
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -0
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +5 -0
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map +1 -0
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +21 -0
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -0
- package/dist/interaction_client/PopupClient.d.ts +37 -0
- package/dist/interaction_client/PopupClient.d.ts.map +1 -0
- package/dist/interaction_client/PopupClient.js +234 -0
- package/dist/interaction_client/PopupClient.js.map +1 -0
- package/dist/interaction_client/RedirectClient.d.ts +42 -0
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -0
- package/dist/interaction_client/RedirectClient.js +301 -0
- package/dist/interaction_client/RedirectClient.js.map +1 -0
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -0
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -0
- package/dist/interaction_client/SilentAuthCodeClient.js +80 -0
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -0
- package/dist/interaction_client/SilentCacheClient.d.ts +22 -0
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -0
- package/dist/interaction_client/SilentCacheClient.js +85 -0
- package/dist/interaction_client/SilentCacheClient.js.map +1 -0
- package/dist/interaction_client/SilentIframeClient.d.ts +29 -0
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -0
- package/dist/interaction_client/SilentIframeClient.js +107 -0
- package/dist/interaction_client/SilentIframeClient.js.map +1 -0
- package/dist/interaction_client/SilentRefreshClient.d.ts +20 -0
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -0
- package/dist/interaction_client/SilentRefreshClient.js +76 -0
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -0
- package/dist/interaction_client/StandardInteractionClient.d.ts +66 -0
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -0
- package/dist/interaction_client/StandardInteractionClient.js +249 -0
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -0
- package/dist/interaction_handler/InteractionHandler.d.ts +11 -2
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +36 -10
- package/dist/interaction_handler/InteractionHandler.js.map +1 -1
- package/dist/interaction_handler/PopupHandler.d.ts +2 -0
- package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
- package/dist/interaction_handler/PopupHandler.js +3 -4
- package/dist/interaction_handler/PopupHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +7 -6
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +8 -0
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
- package/dist/request/EndSessionPopupRequest.d.ts +3 -0
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/PopupRequest.d.ts +3 -0
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.d.ts +13 -1
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +17 -3
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/dist/utils/PopupUtils.d.ts +26 -2
- package/dist/utils/PopupUtils.d.ts.map +1 -1
- package/dist/utils/PopupUtils.js +42 -15
- package/dist/utils/PopupUtils.js.map +1 -1
- package/lib/msal-browser.js +4678 -2996
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +32 -32
- package/package.json +9 -2
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Logger } from "..";
|
|
1
2
|
/**
|
|
2
3
|
* This class implements functions used by the browser library to perform cryptography operations such as
|
|
3
4
|
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
4
5
|
*/
|
|
5
6
|
export declare class BrowserCrypto {
|
|
6
7
|
private _keygenAlgorithmOptions;
|
|
7
|
-
|
|
8
|
+
private logger;
|
|
9
|
+
constructor(logger: Logger);
|
|
8
10
|
/**
|
|
9
11
|
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
10
12
|
* @param dataString
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserCrypto.d.ts","sourceRoot":"","sources":["../../src/crypto/BrowserCrypto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BrowserCrypto.d.ts","sourceRoot":"","sources":["../../src/crypto/BrowserCrypto.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAa5B;;;GAGG;AACH,qBAAa,aAAa;IAEtB,OAAO,CAAC,uBAAuB,CAAwB;IACvD,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAe1B;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM5D;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAQ7C;;;;OAIG;IACG,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ5F;;;;OAIG;IACG,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAIpD;;;;;;OAMG;IACG,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IASnG;;;;OAIG;IACG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAMnE;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;OAIG;YACW,qBAAqB;IAInC;;;;OAIG;YACW,iBAAiB;IAY/B;;;;OAIG;YACW,mBAAmB;IAajC;;;;OAIG;YACW,iBAAiB;IA0B/B;;;;;;OAMG;YACW,iBAAiB;IAa/B;;;;OAIG;YACW,YAAY;IAa1B;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM;CAG/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.20.0 2021-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
4
|
import { BrowserStringUtils } from '../utils/BrowserStringUtils.js';
|
|
@@ -25,7 +25,8 @@ var PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
|
25
25
|
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
26
26
|
*/
|
|
27
27
|
var BrowserCrypto = /** @class */ (function () {
|
|
28
|
-
function BrowserCrypto() {
|
|
28
|
+
function BrowserCrypto(logger) {
|
|
29
|
+
this.logger = logger;
|
|
29
30
|
if (!(this.hasCryptoAPI())) {
|
|
30
31
|
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto or msCrypto object not available.");
|
|
31
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserCrypto.js","sources":["../../src/crypto/BrowserCrypto.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BrowserStringUtils } from \"../utils/BrowserStringUtils\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { KEY_FORMAT_JWK } from \"../utils/BrowserConstants\";\n/**\n * See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams\n */\n// RSA KeyGen Algorithm\nconst PKCS1_V15_KEYGEN_ALG = \"RSASSA-PKCS1-v1_5\";\n// SHA-256 hashing algorithm\nconst S256_HASH_ALG = \"SHA-256\";\n// MOD length for PoP tokens\nconst MODULUS_LENGTH = 2048;\n// Public Exponent\nconst PUBLIC_EXPONENT: Uint8Array = new Uint8Array([0x01, 0x00, 0x01]);\n\n/**\n * This class implements functions used by the browser library to perform cryptography operations such as\n * hashing and encoding. It also has helper functions to validate the availability of specific APIs.\n */\nexport class BrowserCrypto {\n\n private _keygenAlgorithmOptions: RsaHashedKeyGenParams;\n\n constructor() {\n if (!(this.hasCryptoAPI())) {\n throw BrowserAuthError.createCryptoNotAvailableError(\"Browser crypto or msCrypto object not available.\");\n }\n\n this._keygenAlgorithmOptions = {\n name: PKCS1_V15_KEYGEN_ALG,\n hash: S256_HASH_ALG,\n modulusLength: MODULUS_LENGTH,\n publicExponent: PUBLIC_EXPONENT\n };\n }\n\n /**\n * Returns a sha-256 hash of the given dataString as an ArrayBuffer.\n * @param dataString \n */\n async sha256Digest(dataString: string): Promise<ArrayBuffer> {\n const data = BrowserStringUtils.stringToUtf8Arr(dataString);\n\n return this.hasIECrypto() ? this.getMSCryptoDigest(S256_HASH_ALG, data) : this.getSubtleCryptoDigest(S256_HASH_ALG, data);\n }\n\n /**\n * Populates buffer with cryptographically random values.\n * @param dataBuffer \n */\n getRandomValues(dataBuffer: Uint8Array): void {\n const cryptoObj = window[\"msCrypto\"] || window.crypto;\n if (!cryptoObj.getRandomValues) {\n throw BrowserAuthError.createCryptoNotAvailableError(\"getRandomValues does not exist.\");\n }\n cryptoObj.getRandomValues(dataBuffer);\n }\n\n /**\n * Generates a keypair based on current keygen algorithm config.\n * @param extractable \n * @param usages \n */\n async generateKeyPair(extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKeyPair> {\n return (\n this.hasIECrypto() ? \n this.msCryptoGenerateKey(extractable, usages) \n : window.crypto.subtle.generateKey(this._keygenAlgorithmOptions, extractable, usages)\n ) as Promise<CryptoKeyPair>;\n }\n\n /**\n * Export key as Json Web Key (JWK)\n * @param key \n * @param format \n */\n async exportJwk(key: CryptoKey): Promise<JsonWebKey> {\n return this.hasIECrypto() ? this.msCryptoExportJwk(key) : window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);\n }\n\n /**\n * Imports key as Json Web Key (JWK), can set extractable and usages.\n * @param key \n * @param format \n * @param extractable \n * @param usages \n */\n async importJwk(key: JsonWebKey, extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKey> {\n const keyString = BrowserCrypto.getJwkString(key);\n const keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);\n\n return this.hasIECrypto() ? \n this.msCryptoImportKey(keyBuffer, extractable, usages) \n : window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, this._keygenAlgorithmOptions, extractable, usages);\n }\n\n /**\n * Signs given data with given key\n * @param key \n * @param data \n */\n async sign(key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer> {\n return this.hasIECrypto() ?\n this.msCryptoSign(key, data)\n : window.crypto.subtle.sign(this._keygenAlgorithmOptions, key, data);\n }\n\n /**\n * Check whether IE crypto or other browser cryptography is available.\n */\n private hasCryptoAPI(): boolean {\n return this.hasIECrypto() || this.hasBrowserCrypto();\n }\n\n /**\n * Checks whether IE crypto (AKA msCrypto) is available.\n */\n private hasIECrypto(): boolean {\n return \"msCrypto\" in window;\n }\n\n /**\n * Check whether browser crypto is available.\n */\n private hasBrowserCrypto(): boolean {\n return \"crypto\" in window;\n }\n\n /**\n * Helper function for SHA digest.\n * @param algorithm \n * @param data \n */\n private async getSubtleCryptoDigest(algorithm: string, data: Uint8Array): Promise<ArrayBuffer> {\n return window.crypto.subtle.digest(algorithm, data);\n }\n\n /**\n * IE Helper function for SHA digest.\n * @param algorithm \n * @param data \n */\n private async getMSCryptoDigest(algorithm: string, data: Uint8Array): Promise<ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const digestOperation = window[\"msCrypto\"].subtle.digest(algorithm, data.buffer);\n digestOperation.addEventListener(\"complete\", (e: { target: { result: ArrayBuffer | PromiseLike<ArrayBuffer>; }; }) => {\n resolve(e.target.result);\n });\n digestOperation.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for generating a keypair\n * @param extractable \n * @param usages \n */\n private async msCryptoGenerateKey(extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKeyPair> {\n return new Promise((resolve: Function, reject: Function) => {\n const msGenerateKey = window[\"msCrypto\"].subtle.generateKey(this._keygenAlgorithmOptions, extractable, usages);\n msGenerateKey.addEventListener(\"complete\", (e: { target: { result: CryptoKeyPair | PromiseLike<CryptoKeyPair>; }; }) => {\n resolve(e.target.result);\n });\n\n msGenerateKey.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for exportKey\n * @param key \n * @param format \n */\n private async msCryptoExportJwk(key: CryptoKey): Promise<JsonWebKey> {\n return new Promise((resolve: Function, reject: Function) => {\n const msExportKey = window[\"msCrypto\"].subtle.exportKey(KEY_FORMAT_JWK, key);\n msExportKey.addEventListener(\"complete\", (e: { target: { result: ArrayBuffer; }; }) => {\n const resultBuffer: ArrayBuffer = e.target.result;\n\n const resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))\n .replace(/\\r/g, \"\")\n .replace(/\\n/g, \"\")\n .replace(/\\t/g, \"\")\n .split(\" \").join(\"\")\n .replace(\"\\u0000\", \"\");\n\n try {\n resolve(JSON.parse(resultString));\n } catch (e) {\n reject(e);\n }\n });\n\n msExportKey.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for importKey\n * @param key \n * @param format \n * @param extractable \n * @param usages \n */\n private async msCryptoImportKey(keyBuffer: ArrayBuffer, extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKey> {\n return new Promise((resolve: Function, reject: Function) => {\n const msImportKey = window[\"msCrypto\"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, this._keygenAlgorithmOptions, extractable, usages);\n msImportKey.addEventListener(\"complete\", (e: { target: { result: CryptoKey | PromiseLike<CryptoKey>; }; }) => {\n resolve(e.target.result);\n });\n\n msImportKey.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for sign JWT\n * @param key \n * @param data \n */\n private async msCryptoSign(key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer> {\n return new Promise((resolve: Function, reject: Function) => {\n const msSign = window[\"msCrypto\"].subtle.sign(this._keygenAlgorithmOptions, key, data);\n msSign.addEventListener(\"complete\", (e: { target: { result: ArrayBuffer | PromiseLike<ArrayBuffer>; }; }) => {\n resolve(e.target.result);\n });\n\n msSign.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * Returns stringified jwk.\n * @param jwk \n */\n static getJwkString(jwk: JsonWebKey): string {\n return JSON.stringify(jwk, Object.keys(jwk).sort());\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;AAQA;;;AAGA;AACA,IAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACjD;AACA,IAAM,aAAa,GAAG,SAAS,CAAC;AAChC;AACA,IAAM,cAAc,GAAG,IAAI,CAAC;AAC5B;AACA,IAAM,eAAe,GAAe,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEvE;;;;;IAQI;QACI,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE;YACxB,MAAM,gBAAgB,CAAC,6BAA6B,CAAC,kDAAkD,CAAC,CAAC;SAC5G;QAED,IAAI,CAAC,uBAAuB,GAAG;YAC3B,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,aAAa;YACnB,aAAa,EAAE,cAAc;YAC7B,cAAc,EAAE,eAAe;SAClC,CAAC;KACL;;;;;IAMK,oCAAY,GAAlB,UAAmB,UAAkB;;;;gBAC3B,IAAI,GAAG,kBAAkB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;gBAE5D,sBAAO,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,IAAI,CAAC,EAAC;;;KAC7H;;;;;IAMD,uCAAe,GAAf,UAAgB,UAAsB;QAClC,IAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE;YAC5B,MAAM,gBAAgB,CAAC,6BAA6B,CAAC,iCAAiC,CAAC,CAAC;SAC3F;QACD,SAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;KACzC;;;;;;I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;;;"}
|
|
1
|
+
{"version":3,"file":"BrowserCrypto.js","sources":["../../src/crypto/BrowserCrypto.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BrowserStringUtils } from \"../utils/BrowserStringUtils\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { KEY_FORMAT_JWK } from \"../utils/BrowserConstants\";\nimport { Logger } from \"..\";\n/**\n * See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams\n */\n// RSA KeyGen Algorithm\nconst PKCS1_V15_KEYGEN_ALG = \"RSASSA-PKCS1-v1_5\";\n// SHA-256 hashing algorithm\nconst S256_HASH_ALG = \"SHA-256\";\n// MOD length for PoP tokens\nconst MODULUS_LENGTH = 2048;\n// Public Exponent\nconst PUBLIC_EXPONENT: Uint8Array = new Uint8Array([0x01, 0x00, 0x01]);\n\n/**\n * This class implements functions used by the browser library to perform cryptography operations such as\n * hashing and encoding. It also has helper functions to validate the availability of specific APIs.\n */\nexport class BrowserCrypto {\n\n private _keygenAlgorithmOptions: RsaHashedKeyGenParams;\n private logger: Logger;\n\n constructor(logger: Logger) {\n this.logger = logger;\n \n if (!(this.hasCryptoAPI())) {\n throw BrowserAuthError.createCryptoNotAvailableError(\"Browser crypto or msCrypto object not available.\");\n }\n\n this._keygenAlgorithmOptions = {\n name: PKCS1_V15_KEYGEN_ALG,\n hash: S256_HASH_ALG,\n modulusLength: MODULUS_LENGTH,\n publicExponent: PUBLIC_EXPONENT\n };\n }\n\n /**\n * Returns a sha-256 hash of the given dataString as an ArrayBuffer.\n * @param dataString \n */\n async sha256Digest(dataString: string): Promise<ArrayBuffer> {\n const data = BrowserStringUtils.stringToUtf8Arr(dataString);\n\n return this.hasIECrypto() ? this.getMSCryptoDigest(S256_HASH_ALG, data) : this.getSubtleCryptoDigest(S256_HASH_ALG, data);\n }\n\n /**\n * Populates buffer with cryptographically random values.\n * @param dataBuffer \n */\n getRandomValues(dataBuffer: Uint8Array): void {\n const cryptoObj = window[\"msCrypto\"] || window.crypto;\n if (!cryptoObj.getRandomValues) {\n throw BrowserAuthError.createCryptoNotAvailableError(\"getRandomValues does not exist.\");\n }\n cryptoObj.getRandomValues(dataBuffer);\n }\n\n /**\n * Generates a keypair based on current keygen algorithm config.\n * @param extractable \n * @param usages \n */\n async generateKeyPair(extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKeyPair> {\n return (\n this.hasIECrypto() ? \n this.msCryptoGenerateKey(extractable, usages) \n : window.crypto.subtle.generateKey(this._keygenAlgorithmOptions, extractable, usages)\n ) as Promise<CryptoKeyPair>;\n }\n\n /**\n * Export key as Json Web Key (JWK)\n * @param key \n * @param format \n */\n async exportJwk(key: CryptoKey): Promise<JsonWebKey> {\n return this.hasIECrypto() ? this.msCryptoExportJwk(key) : window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);\n }\n\n /**\n * Imports key as Json Web Key (JWK), can set extractable and usages.\n * @param key \n * @param format \n * @param extractable \n * @param usages \n */\n async importJwk(key: JsonWebKey, extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKey> {\n const keyString = BrowserCrypto.getJwkString(key);\n const keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);\n\n return this.hasIECrypto() ? \n this.msCryptoImportKey(keyBuffer, extractable, usages) \n : window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, this._keygenAlgorithmOptions, extractable, usages);\n }\n\n /**\n * Signs given data with given key\n * @param key \n * @param data \n */\n async sign(key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer> {\n return this.hasIECrypto() ?\n this.msCryptoSign(key, data)\n : window.crypto.subtle.sign(this._keygenAlgorithmOptions, key, data);\n }\n\n /**\n * Check whether IE crypto or other browser cryptography is available.\n */\n private hasCryptoAPI(): boolean {\n return this.hasIECrypto() || this.hasBrowserCrypto();\n }\n\n /**\n * Checks whether IE crypto (AKA msCrypto) is available.\n */\n private hasIECrypto(): boolean {\n return \"msCrypto\" in window;\n }\n\n /**\n * Check whether browser crypto is available.\n */\n private hasBrowserCrypto(): boolean {\n return \"crypto\" in window;\n }\n\n /**\n * Helper function for SHA digest.\n * @param algorithm \n * @param data \n */\n private async getSubtleCryptoDigest(algorithm: string, data: Uint8Array): Promise<ArrayBuffer> {\n return window.crypto.subtle.digest(algorithm, data);\n }\n\n /**\n * IE Helper function for SHA digest.\n * @param algorithm \n * @param data \n */\n private async getMSCryptoDigest(algorithm: string, data: Uint8Array): Promise<ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const digestOperation = window[\"msCrypto\"].subtle.digest(algorithm, data.buffer);\n digestOperation.addEventListener(\"complete\", (e: { target: { result: ArrayBuffer | PromiseLike<ArrayBuffer>; }; }) => {\n resolve(e.target.result);\n });\n digestOperation.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for generating a keypair\n * @param extractable \n * @param usages \n */\n private async msCryptoGenerateKey(extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKeyPair> {\n return new Promise((resolve: Function, reject: Function) => {\n const msGenerateKey = window[\"msCrypto\"].subtle.generateKey(this._keygenAlgorithmOptions, extractable, usages);\n msGenerateKey.addEventListener(\"complete\", (e: { target: { result: CryptoKeyPair | PromiseLike<CryptoKeyPair>; }; }) => {\n resolve(e.target.result);\n });\n\n msGenerateKey.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for exportKey\n * @param key \n * @param format \n */\n private async msCryptoExportJwk(key: CryptoKey): Promise<JsonWebKey> {\n return new Promise((resolve: Function, reject: Function) => {\n const msExportKey = window[\"msCrypto\"].subtle.exportKey(KEY_FORMAT_JWK, key);\n msExportKey.addEventListener(\"complete\", (e: { target: { result: ArrayBuffer; }; }) => {\n const resultBuffer: ArrayBuffer = e.target.result;\n\n const resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))\n .replace(/\\r/g, \"\")\n .replace(/\\n/g, \"\")\n .replace(/\\t/g, \"\")\n .split(\" \").join(\"\")\n .replace(\"\\u0000\", \"\");\n\n try {\n resolve(JSON.parse(resultString));\n } catch (e) {\n reject(e);\n }\n });\n\n msExportKey.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for importKey\n * @param key \n * @param format \n * @param extractable \n * @param usages \n */\n private async msCryptoImportKey(keyBuffer: ArrayBuffer, extractable: boolean, usages: Array<KeyUsage>): Promise<CryptoKey> {\n return new Promise((resolve: Function, reject: Function) => {\n const msImportKey = window[\"msCrypto\"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, this._keygenAlgorithmOptions, extractable, usages);\n msImportKey.addEventListener(\"complete\", (e: { target: { result: CryptoKey | PromiseLike<CryptoKey>; }; }) => {\n resolve(e.target.result);\n });\n\n msImportKey.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * IE Helper function for sign JWT\n * @param key \n * @param data \n */\n private async msCryptoSign(key: CryptoKey, data: ArrayBuffer): Promise<ArrayBuffer> {\n return new Promise((resolve: Function, reject: Function) => {\n const msSign = window[\"msCrypto\"].subtle.sign(this._keygenAlgorithmOptions, key, data);\n msSign.addEventListener(\"complete\", (e: { target: { result: ArrayBuffer | PromiseLike<ArrayBuffer>; }; }) => {\n resolve(e.target.result);\n });\n\n msSign.addEventListener(\"error\", (error: string) => {\n reject(error);\n });\n });\n }\n\n /**\n * Returns stringified jwk.\n * @param jwk \n */\n static getJwkString(jwk: JsonWebKey): string {\n return JSON.stringify(jwk, Object.keys(jwk).sort());\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;AASA;;;AAGA;AACA,IAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACjD;AACA,IAAM,aAAa,GAAG,SAAS,CAAC;AAChC;AACA,IAAM,cAAc,GAAG,IAAI,CAAC;AAC5B;AACA,IAAM,eAAe,GAAe,IAAI,UAAU,CAAC,CAA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AU,EAAE,UAAC,CAA+D;4BACrG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;yBAC5B,CAAC,CAAC;wBAEH,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAC,KAAa;4BAChD,MAAM,CAAC,KAAK,CAAC,CAAC;yBACjB,CAAC,CAAC;qBACN,CAAC,EAAC;;;KACN;;;;;;IAOa,oCAAY,GAA1B,UAA2B,GAAc,EAAE,IAAiB;;;;gBACxD,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAiB,EAAE,MAAgB;wBACnD,IAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;wBACvF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAC,CAAmE;4BACpG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;yBAC5B,CAAC,CAAC;wBAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAC,KAAa;4BAC3C,MAAM,CAAC,KAAK,CAAC,CAAC;yBACjB,CAAC,CAAC;qBACN,CAAC,EAAC;;;KACN;;;;;IAMM,0BAAY,GAAnB,UAAoB,GAAe;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;KACvD;IACL,oBAAC;AAAD,CAAC;;;;"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICrypto, Logger, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common";
|
|
2
|
+
import { AsyncMemoryStorage } from "../cache/AsyncMemoryStorage";
|
|
2
3
|
export declare type CachedKeyPair = {
|
|
3
4
|
publicKey: CryptoKey;
|
|
4
5
|
privateKey: CryptoKey;
|
|
5
6
|
requestMethod?: string;
|
|
6
7
|
requestUri?: string;
|
|
7
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* MSAL CryptoKeyStore DB Version 2
|
|
11
|
+
*/
|
|
12
|
+
export declare type CryptoKeyStore = {
|
|
13
|
+
asymmetricKeys: AsyncMemoryStorage<CachedKeyPair>;
|
|
14
|
+
symmetricKeys: AsyncMemoryStorage<CryptoKey>;
|
|
15
|
+
};
|
|
8
16
|
/**
|
|
9
17
|
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
10
18
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
@@ -15,13 +23,11 @@ export declare class CryptoOps implements ICrypto {
|
|
|
15
23
|
private b64Encode;
|
|
16
24
|
private b64Decode;
|
|
17
25
|
private pkceGenerator;
|
|
26
|
+
private logger;
|
|
18
27
|
private static POP_KEY_USAGES;
|
|
19
28
|
private static EXTRACTABLE;
|
|
20
|
-
private static DB_VERSION;
|
|
21
|
-
private static DB_NAME;
|
|
22
|
-
private static TABLE_NAME;
|
|
23
29
|
private cache;
|
|
24
|
-
constructor();
|
|
30
|
+
constructor(logger: Logger);
|
|
25
31
|
/**
|
|
26
32
|
* Creates a new random GUID - used to populate state and nonce.
|
|
27
33
|
* @returns string (GUID)
|
|
@@ -45,7 +51,16 @@ export declare class CryptoOps implements ICrypto {
|
|
|
45
51
|
* Generates a keypair, stores it and returns a thumbprint
|
|
46
52
|
* @param request
|
|
47
53
|
*/
|
|
48
|
-
getPublicKeyThumbprint(request:
|
|
54
|
+
getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
57
|
+
* @param kid
|
|
58
|
+
*/
|
|
59
|
+
removeTokenBindingKey(kid: string): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Removes all cryptographic keys from IndexedDB storage
|
|
62
|
+
*/
|
|
63
|
+
clearKeystore(): Promise<boolean>;
|
|
49
64
|
/**
|
|
50
65
|
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
51
66
|
* @param payload
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoOps.d.ts","sourceRoot":"","sources":["../../src/crypto/CryptoOps.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CryptoOps.d.ts","sourceRoot":"","sources":["../../src/crypto/CryptoOps.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAShH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,oBAAY,aAAa,GAAG;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,cAAc,GAAG;IACzB,cAAc,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAClD,aAAa,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CAChD,CAAC;AAEF;;;GAGG;AACH,qBAAa,SAAU,YAAW,OAAO;IAErC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAuC;IACpE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAiB;IAC3C,OAAO,CAAC,KAAK,CAAiB;gBAElB,MAAM,EAAE,MAAM;IAc1B;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC;IAI7C;;;OAGG;IACG,sBAAsB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IAoCnF;;;OAGG;IACG,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM1D;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAMvC;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAkC1E"}
|
package/dist/crypto/CryptoOps.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.20.0 2021-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
4
|
import { GuidGenerator } from './GuidGenerator.js';
|
|
@@ -6,9 +6,10 @@ import { Base64Encode } from '../encode/Base64Encode.js';
|
|
|
6
6
|
import { Base64Decode } from '../encode/Base64Decode.js';
|
|
7
7
|
import { PkceGenerator } from './PkceGenerator.js';
|
|
8
8
|
import { BrowserCrypto } from './BrowserCrypto.js';
|
|
9
|
-
import { DatabaseStorage } from '../cache/DatabaseStorage.js';
|
|
10
9
|
import { BrowserStringUtils } from '../utils/BrowserStringUtils.js';
|
|
11
10
|
import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';
|
|
11
|
+
import { BrowserAuthError } from '../error/BrowserAuthError.js';
|
|
12
|
+
import { AsyncMemoryStorage } from '../cache/AsyncMemoryStorage.js';
|
|
12
13
|
|
|
13
14
|
/*
|
|
14
15
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -19,14 +20,18 @@ import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';
|
|
|
19
20
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
20
21
|
*/
|
|
21
22
|
var CryptoOps = /** @class */ (function () {
|
|
22
|
-
function CryptoOps() {
|
|
23
|
+
function CryptoOps(logger) {
|
|
24
|
+
this.logger = logger;
|
|
23
25
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
24
|
-
this.browserCrypto = new BrowserCrypto();
|
|
26
|
+
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
25
27
|
this.b64Encode = new Base64Encode();
|
|
26
28
|
this.b64Decode = new Base64Decode();
|
|
27
29
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
28
30
|
this.pkceGenerator = new PkceGenerator(this.browserCrypto);
|
|
29
|
-
this.cache =
|
|
31
|
+
this.cache = {
|
|
32
|
+
asymmetricKeys: new AsyncMemoryStorage(this.logger),
|
|
33
|
+
symmetricKeys: new AsyncMemoryStorage(this.logger)
|
|
34
|
+
};
|
|
30
35
|
}
|
|
31
36
|
/**
|
|
32
37
|
* Creates a new random GUID - used to populate state and nonce.
|
|
@@ -91,17 +96,64 @@ var CryptoOps = /** @class */ (function () {
|
|
|
91
96
|
case 5:
|
|
92
97
|
unextractablePrivateKey = _a.sent();
|
|
93
98
|
// Store Keypair data in keystore
|
|
94
|
-
this.cache.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
return [4 /*yield*/, this.cache.asymmetricKeys.setItem(publicJwkHash, {
|
|
100
|
+
privateKey: unextractablePrivateKey,
|
|
101
|
+
publicKey: keyPair.publicKey,
|
|
102
|
+
requestMethod: request.resourceRequestMethod,
|
|
103
|
+
requestUri: request.resourceRequestUri
|
|
104
|
+
})];
|
|
105
|
+
case 6:
|
|
106
|
+
// Store Keypair data in keystore
|
|
107
|
+
_a.sent();
|
|
100
108
|
return [2 /*return*/, publicJwkHash];
|
|
101
109
|
}
|
|
102
110
|
});
|
|
103
111
|
});
|
|
104
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
115
|
+
* @param kid
|
|
116
|
+
*/
|
|
117
|
+
CryptoOps.prototype.removeTokenBindingKey = function (kid) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
var keyFound;
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0: return [4 /*yield*/, this.cache.asymmetricKeys.removeItem(kid)];
|
|
123
|
+
case 1:
|
|
124
|
+
_a.sent();
|
|
125
|
+
return [4 /*yield*/, this.cache.asymmetricKeys.containsKey(kid)];
|
|
126
|
+
case 2:
|
|
127
|
+
keyFound = _a.sent();
|
|
128
|
+
return [2 /*return*/, !keyFound];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Removes all cryptographic keys from IndexedDB storage
|
|
135
|
+
*/
|
|
136
|
+
CryptoOps.prototype.clearKeystore = function () {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
var dataStoreNames, databaseStorage, _a;
|
|
139
|
+
return __generator(this, function (_b) {
|
|
140
|
+
switch (_b.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
dataStoreNames = Object.keys(this.cache);
|
|
143
|
+
databaseStorage = this.cache[dataStoreNames[0]];
|
|
144
|
+
if (!databaseStorage) return [3 /*break*/, 2];
|
|
145
|
+
return [4 /*yield*/, databaseStorage.deleteDatabase()];
|
|
146
|
+
case 1:
|
|
147
|
+
_a = _b.sent();
|
|
148
|
+
return [3 /*break*/, 3];
|
|
149
|
+
case 2:
|
|
150
|
+
_a = false;
|
|
151
|
+
_b.label = 3;
|
|
152
|
+
case 3: return [2 /*return*/, _a];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
};
|
|
105
157
|
/**
|
|
106
158
|
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
107
159
|
* @param payload
|
|
@@ -112,9 +164,12 @@ var CryptoOps = /** @class */ (function () {
|
|
|
112
164
|
var cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature;
|
|
113
165
|
return __generator(this, function (_a) {
|
|
114
166
|
switch (_a.label) {
|
|
115
|
-
case 0: return [4 /*yield*/, this.cache.
|
|
167
|
+
case 0: return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];
|
|
116
168
|
case 1:
|
|
117
169
|
cachedKeyPair = _a.sent();
|
|
170
|
+
if (!cachedKeyPair) {
|
|
171
|
+
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
172
|
+
}
|
|
118
173
|
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];
|
|
119
174
|
case 2:
|
|
120
175
|
publicKeyJwk = _a.sent();
|
|
@@ -142,9 +197,6 @@ var CryptoOps = /** @class */ (function () {
|
|
|
142
197
|
};
|
|
143
198
|
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
144
199
|
CryptoOps.EXTRACTABLE = true;
|
|
145
|
-
CryptoOps.DB_VERSION = 1;
|
|
146
|
-
CryptoOps.DB_NAME = "msal.db";
|
|
147
|
-
CryptoOps.TABLE_NAME = CryptoOps.DB_NAME + ".keys";
|
|
148
200
|
return CryptoOps;
|
|
149
201
|
}());
|
|
150
202
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoOps.js","sources":["../../src/crypto/CryptoOps.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseAuthRequest, ICrypto, PkceCodes, SignedHttpRequest } from \"@azure/msal-common\";\nimport { GuidGenerator } from \"./GuidGenerator\";\nimport { Base64Encode } from \"../encode/Base64Encode\";\nimport { Base64Decode } from \"../encode/Base64Decode\";\nimport { PkceGenerator } from \"./PkceGenerator\";\nimport { BrowserCrypto } from \"./BrowserCrypto\";\nimport { DatabaseStorage } from \"../cache/DatabaseStorage\";\nimport { BrowserStringUtils } from \"../utils/BrowserStringUtils\";\nimport { KEY_FORMAT_JWK } from \"../utils/BrowserConstants\";\n\nexport type CachedKeyPair = {\n publicKey: CryptoKey,\n privateKey: CryptoKey,\n requestMethod?: string,\n requestUri?: string\n};\n\n/**\n * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and \n * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).\n */\nexport class CryptoOps implements ICrypto {\n\n private browserCrypto: BrowserCrypto;\n private guidGenerator: GuidGenerator;\n private b64Encode: Base64Encode;\n private b64Decode: Base64Decode;\n private pkceGenerator: PkceGenerator;\n\n private static POP_KEY_USAGES: Array<KeyUsage> = [\"sign\", \"verify\"];\n private static EXTRACTABLE: boolean = true;\n\n private static DB_VERSION = 1;\n private static DB_NAME = \"msal.db\";\n private static TABLE_NAME =`${CryptoOps.DB_NAME}.keys`;\n private cache: DatabaseStorage<CachedKeyPair>;\n\n constructor() {\n // Browser crypto needs to be validated first before any other classes can be set.\n this.browserCrypto = new BrowserCrypto();\n this.b64Encode = new Base64Encode();\n this.b64Decode = new Base64Decode();\n this.guidGenerator = new GuidGenerator(this.browserCrypto);\n this.pkceGenerator = new PkceGenerator(this.browserCrypto);\n this.cache = new DatabaseStorage(CryptoOps.DB_NAME, CryptoOps.TABLE_NAME, CryptoOps.DB_VERSION);\n }\n\n /**\n * Creates a new random GUID - used to populate state and nonce.\n * @returns string (GUID)\n */\n createNewGuid(): string {\n return this.guidGenerator.generateGuid();\n }\n\n /**\n * Encodes input string to base64.\n * @param input \n */\n base64Encode(input: string): string {\n return this.b64Encode.encode(input);\n } \n \n /**\n * Decodes input string from base64.\n * @param input \n */\n base64Decode(input: string): string {\n return this.b64Decode.decode(input);\n }\n\n /**\n * Generates PKCE codes used in Authorization Code Flow.\n */\n async generatePkceCodes(): Promise<PkceCodes> {\n return this.pkceGenerator.generateCodes();\n }\n\n /**\n * Generates a keypair, stores it and returns a thumbprint\n * @param request\n */\n async getPublicKeyThumbprint(request: BaseAuthRequest): Promise<string> {\n // Generate Keypair\n const keyPair = await this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);\n\n // Generate Thumbprint for Public Key\n const publicKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.publicKey);\n const pubKeyThumprintObj: JsonWebKey = {\n e: publicKeyJwk.e,\n kty: publicKeyJwk.kty,\n n: publicKeyJwk.n\n };\n const publicJwkString: string = BrowserCrypto.getJwkString(pubKeyThumprintObj);\n const publicJwkBuffer: ArrayBuffer = await this.browserCrypto.sha256Digest(publicJwkString);\n const publicJwkHash: string = this.b64Encode.urlEncodeArr(new Uint8Array(publicJwkBuffer));\n\n // Generate Thumbprint for Private Key\n const privateKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.privateKey);\n // Re-import private key to make it unextractable\n const unextractablePrivateKey: CryptoKey = await this.browserCrypto.importJwk(privateKeyJwk, false, [\"sign\"]);\n\n // Store Keypair data in keystore\n this.cache.put(publicJwkHash, {\n privateKey: unextractablePrivateKey,\n publicKey: keyPair.publicKey,\n requestMethod: request.resourceRequestMethod,\n requestUri: request.resourceRequestUri\n });\n\n return publicJwkHash;\n }\n\n /**\n * Signs the given object as a jwt payload with private key retrieved by given kid.\n * @param payload \n * @param kid \n */\n async signJwt(payload: SignedHttpRequest, kid: string): Promise<string> {\n // Get keypair from cache\n const cachedKeyPair: CachedKeyPair = await this.cache.get(kid);\n\n // Get public key as JWK\n const publicKeyJwk = await this.browserCrypto.exportJwk(cachedKeyPair.publicKey);\n const publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);\n\n // Generate header\n const header = {\n alg: publicKeyJwk.alg,\n type: KEY_FORMAT_JWK\n };\n const encodedHeader = this.b64Encode.urlEncode(JSON.stringify(header));\n\n // Generate payload\n payload.cnf = {\n jwk: JSON.parse(publicKeyJwkString)\n };\n const encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));\n\n // Form token string\n const tokenString = `${encodedHeader}.${encodedPayload}`;\n\n // Sign token\n const tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);\n const signatureBuffer = await this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer);\n const encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));\n\n return `${tokenString}.${encodedSignature}`;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;AAsBA;;;;;IAoBI;;QAEI,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,GAAG,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;KACnG;;;;;IAMD,iCAAa,GAAb;QACI,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;KAC5C;;;;;IAMD,gCAAY,GAAZ,UAAa,KAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,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eAAe,CAAC,CAAC,CAAC;wBAEtF,sBAAU,WAAW,SAAI,gBAAkB,EAAC;;;;KAC/C;IAvHc,wBAAc,GAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,qBAAW,GAAY,IAAI,CAAC;IAE5B,oBAAU,GAAG,CAAC,CAAC;IACf,iBAAO,GAAG,SAAS,CAAC;IACpB,oBAAU,GAAK,SAAS,CAAC,OAAO,UAAO,CAAC;IAmH3D,gBAAC;CAhID;;;;"}
|
|
1
|
+
{"version":3,"file":"CryptoOps.js","sources":["../../src/crypto/CryptoOps.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, Logger, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from \"@azure/msal-common\";\nimport { GuidGenerator } from \"./GuidGenerator\";\nimport { Base64Encode } from \"../encode/Base64Encode\";\nimport { Base64Decode } from \"../encode/Base64Decode\";\nimport { PkceGenerator } from \"./PkceGenerator\";\nimport { BrowserCrypto } from \"./BrowserCrypto\";\nimport { BrowserStringUtils } from \"../utils/BrowserStringUtils\";\nimport { KEY_FORMAT_JWK } from \"../utils/BrowserConstants\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { AsyncMemoryStorage } from \"../cache/AsyncMemoryStorage\";\n\nexport type CachedKeyPair = {\n publicKey: CryptoKey,\n privateKey: CryptoKey,\n requestMethod?: string,\n requestUri?: string\n};\n\n/**\n * MSAL CryptoKeyStore DB Version 2\n */\nexport type CryptoKeyStore = {\n asymmetricKeys: AsyncMemoryStorage<CachedKeyPair>;\n symmetricKeys: AsyncMemoryStorage<CryptoKey>;\n};\n\n/**\n * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and \n * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).\n */\nexport class CryptoOps implements ICrypto {\n\n private browserCrypto: BrowserCrypto;\n private guidGenerator: GuidGenerator;\n private b64Encode: Base64Encode;\n private b64Decode: Base64Decode;\n private pkceGenerator: PkceGenerator;\n private logger: Logger;\n\n private static POP_KEY_USAGES: Array<KeyUsage> = [\"sign\", \"verify\"];\n private static EXTRACTABLE: boolean = true;\n private cache: CryptoKeyStore;\n\n constructor(logger: Logger) {\n this.logger = logger;\n // Browser crypto needs to be validated first before any other classes can be set.\n this.browserCrypto = new BrowserCrypto(this.logger);\n this.b64Encode = new Base64Encode();\n this.b64Decode = new Base64Decode();\n this.guidGenerator = new GuidGenerator(this.browserCrypto);\n this.pkceGenerator = new PkceGenerator(this.browserCrypto);\n this.cache = {\n asymmetricKeys: new AsyncMemoryStorage<CachedKeyPair>(this.logger),\n symmetricKeys: new AsyncMemoryStorage<CryptoKey>(this.logger)\n };\n }\n\n /**\n * Creates a new random GUID - used to populate state and nonce.\n * @returns string (GUID)\n */\n createNewGuid(): string {\n return this.guidGenerator.generateGuid();\n }\n\n /**\n * Encodes input string to base64.\n * @param input \n */\n base64Encode(input: string): string {\n return this.b64Encode.encode(input);\n } \n \n /**\n * Decodes input string from base64.\n * @param input \n */\n base64Decode(input: string): string {\n return this.b64Decode.decode(input);\n }\n\n /**\n * Generates PKCE codes used in Authorization Code Flow.\n */\n async generatePkceCodes(): Promise<PkceCodes> {\n return this.pkceGenerator.generateCodes();\n }\n\n /**\n * Generates a keypair, stores it and returns a thumbprint\n * @param request\n */\n async getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string> {\n // Generate Keypair\n const keyPair: CryptoKeyPair = await this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);\n\n // Generate Thumbprint for Public Key\n const publicKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.publicKey);\n \n const pubKeyThumprintObj: JsonWebKey = {\n e: publicKeyJwk.e,\n kty: publicKeyJwk.kty,\n n: publicKeyJwk.n\n };\n\n const publicJwkString: string = BrowserCrypto.getJwkString(pubKeyThumprintObj);\n const publicJwkBuffer: ArrayBuffer = await this.browserCrypto.sha256Digest(publicJwkString);\n const publicJwkHash: string = this.b64Encode.urlEncodeArr(new Uint8Array(publicJwkBuffer));\n\n // Generate Thumbprint for Private Key\n const privateKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.privateKey);\n // Re-import private key to make it unextractable\n const unextractablePrivateKey: CryptoKey = await this.browserCrypto.importJwk(privateKeyJwk, false, [\"sign\"]);\n\n // Store Keypair data in keystore\n await this.cache.asymmetricKeys.setItem(\n publicJwkHash, \n {\n privateKey: unextractablePrivateKey,\n publicKey: keyPair.publicKey,\n requestMethod: request.resourceRequestMethod,\n requestUri: request.resourceRequestUri\n }\n );\n\n return publicJwkHash;\n }\n\n /**\n * Removes cryptographic keypair from key store matching the keyId passed in\n * @param kid \n */\n async removeTokenBindingKey(kid: string): Promise<boolean> {\n await this.cache.asymmetricKeys.removeItem(kid);\n const keyFound = await this.cache.asymmetricKeys.containsKey(kid);\n return !keyFound;\n }\n\n /**\n * Removes all cryptographic keys from IndexedDB storage\n */\n async clearKeystore(): Promise<boolean> {\n const dataStoreNames = Object.keys(this.cache);\n const databaseStorage = this.cache[dataStoreNames[0]];\n return databaseStorage ? await databaseStorage.deleteDatabase() : false;\n }\n\n /**\n * Signs the given object as a jwt payload with private key retrieved by given kid.\n * @param payload \n * @param kid \n */\n async signJwt(payload: SignedHttpRequest, kid: string): Promise<string> {\n const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);\n \n if (!cachedKeyPair) {\n throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);\n }\n\n // Get public key as JWK\n const publicKeyJwk = await this.browserCrypto.exportJwk(cachedKeyPair.publicKey);\n const publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);\n\n // Generate header\n const header = {\n alg: publicKeyJwk.alg,\n type: KEY_FORMAT_JWK\n };\n const encodedHeader = this.b64Encode.urlEncode(JSON.stringify(header));\n\n // Generate payload\n payload.cnf = {\n jwk: JSON.parse(publicKeyJwkString)\n };\n const encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));\n\n // Form token string\n const tokenString = `${encodedHeader}.${encodedPayload}`;\n\n // Sign token\n const tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);\n const signatureBuffer = await this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer);\n const encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));\n\n return `${tokenString}.${encodedSignature}`;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;AA+BA;;;;;IAiBI,mBAAY,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;QAErB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,GAAG;YACT,cAAc,EAAE,IAAI,kBAAkB,CAAgB,IAAI,CAAC,MAAM,CAAC;YAClE,aAAa,EAAE,IAAI,kBAAkB,CAAY,IAAI,CAAC,MAAM,CAAC;SAChE,CAAC;KACL;;;;;IAMD,iCAAa,GAAb;QACI,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;KAC5C;;;;;IAMD,gCAAY,GAAZ,UAAa,KAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACvC;;;;;IAMD,gCAAY,GAAZ,UAAa,KAAa;QACtB,OAAO,IAAI,CAAC,SAAS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wBAG9D,MAAM,GAAG;4BACX,GAAG,EAAE,YAAY,CAAC,GAAG;4BACrB,IAAI,EAAE,cAAc;yBACvB,CAAC;wBACI,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;;wBAGvE,OAAO,CAAC,GAAG,GAAG;4BACV,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;yBACtC,CAAC;wBACI,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;wBAGnE,WAAW,GAAM,aAAa,SAAI,cAAgB,CAAC;wBAGnD,WAAW,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;wBAChD,qBAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,EAAA;;wBAAtF,eAAe,GAAG,SAAoE;wBACtF,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;wBAEtF,sBAAU,WAAW,SAAI,gBAAkB,EAAC;;;;KAC/C;IAlJc,wBAAc,GAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,qBAAW,GAAY,IAAI,CAAC;IAkJ/C,gBAAC;CA5JD;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LoggerOptions, SignedHttpRequestParameters } from "@azure/msal-common";
|
|
2
|
+
export declare type SignedHttpRequestOptions = {
|
|
3
|
+
loggerOptions: LoggerOptions;
|
|
4
|
+
};
|
|
5
|
+
export declare class SignedHttpRequest {
|
|
6
|
+
private popTokenGenerator;
|
|
7
|
+
private cryptoOps;
|
|
8
|
+
private shrParameters;
|
|
9
|
+
private logger;
|
|
10
|
+
constructor(shrParameters: SignedHttpRequestParameters, shrOptions?: SignedHttpRequestOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Generates and caches a keypair for the given request options.
|
|
13
|
+
* @returns Public key digest, which should be sent to the token issuer.
|
|
14
|
+
*/
|
|
15
|
+
generatePublicKeyThumbprint(): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Generates a signed http request for the given payload with the given key.
|
|
18
|
+
* @param payload Payload to sign (e.g. access token)
|
|
19
|
+
* @param publicKeyThumbprint Public key digest (from generatePublicKeyThumbprint API)
|
|
20
|
+
* @param claims Additional claims to include/override in the signed JWT
|
|
21
|
+
* @returns Pop token signed with the corresponding private key
|
|
22
|
+
*/
|
|
23
|
+
signRequest(payload: string, publicKeyThumbprint: string, claims?: object): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Removes cached keys from browser for given public key thumbprint
|
|
26
|
+
* @param publicKeyThumbprint Public key digest (from generatePublicKeyThumbprint API)
|
|
27
|
+
* @returns If keys are properly deleted
|
|
28
|
+
*/
|
|
29
|
+
removeKeys(publicKeyThumbprint: string): Promise<boolean>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=SignedHttpRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedHttpRequest.d.ts","sourceRoot":"","sources":["../../src/crypto/SignedHttpRequest.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,aAAa,EAAqB,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAG3G,oBAAY,wBAAwB,GAAG;IACnC,aAAa,EAAE,aAAa,CAAA;CAC/B,CAAC;AAEF,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,MAAM,CAAS;gBAEX,aAAa,EAAE,2BAA2B,EAAE,UAAU,CAAC,EAAE,wBAAwB;IAQ7F;;;OAGG;IACG,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC;IAMpD;;;;;;OAMG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASjG;;;;OAIG;IACG,UAAU,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*! @azure/msal-browser v2.20.0 2021-12-07 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
+
import { CryptoOps } from './CryptoOps.js';
|
|
5
|
+
import { Logger, PopTokenGenerator } from '@azure/msal-common';
|
|
6
|
+
import { name, version } from '../packageMetadata.js';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
var SignedHttpRequest = /** @class */ (function () {
|
|
13
|
+
function SignedHttpRequest(shrParameters, shrOptions) {
|
|
14
|
+
var loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};
|
|
15
|
+
this.logger = new Logger(loggerOptions, name, version);
|
|
16
|
+
this.cryptoOps = new CryptoOps(this.logger);
|
|
17
|
+
this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps);
|
|
18
|
+
this.shrParameters = shrParameters;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generates and caches a keypair for the given request options.
|
|
22
|
+
* @returns Public key digest, which should be sent to the token issuer.
|
|
23
|
+
*/
|
|
24
|
+
SignedHttpRequest.prototype.generatePublicKeyThumbprint = function () {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
26
|
+
var kid;
|
|
27
|
+
return __generator(this, function (_a) {
|
|
28
|
+
switch (_a.label) {
|
|
29
|
+
case 0: return [4 /*yield*/, this.popTokenGenerator.generateKid(this.shrParameters)];
|
|
30
|
+
case 1:
|
|
31
|
+
kid = (_a.sent()).kid;
|
|
32
|
+
return [2 /*return*/, kid];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Generates a signed http request for the given payload with the given key.
|
|
39
|
+
* @param payload Payload to sign (e.g. access token)
|
|
40
|
+
* @param publicKeyThumbprint Public key digest (from generatePublicKeyThumbprint API)
|
|
41
|
+
* @param claims Additional claims to include/override in the signed JWT
|
|
42
|
+
* @returns Pop token signed with the corresponding private key
|
|
43
|
+
*/
|
|
44
|
+
SignedHttpRequest.prototype.signRequest = function (payload, publicKeyThumbprint, claims) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
return [2 /*return*/, this.popTokenGenerator.signPayload(payload, publicKeyThumbprint, this.shrParameters, claims)];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Removes cached keys from browser for given public key thumbprint
|
|
53
|
+
* @param publicKeyThumbprint Public key digest (from generatePublicKeyThumbprint API)
|
|
54
|
+
* @returns If keys are properly deleted
|
|
55
|
+
*/
|
|
56
|
+
SignedHttpRequest.prototype.removeKeys = function (publicKeyThumbprint) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0: return [4 /*yield*/, this.cryptoOps.removeTokenBindingKey(publicKeyThumbprint)];
|
|
61
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return SignedHttpRequest;
|
|
67
|
+
}());
|
|
68
|
+
|
|
69
|
+
export { SignedHttpRequest };
|
|
70
|
+
//# sourceMappingURL=SignedHttpRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignedHttpRequest.js","sources":["../../src/crypto/SignedHttpRequest.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { CryptoOps } from \"./CryptoOps\";\nimport { Logger, LoggerOptions, PopTokenGenerator, SignedHttpRequestParameters } from \"@azure/msal-common\";\nimport { version, name } from \"../packageMetadata\";\n\nexport type SignedHttpRequestOptions = {\n loggerOptions: LoggerOptions\n};\n\nexport class SignedHttpRequest {\n private popTokenGenerator: PopTokenGenerator;\n private cryptoOps: CryptoOps;\n private shrParameters: SignedHttpRequestParameters;\n private logger: Logger;\n\n constructor(shrParameters: SignedHttpRequestParameters, shrOptions?: SignedHttpRequestOptions) {\n const loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};\n this.logger = new Logger(loggerOptions, name, version);\n this.cryptoOps = new CryptoOps(this.logger);\n this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps);\n this.shrParameters = shrParameters;\n }\n\n /**\n * Generates and caches a keypair for the given request options.\n * @returns Public key digest, which should be sent to the token issuer.\n */\n async generatePublicKeyThumbprint(): Promise<string> {\n const { kid } = await this.popTokenGenerator.generateKid(this.shrParameters);\n\n return kid;\n }\n\n /**\n * Generates a signed http request for the given payload with the given key.\n * @param payload Payload to sign (e.g. access token)\n * @param publicKeyThumbprint Public key digest (from generatePublicKeyThumbprint API)\n * @param claims Additional claims to include/override in the signed JWT \n * @returns Pop token signed with the corresponding private key\n */\n async signRequest(payload: string, publicKeyThumbprint: string, claims?: object): Promise<string> {\n return this.popTokenGenerator.signPayload(\n payload, \n publicKeyThumbprint,\n this.shrParameters, \n claims\n );\n }\n\n /**\n * Removes cached keys from browser for given public key thumbprint\n * @param publicKeyThumbprint Public key digest (from generatePublicKeyThumbprint API)\n * @returns If keys are properly deleted\n */\n async removeKeys(publicKeyThumbprint: string): Promise<boolean> {\n return await this.cryptoOps.removeTokenBindingKey(publicKeyThumbprint);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;IAmBI,2BAAY,aAA0C,EAAE,UAAqC;QACzF,IAAM,aAAa,GAAG,CAAC,UAAU,IAAI,UAAU,CAAC,aAAa,KAAK,EAAE,CAAC;QACrE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;KACtC;;;;;IAMK,uDAA2B,GAAjC;;;;;4BACoB,qBAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,EAAA;;wBAApE,GAAG,GAAK,CAAA,SAA4D,KAAjE;wBAEX,sBAAO,GAAG,EAAC;;;;KACd;;;;;;;;IASK,uCAAW,GAAjB,UAAkB,OAAe,EAAE,mBAA2B,EAAE,MAAe;;;gBAC3E,sBAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CACrC,OAAO,EACP,mBAAmB,EACnB,IAAI,CAAC,aAAa,EAClB,MAAM,CACT,EAAC;;;KACL;;;;;;IAOK,sCAAU,GAAhB,UAAiB,mBAA2B;;;;4BACjC,qBAAM,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,EAAA;4BAAtE,sBAAO,SAA+D,EAAC;;;;KAC1E;IACL,wBAAC;AAAD,CAAC;;;;"}
|
|
@@ -43,7 +43,7 @@ export declare const BrowserAuthErrorMessage: {
|
|
|
43
43
|
code: string;
|
|
44
44
|
desc: string;
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
popupWindowError: {
|
|
47
47
|
code: string;
|
|
48
48
|
desc: string;
|
|
49
49
|
};
|
|
@@ -79,7 +79,7 @@ export declare const BrowserAuthErrorMessage: {
|
|
|
79
79
|
code: string;
|
|
80
80
|
desc: string;
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
silentLogoutUnsupportedError: {
|
|
83
83
|
code: string;
|
|
84
84
|
desc: string;
|
|
85
85
|
};
|
|
@@ -135,6 +135,22 @@ export declare const BrowserAuthErrorMessage: {
|
|
|
135
135
|
code: string;
|
|
136
136
|
desc: string;
|
|
137
137
|
};
|
|
138
|
+
unableToLoadTokenError: {
|
|
139
|
+
code: string;
|
|
140
|
+
desc: string;
|
|
141
|
+
};
|
|
142
|
+
signingKeyNotFoundInStorage: {
|
|
143
|
+
code: string;
|
|
144
|
+
desc: string;
|
|
145
|
+
};
|
|
146
|
+
authCodeRequired: {
|
|
147
|
+
code: string;
|
|
148
|
+
desc: string;
|
|
149
|
+
};
|
|
150
|
+
databaseUnavailable: {
|
|
151
|
+
code: string;
|
|
152
|
+
desc: string;
|
|
153
|
+
};
|
|
138
154
|
};
|
|
139
155
|
/**
|
|
140
156
|
* Browser library error class thrown by the MSAL.js library for SPAs
|
|
@@ -226,9 +242,9 @@ export declare class BrowserAuthError extends AuthError {
|
|
|
226
242
|
*/
|
|
227
243
|
static createIframeClosedPrematurelyError(): BrowserAuthError;
|
|
228
244
|
/**
|
|
229
|
-
* Creates an error thrown when the
|
|
245
|
+
* Creates an error thrown when the logout API is called on any of the silent interaction clients
|
|
230
246
|
*/
|
|
231
|
-
static
|
|
247
|
+
static createSilentLogoutUnsupportedError(): BrowserAuthError;
|
|
232
248
|
/**
|
|
233
249
|
* Creates an error thrown when the account object is not provided in the acquireTokenSilent API.
|
|
234
250
|
*/
|
|
@@ -281,5 +297,21 @@ export declare class BrowserAuthError extends AuthError {
|
|
|
281
297
|
* Create an error thrown when network client fails to parse network response
|
|
282
298
|
*/
|
|
283
299
|
static createFailedToParseNetworkResponseError(endpoint: string): BrowserAuthError;
|
|
300
|
+
/**
|
|
301
|
+
* Create an error thrown when the necessary information is not available to sideload tokens
|
|
302
|
+
*/
|
|
303
|
+
static createUnableToLoadTokenError(errorDetail: string): BrowserAuthError;
|
|
304
|
+
/**
|
|
305
|
+
* Create an error thrown when the queried cryptographic key is not found in IndexedDB
|
|
306
|
+
*/
|
|
307
|
+
static createSigningKeyNotFoundInStorageError(keyId: string): BrowserAuthError;
|
|
308
|
+
/**
|
|
309
|
+
* Create an error when an authorization code is required but not provided
|
|
310
|
+
*/
|
|
311
|
+
static createAuthCodeRequiredError(): BrowserAuthError;
|
|
312
|
+
/**
|
|
313
|
+
* Create an error when IndexedDB is unavailable
|
|
314
|
+
*/
|
|
315
|
+
static createDatabaseUnavailableError(): BrowserAuthError;
|
|
284
316
|
}
|
|
285
317
|
//# sourceMappingURL=BrowserAuthError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserAuthError.d.ts","sourceRoot":"","sources":["../../src/error/BrowserAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAe,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"BrowserAuthError.d.ts","sourceRoot":"","sources":["../../src/error/BrowserAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAe,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqJnC,CAAC;AAEF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBAE/B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAOpD;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,SAAS,EAAE,MA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