mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
- Add `lux snapshot` command with native BadgerDB backup API - Incremental backups (only changes since last backup) - ~96MB vs 5GB+ for raw file copies (160x smaller) - Zstd compression with manifest tracking - Add `lux snapshot clean` for disk cleanup - Removes old logs, stale runs, backup directories - Dry-run mode for preview - Update `lux network stop` to use incremental by default - --incremental (default: true) - --full flag to force full backup - --cleanup flag to clean logs on stop - Add key migration and session cache improvements - Secure memory locking (mlock) for sensitive data - Session-based key caching - Key migration tooling
33 lines
645 B
Go
33 lines
645 B
Go
// Copyright (C) 2022-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build unix
|
|
|
|
package key
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// mlock locks memory to prevent swapping to disk.
|
|
// This is a security measure for sensitive data like encryption keys.
|
|
func mlock(b []byte) error {
|
|
if len(b) == 0 {
|
|
return nil
|
|
}
|
|
return unix.Mlock(b)
|
|
}
|
|
|
|
// munlock unlocks previously locked memory.
|
|
func munlock(b []byte) error {
|
|
if len(b) == 0 {
|
|
return nil
|
|
}
|
|
return unix.Munlock(b)
|
|
}
|
|
|
|
// mlockSupported returns true if mlock is available on this platform.
|
|
func mlockSupported() bool {
|
|
return true
|
|
}
|