server

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package server provides types and functions for running the secrets server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, config Config) error

Run the server using the provided configuration. This function blocks until the provided context is cancelled or an error occurs.

Types

type Config

type Config struct {
	// Configuration for serving HTTP requests.
	HTTP HTTPConfig `toml:"http"`
	// Configuration for the master & account databases.
	Database DatabaseConfig `toml:"database"`
	// Configuration for generating/parsing JWT tokens used for authentication.
	JWT JWTConfig `toml:"jwt"`
}

The Config type contains all configuration values for the secrets server.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config instance with default configuration. This can be used for development/testing but ideally should not be used for a real deployment.

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig attempts to parse a TOML file at the specified path into a Config type.

func (Config) Validate

func (c Config) Validate() error

Validate the Config.

type DatabaseConfig

type DatabaseConfig struct {
	// The path for storing all databases.
	Path string `toml:"path"`
	// The TTL of individual account databases. Once opened, they will automatically be closed after this
	// time.
	TTL time.Duration `toml:"ttl"`
	// The encryption key for the master database.
	MasterKey string `toml:"master_key"`
}

The DatabaseConfig type contains fields used to configure storage for the master and individual account databases.

type HTTPConfig

type HTTPConfig struct {
	// The bind address of the HTTP server.
	Bind string `toml:"bind"`
}

The HTTPConfig type contains fields used to configure the HTTP server.

type JWTConfig

type JWTConfig struct {
	// The JWT issuer.
	Issuer string `toml:"issuer"`
	// The TTL of each token.
	TTL time.Duration `toml:"ttl"`
	// The key used to sign and verify each JWT token.
	SigningKey string `toml:"signing_key"`
	// The JWT audience.
	Audience string `toml:"audience"`
}

The JWTConfig type contains fields used to configure JWT tokens generated/parsed via the server.

Directories

Path Synopsis
Package api provides HTTP handlers for the application.
Package api provides HTTP handlers for the application.
Package database provides types and functions for managing the persistence layer of the password manager.
Package database provides types and functions for managing the persistence layer of the password manager.
export
bitwarden
Package bitwarden provides types for working with exports of Bitwarden vaults.
Package bitwarden provides types for working with exports of Bitwarden vaults.
Package password provides utilities for evaluating the strength of passwords.
Package password provides utilities for evaluating the strength of passwords.
Package service provides types that manage interactions between inbound network requests and the persistent storage.
Package service provides types that manage interactions between inbound network requests and the persistent storage.
Package token provides types for generating and parsing JWT tokens.
Package token provides types for generating and parsing JWT tokens.
Package urlcmp provides functions that assist in the comparison of urls.
Package urlcmp provides functions that assist in the comparison of urls.

Jump to

Keyboard shortcuts

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