Omni-Bitwarden

Bitwarden Secrets Manager provider for omnivault.
Overview
This package implements the vault.Vault interface using the official Bitwarden Go SDK, allowing applications to access secrets stored in Bitwarden Secrets Manager through the unified OmniVault interface.
Installation
go get github.com/plexusone/omni-bitwarden
Authentication
Bitwarden Secrets Manager requires:
| Variable |
Required |
Description |
BW_ACCESS_TOKEN |
Yes |
Access token for authentication |
BW_ORGANIZATION_ID |
Yes* |
Default organization ID (*can be specified in path) |
Optional for self-hosted instances:
| Variable |
Description |
BW_API_URL |
Custom API URL |
BW_IDENTITY_URL |
Custom Identity URL |
To create an access token, see Bitwarden Access Tokens documentation.
Quick Start
Direct Usage
import (
bitwarden "github.com/plexusone/omni-bitwarden/omnivault"
)
// Create provider (uses BW_ACCESS_TOKEN and BW_ORGANIZATION_ID env vars)
provider, err := bitwarden.NewFromEnv()
if err != nil {
log.Fatal(err)
}
defer provider.Close()
// Get a secret
secret, err := provider.Get(ctx, "my-api-key")
fmt.Println("Value:", secret.Value)
// Get a specific field
secret, err := provider.Get(ctx, "my-api-key/note")
fmt.Println("Note:", secret.Value)
With OmniVault Resolver
import (
"github.com/plexusone/omnivault"
bitwarden "github.com/plexusone/omni-bitwarden/omnivault"
)
provider, _ := bitwarden.NewFromEnv()
resolver := omnivault.NewResolver()
resolver.Register("bw", provider)
// Resolve using URI
value, err := resolver.Resolve(ctx, "bw://org-id/my-api-key")
Auto-Registration
Import the register package to automatically register the bw:// scheme:
import (
"github.com/plexusone/omnivault"
_ "github.com/plexusone/omni-bitwarden/omnivault/register"
)
// Now bw:// URIs work automatically
vault, err := omnivault.VaultFromURI("bw://org-id")
secret, err := vault.Get(ctx, "my-api-key")
| Format |
Example |
Description |
| Secret key |
my-api-key |
Uses default organization ID |
| Key with field |
my-api-key/note |
Returns specific field |
| Org + key |
org-id/my-api-key |
Specific organization |
| Org + key + field |
org-id/my-api-key/value |
Specific field from org |
| Native URI |
bw://org-id/my-api-key |
Bitwarden secret reference |
Supported Fields
| Field |
Description |
value |
Secret value (default) |
key |
Secret key/name |
note |
Secret note |
Configuration
provider, err := bitwarden.New(bitwarden.Config{
AccessToken: "access-token", // Required
OrganizationID: "org-id", // Default org for operations
APIURL: "", // For self-hosted (optional)
IdentityURL: "", // For self-hosted (optional)
StateFile: "", // Persist auth state (optional)
})
Environment Variables
| Variable |
Description |
BW_ACCESS_TOKEN |
Access token for authentication |
BW_ORGANIZATION_ID |
Default organization ID |
BW_API_URL |
Custom API URL (self-hosted) |
BW_IDENTITY_URL |
Custom Identity URL (self-hosted) |
Capabilities
| Capability |
Supported |
| Read |
Yes |
| Write |
Yes |
| Delete |
Yes |
| List |
Yes |
| Multi-Field |
Yes (key, value, note) |
| Batch |
Yes |
| Binary |
No |
Usage with omnivault-desktop
For applications using multiple vault providers (1Password, Bitwarden, Keeper), import omnivault-desktop:
import (
"github.com/plexusone/omnivault"
_ "github.com/plexusone/omnivault-desktop" // Registers all desktop vault providers
)
func main() {
// Bitwarden provider is automatically registered
vault, err := omnivault.VaultFromURI("bw://org-id")
// ...
}
License
MIT