bitwarden

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGetEnvForTesting

func SetGetEnvForTesting(fn func(string) string)

SetGetEnvForTesting allows tests to override the getEnv function

Types

type BitwardenConfig

type BitwardenConfig struct {
	// ItemID is the ID of the item in Bitwarden vault (required)
	// Can be found using: bw list items --search "item name" or via Bitwarden web vault
	ItemID string `json:"item_id" yaml:"item_id"`
	// Format specifies how to parse the secret: "note" (JSON), "fields" (key-value pairs), or "login" (username/password)
	Format string `json:"format,omitempty" yaml:"format,omitempty"`
	// BWPath is the path to the Bitwarden CLI binary (optional, defaults to "bw" in PATH)
	BWPath string `json:"bw_path,omitempty" yaml:"bw_path,omitempty"`
	// ServerURL is the Bitwarden server URL (optional, defaults to https://vault.bitwarden.com)
	// For self-hosted instances, set this to your server URL
	ServerURL string `json:"server_url,omitempty" yaml:"server_url,omitempty"`
	// APIPort is the port for the local API server (optional, defaults to 8087)
	APIPort int `json:"api_port,omitempty" yaml:"api_port,omitempty"`
	// APIHostname is the hostname for the local API server (optional, defaults to "localhost")
	APIHostname string `json:"api_hostname,omitempty" yaml:"api_hostname,omitempty"`
}

BitwardenConfig represents the configuration for personal Bitwarden provider (using CLI REST API) The Bitwarden CLI (bw) must be installed and API credentials must be provided

type BitwardenField

type BitwardenField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Type  int    `json:"type"` // 0 = Text, 1 = Hidden, 2 = Boolean, 3 = Linked
}

BitwardenField represents custom fields in a Bitwarden item

type BitwardenItem

type BitwardenItem struct {
	ID         string               `json:"id"`
	Name       string               `json:"name"`
	Type       int                  `json:"type"` // 1 = Login, 2 = Secure Note, etc.
	Login      *BitwardenLogin      `json:"login,omitempty"`
	SecureNote *BitwardenSecureNote `json:"secureNote,omitempty"`
	Fields     []BitwardenField     `json:"fields,omitempty"`
	Notes      string               `json:"notes,omitempty"`
}

BitwardenItem represents a Bitwarden vault item structure from the REST API

type BitwardenLogin

type BitwardenLogin struct {
	Username string `json:"username"`
	Password string `json:"password"`
	URIs     []struct {
		URI string `json:"uri"`
	} `json:"uris,omitempty"`
}

BitwardenLogin represents login credentials

type BitwardenProvider

type BitwardenProvider struct{}

BitwardenProvider implements the provider interface for personal Bitwarden (using CLI REST API)

func (*BitwardenProvider) Fetch

func (p *BitwardenProvider) Fetch(ctx context.Context, mapID string, config map[string]interface{}, keys map[string]string) ([]provider.KeyValue, error)

Fetch fetches secrets from personal Bitwarden vault using REST API

func (*BitwardenProvider) Name

func (p *BitwardenProvider) Name() string

Name returns the provider name

type BitwardenSMConfig

type BitwardenSMConfig struct {
	// ServerURL is the Bitwarden server URL (optional, defaults to BITWARDEN_SERVER_URL env var or https://vault.bitwarden.com)
	ServerURL string `json:"server_url,omitempty" yaml:"server_url,omitempty"`
	// OrganizationID is the ID of the organization in Bitwarden Secret Manager (required)
	OrganizationID string `json:"organization_id" yaml:"organization_id"`
	// ProjectID is the ID of the project in Bitwarden Secret Manager (required)
	ProjectID string `json:"project_id" yaml:"project_id"`
}

BitwardenSMConfig represents the configuration for Bitwarden Secret Manager provider Note: Access token must be provided via BITWARDEN_SM_ACCESS_TOKEN environment variable

type BitwardenSMProvider

type BitwardenSMProvider struct {
	// contains filtered or unexported fields
}

BitwardenSMProvider implements the provider interface for Bitwarden Secret Manager

func (*BitwardenSMProvider) Fetch

func (p *BitwardenSMProvider) Fetch(ctx context.Context, mapID string, config map[string]interface{}, keys map[string]string) ([]provider.KeyValue, error)

Fetch fetches all secrets from a Bitwarden Secret Manager project Only Key-Value pairs are extracted from secrets. Note fields are ignored.

func (*BitwardenSMProvider) Name

func (p *BitwardenSMProvider) Name() string

Name returns the provider name

type BitwardenSecureNote

type BitwardenSecureNote struct {
	Type int `json:"type"` // 0 = Generic
}

BitwardenSecureNote represents secure note data

Jump to

Keyboard shortcuts

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