@serviceme/devtools-shared 0.4.11 → 0.4.12
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/index.js +109 -2
- package/dist/index.mjs +108 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1619,8 +1619,115 @@ var CERTIFICATE_BUNDLE_FORMATS = [
|
|
|
1619
1619
|
}
|
|
1620
1620
|
];
|
|
1621
1621
|
|
|
1622
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1623
|
+
var import_crypto = require("crypto");
|
|
1624
|
+
|
|
1625
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/shared.mjs
|
|
1626
|
+
var INPUT_ERROR = "input is invalid type";
|
|
1627
|
+
var FINALIZE_ERROR = "finalize already called";
|
|
1628
|
+
var ARRAY_BUFFER = typeof ArrayBuffer !== "undefined";
|
|
1629
|
+
var formatMessage = function(message) {
|
|
1630
|
+
var type = typeof message;
|
|
1631
|
+
if (type === "string") {
|
|
1632
|
+
return [message, true];
|
|
1633
|
+
}
|
|
1634
|
+
if (Array.isArray(message)) {
|
|
1635
|
+
return [message, false];
|
|
1636
|
+
}
|
|
1637
|
+
if (ARRAY_BUFFER && message) {
|
|
1638
|
+
if (message.constructor === ArrayBuffer) {
|
|
1639
|
+
return [new Uint8Array(message), false];
|
|
1640
|
+
} else if (ArrayBuffer.isView(message)) {
|
|
1641
|
+
return [message, false];
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
throw new Error(INPUT_ERROR);
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1648
|
+
function toNodeInput(message) {
|
|
1649
|
+
const [msg, isString] = formatMessage(message);
|
|
1650
|
+
return isString ? Buffer.from(msg, "utf8") : Buffer.from(msg);
|
|
1651
|
+
}
|
|
1652
|
+
var NodeHasher = class {
|
|
1653
|
+
constructor(hash) {
|
|
1654
|
+
this.hash = hash;
|
|
1655
|
+
this.result = void 0;
|
|
1656
|
+
}
|
|
1657
|
+
update(message) {
|
|
1658
|
+
if (this.result) {
|
|
1659
|
+
throw new Error(FINALIZE_ERROR);
|
|
1660
|
+
}
|
|
1661
|
+
this.hash.update(toNodeInput(message));
|
|
1662
|
+
return this;
|
|
1663
|
+
}
|
|
1664
|
+
finalize() {
|
|
1665
|
+
if (!this.result) {
|
|
1666
|
+
this.result = this.hash.digest();
|
|
1667
|
+
this.hash = void 0;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
hex() {
|
|
1671
|
+
this.finalize();
|
|
1672
|
+
return this.result.toString("hex");
|
|
1673
|
+
}
|
|
1674
|
+
toString() {
|
|
1675
|
+
return this.hex();
|
|
1676
|
+
}
|
|
1677
|
+
array() {
|
|
1678
|
+
this.finalize();
|
|
1679
|
+
return Array.from(this.result);
|
|
1680
|
+
}
|
|
1681
|
+
digest() {
|
|
1682
|
+
return this.array();
|
|
1683
|
+
}
|
|
1684
|
+
arrayBuffer() {
|
|
1685
|
+
return Uint8Array.from(this.array()).buffer;
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
function addOutputMethods(method, createHasher) {
|
|
1689
|
+
method.hex = method;
|
|
1690
|
+
method.array = function(...args) {
|
|
1691
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).array();
|
|
1692
|
+
};
|
|
1693
|
+
method.digest = method.array;
|
|
1694
|
+
method.arrayBuffer = function(...args) {
|
|
1695
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).arrayBuffer();
|
|
1696
|
+
};
|
|
1697
|
+
return method;
|
|
1698
|
+
}
|
|
1699
|
+
function createNodeMethod(algorithm) {
|
|
1700
|
+
const createHasher = () => new NodeHasher((0, import_crypto.createHash)(algorithm));
|
|
1701
|
+
const method = function(message) {
|
|
1702
|
+
return createHasher().update(message).hex();
|
|
1703
|
+
};
|
|
1704
|
+
addOutputMethods(method, createHasher);
|
|
1705
|
+
method.create = createHasher;
|
|
1706
|
+
method.update = function(message) {
|
|
1707
|
+
return method.create().update(message);
|
|
1708
|
+
};
|
|
1709
|
+
return method;
|
|
1710
|
+
}
|
|
1711
|
+
function createNodeHmacMethod(algorithm) {
|
|
1712
|
+
const createHasher = (key) => new NodeHasher((0, import_crypto.createHmac)(algorithm, toNodeInput(key)));
|
|
1713
|
+
const method = function(key, message) {
|
|
1714
|
+
return createHasher(key).update(message).hex();
|
|
1715
|
+
};
|
|
1716
|
+
addOutputMethods(method, createHasher);
|
|
1717
|
+
method.create = createHasher;
|
|
1718
|
+
method.update = function(key, message) {
|
|
1719
|
+
return method.create(key).update(message);
|
|
1720
|
+
};
|
|
1721
|
+
return method;
|
|
1722
|
+
}
|
|
1723
|
+
var sha256 = createNodeMethod("sha256");
|
|
1724
|
+
var sha224 = createNodeMethod("sha224");
|
|
1725
|
+
sha256.sha256 = sha256;
|
|
1726
|
+
sha256.sha224 = sha224;
|
|
1727
|
+
sha256.hmac = createNodeHmacMethod("sha256");
|
|
1728
|
+
sha224.hmac = createNodeHmacMethod("sha224");
|
|
1729
|
+
|
|
1622
1730
|
// src/device-auth.ts
|
|
1623
|
-
var import_js_sha256 = require("js-sha256");
|
|
1624
1731
|
var DeviceAuthHeaders = {
|
|
1625
1732
|
deviceId: "x-ms-device-id",
|
|
1626
1733
|
deviceSecret: "x-ms-device-secret",
|
|
@@ -1636,7 +1743,7 @@ function createDeviceRequestSignature(params) {
|
|
|
1636
1743
|
params.body,
|
|
1637
1744
|
params.secret
|
|
1638
1745
|
].join("\n");
|
|
1639
|
-
return
|
|
1746
|
+
return sha256(basis);
|
|
1640
1747
|
}
|
|
1641
1748
|
|
|
1642
1749
|
// src/git-utils.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1540,8 +1540,115 @@ var CERTIFICATE_BUNDLE_FORMATS = [
|
|
|
1540
1540
|
}
|
|
1541
1541
|
];
|
|
1542
1542
|
|
|
1543
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1544
|
+
import { createHash, createHmac } from "crypto";
|
|
1545
|
+
|
|
1546
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/shared.mjs
|
|
1547
|
+
var INPUT_ERROR = "input is invalid type";
|
|
1548
|
+
var FINALIZE_ERROR = "finalize already called";
|
|
1549
|
+
var ARRAY_BUFFER = typeof ArrayBuffer !== "undefined";
|
|
1550
|
+
var formatMessage = function(message) {
|
|
1551
|
+
var type = typeof message;
|
|
1552
|
+
if (type === "string") {
|
|
1553
|
+
return [message, true];
|
|
1554
|
+
}
|
|
1555
|
+
if (Array.isArray(message)) {
|
|
1556
|
+
return [message, false];
|
|
1557
|
+
}
|
|
1558
|
+
if (ARRAY_BUFFER && message) {
|
|
1559
|
+
if (message.constructor === ArrayBuffer) {
|
|
1560
|
+
return [new Uint8Array(message), false];
|
|
1561
|
+
} else if (ArrayBuffer.isView(message)) {
|
|
1562
|
+
return [message, false];
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
throw new Error(INPUT_ERROR);
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
// ../../node_modules/.pnpm/js-sha256@1.0.0/node_modules/js-sha256/src/node.mjs
|
|
1569
|
+
function toNodeInput(message) {
|
|
1570
|
+
const [msg, isString] = formatMessage(message);
|
|
1571
|
+
return isString ? Buffer.from(msg, "utf8") : Buffer.from(msg);
|
|
1572
|
+
}
|
|
1573
|
+
var NodeHasher = class {
|
|
1574
|
+
constructor(hash) {
|
|
1575
|
+
this.hash = hash;
|
|
1576
|
+
this.result = void 0;
|
|
1577
|
+
}
|
|
1578
|
+
update(message) {
|
|
1579
|
+
if (this.result) {
|
|
1580
|
+
throw new Error(FINALIZE_ERROR);
|
|
1581
|
+
}
|
|
1582
|
+
this.hash.update(toNodeInput(message));
|
|
1583
|
+
return this;
|
|
1584
|
+
}
|
|
1585
|
+
finalize() {
|
|
1586
|
+
if (!this.result) {
|
|
1587
|
+
this.result = this.hash.digest();
|
|
1588
|
+
this.hash = void 0;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
hex() {
|
|
1592
|
+
this.finalize();
|
|
1593
|
+
return this.result.toString("hex");
|
|
1594
|
+
}
|
|
1595
|
+
toString() {
|
|
1596
|
+
return this.hex();
|
|
1597
|
+
}
|
|
1598
|
+
array() {
|
|
1599
|
+
this.finalize();
|
|
1600
|
+
return Array.from(this.result);
|
|
1601
|
+
}
|
|
1602
|
+
digest() {
|
|
1603
|
+
return this.array();
|
|
1604
|
+
}
|
|
1605
|
+
arrayBuffer() {
|
|
1606
|
+
return Uint8Array.from(this.array()).buffer;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
function addOutputMethods(method, createHasher) {
|
|
1610
|
+
method.hex = method;
|
|
1611
|
+
method.array = function(...args) {
|
|
1612
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).array();
|
|
1613
|
+
};
|
|
1614
|
+
method.digest = method.array;
|
|
1615
|
+
method.arrayBuffer = function(...args) {
|
|
1616
|
+
return createHasher(...args.slice(0, -1)).update(args[args.length - 1]).arrayBuffer();
|
|
1617
|
+
};
|
|
1618
|
+
return method;
|
|
1619
|
+
}
|
|
1620
|
+
function createNodeMethod(algorithm) {
|
|
1621
|
+
const createHasher = () => new NodeHasher(createHash(algorithm));
|
|
1622
|
+
const method = function(message) {
|
|
1623
|
+
return createHasher().update(message).hex();
|
|
1624
|
+
};
|
|
1625
|
+
addOutputMethods(method, createHasher);
|
|
1626
|
+
method.create = createHasher;
|
|
1627
|
+
method.update = function(message) {
|
|
1628
|
+
return method.create().update(message);
|
|
1629
|
+
};
|
|
1630
|
+
return method;
|
|
1631
|
+
}
|
|
1632
|
+
function createNodeHmacMethod(algorithm) {
|
|
1633
|
+
const createHasher = (key) => new NodeHasher(createHmac(algorithm, toNodeInput(key)));
|
|
1634
|
+
const method = function(key, message) {
|
|
1635
|
+
return createHasher(key).update(message).hex();
|
|
1636
|
+
};
|
|
1637
|
+
addOutputMethods(method, createHasher);
|
|
1638
|
+
method.create = createHasher;
|
|
1639
|
+
method.update = function(key, message) {
|
|
1640
|
+
return method.create(key).update(message);
|
|
1641
|
+
};
|
|
1642
|
+
return method;
|
|
1643
|
+
}
|
|
1644
|
+
var sha256 = createNodeMethod("sha256");
|
|
1645
|
+
var sha224 = createNodeMethod("sha224");
|
|
1646
|
+
sha256.sha256 = sha256;
|
|
1647
|
+
sha256.sha224 = sha224;
|
|
1648
|
+
sha256.hmac = createNodeHmacMethod("sha256");
|
|
1649
|
+
sha224.hmac = createNodeHmacMethod("sha224");
|
|
1650
|
+
|
|
1543
1651
|
// src/device-auth.ts
|
|
1544
|
-
import { sha256 } from "js-sha256";
|
|
1545
1652
|
var DeviceAuthHeaders = {
|
|
1546
1653
|
deviceId: "x-ms-device-id",
|
|
1547
1654
|
deviceSecret: "x-ms-device-secret",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serviceme/devtools-shared",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "Shared webview↔extension message contracts and cross-package data models used by SERVICEME.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"repository": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"lint": "biome check src test",
|
|
47
47
|
"format": "biome check --write src test",
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
|
-
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
50
|
-
"release:check": "pnpm run test && npm pack --dry-run",
|
|
49
|
+
"test": "pnpm run build && node scripts/check-bundle-deps.mjs && node --test test/*.test.mjs",
|
|
50
|
+
"release:check": "pnpm run test && node scripts/check-bundle-deps.mjs && npm pack --dry-run",
|
|
51
51
|
"pack": "npm pack",
|
|
52
52
|
"publish:npm": "pnpm publish --access public --no-git-checks"
|
|
53
53
|
}
|