const { STORAGE_KEYS, getStorage, setStorage } = require('./storage') function createDeviceId() { const randomText = Math.random().toString(36).slice(2, 10) return `mini-device-${Date.now()}-${randomText}` } function getDeviceId() { let value = getStorage(STORAGE_KEYS.DEVICE_ID, '') if (value) { return value } value = createDeviceId() setStorage(STORAGE_KEYS.DEVICE_ID, value) return value } module.exports = { getDeviceId }