bitwarden

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusUnauthenticated = Status(0)
	StatusLocked          = Status(1)
	StatusUnlocked        = Status(2)
)

Variables

View Source
var (
	ErrNotLoggedIn   = errors.New("not logged in")
	ErrWrongSession  = errors.New("BW_SESSION either wrong or expired")
	ErrNoSuchItem    = errors.New("no such item")
	ErrItemNotUnique = errors.New("item not unique")

	DetailWrongSession = "" /* 204-byte string literal not displayed */
)
View Source
var (
	ErrIllegalStatus = errors.New("illegal status")
)

Functions

This section is empty.

Types

type Attachment

type Attachment []byte

func (Attachment) String

func (this Attachment) String() string

func (Attachment) ToReader

func (this Attachment) ToReader() io.Reader

func (Attachment) ToTempFile

func (this Attachment) ToTempFile(name string) (*AttachmentTempFile, error)

type AttachmentTempFile

type AttachmentTempFile struct {
	Name string
}

func (*AttachmentTempFile) Close

func (this *AttachmentTempFile) Close() error

func (AttachmentTempFile) String

func (this AttachmentTempFile) String() string

type Bitwarden

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

func NewBitwarden

func NewBitwarden(session, executable string) (*Bitwarden, error)

func (*Bitwarden) CreateAttachment

func (this *Bitwarden) CreateAttachment(of Item, attachmentName string, attachment Attachment) (gErr error)

func (*Bitwarden) DeleteAttachment

func (this *Bitwarden) DeleteAttachment(of Item, attachment ItemAttachmentReference) (gErr error)

func (*Bitwarden) Errorf

func (this *Bitwarden) Errorf(args []string, msg string, msgArgs ...interface{}) error

func (*Bitwarden) Execute

func (this *Bitwarden) Execute(customizer CommandCustomizer, args ...string) ([]byte, error)

func (*Bitwarden) ExecuteAndUnmarshal

func (this *Bitwarden) ExecuteAndUnmarshal(customizer CommandCustomizer, to interface{}, args ...string) error

func (*Bitwarden) ExecuteDirect

func (this *Bitwarden) ExecuteDirect(customizer CommandCustomizer, args ...string) ([]byte, string, error)

func (*Bitwarden) FindItem

func (this *Bitwarden) FindItem(q ItemQuery) (*Item, error)

func (*Bitwarden) FindItems

func (this *Bitwarden) FindItems(q ItemsQuery) (Items, error)

func (*Bitwarden) FormatArgs

func (this *Bitwarden) FormatArgs(args []string) string

func (*Bitwarden) GetAttachment

func (this *Bitwarden) GetAttachment(of Item, attachmentId string, base64encoded bool) (string, error)

func (*Bitwarden) GetAttachments

func (this *Bitwarden) GetAttachments(of Item, by ItemAttachmentQueries) (ItemAttachments, error)

func (*Bitwarden) GetItem

func (this *Bitwarden) GetItem(id string, aq ItemAttachmentQueries) (*Item, error)

func (*Bitwarden) Session

func (this *Bitwarden) Session() string

func (*Bitwarden) Status

func (this *Bitwarden) Status() (status Status, user string, err error)

func (*Bitwarden) Sync

func (this *Bitwarden) Sync() error

func (*Bitwarden) Test

func (this *Bitwarden) Test() (bool, error)

func (*Bitwarden) Unlock

func (this *Bitwarden) Unlock(onlyIfRequired bool) error

type CommandCustomizer

type CommandCustomizer func(*exec.Cmd)

type Item

type Item struct {
	Object               string                   `json:"object"`
	Id                   string                   `json:"id"`
	OrganizationId       *string                  `json:"organizationId"`
	FolderId             *string                  `json:"folderId"`
	Type                 int                      `json:"type"`
	Reprompt             int                      `json:"reprompt"`
	Name                 string                   `json:"name"`
	Favorite             bool                     `json:"favorite"`
	Fields               ItemFields               `json:"fields"`
	Login                ItemLogin                `json:"login"`
	CollectionIds        []string                 `json:"collectionIds"`
	AttachmentReferences ItemAttachmentReferences `json:"attachments"`
	ResolvedAttachments  ItemAttachments          `json:"-"`
	RevisionDate         *time.Time               `json:"revisionDate"`
}

func (*Item) ResolveAttachments

func (this *Item) ResolveAttachments(by ItemAttachmentQueries, using *Bitwarden) error

func (Item) ToResponse

func (this Item) ToResponse() map[string]interface{}

type ItemAttachmentQueries

type ItemAttachmentQueries []ItemAttachmentQuery

func (*ItemAttachmentQueries) Parse

func (this *ItemAttachmentQueries) Parse(plain interface{}) error

type ItemAttachmentQuery

type ItemAttachmentQuery struct {
	Name            string
	FilenameMatches *regexp.Regexp
	Base64Encode    bool
	Unique          bool
}

func (*ItemAttachmentQuery) Parse

func (this *ItemAttachmentQuery) Parse(plain interface{}) error

type ItemAttachmentReference

type ItemAttachmentReference struct {
	Id       string `json:"id"`
	FileName string `json:"fileName"`
	Size     string `json:"size"`
	Url      string `json:"url"`
}

type ItemAttachmentReferences

type ItemAttachmentReferences []ItemAttachmentReference

type ItemAttachments

type ItemAttachments map[string]string

type ItemField

type ItemField struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Type     uint8  `json:"type"`
	LinkedId string `json:"linkedId"`
}

type ItemFields

type ItemFields []ItemField

func (ItemFields) Lookup

func (this ItemFields) Lookup(name string) (ItemField, bool)

type ItemLogin

type ItemLogin struct {
	Uris     ItemLoginUris `json:"uris"`
	Username string        `json:"username"`
	Password string        `json:"password"`
	Totp     string        `json:"totp"`
}

type ItemLoginUri

type ItemLoginUri struct {
	Match string `json:"match"`
	Uri   string `json:"uri"`
}

type ItemLoginUris

type ItemLoginUris []ItemLoginUri

func (ItemLoginUris) ToResponse

func (this ItemLoginUris) ToResponse() []string

type ItemQuery

type ItemQuery struct {
	Name           string
	OrganizationId string
	CollectionId   string
	FolderId       string

	Attachments ItemAttachmentQueries

	OnTooBroadQuery func()
}

type Items

type Items []Item

func (Items) ToResponse

func (this Items) ToResponse() []map[string]interface{}

type ItemsQuery

type ItemsQuery struct {
	Search         string
	OrganizationId string
	CollectionId   string
	FolderId       string

	Attachments ItemAttachmentQueries

	OnTooBroadQuery func()
}

type Status

type Status uint8

func (Status) IsUsable

func (this Status) IsUsable() bool

func (Status) MarshalText

func (this Status) MarshalText() ([]byte, error)

func (Status) String

func (this Status) String() string

func (*Status) UnmarshalText

func (this *Status) UnmarshalText(in []byte) error

Jump to

Keyboard shortcuts

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