matterbridge 3.3.3-dev-20251017-2e6040a → 3.3.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/CHANGELOG.md +1 -1
- package/dist/broadcastServer.d.ts +105 -0
- package/dist/broadcastServer.d.ts.map +1 -0
- package/dist/broadcastServer.js +86 -1
- package/dist/broadcastServer.js.map +1 -0
- package/dist/broadcastServerTypes.d.ts +719 -0
- package/dist/broadcastServerTypes.d.ts.map +1 -0
- package/dist/broadcastServerTypes.js +24 -0
- package/dist/broadcastServerTypes.js.map +1 -0
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +135 -5
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +50 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +37 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/cliHistory.d.ts +74 -0
- package/dist/cliHistory.d.ts.map +1 -0
- package/dist/cliHistory.js +44 -0
- package/dist/cliHistory.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +2 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +28 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +24 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +117 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +124 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/airConditioner.d.ts +98 -0
- package/dist/devices/airConditioner.d.ts.map +1 -0
- package/dist/devices/airConditioner.js +57 -0
- package/dist/devices/airConditioner.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +48 -1
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/cooktop.d.ts +60 -0
- package/dist/devices/cooktop.d.ts.map +1 -0
- package/dist/devices/cooktop.js +55 -0
- package/dist/devices/cooktop.js.map +1 -0
- package/dist/devices/dishwasher.d.ts +71 -0
- package/dist/devices/dishwasher.d.ts.map +1 -0
- package/dist/devices/dishwasher.js +57 -0
- package/dist/devices/dishwasher.js.map +1 -0
- package/dist/devices/evse.d.ts +75 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +74 -10
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +17 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +5 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/extractorHood.d.ts +46 -0
- package/dist/devices/extractorHood.d.ts.map +1 -0
- package/dist/devices/extractorHood.js +42 -0
- package/dist/devices/extractorHood.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +50 -2
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +67 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +62 -3
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +81 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +70 -4
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/microwaveOven.d.ts +168 -0
- package/dist/devices/microwaveOven.d.ts.map +1 -0
- package/dist/devices/microwaveOven.js +88 -5
- package/dist/devices/microwaveOven.js.map +1 -0
- package/dist/devices/oven.d.ts +105 -0
- package/dist/devices/oven.d.ts.map +1 -0
- package/dist/devices/oven.js +85 -0
- package/dist/devices/oven.js.map +1 -0
- package/dist/devices/refrigerator.d.ts +118 -0
- package/dist/devices/refrigerator.d.ts.map +1 -0
- package/dist/devices/refrigerator.js +102 -0
- package/dist/devices/refrigerator.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +100 -9
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +38 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/speaker.d.ts +87 -0
- package/dist/devices/speaker.d.ts.map +1 -0
- package/dist/devices/speaker.js +84 -0
- package/dist/devices/speaker.js.map +1 -0
- package/dist/devices/temperatureControl.d.ts +166 -0
- package/dist/devices/temperatureControl.d.ts.map +1 -0
- package/dist/devices/temperatureControl.js +25 -3
- package/dist/devices/temperatureControl.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +82 -2
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/dgram/coap.d.ts +205 -0
- package/dist/dgram/coap.d.ts.map +1 -0
- package/dist/dgram/coap.js +126 -13
- package/dist/dgram/coap.js.map +1 -0
- package/dist/dgram/dgram.d.ts +141 -0
- package/dist/dgram/dgram.d.ts.map +1 -0
- package/dist/dgram/dgram.js +114 -2
- package/dist/dgram/dgram.js.map +1 -0
- package/dist/dgram/mb_coap.d.ts +24 -0
- package/dist/dgram/mb_coap.d.ts.map +1 -0
- package/dist/dgram/mb_coap.js +41 -3
- package/dist/dgram/mb_coap.js.map +1 -0
- package/dist/dgram/mb_mdns.d.ts +24 -0
- package/dist/dgram/mb_mdns.d.ts.map +1 -0
- package/dist/dgram/mb_mdns.js +80 -15
- package/dist/dgram/mb_mdns.js.map +1 -0
- package/dist/dgram/mdns.d.ts +290 -0
- package/dist/dgram/mdns.d.ts.map +1 -0
- package/dist/dgram/mdns.js +299 -137
- package/dist/dgram/mdns.js.map +1 -0
- package/dist/dgram/multicast.d.ts +67 -0
- package/dist/dgram/multicast.d.ts.map +1 -0
- package/dist/dgram/multicast.js +62 -1
- package/dist/dgram/multicast.js.map +1 -0
- package/dist/dgram/unicast.d.ts +56 -0
- package/dist/dgram/unicast.d.ts.map +1 -0
- package/dist/dgram/unicast.js +54 -0
- package/dist/dgram/unicast.js.map +1 -0
- package/dist/frontend.d.ts +235 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +415 -29
- package/dist/frontend.js.map +1 -0
- package/dist/frontendTypes.d.ts +529 -0
- package/dist/frontendTypes.d.ts.map +1 -0
- package/dist/frontendTypes.js +45 -0
- package/dist/frontendTypes.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +53 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +3 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +469 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +795 -45
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +36 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +2399 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +71 -5
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +761 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +630 -17
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +36 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1545 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1412 -58
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +560 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +368 -10
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +402 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +341 -1
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +209 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +26 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +353 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +325 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/shelly.d.ts +174 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +168 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +75 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +69 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +99 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +97 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +59 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +54 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +33 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +38 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +34 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +33 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +39 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +47 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +32 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +39 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +54 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +72 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/error.d.ts +44 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +41 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/export.d.ts +13 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +89 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +124 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +103 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +101 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/jestHelpers.d.ts +137 -0
- package/dist/utils/jestHelpers.d.ts.map +1 -0
- package/dist/utils/jestHelpers.js +153 -3
- package/dist/utils/jestHelpers.js.map +1 -0
- package/dist/utils/network.d.ts +115 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +108 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +35 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +71 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +54 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +60 -8
- package/dist/utils/wait.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
package/dist/utils/deepEqual.js
CHANGED
|
@@ -1,23 +1,89 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the deepEqual function.
|
|
4
|
+
*
|
|
5
|
+
* @file deepEqual.ts
|
|
6
|
+
* @author Luca Liguori
|
|
7
|
+
* @created 2025-02-16
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
* @license Apache-2.0
|
|
10
|
+
*
|
|
11
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License.
|
|
15
|
+
* You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
26
|
+
/**
|
|
27
|
+
* Performs a deep comparison between two values to determine if they are equivalent.
|
|
28
|
+
* This comparison includes primitive types, arrays, and objects, allowing for optional
|
|
29
|
+
* exclusion of specific properties from the comparison in objects.
|
|
30
|
+
*
|
|
31
|
+
* @param {any} a The first value to compare.
|
|
32
|
+
* @param {any} b The second value to compare.
|
|
33
|
+
* @param {string[]} [excludeProperties] An array of property names to exclude from the comparison in objects.
|
|
34
|
+
* @returns {boolean} True if the values are deeply equal, excluding any specified properties; otherwise, false.
|
|
35
|
+
*
|
|
36
|
+
* Note: This function utilizes recursion for deep comparison of nested structures and includes a debugging
|
|
37
|
+
* mechanism that can be toggled on or off for detailed comparison logging. It is important to ensure that
|
|
38
|
+
* objects do not contain circular references when enabling debug logging to avoid infinite loops.
|
|
39
|
+
*
|
|
40
|
+
* Example usage:
|
|
41
|
+
* ```
|
|
42
|
+
* const obj1 = { a: 1, b: { c: 2 } };
|
|
43
|
+
* const obj2 = { a: 1, b: { c: 2 } };
|
|
44
|
+
* console.log(deepEqual(obj1, obj2)); // true
|
|
45
|
+
*
|
|
46
|
+
* const arr1 = [1, 2, [3, 4]];
|
|
47
|
+
* const arr2 = [1, 2, [3, 4]];
|
|
48
|
+
* console.log(deepEqual(arr1, arr2)); // true
|
|
49
|
+
*
|
|
50
|
+
* const obj3 = { a: 1, b: { c: 2, d: 3 } };
|
|
51
|
+
* const obj4 = { a: 1, b: { c: 2 } };
|
|
52
|
+
* console.log(deepEqual(obj3, obj4, ['d'])); // true, excluding property 'd' from comparison
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
1
55
|
export function deepEqual(a, b, excludeProperties = []) {
|
|
56
|
+
// Toggle debugging on or off easily
|
|
57
|
+
// const debug = false;
|
|
58
|
+
// Helper function for conditional logging
|
|
2
59
|
const debugLog = (...messages) => {
|
|
60
|
+
// if (debug) {
|
|
61
|
+
// console.log(...messages);
|
|
62
|
+
// }
|
|
3
63
|
};
|
|
64
|
+
// If both are the same instance, return true (handles primitives and same object references)
|
|
4
65
|
if (a === b) {
|
|
5
66
|
return true;
|
|
6
67
|
}
|
|
68
|
+
// If types are different, return false
|
|
7
69
|
if (typeof a !== typeof b) {
|
|
8
70
|
debugLog(`deepEqual false for typeof a: ${typeof a} typeof b: ${typeof b}`);
|
|
9
71
|
return false;
|
|
10
72
|
}
|
|
73
|
+
// If one of them is null (and we know they are not equal from the first check), return false
|
|
11
74
|
if (a == null || b == null) {
|
|
12
75
|
debugLog('deepEqual false for == null');
|
|
13
76
|
return false;
|
|
14
77
|
}
|
|
78
|
+
// Handle Dates compare by timestamp
|
|
15
79
|
if (a instanceof Date && b instanceof Date) {
|
|
16
80
|
return a.getTime() === b.getTime();
|
|
17
81
|
}
|
|
82
|
+
// Handle Regexps compare by their source & flags
|
|
18
83
|
if (a instanceof RegExp && b instanceof RegExp) {
|
|
19
84
|
return a.source === b.source && a.flags === b.flags;
|
|
20
85
|
}
|
|
86
|
+
// Handle Arrays
|
|
21
87
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
22
88
|
if (a.length !== b.length) {
|
|
23
89
|
debugLog(`deepEqual false for array a.length(${a.length}) !== b.length(${b.length})`);
|
|
@@ -33,26 +99,31 @@ export function deepEqual(a, b, excludeProperties = []) {
|
|
|
33
99
|
}
|
|
34
100
|
return true;
|
|
35
101
|
}
|
|
102
|
+
// Handle Objects (and exclude null, functions, and arrays)
|
|
36
103
|
if (typeof a === 'object' && typeof b === 'object') {
|
|
37
104
|
const aProps = Object.getOwnPropertyNames(a).filter((prop) => !excludeProperties.includes(prop));
|
|
38
105
|
const bProps = Object.getOwnPropertyNames(b).filter((prop) => !excludeProperties.includes(prop));
|
|
106
|
+
// If their property lengths are different, they're different objects
|
|
39
107
|
if (aProps.length !== bProps.length) {
|
|
40
108
|
debugLog(`deepEqual false for aProps.length(${aProps.length}) !== bProps.length(${bProps.length})`);
|
|
41
109
|
debugLog(`- aProps.length(${aProps.length}):`, aProps);
|
|
42
110
|
debugLog(`- bProps.length(${bProps.length}):`, bProps);
|
|
43
111
|
return false;
|
|
44
112
|
}
|
|
113
|
+
// Check each property in 'a' to see if it's in 'b' and if it's equal (deep check)
|
|
45
114
|
for (const prop of aProps) {
|
|
46
115
|
if (!Object.prototype.hasOwnProperty.call(b, prop)) {
|
|
47
116
|
debugLog(`deepEqual false for !b.hasOwnProperty(${prop})`);
|
|
48
117
|
return false;
|
|
49
118
|
}
|
|
50
119
|
if (!deepEqual(a[prop], b[prop], excludeProperties)) {
|
|
51
|
-
debugLog(`deepEqual false for !deepEqual(a[${prop}], b[${prop}])`);
|
|
120
|
+
debugLog(`deepEqual false for !deepEqual(a[${prop}], b[${prop}])` /* , a[prop], b[prop]*/);
|
|
52
121
|
return false;
|
|
53
122
|
}
|
|
54
123
|
}
|
|
55
124
|
return true;
|
|
56
125
|
}
|
|
126
|
+
// If none of the above, the objects are not equal
|
|
57
127
|
return false;
|
|
58
128
|
}
|
|
129
|
+
//# sourceMappingURL=deepEqual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepEqual.js","sourceRoot":"","sources":["../../src/utils/deepEqual.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD;;;;;;;;;;;;;;;;;;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C,QAAQ,CAAC,qCAAqC,MAAM,CAAC,MAAM,uBAAuB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YACpG,QAAQ,CAAC,mBAAmB,MAAM,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,CAAC;YACvD,QAAQ,CAAC,mBAAmB,MAAM,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,kFAAkF;QAClF,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;gBACnD,QAAQ,CAAC,yCAAyC,IAAI,GAAG,CAAC,CAAC;gBAC3D,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC,EAAE,CAAC;gBACpD,QAAQ,CAAC,oCAAoC,IAAI,QAAQ,IAAI,IAAI,CAAC,uBAAuB,CAAC,CAAC;gBAC3F,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the error functions.
|
|
3
|
+
*
|
|
4
|
+
* @file error.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2025-07-17
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
import type { AnsiLogger } from 'node-ansi-logger';
|
|
25
|
+
/**
|
|
26
|
+
* Logs an error message using the provided AnsiLogger instance.
|
|
27
|
+
*
|
|
28
|
+
* @param {AnsiLogger} log - The AnsiLogger instance to use for logging.
|
|
29
|
+
* @param {string} message - The error message to log.
|
|
30
|
+
* @param {unknown} error - The error object or value to log. If it's an Error instance,
|
|
31
|
+
* its message and stack trace will be included in the log.
|
|
32
|
+
*/
|
|
33
|
+
export declare function logError(log: AnsiLogger, message: string, error: unknown): void;
|
|
34
|
+
/**
|
|
35
|
+
* Logs an error message using the provided AnsiLogger instance with detailed inspection.
|
|
36
|
+
* Uses util.inspect to get a detailed view of the error with a stack depth of 10 levels.
|
|
37
|
+
* If the error is an Error instance, it also includes the error message.
|
|
38
|
+
*
|
|
39
|
+
* @param {AnsiLogger} log - The AnsiLogger instance to use for logging.
|
|
40
|
+
* @param {string} message - The error message to log.
|
|
41
|
+
* @param {unknown} error - The error object or value to log. Will be inspected with depth 10.
|
|
42
|
+
*/
|
|
43
|
+
export declare function inspectError(log: AnsiLogger, message: string, error: unknown): void;
|
|
44
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAInF"}
|
package/dist/utils/error.js
CHANGED
|
@@ -1,9 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the error functions.
|
|
3
|
+
*
|
|
4
|
+
* @file error.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2025-07-17
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
1
24
|
import { inspect } from 'node:util';
|
|
25
|
+
/**
|
|
26
|
+
* Logs an error message using the provided AnsiLogger instance.
|
|
27
|
+
*
|
|
28
|
+
* @param {AnsiLogger} log - The AnsiLogger instance to use for logging.
|
|
29
|
+
* @param {string} message - The error message to log.
|
|
30
|
+
* @param {unknown} error - The error object or value to log. If it's an Error instance,
|
|
31
|
+
* its message and stack trace will be included in the log.
|
|
32
|
+
*/
|
|
2
33
|
export function logError(log, message, error) {
|
|
3
34
|
log.error(`${message}: ${error instanceof Error ? error.message + '\nStack:\n' + error.stack : error}`);
|
|
4
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Logs an error message using the provided AnsiLogger instance with detailed inspection.
|
|
38
|
+
* Uses util.inspect to get a detailed view of the error with a stack depth of 10 levels.
|
|
39
|
+
* If the error is an Error instance, it also includes the error message.
|
|
40
|
+
*
|
|
41
|
+
* @param {AnsiLogger} log - The AnsiLogger instance to use for logging.
|
|
42
|
+
* @param {string} message - The error message to log.
|
|
43
|
+
* @param {unknown} error - The error object or value to log. Will be inspected with depth 10.
|
|
44
|
+
*/
|
|
5
45
|
export function inspectError(log, message, error) {
|
|
6
46
|
const errorMessage = error instanceof Error ? `${error.message}\n` : '';
|
|
7
47
|
const inspectedError = inspect(error, { depth: 10, colors: true, showHidden: false });
|
|
8
48
|
log.error(`${message}: ${errorMessage}${inspectedError}`);
|
|
9
49
|
}
|
|
50
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAe,EAAE,OAAe,EAAE,KAAc;IACvE,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC1G,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,GAAe,EAAE,OAAe,EAAE,KAAc;IAC3E,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,KAAK,YAAY,GAAG,cAAc,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './network.js';
|
|
2
|
+
export * from './commandLine.js';
|
|
3
|
+
export * from './isvalid.js';
|
|
4
|
+
export * from './colorUtils.js';
|
|
5
|
+
export * from './deepCopy.js';
|
|
6
|
+
export * from './deepEqual.js';
|
|
7
|
+
export * from './copyDirectory.js';
|
|
8
|
+
export * from './createDirectory.js';
|
|
9
|
+
export * from './createZip.js';
|
|
10
|
+
export * from './wait.js';
|
|
11
|
+
export * from './hex.js';
|
|
12
|
+
export * from './error.js';
|
|
13
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/utils/export.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/utils/export.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/utils/export.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the hex functions.
|
|
3
|
+
*
|
|
4
|
+
* @file hex.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2025-05-06
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Converts an ArrayBuffer or Uint8Array to a hexadecimal string.
|
|
26
|
+
*
|
|
27
|
+
* Accepts any {ArrayBufferLike} input: a raw ArrayBuffer (binary data storage) or
|
|
28
|
+
* a Uint8Array (TypedArray view over an ArrayBuffer). While an ArrayBuffer holds
|
|
29
|
+
* the raw memory, a Uint8Array is a typed view into that memory, letting you access
|
|
30
|
+
* its bytes directly. This function normalizes both by creating a Uint8Array view
|
|
31
|
+
* before conversion.
|
|
32
|
+
*
|
|
33
|
+
* @param {ArrayBufferLike} buffer - The buffer or typed-array view to convert.
|
|
34
|
+
* @returns {string} A lowercase hex string representation of the buffer's bytes.
|
|
35
|
+
*
|
|
36
|
+
* @throws {TypeError} If the input is not an ArrayBuffer or ArrayBufferView.
|
|
37
|
+
*/
|
|
38
|
+
export declare function bufferToHex(buffer: ArrayBufferLike): string;
|
|
39
|
+
/**
|
|
40
|
+
* Converts a hexadecimal string to a Uint8Array.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} hex - The hex string to convert. Can include uppercase or lowercase characters.
|
|
43
|
+
* @returns {Uint8Array} A Uint8Array representing the corresponding binary data.
|
|
44
|
+
*
|
|
45
|
+
* @throws {TypeError} If the input is not a string.
|
|
46
|
+
* @throws {Error} If the input length is odd or contains non-hex characters.
|
|
47
|
+
*/
|
|
48
|
+
export declare function hexToBuffer(hex: string): Uint8Array;
|
|
49
|
+
/**
|
|
50
|
+
* Converts a PEM (Privacy-Enhanced Mail) formatted string to a Uint8Array.
|
|
51
|
+
*
|
|
52
|
+
* PEM format is a base64-encoded format commonly used for cryptographic keys and certificates,
|
|
53
|
+
* wrapped with header and footer lines like "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----".
|
|
54
|
+
* This function extracts the base64 content and converts it to binary data using Node.js Buffer API.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} pem - The PEM formatted string to convert.
|
|
57
|
+
* @param {boolean} validate - Whether to validate the PEM content using Node.js crypto module. Default is false.
|
|
58
|
+
* @returns {Uint8Array} A Uint8Array representing the decoded binary data.
|
|
59
|
+
*
|
|
60
|
+
* @throws {TypeError} If the input is not a string.
|
|
61
|
+
* @throws {Error} If the PEM format is invalid, contains invalid base64 characters, or validation fails.
|
|
62
|
+
*/
|
|
63
|
+
export declare function pemToBuffer(pem: string, validate?: boolean): Uint8Array;
|
|
64
|
+
/**
|
|
65
|
+
* Extracts the raw 32-byte private key scalar from an EC private key PEM.
|
|
66
|
+
*
|
|
67
|
+
* This function parses an EC private key in PEM format and extracts the raw
|
|
68
|
+
* 32-byte private scalar (the "d" value) used in elliptic curve cryptography.
|
|
69
|
+
* This is the actual secret key material.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} pemPrivateKey - The EC private key in PEM format
|
|
72
|
+
* @returns {Uint8Array} The raw 32-byte private key scalar
|
|
73
|
+
* @throws {Error} If the input is not a valid EC private key PEM
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const pemKey = `-----BEGIN EC PRIVATE KEY-----
|
|
78
|
+
* MHcCAQEEIFBxqFkUxMoN2JkUXLFeiZnLNUpftjLi0sKMbZ6uajHXoAoGCCqGSM49
|
|
79
|
+
* AwEHoUQDQgAEcJ3eH/rG3zf9WmqMjh5eBSkeXz3Cb4Fig1rTosfHmgyjx/WnLPEe
|
|
80
|
+
* BF4SHvLo0G2COJEHa/VDE5EiKWO9ZR6AOQ==
|
|
81
|
+
* -----END EC PRIVATE KEY-----`;
|
|
82
|
+
*
|
|
83
|
+
* const rawKey = extractPrivateKeyRaw(pemKey);
|
|
84
|
+
* console.log(rawKey.length); // 32
|
|
85
|
+
* console.log(bufferToHex(rawKey)); // hex representation of the private scalar
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function extractPrivateKeyRaw(pemPrivateKey: string): Uint8Array;
|
|
89
|
+
//# sourceMappingURL=hex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../src/utils/hex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAa3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAgCnD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAe,GAAG,UAAU,CAoG9E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,UAAU,CAgCtE"}
|
package/dist/utils/hex.js
CHANGED
|
@@ -1,39 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the hex functions.
|
|
3
|
+
*
|
|
4
|
+
* @file hex.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2025-05-06
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
1
24
|
import { createPublicKey, createPrivateKey, X509Certificate } from 'node:crypto';
|
|
25
|
+
/**
|
|
26
|
+
* Converts an ArrayBuffer or Uint8Array to a hexadecimal string.
|
|
27
|
+
*
|
|
28
|
+
* Accepts any {ArrayBufferLike} input: a raw ArrayBuffer (binary data storage) or
|
|
29
|
+
* a Uint8Array (TypedArray view over an ArrayBuffer). While an ArrayBuffer holds
|
|
30
|
+
* the raw memory, a Uint8Array is a typed view into that memory, letting you access
|
|
31
|
+
* its bytes directly. This function normalizes both by creating a Uint8Array view
|
|
32
|
+
* before conversion.
|
|
33
|
+
*
|
|
34
|
+
* @param {ArrayBufferLike} buffer - The buffer or typed-array view to convert.
|
|
35
|
+
* @returns {string} A lowercase hex string representation of the buffer's bytes.
|
|
36
|
+
*
|
|
37
|
+
* @throws {TypeError} If the input is not an ArrayBuffer or ArrayBufferView.
|
|
38
|
+
*/
|
|
2
39
|
export function bufferToHex(buffer) {
|
|
40
|
+
// Check if the input is an ArrayBuffer or ArrayBufferView
|
|
3
41
|
if (!(buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer))) {
|
|
4
42
|
throw new TypeError('Expected input to be an ArrayBuffer or ArrayBufferView');
|
|
5
43
|
}
|
|
44
|
+
// Create a Uint8Array view over the buffer
|
|
6
45
|
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
46
|
+
// Convert each byte to 2-digit hex
|
|
7
47
|
return Array.from(bytes)
|
|
8
48
|
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
9
49
|
.join('');
|
|
10
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Converts a hexadecimal string to a Uint8Array.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} hex - The hex string to convert. Can include uppercase or lowercase characters.
|
|
55
|
+
* @returns {Uint8Array} A Uint8Array representing the corresponding binary data.
|
|
56
|
+
*
|
|
57
|
+
* @throws {TypeError} If the input is not a string.
|
|
58
|
+
* @throws {Error} If the input length is odd or contains non-hex characters.
|
|
59
|
+
*/
|
|
11
60
|
export function hexToBuffer(hex) {
|
|
61
|
+
// Ensure the input is a string
|
|
12
62
|
if (typeof hex !== 'string') {
|
|
13
63
|
throw new TypeError('Expected a string for hex input');
|
|
14
64
|
}
|
|
65
|
+
// Trim any whitespace from the input string
|
|
15
66
|
const cleaned = hex.trim();
|
|
67
|
+
// Check if the length of the hex string is even
|
|
16
68
|
if (cleaned.length % 2 !== 0) {
|
|
17
69
|
throw new Error('Invalid hex string length, must be even');
|
|
18
70
|
}
|
|
71
|
+
// Validate that the string contains only valid hex characters
|
|
19
72
|
if (!/^[0-9a-fA-F]*$/.test(cleaned)) {
|
|
20
73
|
throw new Error('Invalid hex string, contains non-hex characters');
|
|
21
74
|
}
|
|
75
|
+
// Calculate the length of the resulting Uint8Array
|
|
22
76
|
const length = cleaned.length / 2;
|
|
77
|
+
// Create a Uint8Array to hold the binary data
|
|
23
78
|
const result = new Uint8Array(length);
|
|
79
|
+
// Convert each pair of hex characters into a byte
|
|
24
80
|
for (let i = 0; i < length; i++) {
|
|
25
81
|
result[i] = parseInt(cleaned.substr(i * 2, 2), 16);
|
|
26
82
|
}
|
|
83
|
+
// Return the resulting Uint8Array
|
|
27
84
|
return result;
|
|
28
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Converts a PEM (Privacy-Enhanced Mail) formatted string to a Uint8Array.
|
|
88
|
+
*
|
|
89
|
+
* PEM format is a base64-encoded format commonly used for cryptographic keys and certificates,
|
|
90
|
+
* wrapped with header and footer lines like "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----".
|
|
91
|
+
* This function extracts the base64 content and converts it to binary data using Node.js Buffer API.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} pem - The PEM formatted string to convert.
|
|
94
|
+
* @param {boolean} validate - Whether to validate the PEM content using Node.js crypto module. Default is false.
|
|
95
|
+
* @returns {Uint8Array} A Uint8Array representing the decoded binary data.
|
|
96
|
+
*
|
|
97
|
+
* @throws {TypeError} If the input is not a string.
|
|
98
|
+
* @throws {Error} If the PEM format is invalid, contains invalid base64 characters, or validation fails.
|
|
99
|
+
*/
|
|
29
100
|
export function pemToBuffer(pem, validate = false) {
|
|
101
|
+
// Ensure the input is a string
|
|
30
102
|
if (typeof pem !== 'string') {
|
|
31
103
|
throw new TypeError('Expected a string for PEM input');
|
|
32
104
|
}
|
|
105
|
+
// Trim whitespace from the input
|
|
33
106
|
const cleaned = pem.trim();
|
|
107
|
+
// Check if the string appears to be in PEM format
|
|
34
108
|
if (!cleaned.includes('-----BEGIN') || !cleaned.includes('-----END')) {
|
|
35
109
|
throw new Error('Invalid PEM format: missing BEGIN/END markers');
|
|
36
110
|
}
|
|
111
|
+
// Extract the base64 content between the header and footer
|
|
37
112
|
const lines = cleaned.split('\n');
|
|
38
113
|
const base64Lines = [];
|
|
39
114
|
let inContent = false;
|
|
@@ -54,65 +129,114 @@ export function pemToBuffer(pem, validate = false) {
|
|
|
54
129
|
if (base64Lines.length === 0) {
|
|
55
130
|
throw new Error('Invalid PEM format: no content found between BEGIN/END markers');
|
|
56
131
|
}
|
|
132
|
+
// Join all base64 lines together
|
|
57
133
|
const base64String = base64Lines.join('');
|
|
134
|
+
// Validate base64 string format
|
|
58
135
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(base64String)) {
|
|
59
136
|
throw new Error('Invalid PEM format: contains invalid base64 characters');
|
|
60
137
|
}
|
|
61
138
|
try {
|
|
139
|
+
// Use Node.js Buffer API instead of legacy atob()
|
|
62
140
|
const buffer = Buffer.from(base64String, 'base64');
|
|
141
|
+
// Convert Buffer to Uint8Array
|
|
63
142
|
const result = new Uint8Array(buffer);
|
|
143
|
+
// Validate PEM content using Node.js crypto module if requested
|
|
64
144
|
if (validate) {
|
|
65
145
|
try {
|
|
146
|
+
// Determine PEM type from the header and validate accordingly
|
|
66
147
|
const pemType = cleaned.match(/-----BEGIN\s+([^-]+)-----/)?.[1]?.trim();
|
|
67
148
|
if (pemType?.includes('CERTIFICATE')) {
|
|
149
|
+
// Use X509Certificate for robust certificate validation
|
|
68
150
|
const cert = new X509Certificate(pem);
|
|
151
|
+
// Check validity period
|
|
69
152
|
if (cert.validFrom && cert.validTo) {
|
|
70
153
|
const now = Date.now();
|
|
71
154
|
const from = Date.parse(cert.validFrom);
|
|
72
155
|
const to = Date.parse(cert.validTo);
|
|
156
|
+
// istanbul ignore next if
|
|
73
157
|
if (now < from || now > to) {
|
|
74
158
|
throw new Error('Certificate is not currently valid');
|
|
75
159
|
}
|
|
76
160
|
}
|
|
161
|
+
// Check subject/issuer fields
|
|
162
|
+
// istanbul ignore next if
|
|
77
163
|
if (!cert.subject || !cert.issuer) {
|
|
78
164
|
throw new Error('Certificate missing subject or issuer');
|
|
79
165
|
}
|
|
166
|
+
// Optionally check signature (not possible without CA chain)
|
|
80
167
|
}
|
|
81
168
|
else if (pemType?.includes('PRIVATE KEY')) {
|
|
169
|
+
// For private keys, try to create a private key
|
|
82
170
|
createPrivateKey({ key: pem, format: 'pem' });
|
|
83
171
|
}
|
|
84
172
|
else if (pemType?.includes('PUBLIC KEY')) {
|
|
173
|
+
// For public keys, try to create a public key
|
|
85
174
|
createPublicKey({ key: pem, format: 'pem' });
|
|
86
175
|
}
|
|
176
|
+
// If no specific type is detected, skip validation
|
|
87
177
|
}
|
|
88
178
|
catch (validationError) {
|
|
179
|
+
// istanbul ignore next
|
|
89
180
|
throw new Error(`PEM validation failed: ${validationError instanceof Error ? validationError.message : String(validationError)}`);
|
|
90
181
|
}
|
|
91
182
|
}
|
|
92
183
|
return result;
|
|
93
184
|
}
|
|
94
185
|
catch (error) {
|
|
186
|
+
// istanbul ignore next
|
|
95
187
|
throw new Error(`Failed to decode base64 content: ${error instanceof Error ? error.message : String(error)}`);
|
|
96
188
|
}
|
|
97
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Extracts the raw 32-byte private key scalar from an EC private key PEM.
|
|
192
|
+
*
|
|
193
|
+
* This function parses an EC private key in PEM format and extracts the raw
|
|
194
|
+
* 32-byte private scalar (the "d" value) used in elliptic curve cryptography.
|
|
195
|
+
* This is the actual secret key material.
|
|
196
|
+
*
|
|
197
|
+
* @param {string} pemPrivateKey - The EC private key in PEM format
|
|
198
|
+
* @returns {Uint8Array} The raw 32-byte private key scalar
|
|
199
|
+
* @throws {Error} If the input is not a valid EC private key PEM
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const pemKey = `-----BEGIN EC PRIVATE KEY-----
|
|
204
|
+
* MHcCAQEEIFBxqFkUxMoN2JkUXLFeiZnLNUpftjLi0sKMbZ6uajHXoAoGCCqGSM49
|
|
205
|
+
* AwEHoUQDQgAEcJ3eH/rG3zf9WmqMjh5eBSkeXz3Cb4Fig1rTosfHmgyjx/WnLPEe
|
|
206
|
+
* BF4SHvLo0G2COJEHa/VDE5EiKWO9ZR6AOQ==
|
|
207
|
+
* -----END EC PRIVATE KEY-----`;
|
|
208
|
+
*
|
|
209
|
+
* const rawKey = extractPrivateKeyRaw(pemKey);
|
|
210
|
+
* console.log(rawKey.length); // 32
|
|
211
|
+
* console.log(bufferToHex(rawKey)); // hex representation of the private scalar
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
98
214
|
export function extractPrivateKeyRaw(pemPrivateKey) {
|
|
99
215
|
if (typeof pemPrivateKey !== 'string') {
|
|
100
216
|
throw new TypeError('Expected a string for PEM private key input');
|
|
101
217
|
}
|
|
218
|
+
// Extract the private key block
|
|
102
219
|
const keyBlock = /-----BEGIN (?:EC )?PRIVATE KEY-----[^-]+-----END (?:EC )?PRIVATE KEY-----/s.exec(pemPrivateKey);
|
|
103
220
|
if (!keyBlock) {
|
|
104
221
|
throw new Error('No EC PRIVATE KEY block found in the supplied PEM');
|
|
105
222
|
}
|
|
106
223
|
try {
|
|
224
|
+
// Create a private key object
|
|
107
225
|
const privateKey = createPrivateKey(keyBlock[0]);
|
|
226
|
+
// Export as PKCS#8 DER format
|
|
108
227
|
const pkcs8Der = privateKey.export({ format: 'der', type: 'pkcs8' });
|
|
228
|
+
// For P-256 curves, the private scalar is the last 32 bytes of the PKCS#8 DER
|
|
229
|
+
// istanbul ignore next
|
|
109
230
|
if (pkcs8Der.length < 32) {
|
|
110
231
|
throw new Error('Invalid private key: DER data too short');
|
|
111
232
|
}
|
|
233
|
+
// Extract the last 32 bytes which contain the raw private scalar
|
|
112
234
|
const rawPrivateKey = pkcs8Der.subarray(pkcs8Der.length - 32);
|
|
113
235
|
return new Uint8Array(rawPrivateKey);
|
|
114
236
|
}
|
|
115
237
|
catch (error) {
|
|
238
|
+
// istanbul ignore next
|
|
116
239
|
throw new Error(`Failed to extract private key: ${error instanceof Error ? error.message : String(error)}`);
|
|
117
240
|
}
|
|
118
241
|
}
|
|
242
|
+
//# sourceMappingURL=hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../src/utils/hex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CAAC,MAAuB;IACjD,0DAA0D;IAC1D,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;IAChF,CAAC;IAED,2CAA2C;IAC3C,MAAM,KAAK,GAAG,MAAM,YAAY,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAE7E,mCAAmC;IACnC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SACjD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,+BAA+B;IAC/B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC;IACzD,CAAC;IAED,4CAA4C;IAC5C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAE3B,gDAAgD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