Documentation ¶
Index ¶
- Variables
- func Block(inst *instance.Instance, reason ...string) error
- func CheckHint(inst *instance.Instance, setting *settings.Settings, hint string) error
- func CheckPassphrase(inst *instance.Instance, pass []byte) error
- func CheckPassphraseRenewToken(inst *instance.Instance, tok []byte) error
- func Create(opts *Options) (*instance.Instance, error)
- func CreateKeyPair(symKey []byte) (string, string, error)
- func CreatePassphraseKey(masterKey []byte) (string, []byte, error)
- func CreateWithoutHooks(opts *Options) (*instance.Instance, error)
- func DefineViewsAndIndex(inst *instance.Instance) error
- func Destroy(domain string) error
- func ForceUpdatePassphrase(inst *instance.Instance, newPassword []byte, params PassParameters) error
- func GetInstance(domain string) (*instance.Instance, error)
- func ManagerSignTOS(inst *instance.Instance, originalReq *http.Request) error
- func NewSecurityStamp() string
- func PassphraseRenew(inst *instance.Instance, tok []byte, params PassParameters) error
- func Patch(i *instance.Instance, opts *Options) error
- func RegisterPassphrase(inst *instance.Instance, tok []byte, params PassParameters) error
- func RequestPassphraseReset(inst *instance.Instance) error
- func Reset(inst *instance.Instance) error
- func SendHint(inst *instance.Instance) error
- func SendMail(inst *instance.Instance, m *Mail) error
- func SendMailConfirmationCode(inst *instance.Instance) error
- func SendTwoFactorPasscode(inst *instance.Instance) ([]byte, error)
- func Triggers(db prefixer.Prefixer) []job.TriggerInfos
- func Unblock(inst *instance.Instance) error
- func UpdatePassphrase(inst *instance.Instance, current []byte, twoFactorPasscode string, ...) error
- type Mail
- type Options
- type PassParameters
Constants ¶
This section is empty.
Variables ¶
var AskReupload func(*instance.Instance) error
AskReupload is the function that will be called when the disk quota is increased to ask reuploading files from the sharings. A package variable is used to avoid a dependency on the model/sharing package (which would lead to circular import issue).
var ErrHintSameAsPassword = errors.New("The hint cannot be the same as the password")
ErrHintSameAsPassword is used when trying to set an hint that is the same as the password, which would defeat security (e.g. the hint is not encrypted in CouchDB).
Functions ¶
func CheckHint ¶
CheckHint returns true if the hint is valid, ie it is not the same as the password.
func CheckPassphrase ¶
CheckPassphrase confirm an instance password
func CheckPassphraseRenewToken ¶
CheckPassphraseRenewToken checks whether the given token is good to use for resetting the passphrase.
func CreateKeyPair ¶
CreateKeyPair creates a key pair for sharing ciphers with a bitwarden organization. It returns in first position the public key, and in second position the private key. The public key is encoded in base64. The private key is encrypted, and in in the cipherString format.
func CreatePassphraseKey ¶
CreatePassphraseKey creates an encryption key for Bitwarden. It returns in the first position the key encrypted with the masterKey, and in clear in second position. See https://github.com/jcs/rubywarden/blob/master/API.md
func CreateWithoutHooks ¶
CreateWithoutHooks builds an instance and initializes it. The difference with Create is that script hooks are not executed for this function.
func DefineViewsAndIndex ¶
DefineViewsAndIndex can be used to ensure that the CouchDB views and indexes used by the stack are correctly set.
func Destroy ¶
Destroy is used to remove the instance. All the data linked to this instance will be permanently deleted.
func ForceUpdatePassphrase ¶
func ForceUpdatePassphrase(inst *instance.Instance, newPassword []byte, params PassParameters) error
ForceUpdatePassphrase replace the passphrase without checking the current one
func GetInstance ¶
GetInstance retrieves the instance for a request by its host.
func ManagerSignTOS ¶
ManagerSignTOS make a request to the manager in order to finalize the TOS signing flow.
func NewSecurityStamp ¶
func NewSecurityStamp() string
NewSecurityStamp returns a new UUID that can be used as a security stamp.
func PassphraseRenew ¶
func PassphraseRenew(inst *instance.Instance, tok []byte, params PassParameters) error
PassphraseRenew changes the passphrase to the specified one if the given token matches the `PassphraseResetToken` field.
func Patch ¶
Patch updates the given instance with the specified options if necessary. It can also update the settings document if provided in the options.
func RegisterPassphrase ¶
func RegisterPassphrase(inst *instance.Instance, tok []byte, params PassParameters) error
RegisterPassphrase replace the instance registerToken by a passphrase
func RequestPassphraseReset ¶
RequestPassphraseReset generates a new registration token for the user to renew its password.
func Reset ¶
Reset will clean all the data from the instances, and most apps. It should be used only just before an import.
func SendMailConfirmationCode ¶
SendMailConfirmationCode send a code to validate the email of the instance in order to activate 2FA.
func SendTwoFactorPasscode ¶
SendTwoFactorPasscode sends by mail the two factor secret to the owner of the instance. It returns the generated token.
func Triggers ¶
func Triggers(db prefixer.Prefixer) []job.TriggerInfos
Triggers returns the list of the triggers to add when an instance is created
func UpdatePassphrase ¶
func UpdatePassphrase( inst *instance.Instance, current []byte, twoFactorPasscode string, twoFactorToken []byte, params PassParameters, ) error
UpdatePassphrase replace the passphrase
Types ¶
type Options ¶
type Options struct { Domain string DomainAliases []string Locale string UUID string OIDCID string TOSSigned string TOSLatest string Timezone string ContextName string Email string PublicName string Settings string SettingsObj *couchdb.JSONDoc AuthMode string Passphrase string Key string KdfIterations int SwiftLayout int DiskQuota int64 Apps []string AutoUpdate *bool Debug *bool Traced *bool OnboardingFinished *bool Blocked *bool BlockingReason string FromCloudery bool // Do not call the cloudery when the changes come from it }
Options holds the parameters to create a new instance.
type PassParameters ¶
type PassParameters struct { Pass []byte // Pass is the password hashed on client side, but not yet on server. Iterations int // Iterations is the number of iterations applied by PBKDF2 on client side. Key string // Key is the encryption key (encrypted, and in CipherString format). PublicKey string // PublicKey is part of the key pair for bitwarden (encoded in base64). PrivateKey string // PrivateKey is the other part (encrypted, in CipherString format). Hint string // Hint is the hint for the user to find again their password }
PassParameters are the parameters for setting a new passphrase