settings

package
v0.0.0-...-4b98c26 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DocTypeVersion = "1"

DocTypeVersion represents the doctype version. Each time this document structure is modified, update this value

Variables

View Source
var ErrMissingOrgKey = errors.New("No organization key")

ErrMissingOrgKey is used when the organization key does not exist

Functions

func HasVault

func HasVault(inst *instance.Instance) bool

HasVault returns true if a pass/bitwarden has been used on this instance.

func UpdateRevisionDate

func UpdateRevisionDate(inst *instance.Instance, settings *Settings) error

UpdateRevisionDate updates the updatedAt field of the bitwarden settings document. This field is used to know by some clients to know the date of the last change on the server before doing a full sync.

Types

type Settings

type Settings struct {
	CouchID                 string                 `json:"_id,omitempty"`
	CouchRev                string                 `json:"_rev,omitempty"`
	PassphraseKdf           int                    `json:"passphrase_kdf,omitempty"`
	PassphraseKdfIterations int                    `json:"passphrase_kdf_iterations,omitempty"`
	PassphraseHint          string                 `json:"passphrase_hint,omitempty"`
	SecurityStamp           string                 `json:"security_stamp,omitempty"`
	Key                     string                 `json:"key,omitempty"`
	PublicKey               string                 `json:"public_key,omitempty"`
	PrivateKey              string                 `json:"private_key,omitempty"`
	EncryptedOrgKey         string                 `json:"encrypted_organization_key,omitempty"`
	OrganizationID          string                 `json:"organization_id,omitempty"`
	CollectionID            string                 `json:"collection_id,omitempty"`
	EquivalentDomains       [][]string             `json:"equivalent_domains,omitempty"`
	GlobalEquivalentDomains []int                  `json:"global_equivalent_domains,omitempty"`
	Metadata                *metadata.CozyMetadata `json:"cozyMetadata,omitempty"`
	ExtensionInstalled      bool                   `json:"extension_installed,omitempty"`
}

Settings is the struct that holds the birwarden settings

func Get

func Get(inst *instance.Instance) (*Settings, error)

Get returns the settings document for bitwarden.

func (*Settings) Clone

func (s *Settings) Clone() couchdb.Doc

Clone implements couchdb.Doc

func (*Settings) DocType

func (s *Settings) DocType() string

DocType returns the settings document type

func (*Settings) EnsureCozyOrganization

func (s *Settings) EnsureCozyOrganization(inst *instance.Instance) error

EnsureCozyOrganization make sure that the settings for the Cozy organization are set.

func (*Settings) ID

func (s *Settings) ID() string

ID returns the settings qualified identifier

func (*Settings) OrganizationKey

func (s *Settings) OrganizationKey() ([]byte, error)

OrganizationKey returns the organization key (in clear, not encrypted).

func (*Settings) Rev

func (s *Settings) Rev() string

Rev returns the settings revision

func (*Settings) Save

func (s *Settings) Save(inst *instance.Instance) error

Save persists the settings document for bitwarden in CouchDB.

func (*Settings) SetID

func (s *Settings) SetID(id string)

SetID changes the settings qualified identifier

func (*Settings) SetKeyPair

func (s *Settings) SetKeyPair(inst *instance.Instance, pub, priv string) error

SetKeyPair is used to save the key pair of the user, that will be used to share passwords with the cozy organization.

func (*Settings) SetRev

func (s *Settings) SetRev(rev string)

SetRev changes the settings revision

Jump to

Keyboard shortcuts

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