@azure/communication-common 2.4.2-alpha.20260210.1 → 2.4.2
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/README.md +1 -1
- package/dist/browser/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
- package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js +6 -10
- package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
- package/dist/browser/entraTokenCredential.d.ts.map +1 -1
- package/dist/browser/entraTokenCredential.js +12 -7
- package/dist/browser/entraTokenCredential.js.map +1 -1
- package/dist/browser/index.d.ts +3 -3
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/commonjs/autoRefreshTokenCredential.js +110 -95
- package/dist/commonjs/autoRefreshTokenCredential.js.map +7 -1
- package/dist/commonjs/azureCommunicationTokenCredential.js +64 -47
- package/dist/commonjs/azureCommunicationTokenCredential.js.map +7 -1
- package/dist/commonjs/communicationTokenCredential.js +16 -5
- package/dist/commonjs/communicationTokenCredential.js.map +7 -1
- package/dist/commonjs/credential/clientArguments.js +46 -40
- package/dist/commonjs/credential/clientArguments.js.map +7 -1
- package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
- package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js +53 -42
- package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js.map +7 -1
- package/dist/commonjs/credential/communicationAuthPolicy.js +39 -26
- package/dist/commonjs/credential/communicationAuthPolicy.js.map +7 -1
- package/dist/commonjs/credential/connectionString.js +39 -28
- package/dist/commonjs/credential/connectionString.js.map +7 -1
- package/dist/commonjs/credential/index.js +28 -10
- package/dist/commonjs/credential/index.js.map +7 -1
- package/dist/commonjs/entraTokenCredential.d.ts.map +1 -1
- package/dist/commonjs/entraTokenCredential.js +137 -113
- package/dist/commonjs/entraTokenCredential.js.map +7 -1
- package/dist/commonjs/identifierModelSerializer.js +172 -159
- package/dist/commonjs/identifierModelSerializer.js.map +7 -1
- package/dist/commonjs/identifierModels.js +183 -205
- package/dist/commonjs/identifierModels.js.map +7 -1
- package/dist/commonjs/index.d.ts +3 -3
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +35 -12
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/staticTokenCredential.js +36 -20
- package/dist/commonjs/staticTokenCredential.js.map +7 -1
- package/dist/commonjs/tokenParser.js +33 -13
- package/dist/commonjs/tokenParser.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
- package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js +6 -10
- package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
- package/dist/esm/entraTokenCredential.d.ts.map +1 -1
- package/dist/esm/entraTokenCredential.js +12 -7
- package/dist/esm/entraTokenCredential.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
- package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js +6 -10
- package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
- package/dist/react-native/entraTokenCredential.d.ts.map +1 -1
- package/dist/react-native/entraTokenCredential.js +12 -7
- package/dist/react-native/entraTokenCredential.js.map +1 -1
- package/dist/react-native/index.d.ts +3 -3
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/package.json +30 -37
- package/dist/browser/credential/cryptoUtils-browser.d.mts.map +0 -1
- package/dist/browser/credential/cryptoUtils-browser.mjs.map +0 -1
- package/dist/browser/credential/cryptoUtils.d.ts +0 -3
- package/dist/browser/credential/cryptoUtils.js +0 -19
- package/dist/browser/credential/encodeUtils-browser.d.mts +0 -4
- package/dist/browser/credential/encodeUtils-browser.d.mts.map +0 -1
- package/dist/browser/credential/encodeUtils-browser.mjs +0 -19
- package/dist/browser/credential/encodeUtils-browser.mjs.map +0 -1
- package/dist/commonjs/credential/cryptoUtils.d.ts +0 -3
- package/dist/commonjs/credential/cryptoUtils.d.ts.map +0 -1
- package/dist/commonjs/credential/cryptoUtils.js +0 -14
- package/dist/commonjs/credential/cryptoUtils.js.map +0 -1
- package/dist/esm/credential/cryptoUtils.d.ts +0 -3
- package/dist/esm/credential/cryptoUtils.d.ts.map +0 -1
- package/dist/esm/credential/cryptoUtils.js +0 -9
- package/dist/esm/credential/cryptoUtils.js.map +0 -1
- package/dist/esm/credential/encodeUtils-browser.d.mts +0 -4
- package/dist/esm/credential/encodeUtils-browser.d.mts.map +0 -1
- package/dist/esm/credential/encodeUtils-browser.mjs +0 -19
- package/dist/esm/credential/encodeUtils-browser.mjs.map +0 -1
- package/dist/react-native/credential/cryptoUtils.d.ts +0 -3
- package/dist/react-native/credential/cryptoUtils.d.ts.map +0 -1
- package/dist/react-native/credential/cryptoUtils.js +0 -9
- package/dist/react-native/credential/cryptoUtils.js.map +0 -1
- package/dist/react-native/credential/encodeUtils-browser.d.mts +0 -4
- package/dist/react-native/credential/encodeUtils-browser.d.mts.map +0 -1
- package/dist/react-native/credential/encodeUtils-browser.mjs +0 -19
- package/dist/react-native/credential/encodeUtils-browser.mjs.map +0 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var communicationTokenCredential_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(communicationTokenCredential_exports);
|
|
16
|
+
//# sourceMappingURL=communicationTokenCredential.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/communicationTokenCredential.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { AccessToken } from \"@azure/core-auth\";\n\nexport type TokenCredential = Pick<CommunicationTokenCredential, \"getToken\" | \"dispose\">;\n\n/**\n * Options for `CommunicationTokenCredential`'s `getToken` function.\n */\nexport interface CommunicationGetTokenOptions {\n /**\n * An implementation of `AbortSignalLike` to cancel the operation.\n */\n abortSignal?: AbortSignalLike;\n}\n\n/**\n * The Azure Communication Services token credential.\n */\nexport interface CommunicationTokenCredential {\n /**\n * Gets an `AccessToken` for the user. Throws if already disposed.\n * @param options - Additional options.\n */\n getToken(options?: CommunicationGetTokenOptions): Promise<AccessToken>;\n /**\n * Disposes the CommunicationTokenCredential and cancels any internal auto-refresh operation.\n */\n dispose(): void;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var clientArguments_exports = {};
|
|
19
|
+
__export(clientArguments_exports, {
|
|
20
|
+
isKeyCredential: () => isKeyCredential,
|
|
21
|
+
parseClientArguments: () => parseClientArguments
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(clientArguments_exports);
|
|
24
|
+
var import_core_auth = require("@azure/core-auth");
|
|
25
|
+
var import_connectionString = require("./connectionString.js");
|
|
8
26
|
const isValidEndpoint = (host) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
url.host !== undefined &&
|
|
12
|
-
url.host !== "" &&
|
|
13
|
-
(url.pathname === undefined || url.pathname === "" || url.pathname === "/"));
|
|
27
|
+
const url = new URL(host);
|
|
28
|
+
return !!url.protocol?.match(/^http[s]?/) && url.host !== void 0 && url.host !== "" && (url.pathname === void 0 || url.pathname === "" || url.pathname === "/");
|
|
14
29
|
};
|
|
15
30
|
const assertValidEndpoint = (host) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
31
|
+
if (!isValidEndpoint(host)) {
|
|
32
|
+
throw new Error(`Invalid endpoint url ${host}`);
|
|
33
|
+
}
|
|
19
34
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Checks whether a value is a KeyCredential.
|
|
22
|
-
*
|
|
23
|
-
* @param credential - The credential being checked.
|
|
24
|
-
*/
|
|
25
35
|
const isKeyCredential = (credential) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
typeof castCredential.key === "string" &&
|
|
29
|
-
castCredential.getToken === undefined);
|
|
36
|
+
const castCredential = credential;
|
|
37
|
+
return castCredential && typeof castCredential.key === "string" && castCredential.getToken === void 0;
|
|
30
38
|
};
|
|
31
|
-
exports.isKeyCredential = isKeyCredential;
|
|
32
|
-
/**
|
|
33
|
-
* Parses arguments passed to a communication client.
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
36
39
|
const parseClientArguments = (connectionStringOrUrl, credentialOrOptions) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
40
|
+
if (isKeyCredential(credentialOrOptions) || (0, import_core_auth.isTokenCredential)(credentialOrOptions)) {
|
|
41
|
+
assertValidEndpoint(connectionStringOrUrl);
|
|
42
|
+
return { url: connectionStringOrUrl, credential: credentialOrOptions };
|
|
43
|
+
} else {
|
|
44
|
+
const { endpoint: host, credential } = (0, import_connectionString.parseConnectionString)(connectionStringOrUrl);
|
|
45
|
+
assertValidEndpoint(host);
|
|
46
|
+
return { url: host, credential };
|
|
47
|
+
}
|
|
46
48
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
isKeyCredential,
|
|
52
|
+
parseClientArguments
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=clientArguments.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/credential/clientArguments.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { type KeyCredential, type TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { parseConnectionString } from \"./connectionString.js\";\n\nconst isValidEndpoint = (host: string): boolean => {\n const url = new URL(host);\n\n return (\n !!url.protocol?.match(/^http[s]?/) &&\n url.host !== undefined &&\n url.host !== \"\" &&\n (url.pathname === undefined || url.pathname === \"\" || url.pathname === \"/\")\n );\n};\n\nconst assertValidEndpoint = (host: string): void => {\n if (!isValidEndpoint(host)) {\n throw new Error(`Invalid endpoint url ${host}`);\n }\n};\n\n/**\n * Checks whether a value is a KeyCredential.\n *\n * @param credential - The credential being checked.\n */\nexport const isKeyCredential = (credential: unknown): credential is KeyCredential => {\n const castCredential = credential as {\n key: unknown;\n getToken: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.key === \"string\" &&\n castCredential.getToken === undefined\n );\n};\n\n/**\n * The URL and credential from parsing the arguments of a communication client.\n * @hidden\n */\nexport type UrlWithCredential = {\n url: string;\n credential: TokenCredential | KeyCredential;\n};\n\n/**\n * Parses arguments passed to a communication client.\n * @hidden\n */\nexport const parseClientArguments = (\n connectionStringOrUrl: string,\n credentialOrOptions?: unknown,\n): UrlWithCredential => {\n if (isKeyCredential(credentialOrOptions) || isTokenCredential(credentialOrOptions)) {\n assertValidEndpoint(connectionStringOrUrl);\n return { url: connectionStringOrUrl, credential: credentialOrOptions };\n } else {\n const { endpoint: host, credential } = parseConnectionString(connectionStringOrUrl);\n assertValidEndpoint(host);\n return { url: host, credential };\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAA4E;AAC5E,8BAAsC;AAEtC,MAAM,kBAAkB,CAAC,SAA0B;AACjD,QAAM,MAAM,IAAI,IAAI,IAAI;AAExB,SACE,CAAC,CAAC,IAAI,UAAU,MAAM,WAAW,KACjC,IAAI,SAAS,UACb,IAAI,SAAS,OACZ,IAAI,aAAa,UAAa,IAAI,aAAa,MAAM,IAAI,aAAa;AAE3E;AAEA,MAAM,sBAAsB,CAAC,SAAuB;AAClD,MAAI,CAAC,gBAAgB,IAAI,GAAG;AAC1B,UAAM,IAAI,MAAM,wBAAwB,IAAI,EAAE;AAAA,EAChD;AACF;AAOO,MAAM,kBAAkB,CAAC,eAAqD;AACnF,QAAM,iBAAiB;AAIvB,SACE,kBACA,OAAO,eAAe,QAAQ,YAC9B,eAAe,aAAa;AAEhC;AAeO,MAAM,uBAAuB,CAClC,uBACA,wBACsB;AACtB,MAAI,gBAAgB,mBAAmB,SAAK,oCAAkB,mBAAmB,GAAG;AAClF,wBAAoB,qBAAqB;AACzC,WAAO,EAAE,KAAK,uBAAuB,YAAY,oBAAoB;AAAA,EACvE,OAAO;AACL,UAAM,EAAE,UAAU,MAAM,WAAW,QAAI,+CAAsB,qBAAqB;AAClF,wBAAoB,IAAI;AACxB,WAAO,EAAE,KAAK,MAAM,WAAW;AAAA,EACjC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communicationAccessKeyCredentialPolicy.d.ts","sourceRoot":"","sources":["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"communicationAccessKeyCredentialPolicy.d.ts","sourceRoot":"","sources":["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAStD;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,UAAU,EAAE,aAAa,GACxB,cAAc,CA4BhB"}
|
|
@@ -1,45 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var communicationAccessKeyCredentialPolicy_exports = {};
|
|
19
|
+
__export(communicationAccessKeyCredentialPolicy_exports, {
|
|
20
|
+
createCommunicationAccessKeyCredentialPolicy: () => createCommunicationAccessKeyCredentialPolicy
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(communicationAccessKeyCredentialPolicy_exports);
|
|
23
|
+
var import_core_util = require("@azure/core-util");
|
|
12
24
|
const communicationAccessKeyCredentialPolicy = "CommunicationAccessKeyCredentialPolicy";
|
|
13
|
-
/**
|
|
14
|
-
* Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.
|
|
15
|
-
* @hidden
|
|
16
|
-
*
|
|
17
|
-
* @param credential - The key credential.
|
|
18
|
-
*/
|
|
19
25
|
function createCommunicationAccessKeyCredentialPolicy(credential) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
26
|
+
return {
|
|
27
|
+
name: communicationAccessKeyCredentialPolicy,
|
|
28
|
+
async sendRequest(request, next) {
|
|
29
|
+
const verb = request.method.toUpperCase();
|
|
30
|
+
const utcNow = (/* @__PURE__ */ new Date()).toUTCString();
|
|
31
|
+
const contentHash = await (0, import_core_util.computeSha256Hash)(request.body?.toString() || "", "base64");
|
|
32
|
+
const dateHeader = "x-ms-date";
|
|
33
|
+
const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;
|
|
34
|
+
const url = new URL(request.url);
|
|
35
|
+
const query = url.searchParams.toString();
|
|
36
|
+
const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;
|
|
37
|
+
const stringToSign = `${verb}
|
|
38
|
+
${urlPathAndQuery}
|
|
39
|
+
${utcNow};${url.host};${contentHash}`;
|
|
40
|
+
const signature = await (0, import_core_util.computeSha256Hmac)(credential.key, stringToSign, "base64");
|
|
41
|
+
request.headers.set("Host", url.host);
|
|
42
|
+
request.headers.set(dateHeader, utcNow);
|
|
43
|
+
request.headers.set("x-ms-content-sha256", contentHash);
|
|
44
|
+
request.headers.set(
|
|
45
|
+
"Authorization",
|
|
46
|
+
`HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`
|
|
47
|
+
);
|
|
48
|
+
return next(request);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
44
51
|
}
|
|
45
|
-
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
createCommunicationAccessKeyCredentialPolicy
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=communicationAccessKeyCredentialPolicy.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport { computeSha256Hash, computeSha256Hmac } from \"@azure/core-util\";\n\n/**\n * CommunicationKeyCredentialPolicy provides a means of signing requests made through\n * the SmsClient.\n */\nconst communicationAccessKeyCredentialPolicy = \"CommunicationAccessKeyCredentialPolicy\";\n\n/**\n * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.\n * @hidden\n *\n * @param credential - The key credential.\n */\nexport function createCommunicationAccessKeyCredentialPolicy(\n credential: KeyCredential,\n): PipelinePolicy {\n return {\n name: communicationAccessKeyCredentialPolicy,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const verb = request.method.toUpperCase();\n const utcNow = new Date().toUTCString();\n const contentHash = await computeSha256Hash(request.body?.toString() || \"\", \"base64\");\n const dateHeader = \"x-ms-date\";\n const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;\n\n const url = new URL(request.url);\n const query = url.searchParams.toString();\n const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;\n\n const stringToSign = `${verb}\\n${urlPathAndQuery}\\n${utcNow};${url.host};${contentHash}`;\n const signature = await computeSha256Hmac(credential.key, stringToSign, \"base64\");\n\n // Host is a forbidden header in browsers (silently ignored), but needed in Node.js\n request.headers.set(\"Host\", url.host);\n request.headers.set(dateHeader, utcNow);\n request.headers.set(\"x-ms-content-sha256\", contentHash);\n request.headers.set(\n \"Authorization\",\n `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`,\n );\n return next(request);\n },\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,uBAAqD;AAMrD,MAAM,yCAAyC;AAQxC,SAAS,6CACd,YACgB;AAChB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,YAAM,OAAO,QAAQ,OAAO,YAAY;AACxC,YAAM,UAAS,oBAAI,KAAK,GAAE,YAAY;AACtC,YAAM,cAAc,UAAM,oCAAkB,QAAQ,MAAM,SAAS,KAAK,IAAI,QAAQ;AACpF,YAAM,aAAa;AACnB,YAAM,gBAAgB,GAAG,UAAU;AAEnC,YAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,YAAM,QAAQ,IAAI,aAAa,SAAS;AACxC,YAAM,kBAAkB,QAAQ,GAAG,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI;AAEjE,YAAM,eAAe,GAAG,IAAI;AAAA,EAAK,eAAe;AAAA,EAAK,MAAM,IAAI,IAAI,IAAI,IAAI,WAAW;AACtF,YAAM,YAAY,UAAM,oCAAkB,WAAW,KAAK,cAAc,QAAQ;AAGhF,cAAQ,QAAQ,IAAI,QAAQ,IAAI,IAAI;AACpC,cAAQ,QAAQ,IAAI,YAAY,MAAM;AACtC,cAAQ,QAAQ,IAAI,uBAAuB,WAAW;AACtD,cAAQ,QAAQ;AAAA,QACd;AAAA,QACA,6BAA6B,aAAa,cAAc,SAAS;AAAA,MACnE;AACA,aAAO,KAAK,OAAO;AAAA,IACrB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var communicationAuthPolicy_exports = {};
|
|
19
|
+
__export(communicationAuthPolicy_exports, {
|
|
20
|
+
createCommunicationAuthPolicy: () => createCommunicationAuthPolicy
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(communicationAuthPolicy_exports);
|
|
23
|
+
var import_core_rest_pipeline = require("@azure/core-rest-pipeline");
|
|
24
|
+
var import_core_auth = require("@azure/core-auth");
|
|
25
|
+
var import_communicationAccessKeyCredentialPolicy = require("./communicationAccessKeyCredentialPolicy.js");
|
|
16
26
|
function createCommunicationAuthPolicy(credential) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
+
if ((0, import_core_auth.isTokenCredential)(credential)) {
|
|
28
|
+
const policyOptions = {
|
|
29
|
+
credential,
|
|
30
|
+
scopes: ["https://communication.azure.com//.default"]
|
|
31
|
+
};
|
|
32
|
+
return (0, import_core_rest_pipeline.bearerTokenAuthenticationPolicy)(policyOptions);
|
|
33
|
+
} else {
|
|
34
|
+
return (0, import_communicationAccessKeyCredentialPolicy.createCommunicationAccessKeyCredentialPolicy)(credential);
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
|
-
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
createCommunicationAuthPolicy
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=communicationAuthPolicy.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/credential/communicationAuthPolicy.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n type BearerTokenAuthenticationPolicyOptions,\n type PipelinePolicy,\n bearerTokenAuthenticationPolicy,\n} from \"@azure/core-rest-pipeline\";\nimport { type KeyCredential, type TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createCommunicationAccessKeyCredentialPolicy } from \"./communicationAccessKeyCredentialPolicy.js\";\n/**\n * Creates a pipeline policy to authenticate request based\n * on the credential passed in.\n * @hidden\n *\n * @param credential - The KeyCredential or TokenCredential.\n */\nexport function createCommunicationAuthPolicy(\n credential: KeyCredential | TokenCredential,\n): PipelinePolicy {\n if (isTokenCredential(credential)) {\n const policyOptions: BearerTokenAuthenticationPolicyOptions = {\n credential: credential,\n scopes: [\"https://communication.azure.com//.default\"],\n };\n return bearerTokenAuthenticationPolicy(policyOptions);\n } else {\n return createCommunicationAccessKeyCredentialPolicy(credential);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAIO;AACP,uBAA4E;AAC5E,oDAA6D;AAQtD,SAAS,8BACd,YACgB;AAChB,UAAI,oCAAkB,UAAU,GAAG;AACjC,UAAM,gBAAwD;AAAA,MAC5D;AAAA,MACA,QAAQ,CAAC,2CAA2C;AAAA,IACtD;AACA,eAAO,2DAAgC,aAAa;AAAA,EACtD,OAAO;AACL,eAAO,4FAA6C,UAAU;AAAA,EAChE;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,33 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var connectionString_exports = {};
|
|
19
|
+
__export(connectionString_exports, {
|
|
20
|
+
parseConnectionString: () => parseConnectionString
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(connectionString_exports);
|
|
23
|
+
var import_core_auth = require("@azure/core-auth");
|
|
8
24
|
const CONNECTION_STRING_REGEX = /endpoint=(.*);accesskey=(.*)/i;
|
|
9
25
|
const tryParseConnectionString = (s) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
const match = s.match(CONNECTION_STRING_REGEX);
|
|
27
|
+
if (match?.[1] && match[2]) {
|
|
28
|
+
return { endpoint: match[1], credential: new import_core_auth.AzureKeyCredential(match[2]) };
|
|
29
|
+
}
|
|
30
|
+
return void 0;
|
|
15
31
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Returns an EndpointCredential to easily access properties of the connection string.
|
|
18
|
-
* @hidden
|
|
19
|
-
*
|
|
20
|
-
* @param connectionString - The connection string to parse
|
|
21
|
-
* @returns Object to access the endpoint and the credentials
|
|
22
|
-
*/
|
|
23
32
|
const parseConnectionString = (connectionString) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
33
|
+
const parsedConnectionString = tryParseConnectionString(connectionString);
|
|
34
|
+
if (parsedConnectionString) {
|
|
35
|
+
return parsedConnectionString;
|
|
36
|
+
} else {
|
|
37
|
+
throw new Error(`Invalid connection string ${connectionString}`);
|
|
38
|
+
}
|
|
31
39
|
};
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
parseConnectionString
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=connectionString.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/credential/connectionString.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureKeyCredential, type KeyCredential } from \"@azure/core-auth\";\n/**\n * Represents different properties of connection string\n * using format \"/endpoint=(.*);accesskey=(.*)\".\n * @hidden\n */\nexport interface EndpointCredential {\n /**\n * The endpoint as string\n */\n endpoint: string;\n /**\n * The access key represented as a KeyCredential object\n */\n credential: KeyCredential;\n}\n\n// TODO: update when connection string format is finalized\nconst CONNECTION_STRING_REGEX = /endpoint=(.*);accesskey=(.*)/i;\n\nconst tryParseConnectionString = (s: string): EndpointCredential | undefined => {\n const match = s.match(CONNECTION_STRING_REGEX);\n if (match?.[1] && match[2]) {\n return { endpoint: match[1], credential: new AzureKeyCredential(match[2]) };\n }\n return undefined;\n};\n/**\n * Returns an EndpointCredential to easily access properties of the connection string.\n * @hidden\n *\n * @param connectionString - The connection string to parse\n * @returns Object to access the endpoint and the credentials\n */\nexport const parseConnectionString = (connectionString: string): EndpointCredential => {\n const parsedConnectionString = tryParseConnectionString(connectionString);\n if (parsedConnectionString) {\n return parsedConnectionString;\n } else {\n throw new Error(`Invalid connection string ${connectionString}`);\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAuD;AAkBvD,MAAM,0BAA0B;AAEhC,MAAM,2BAA2B,CAAC,MAA8C;AAC9E,QAAM,QAAQ,EAAE,MAAM,uBAAuB;AAC7C,MAAI,QAAQ,CAAC,KAAK,MAAM,CAAC,GAAG;AAC1B,WAAO,EAAE,UAAU,MAAM,CAAC,GAAG,YAAY,IAAI,oCAAmB,MAAM,CAAC,CAAC,EAAE;AAAA,EAC5E;AACA,SAAO;AACT;AAQO,MAAM,wBAAwB,CAAC,qBAAiD;AACrF,QAAM,yBAAyB,yBAAyB,gBAAgB;AACxE,MAAI,wBAAwB;AAC1B,WAAO;AAAA,EACT,OAAO;AACL,UAAM,IAAI,MAAM,6BAA6B,gBAAgB,EAAE;AAAA,EACjE;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var credential_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(credential_exports);
|
|
17
|
+
__reExport(credential_exports, require("./communicationAccessKeyCredentialPolicy.js"), module.exports);
|
|
18
|
+
__reExport(credential_exports, require("./communicationAuthPolicy.js"), module.exports);
|
|
19
|
+
__reExport(credential_exports, require("./clientArguments.js"), module.exports);
|
|
20
|
+
__reExport(credential_exports, require("./connectionString.js"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./communicationAccessKeyCredentialPolicy.js"),
|
|
24
|
+
...require("./communicationAuthPolicy.js"),
|
|
25
|
+
...require("./clientArguments.js"),
|
|
26
|
+
...require("./connectionString.js")
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/credential/index.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./communicationAccessKeyCredentialPolicy.js\";\nexport * from \"./communicationAuthPolicy.js\";\nexport * from \"./clientArguments.js\";\nexport * from \"./connectionString.js\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAGA,+BAAc,wDAHd;AAIA,+BAAc,yCAJd;AAKA,+BAAc,iCALd;AAMA,+BAAc,kCANd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entraTokenCredential.d.ts","sourceRoot":"","sources":["../../src/entraTokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,IAAI,kBAAkB,EAC1C,KAAK,4BAA4B,EAClC,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"entraTokenCredential.d.ts","sourceRoot":"","sources":["../../src/entraTokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,IAAI,kBAAkB,EAC1C,KAAK,4BAA4B,EAClC,MAAM,mCAAmC,CAAC;AAwB3C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACvD;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB;IASjD,OAAO,CAAC,OAAO;IAR3B,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAGZ;IACF,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAa;gBAEX,OAAO,EAAE,wCAAwC;IAYxD,QAAQ,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,WAAW,CAAC;YAoBrE,gBAAgB;IAmCvB,OAAO,IAAI,IAAI;YAOR,kBAAkB;IA8BhC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,8BAA8B;CAmBvC"}
|