native-machine-id 0.0.3 → 0.0.5

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.
Files changed (2) hide show
  1. package/binding.cc +4 -6
  2. package/package.json +1 -1
package/binding.cc CHANGED
@@ -5,11 +5,9 @@
5
5
  #include <CoreFoundation/CoreFoundation.h>
6
6
  #include <IOKit/IOKitLib.h>
7
7
  #include <AvailabilityMacros.h>
8
- // kIOMainPortDefault is the replacement on macOS 12+ but is not available in older SDKs
9
- #if (defined(MAC_OS_VERSION_MIN_REQUIRED) && MAC_OS_VERSION_MIN_REQUIRED >= 120000)
10
- #define IO_PORT_DEFAULT kIOMainPortDefault
11
- #else
12
- #define IO_PORT_DEFAULT kIOMasterPortDefault
8
+ // Ensure compatibility with older macOS
9
+ #if (MAC_OS_X_VERSION_MAX_ALLOWED < 120000)
10
+ #define kIOMainPortDefault kIOMasterPortDefault
13
11
  #endif
14
12
  #elif defined(__linux__)
15
13
  #include <fstream>
@@ -28,7 +26,7 @@ namespace
28
26
  std::string getMachineId() noexcept
29
27
  {
30
28
  std::string uuid;
31
- io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(IO_PORT_DEFAULT, "IOService:/");
29
+ io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMainPortDefault, "IOService:/");
32
30
 
33
31
  if (ioRegistryRoot == MACH_PORT_NULL)
34
32
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-machine-id",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Native retrieval of a unique desktop machine ID without admin privileges or child processes. Faster and more reliable alternative to node-machine-id.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",