forked from imbytecat/fullstack-starter
feat: 添加硬件指纹生成功能
- 生成硬件指纹,通过收集系统唯一标识、主板、BIOS、系统信息、磁盘布局和网络接口数据并哈希处理
This commit is contained in:
@@ -1,2 +1,29 @@
|
||||
import { hash } from 'ohash'
|
||||
import si from 'systeminformation'
|
||||
|
||||
async function getSystemInfo() {
|
||||
const [uuid, baseboard, bios, system, diskLayout, networkInterfaces] =
|
||||
await Promise.all([
|
||||
si.uuid(),
|
||||
si.baseboard(),
|
||||
si.bios(),
|
||||
si.system(),
|
||||
si.diskLayout(),
|
||||
si.networkInterfaces(),
|
||||
])
|
||||
|
||||
return {
|
||||
uuid,
|
||||
baseboard,
|
||||
bios,
|
||||
system,
|
||||
diskLayout,
|
||||
networkInterfaces,
|
||||
}
|
||||
}
|
||||
|
||||
export async function getHardwareFingerprint() {
|
||||
const systemInfo = await getSystemInfo()
|
||||
|
||||
return hash(systemInfo)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user