bw

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBitwardenServerURL = "https://vault.bitwarden.com"
)
View Source
const (
	RevisionDateLayout = "2006-01-02T15:04:05.000Z"
)

Variables

View Source
var (
	ErrNotFound = errNotFound()
)

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateObject(Object) (*Object, error)
	EditObject(Object) (*Object, error)
	HasSessionKey() bool
	SetSessionKey(string)
	GetObject(Object) (*Object, error)
	LoginWithPassword(username, password string) error
	LoginWithAPIKey(password, clientId, clientSecret string) error
	Logout() error
	RemoveObject(Object) error
	SetServer(string) error
	Status() (*Status, error)
	Sync() error
	Unlock(password string) error
}

func NewClient

func NewClient(execPath string, opts ...Options) Client

type Field

type Field struct {
	Name  string    `json:"name,omitempty"`
	Value string    `json:"value,omitempty"`
	Type  FieldType `json:"type,omitempty"`
}

type FieldType

type FieldType int
const (
	FieldTypeText    FieldType = 0
	FieldTypeHidden  FieldType = 1
	FieldTypeBoolean FieldType = 2
	FieldTypeLinked  FieldType = 3
)

type ItemType

type ItemType int
const (
	ItemTypeLogin      ItemType = 1
	ItemTypeSecureNote ItemType = 2
)

type Login

type Login struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Totp     string `json:"totp,omitempty"`
}

type Object

type Object struct {
	CollectionIds  []string   `json:"collectionIds,omitempty"`
	ID             string     `json:"id,omitempty"`
	ExternalID     string     `json:"externalId,omitempty"`
	FolderID       string     `json:"folderId,omitempty"`
	Login          Login      `json:"login,omitempty"`
	Name           string     `json:"name,omitempty"`
	Notes          string     `json:"notes,omitempty"`
	Object         ObjectType `json:"object,omitempty"`
	OrganizationID string     `json:"organizationId,omitempty"`
	SecureNote     SecureNote `json:"secureNote,omitempty"`
	Type           ItemType   `json:"type,omitempty"`
	Fields         []Field    `json:"fields,omitempty"`
	Reprompt       int        `json:"reprompt,omitempty"`
	Favorite       bool       `json:"favorite,omitempty"`
	RevisionDate   *time.Time `json:"revisionDate,omitempty"`
}

type ObjectType

type ObjectType string
const (
	ObjectTypeItem   ObjectType = "item"
	ObjectTypeFolder ObjectType = "folder"
)

type Options

type Options func(c Client)

func DisableSync

func DisableSync() Options

func WithAppDataDir

func WithAppDataDir(appDataDir string) Options

type SecureNote

type SecureNote struct {
	Type int `json:"type,omitempty"`
}

type Status

type Status struct {
	ServerURL string      `json:"serverURL,omitempty"`
	LastSync  time.Time   `json:"lastSync,omitempty"`
	UserEmail string      `json:"userEmail,omitempty"`
	UserID    string      `json:"userID,omitempty"`
	Status    VaultStatus `json:"status,omitempty"`
}

func (*Status) VaultFromServer added in v0.3.2

func (s *Status) VaultFromServer(serverUrl string) bool

func (*Status) VaultOfUser added in v0.3.2

func (s *Status) VaultOfUser(email string) bool

type VaultStatus

type VaultStatus string
const (
	StatusLocked          VaultStatus = "locked"
	StatusUnauthenticated VaultStatus = "unauthenticated"
	StatusUnlocked        VaultStatus = "unlocked"
)

Jump to

Keyboard shortcuts

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