Documentation ¶
Index ¶
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) GetCache() map[string]string
- func (c *Client) GetSecret(ctx context.Context, id string) (*PassboltSecretDefinition, error)
- func (c *Client) GetSecretID(name string) (string, error)
- func (c *Client) GetSecretName(id string) (string, error)
- func (c *Client) LoadCache(ctx context.Context) error
- func (c *Client) ReLogin(ctx context.Context) error
- type PassboltSecretDefinition
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 ¶
NewClient initializes a new passbolt client and logs in. The client is configured to use the given URL, username and password.
func (*Client) Close ¶
Close logs out of the passbolt client. This should be called when the client is no longer needed.
func (*Client) GetSecret ¶
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
GetSecretID retrieves the secret ID for the given secret name from the cache.
func (*Client) GetSecretName ¶ added in v1.3.0
GetSecretName retrieves the secret name for the given secret ID from the cache.
func (*Client) LoadCache ¶
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.
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
func (p PassboltSecretDefinition) FieldValue(fieldName passboltv1alpha3.FieldName) string
FieldValue returns the value of the given field by name.