// Jackson Coxson #pragma once #include #include #include #include #include #include #include namespace IdeviceFFI { using RpPairingFilePtr = std::unique_ptr>; class RpPairingFile { public: // Factory: generate a new pairing file with fresh Ed25519 keys static Result generate(const std::string& hostname); // Factory: read from a file path static Result from_file(const std::string& path); // Factory: parse from plist bytes (XML or binary) static Result from_bytes(const uint8_t* data, size_t len); // Serialize to XML plist bytes Result, FfiError> to_bytes() const; // Write to a file path Result write(const std::string& path) const; // RAII / moves ~RpPairingFile() noexcept = default; RpPairingFile(RpPairingFile&&) noexcept = default; RpPairingFile& operator=(RpPairingFile&&) noexcept = default; RpPairingFile(const RpPairingFile&) = delete; RpPairingFile& operator=(const RpPairingFile&) = delete; RpPairingFileHandle* raw() const noexcept { return handle_.get(); } static RpPairingFile adopt(RpPairingFileHandle* h) noexcept { return RpPairingFile(h); } private: explicit RpPairingFile(RpPairingFileHandle* h) noexcept : handle_(h) {} RpPairingFilePtr handle_{}; }; } // namespace IdeviceFFI