Help us shape the future of Go! Take the 2026 Go Developer Survey

bitwarden

package
v1.65.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBitwardenLoginStatus

func CheckBitwardenLoginStatus() (bool, error)

CheckBitwardenLoginStatus checks if the user is logged into Bitwarden.

func EnsureBitwardenSession

func EnsureBitwardenSession() (string, error)

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

func GetExecCommandForTest() func(string, ...string) *exec.Cmd

GetExecCommandForTest retrieves the current execCommand function.

func SaveOrUpdateBitwardenSecret

func SaveOrUpdateBitwardenSecret(name, secret, notes string) (string, error)

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

func SetExecCommandForTest(f func(string, ...string) *exec.Cmd)

SetExecCommandForTest overrides the internal execCommand for test mocking.

func UnlockBitwardenVault

func UnlockBitwardenVault() error

UnlockBitwardenVault prompts the user to unlock their Bitwarden vault.

func VerifyBitwardenSession

func VerifyBitwardenSession(sess string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL