passbolt

package
v1.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a passbolt client. It is used to retrieve secrets from passbolt. Internally, we cache the secret names and IDs to avoid unnecessary API calls. This is necessary because the passbolt API does not allow for searching secrets by name. Instead, we must retrieve all secrets and their UUIDs. This is not ideal, but it is the only way to retrieve secrets by name.

func NewClient

func NewClient(ctx context.Context, url, username, password string) (*Client, error)

NewClient initializes a new passbolt client and logs in. The client is configured to use the given URL, username and password.

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close logs out of the passbolt client. This should be called when the client is no longer needed.

func (*Client) GetCache added in v1.3.0

func (c *Client) GetCache() map[string]string

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, id string) (*PassboltSecretDefinition, error)

GetSecret retrieves the secret value for the given secret name. Under the hook, this function queries the internal cache for the secret ID by name. If the secret is not in the cache, an error is returned. If the secret is in the cache, the secret is retrieved from passbolt.

func (*Client) GetSecretID added in v1.3.0

func (c *Client) GetSecretID(name string) (string, error)

GetSecretID retrieves the secret ID for the given secret name from the cache.

func (*Client) GetSecretName added in v1.3.0

func (c *Client) GetSecretName(id string) (string, error)

GetSecretName retrieves the secret name for the given secret ID from the cache.

func (*Client) LoadCache

func (c *Client) LoadCache(ctx context.Context) error

LoadCache fills the secret cache with all secret names and IDs. This should be called before any secrets are retrieved. This is necessary because the passbolt API does not allow for searching secrets by name. Instead, we must retrieve all secrets and their UUIDs. This is not ideal, but it is the only way to retrieve secrets by name.

func (*Client) ReLogin added in v1.2.0

func (c *Client) ReLogin(ctx context.Context) error

ReLogin logs out of the passbolt client and logs in again. This is useful if the session has expired. This function should be called before any other function.

type PassboltSecretDefinition added in v1.1.0

type PassboltSecretDefinition struct {
	FolderParentID string
	Name           string
	Username       string
	URI            string
	Password       string
	Description    string
}

func (PassboltSecretDefinition) FieldValue added in v1.1.0

FieldValue returns the value of the given field by name.

Jump to

Keyboard shortcuts

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