* Code below is adapted from: * - vscode\src\vs\base\node\id.ts
(macAddress?: string)
| 54 | */ |
| 55 | |
| 56 | async function getMachineId(macAddress?: string): Promise<string | undefined> { |
| 57 | if (!macAddress) { |
| 58 | return undefined; |
| 59 | } |
| 60 | |
| 61 | try { |
| 62 | const crypto = await import('crypto'); |
| 63 | const normalized = macAddress.toUpperCase().replace(/:/g, '-'); |
| 64 | return crypto.createHash('sha256').update(normalized, 'utf8').digest('hex'); |
| 65 | } catch { |
| 66 | return undefined; |
| 67 | } |
| 68 | } |
no test coverage detected