Documentation
¶
Index ¶
- func CheckBitwardenLoginStatus() (bool, error)
- func EnsureBitwardenSession() (string, error)
- func ExtractSSHKeyFromItem(item *BitwardenItem) (string, error)
- func GetExecCommandForTest() func(string, ...string) *exec.Cmd
- func SaveOrUpdateBitwardenSecret(name, secret, notes string) (string, error)
- func SetExecCommandForTest(f func(string, ...string) *exec.Cmd)
- func UnlockBitwardenVault() error
- func VerifyBitwardenSession(sess string) error
- type BitwardenField
- type BitwardenItem
- type BitwardenLogin
- type BitwardenSSHKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckBitwardenLoginStatus ¶
CheckBitwardenLoginStatus checks if the user is logged into Bitwarden.
func EnsureBitwardenSession ¶
EnsureBitwardenSession ensures the Bitwarden vault is unlocked and returns a session key. It first checks BW_SESSION and status; if locked, it prompts for the master password using `bw unlock --raw` and returns the session token. If unauthenticated, it attempts `bw login`.
func ExtractSSHKeyFromItem ¶
func ExtractSSHKeyFromItem(item *BitwardenItem) (string, error)
ExtractSSHKeyFromItem extracts SSH private key from a Bitwarden item.
func GetExecCommandForTest ¶ added in v1.25.0
GetExecCommandForTest retrieves the current execCommand function.
func SaveOrUpdateBitwardenSecret ¶
SaveOrUpdateBitwardenSecret saves a secret value into Bitwarden under the given item name. If the item exists, it will be updated; otherwise it is created. A custom field named "eng-cli" with value "true" is added to tag usage by this CLI.
func SetExecCommandForTest ¶ added in v1.25.0
SetExecCommandForTest overrides the internal execCommand for test mocking.
func UnlockBitwardenVault ¶
func UnlockBitwardenVault() error
UnlockBitwardenVault prompts the user to unlock their Bitwarden vault.
func VerifyBitwardenSession ¶
VerifyBitwardenSession checks if the current Bitwarden session is still valid.
Types ¶
type BitwardenField ¶
type BitwardenField struct {
Name string `json:"name"`
Value string `json:"value"`
Type int `json:"type"`
}
BitwardenField represents a custom field in a Bitwarden item.
type BitwardenItem ¶
type BitwardenItem struct {
ID string `json:"id"`
Name string `json:"name"`
Type int `json:"type,omitempty"`
Fields []BitwardenField `json:"fields,omitempty"`
Login *BitwardenLogin `json:"login,omitempty"`
Notes string `json:"notes,omitempty"`
SSHKey *BitwardenSSHKey `json:"sshKey,omitempty"`
}
BitwardenItem represents a Bitwarden vault item.
func FindSSHKeysInVault ¶
func FindSSHKeysInVault() ([]BitwardenItem, error)
FindSSHKeysInVault searches for SSH key items in the Bitwarden vault.
func GetBitwardenItem ¶
func GetBitwardenItem(name string) (*BitwardenItem, error)
GetBitwardenItem retrieves an item from Bitwarden vault by name.
func ListBitwardenItems ¶
func ListBitwardenItems() ([]BitwardenItem, error)
ListBitwardenItems returns all items in the vault (filtered by type if specified).
type BitwardenLogin ¶
type BitwardenLogin struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
BitwardenLogin represents login credentials.
type BitwardenSSHKey ¶
type BitwardenSSHKey struct {
PrivateKey string `json:"privateKey,omitempty"`
PublicKey string `json:"publicKey,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
}
BitwardenSSHKey represents native SSH key payloads in Bitwarden items.