mirror of
https://github.com/larksuite/cli.git
synced 2026-07-06 16:18:05 +08:00
* feat: (MacOS) add fallback file-based master key storage * refactor(keychain): improve master key file handling and corruption checks - Replace temporary file approach with direct file creation - Add explicit corruption checks for existing keys - Ensure atomic operations and proper cleanup on failure * docs(keychain): add comments to clarify constants and variables Add descriptive comments to explain the purpose of timeout, crypto parameters, and test variables in the macOS keychain implementation. * fix(keychain): use atomic write for master key initialization * fix(keychain): add retry logic for reading master key file Add retry mechanism when reading existing master key file to handle potential race conditions. Return early if read error occurs instead of waiting for all retries. * refactor(keychain): simplify master key validation logic Restructure the key validation flow to reduce redundant checks and improve readability. The corrupted key check is moved after the error handling block for better logical flow. * refactor(keychain): replace os package with vfs for file operations Use vfs package instead of os for file operations to improve testability and abstract filesystem access. This change makes it easier to mock filesystem operations in tests and provides a consistent interface for file handling.