@azure/service-bus 7.10.0-alpha.20251028.1 → 7.10.0-alpha.20251030.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/util/crypto-browser.d.mts.map +1 -1
- package/dist/browser/util/crypto-browser.mjs.map +1 -1
- package/dist/browser/util/crypto.common.d.ts +5 -0
- package/dist/browser/util/crypto.common.d.ts.map +1 -0
- package/dist/browser/util/crypto.common.js +39 -0
- package/dist/browser/util/crypto.common.js.map +1 -0
- package/dist/browser/util/crypto.d.ts +1 -4
- package/dist/browser/util/crypto.js +1 -36
- package/dist/commonjs/util/crypto.common.d.ts +5 -0
- package/dist/commonjs/util/crypto.common.d.ts.map +1 -0
- package/dist/commonjs/util/crypto.common.js +42 -0
- package/dist/commonjs/util/crypto.common.js.map +1 -0
- package/dist/esm/util/crypto.common.d.ts +5 -0
- package/dist/esm/util/crypto.common.d.ts.map +1 -0
- package/dist/esm/util/crypto.common.js +39 -0
- package/dist/esm/util/crypto.common.js.map +1 -0
- package/dist/react-native/util/crypto-react-native.d.mts.map +1 -0
- package/dist/react-native/util/crypto-react-native.mjs.map +1 -0
- package/dist/react-native/util/crypto.common.d.ts +5 -0
- package/dist/react-native/util/crypto.common.d.ts.map +1 -0
- package/dist/react-native/util/crypto.common.js +39 -0
- package/dist/react-native/util/crypto.common.js.map +1 -0
- package/dist/react-native/util/crypto.d.ts +2 -5
- package/dist/react-native/util/crypto.js +2 -9
- package/package.json +9 -9
- package/dist/react-native/util/crypto.d.ts.map +0 -1
- package/dist/react-native/util/crypto.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-browser.d.mts","sourceRoot":"","sources":["../../../src/util/crypto-browser.mts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"crypto-browser.d.mts","sourceRoot":"","sources":["../../../src/util/crypto-browser.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-browser.mjs","sourceRoot":"","sources":["../../../src/util/crypto-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC
|
|
1
|
+
{"version":3,"file":"crypto-browser.mjs","sourceRoot":"","sources":["../../../src/util/crypto-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { generateKey } from \"./crypto.common.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.d.ts","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBvF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export async function generateKey(secret, stringToSign) {
|
|
7
|
+
const key = await globalThis.crypto.subtle.importKey("raw", convertToUint8Array(secret), {
|
|
8
|
+
name: "HMAC",
|
|
9
|
+
hash: { name: "SHA-256" },
|
|
10
|
+
}, false, ["sign"]);
|
|
11
|
+
const signature = await globalThis.crypto.subtle.sign("HMAC", key, convertToUint8Array(stringToSign));
|
|
12
|
+
const base64encodedString = encodeByteArray(new Uint8Array(signature));
|
|
13
|
+
const result = encodeURIComponent(base64encodedString);
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function convertToUint8Array(value) {
|
|
20
|
+
const arr = new Uint8Array(value.length);
|
|
21
|
+
for (let i = 0; i < value.length; i++) {
|
|
22
|
+
arr[i] = value.charCodeAt(i);
|
|
23
|
+
}
|
|
24
|
+
return arr;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Encodes a byte array in base64 format.
|
|
28
|
+
* @param value - the Uint8Array to encode
|
|
29
|
+
* @internal
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
function encodeByteArray(value) {
|
|
33
|
+
let str = "";
|
|
34
|
+
for (let i = 0; i < value.length; i++) {
|
|
35
|
+
str += String.fromCharCode(value[i]);
|
|
36
|
+
}
|
|
37
|
+
return btoa(str);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=crypto.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.js","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,YAAoB;IACpE,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAClD,KAAK,EACL,mBAAmB,CAAC,MAAM,CAAC,EAC3B;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACnD,MAAM,EACN,GAAG,EACH,mBAAmB,CAAC,YAAY,CAAC,CAClC,CAAC;IACF,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACxC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,KAAiB;IACxC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n */\nexport async function generateKey(secret: string, stringToSign: string): Promise<string> {\n const key = await globalThis.crypto.subtle.importKey(\n \"raw\",\n convertToUint8Array(secret),\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\"],\n );\n\n const signature = await globalThis.crypto.subtle.sign(\n \"HMAC\",\n key,\n convertToUint8Array(stringToSign),\n );\n const base64encodedString = encodeByteArray(new Uint8Array(signature));\n const result = encodeURIComponent(base64encodedString);\n return result;\n}\n\n/**\n * @internal\n */\nfunction convertToUint8Array(value: string): Uint8Array<ArrayBuffer> {\n const arr = new Uint8Array(value.length);\n for (let i = 0; i < value.length; i++) {\n arr[i] = value.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - the Uint8Array to encode\n * @internal\n *\n */\nfunction encodeByteArray(value: Uint8Array): string {\n let str = \"\";\n for (let i = 0; i < value.length; i++) {\n str += String.fromCharCode(value[i]);\n }\n return btoa(str);\n}\n"]}
|
|
@@ -1,39 +1,4 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export async function generateKey(secret, stringToSign) {
|
|
7
|
-
const key = await self.crypto.subtle.importKey("raw", convertToUint8Array(secret), {
|
|
8
|
-
name: "HMAC",
|
|
9
|
-
hash: { name: "SHA-256" },
|
|
10
|
-
}, false, ["sign"]);
|
|
11
|
-
const signature = await self.crypto.subtle.sign("HMAC", key, convertToUint8Array(stringToSign));
|
|
12
|
-
const base64encodedString = encodeByteArray(new Uint8Array(signature));
|
|
13
|
-
const result = encodeURIComponent(base64encodedString);
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
function convertToUint8Array(value) {
|
|
20
|
-
const arr = new Uint8Array(value.length);
|
|
21
|
-
for (let i = 0; i < value.length; i++) {
|
|
22
|
-
arr[i] = value.charCodeAt(i);
|
|
23
|
-
}
|
|
24
|
-
return arr;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Encodes a byte array in base64 format.
|
|
28
|
-
* @param value - the Uint8Array to encode
|
|
29
|
-
* @internal
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
function encodeByteArray(value) {
|
|
33
|
-
let str = "";
|
|
34
|
-
for (let i = 0; i < value.length; i++) {
|
|
35
|
-
str += String.fromCharCode(value[i]);
|
|
36
|
-
}
|
|
37
|
-
return btoa(str);
|
|
38
|
-
}
|
|
3
|
+
export { generateKey } from "./crypto.common.js";
|
|
39
4
|
//# sourceMappingURL=crypto-browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.d.ts","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBvF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.generateKey = generateKey;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
async function generateKey(secret, stringToSign) {
|
|
10
|
+
const key = await globalThis.crypto.subtle.importKey("raw", convertToUint8Array(secret), {
|
|
11
|
+
name: "HMAC",
|
|
12
|
+
hash: { name: "SHA-256" },
|
|
13
|
+
}, false, ["sign"]);
|
|
14
|
+
const signature = await globalThis.crypto.subtle.sign("HMAC", key, convertToUint8Array(stringToSign));
|
|
15
|
+
const base64encodedString = encodeByteArray(new Uint8Array(signature));
|
|
16
|
+
const result = encodeURIComponent(base64encodedString);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
function convertToUint8Array(value) {
|
|
23
|
+
const arr = new Uint8Array(value.length);
|
|
24
|
+
for (let i = 0; i < value.length; i++) {
|
|
25
|
+
arr[i] = value.charCodeAt(i);
|
|
26
|
+
}
|
|
27
|
+
return arr;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Encodes a byte array in base64 format.
|
|
31
|
+
* @param value - the Uint8Array to encode
|
|
32
|
+
* @internal
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
function encodeByteArray(value) {
|
|
36
|
+
let str = "";
|
|
37
|
+
for (let i = 0; i < value.length; i++) {
|
|
38
|
+
str += String.fromCharCode(value[i]);
|
|
39
|
+
}
|
|
40
|
+
return btoa(str);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=crypto.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.js","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAKlC,kCAoBC;AAvBD;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,YAAoB;IACpE,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAClD,KAAK,EACL,mBAAmB,CAAC,MAAM,CAAC,EAC3B;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACnD,MAAM,EACN,GAAG,EACH,mBAAmB,CAAC,YAAY,CAAC,CAClC,CAAC;IACF,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACxC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,KAAiB;IACxC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n */\nexport async function generateKey(secret: string, stringToSign: string): Promise<string> {\n const key = await globalThis.crypto.subtle.importKey(\n \"raw\",\n convertToUint8Array(secret),\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\"],\n );\n\n const signature = await globalThis.crypto.subtle.sign(\n \"HMAC\",\n key,\n convertToUint8Array(stringToSign),\n );\n const base64encodedString = encodeByteArray(new Uint8Array(signature));\n const result = encodeURIComponent(base64encodedString);\n return result;\n}\n\n/**\n * @internal\n */\nfunction convertToUint8Array(value: string): Uint8Array<ArrayBuffer> {\n const arr = new Uint8Array(value.length);\n for (let i = 0; i < value.length; i++) {\n arr[i] = value.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - the Uint8Array to encode\n * @internal\n *\n */\nfunction encodeByteArray(value: Uint8Array): string {\n let str = \"\";\n for (let i = 0; i < value.length; i++) {\n str += String.fromCharCode(value[i]);\n }\n return btoa(str);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.d.ts","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBvF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export async function generateKey(secret, stringToSign) {
|
|
7
|
+
const key = await globalThis.crypto.subtle.importKey("raw", convertToUint8Array(secret), {
|
|
8
|
+
name: "HMAC",
|
|
9
|
+
hash: { name: "SHA-256" },
|
|
10
|
+
}, false, ["sign"]);
|
|
11
|
+
const signature = await globalThis.crypto.subtle.sign("HMAC", key, convertToUint8Array(stringToSign));
|
|
12
|
+
const base64encodedString = encodeByteArray(new Uint8Array(signature));
|
|
13
|
+
const result = encodeURIComponent(base64encodedString);
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function convertToUint8Array(value) {
|
|
20
|
+
const arr = new Uint8Array(value.length);
|
|
21
|
+
for (let i = 0; i < value.length; i++) {
|
|
22
|
+
arr[i] = value.charCodeAt(i);
|
|
23
|
+
}
|
|
24
|
+
return arr;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Encodes a byte array in base64 format.
|
|
28
|
+
* @param value - the Uint8Array to encode
|
|
29
|
+
* @internal
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
function encodeByteArray(value) {
|
|
33
|
+
let str = "";
|
|
34
|
+
for (let i = 0; i < value.length; i++) {
|
|
35
|
+
str += String.fromCharCode(value[i]);
|
|
36
|
+
}
|
|
37
|
+
return btoa(str);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=crypto.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.js","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,YAAoB;IACpE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// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n */\nexport async function generateKey(secret: string, stringToSign: string): Promise<string> {\n const key = await globalThis.crypto.subtle.importKey(\n \"raw\",\n convertToUint8Array(secret),\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\"],\n );\n\n const signature = await globalThis.crypto.subtle.sign(\n \"HMAC\",\n key,\n convertToUint8Array(stringToSign),\n );\n const base64encodedString = encodeByteArray(new Uint8Array(signature));\n const result = encodeURIComponent(base64encodedString);\n return result;\n}\n\n/**\n * @internal\n */\nfunction convertToUint8Array(value: string): Uint8Array<ArrayBuffer> {\n const arr = new Uint8Array(value.length);\n for (let i = 0; i < value.length; i++) {\n arr[i] = value.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - the Uint8Array to encode\n * @internal\n *\n */\nfunction encodeByteArray(value: Uint8Array): string {\n let str = \"\";\n for (let i = 0; i < value.length; i++) {\n str += String.fromCharCode(value[i]);\n }\n return btoa(str);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-react-native.d.mts","sourceRoot":"","sources":["../../../src/util/crypto-react-native.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-react-native.mjs","sourceRoot":"","sources":["../../../src/util/crypto-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { generateKey } from \"./crypto.common.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.d.ts","sourceRoot":"","sources":["../../../src/util/crypto.common.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBvF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export async function generateKey(secret, stringToSign) {
|
|
7
|
+
const key = await globalThis.crypto.subtle.importKey("raw", convertToUint8Array(secret), {
|
|
8
|
+
name: "HMAC",
|
|
9
|
+
hash: { name: "SHA-256" },
|
|
10
|
+
}, false, ["sign"]);
|
|
11
|
+
const signature = await globalThis.crypto.subtle.sign("HMAC", key, convertToUint8Array(stringToSign));
|
|
12
|
+
const base64encodedString = encodeByteArray(new Uint8Array(signature));
|
|
13
|
+
const result = encodeURIComponent(base64encodedString);
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function convertToUint8Array(value) {
|
|
20
|
+
const arr = new Uint8Array(value.length);
|
|
21
|
+
for (let i = 0; i < value.length; i++) {
|
|
22
|
+
arr[i] = value.charCodeAt(i);
|
|
23
|
+
}
|
|
24
|
+
return arr;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Encodes a byte array in base64 format.
|
|
28
|
+
* @param value - the Uint8Array to encode
|
|
29
|
+
* @internal
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
function encodeByteArray(value) {
|
|
33
|
+
let str = "";
|
|
34
|
+
for (let i = 0; i < value.length; i++) {
|
|
35
|
+
str += String.fromCharCode(value[i]);
|
|
36
|
+
}
|
|
37
|
+
return btoa(str);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=crypto.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.common.js","sourceRoot":"","sources":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,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n */\nexport async function generateKey(secret: string, stringToSign: string): Promise<string> {\n const key = await globalThis.crypto.subtle.importKey(\n \"raw\",\n convertToUint8Array(secret),\n {\n name: \"HMAC\",\n hash: { name: \"SHA-256\" },\n },\n false,\n [\"sign\"],\n );\n\n const signature = await globalThis.crypto.subtle.sign(\n \"HMAC\",\n key,\n convertToUint8Array(stringToSign),\n );\n const base64encodedString = encodeByteArray(new Uint8Array(signature));\n const result = encodeURIComponent(base64encodedString);\n return result;\n}\n\n/**\n * @internal\n */\nfunction convertToUint8Array(value: string): Uint8Array<ArrayBuffer> {\n const arr = new Uint8Array(value.length);\n for (let i = 0; i < value.length; i++) {\n arr[i] = value.charCodeAt(i);\n }\n return arr;\n}\n\n/**\n * Encodes a byte array in base64 format.\n * @param value - the Uint8Array to encode\n * @internal\n *\n */\nfunction encodeByteArray(value: Uint8Array): string {\n let str = \"\";\n for (let i = 0; i < value.length; i++) {\n str += String.fromCharCode(value[i]);\n }\n return btoa(str);\n}\n"]}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export async function generateKey(secret, stringToSign) {
|
|
8
|
-
const result = encodeURIComponent(crypto.createHmac("sha256", secret).update(stringToSign).digest("base64"));
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=crypto.js.map
|
|
3
|
+
export { generateKey } from "./crypto.common.js";
|
|
4
|
+
//# sourceMappingURL=crypto-react-native.mjs.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure/service-bus",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "7.10.0-alpha.
|
|
5
|
+
"version": "7.10.0-alpha.20251030.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "Azure Service Bus SDK for JavaScript",
|
|
8
8
|
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus/",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@azure/abort-controller": ">=2.1.3-alpha <2.1.3-alphb",
|
|
64
|
-
"@azure/core-amqp": ">=4.4.
|
|
65
|
-
"@azure/core-auth": ">=1.10.
|
|
66
|
-
"@azure/core-client": ">=1.10.
|
|
64
|
+
"@azure/core-amqp": ">=4.4.2-alpha <4.4.2-alphb",
|
|
65
|
+
"@azure/core-auth": ">=1.10.2-alpha <1.10.2-alphb",
|
|
66
|
+
"@azure/core-client": ">=1.10.2-alpha <1.10.2-alphb",
|
|
67
67
|
"@azure/core-paging": ">=1.6.3-alpha <1.6.3-alphb",
|
|
68
|
-
"@azure/core-rest-pipeline": ">=1.22.
|
|
69
|
-
"@azure/core-tracing": ">=1.3.
|
|
70
|
-
"@azure/core-util": ">=1.13.
|
|
68
|
+
"@azure/core-rest-pipeline": ">=1.22.2-alpha <1.22.2-alphb",
|
|
69
|
+
"@azure/core-tracing": ">=1.3.2-alpha <1.3.2-alphb",
|
|
70
|
+
"@azure/core-util": ">=1.13.2-alpha <1.13.2-alphb",
|
|
71
71
|
"@azure/core-xml": ">=1.5.1-alpha <1.5.1-alphb",
|
|
72
72
|
"@azure/logger": ">=1.3.1-alpha <1.3.1-alphb",
|
|
73
73
|
"buffer": "^6.0.3",
|
|
@@ -109,9 +109,9 @@
|
|
|
109
109
|
"ws": "^8.0.0",
|
|
110
110
|
"@azure-tools/test-credential": "^2.1.2",
|
|
111
111
|
"@azure-tools/test-recorder": "^4.1.1",
|
|
112
|
-
"@azure/dev-tool": "^1.0.0",
|
|
113
112
|
"@azure-tools/test-utils-vitest": "^2.0.1",
|
|
114
|
-
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
|
|
113
|
+
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
114
|
+
"@azure/dev-tool": "^1.0.0"
|
|
115
115
|
},
|
|
116
116
|
"type": "module",
|
|
117
117
|
"tshy": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/util/crypto.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKvF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/util/crypto.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,YAAoB;IACpE,MAAM,MAAM,GAAG,kBAAkB,CAC/B,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAC1E,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport crypto from \"node:crypto\";\n\n/**\n * @internal\n */\nexport async function generateKey(secret: string, stringToSign: string): Promise<string> {\n const result = encodeURIComponent(\n crypto.createHmac(\"sha256\", secret).update(stringToSign).digest(\"base64\"),\n );\n return result;\n}\n"]}
|