bitwarden

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

Bitwarden API Client

This package provides a client for the Bitwarden API, which is used to interact with the Bitwarden password manager.

References:

Documentation

Overview

bitwarden implements an API client for bitwarden

References:

https://github.com/jcs/rubywarden/blob/master/API.md
https://github.com/mvdan/bitw/blob/master/auth.go
https://github.com/philhug/bitwarden-client-go

bitwarden implements an API client for bitwarden

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptCredentials added in v1.0.1

func OptCredentials(clientId, secret string) client.ClientOpt

Set the client_id and client_secret

func OptDevice added in v1.0.1

func OptDevice(device schema.Device) client.ClientOpt

Set the device, populating missing fields

func OptFileStorage added in v1.0.2

func OptFileStorage(cachePath string) client.ClientOpt

Use file storage engine to read and write data

func OptStorage added in v1.0.2

func OptStorage(v Storage) client.ClientOpt

Use a storage engine to read and write data

Types

type Client

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

func New

func New(opts ...client.ClientOpt) (*Client, error)

func (*Client) Ciphers added in v1.0.2

func (c *Client) Ciphers(opts ...RequestOpt) (schema.Iterator[*schema.Cipher], error)

Return cipher iterator

func (*Client) Folders added in v1.0.2

func (c *Client) Folders(opts ...RequestOpt) (schema.Iterator[*schema.Folder], error)

Return folder iterator

func (*Client) Login

func (c *Client) Login(opts ...RequestOpt) error

Login sets the session token. Use OptForce to request token even if there is a valid token

func (*Client) Session added in v1.0.2

func (c *Client) Session() *schema.Session

Session returns the copy of the current session

func (*Client) Sync added in v1.0.1

func (c *Client) Sync(opts ...RequestOpt) (*schema.Profile, error)

Sync folders, cipers and folders with storage, and return the profile

type Login added in v1.0.1

type Login struct {
	GrantType    string `json:"grant_type"`
	Scope        string `json:"scope"`
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

type RequestOpt added in v1.0.2

type RequestOpt func(*opt) error

func OptForce added in v1.0.1

func OptForce() RequestOpt

Force login by clearing the token

func OptPassword added in v1.0.2

func OptPassword(v string) RequestOpt

Set decryption password

type Storage added in v1.0.2

type Storage interface {
	// Read the session from storage a session id, returns nil if there is no session
	ReadSession() (*schema.Session, error)

	// Write the session to storage
	WriteSession(*schema.Session) error

	// Read the profile from storage
	ReadProfile() (*schema.Profile, error)

	// Write the profile to storage
	WriteProfile(*schema.Profile) error

	// Write the folders to storage
	WriteFolders(schema.Folders) error

	// Write the ciphers to storage
	WriteCiphers(schema.Ciphers) error

	// Read all ciphers and return an iterator
	ReadCiphers() (schema.Iterator[*schema.Cipher], error)

	// Read all folders and return an iterator
	ReadFolders() (schema.Iterator[*schema.Folder], error)
}

Storage is an interface for reading and writing session, profile, folder and cipher information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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