I am working on an Electron.js application that uses React.js and TypeScript. I need to obtain the device ID and device type within my application. Here is a brief overview of my setup and what I’ve tried so far
Setup:
- Electron.js: Version 30.0.1 React.js: Version 18.3.1 TypeScript:
Version 4.5.4
What I Want to Achieve:
Retrieve the device ID.
Determine the device type (e.g., desktop, laptop, tablet, ipad, mac).
What I’ve Tried:
const platform = os.platform();
const architecture = os.arch();
console.log(`Platform: ${platform}, Architecture: ${architecture}`);```
I've looked into the os module from Node.js, which provides some system information, but it doesn't seem to include a unique device ID. Here's an example of what I've tried so far:
I also found some information suggesting that the node-machine-id package can be used to get a unique device ID, but I'm not sure how to integrate it properly with Electron and React.
**Questions:**
1. What is the best way to retrieve a unique device ID in an Electron
application using React and TypeScript?
2. How can I determine the device type within my application?
**Additional Context:**
Any example code snippets or guidance on how to achieve this would be greatly appreciated. If there are any best practices or potential pitfalls to be aware of when working with Electron.js, React.js, and TypeScript for this purpose, please let me know.
Thank you for your help!