MCPcopy Create free account
hub / github.com/78/tenbox / LoadOrCreateDeviceId

Function LoadOrCreateDeviceId

src/daemon/cloud_tunnel.cpp:193–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193std::string LoadOrCreateDeviceId(const std::string& data_dir) {
194 const auto path = std::filesystem::path(data_dir) / "device.id";
195 std::ifstream in(path);
196 std::string id;
197 if (in >> id; !id.empty()) return id;
198
199 id = GenerateUuid();
200 std::filesystem::create_directories(path.parent_path());
201 std::ofstream out(path, std::ios::trunc);
202 out << id << "\n";
203 return id;
204}
205
206// device.token holds the long-lived shared secret minted by the cloud after
207// the operator confirms pairing in the browser. Phase 3 stores it raw on

Callers 1

ConnectMethod · 0.85

Calls 1

GenerateUuidFunction · 0.70

Tested by

no test coverage detected