wauth.utils module

Platform utilities for machine identification and key derivation.

wauth.utils.get_machine_id()[source]

Retrieve a unique machine identifier in a cross-platform way.

Attempts platform-specific methods in the following order:

  • Linux: Reads /etc/machine-id or /var/lib/dbus/machine-id.

  • Windows: Queries wmic csproduct get uuid.

  • macOS: Extracts IOPlatformUUID from ioreg.

Falls back to platform.node() (hostname) if all methods fail.

Returns:

A string representing the machine ID.

Return type:

str

wauth.utils.generate_key()[source]

Derive a 32-byte key for AES-256 encryption.

The key is derived by hashing a salted machine identifier with SHA-256, producing a deterministic 32-byte output suitable for Fernet.

Returns:

A 32-byte key derived from the machine ID.

Return type:

bytes