Commit Graph

6 Commits

Author SHA1 Message Date
Oli
20f18ba4ac style: show vault sync only in debug mode 2025-11-01 14:56:58 +01:00
Oli
d34142eef0 fix: resolve session corruption and sync issues
- Use BW_SESSION environment variable because commands don't support `--session` parameter anymore
- Suppress output from bw login and cmdkey to prevent pipeline pollution
- Set/unset BW_SESSION immediately in try/finally blocks for security
2025-11-01 14:32:17 +01:00
Oli
5daf68237d fix description 2024-12-14 01:01:41 +01:00
Oli
c8f75649af update to use Bitwarden native SSH key type
Support Bitwarden's new native SSH key type (type 5) introduced in CLI version 2024.12.0.
Previously, SSH keys were stored as notes with attachments. This update removes the
legacy handling and uses the structured sshKey property instead.

- Add version check for Bitwarden CLI (>= 2024.12.0)
- Filter items by type 5 (SSH key) in Get-FolderItems
- Update Get-PrivatePublicKey to use sshKey.privateKey and sshKey.publicKey
- Remove legacy handling of notes and attachments
- Update prerequisites check to ensure minimum CLI version

Breaking Changes:
- Requires Bitwarden CLI version 2024.12.0 or higher
- Only works with SSH keys stored as native SSH key items (type 5)
- Existing SSH keys stored as notes with attachments must be migrated
  to the new SSH key item type manually
2024-12-13 21:08:45 +01:00
Oli
7744667c3d improved error handling and better session management
Added

- New ClearSession parameter to remove the stored Vaultwarden session from the Windows Credential Manager.
- New Test-Prerequisites function to check if the required tools (ssh-add, Bitwarden CLI) are installed and available.
- New Get-BWSession function to retrieve the Vaultwarden session from the Windows Credential Manager, and fallback to getting a new session if the stored one is invalid.
- New Clear-SensitiveData function to clear sensitive data (SecureString, string) from memory.
- New Clear-BWSession function to remove the stored session from the Windows Credential Manager.

Changed

- The Test-VaultwardenConfig function now prompts the user to enter the Vaultwarden server URL if it's not configured, rather than throwing an error.
- The Get-FolderId and Get-FolderItems functions now take the session as a parameter, rather than relying on a global session variable.
- The Get-PrivatePublicKey function now uses the --raw flag to retrieve the private key attachment, instead of joining the attachment content.
The main script execution has been reorganized to handle the session retrieval and management more explicitly.
- The script now includes a detailed help section at the top, providing information about the script's usage and parameters.
Removed
2024-10-25 22:51:13 +02:00
Oli
d8e5346e42 first commit 2024-10-24 00:47:38 +02:00