#machine-uid #tauri-plugin #plugin

sys tauri-plugin-machine-uid

A Tauri plugin for retrieving machine UID

1 unstable release

Uses new Rust 2024

new 0.1.0 Mar 24, 2025

#5 in #machine-uid

Download history 105/week @ 2025-03-19

105 downloads per month

MIT license

41KB
338 lines

Tauri Plugin machine-uid

License

A Tauri plugin that provides access to unique device identifiers across different platforms.

Installation

Add the following to your Cargo.toml:

[dependencies]
tauri-plugin-machine-uid = { git = "https://github.com/SkipperNDT/tauri-plugin-machine-uid" }

Usage

First, register the plugin in your Tauri application:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_machine_uid::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Then you can use it in your application:

import { commands } from '@skipperndt/plugin-machine-uid';

// Get the unique device identifier
const result = await commands.getMachineUid();
if (result.status === "ok") {
    console.log(result.data.id); // e.g. "550e8400-e29b-41d4-a716-446655440000"
}

The getMachineUid() function returns a Result type with the following structure:

type Result<T, E> = 
    | { status: "ok"; data: { id: string | null } }
    | { status: "error"; error: E };

Platform Support

  • Windows: Uses WMI to get the system UUID
  • macOS: Uses IOKit to get the system UUID
  • Linux: Uses D-Bus to get the system machine ID
  • iOS: Uses UIDevice's identifierForVendor
  • Android: Uses Settings.Secure.ANDROID_ID

Contributing

PRs are welcome! Please feel free to submit issues and pull requests.

License

MIT © Florian Stasse

Dependencies

~19–54MB
~869K SLoC