Documentation ¶
Index ¶
- Variables
- func AskDeletion(inst *instance.Instance) error
- func Block(inst *instance.Instance, reason ...string) error
- func CheckHint(inst *instance.Instance, setting *settings.Settings, hint string) error
- func CheckMagicLink(inst *instance.Instance, code string) error
- func CheckPassphraseRenewToken(inst *instance.Instance, tok []byte) error
- func ChooseCouchCluster(clusters []config.CouchDBCluster) (int, error)
- func Create(opts *Options) (*instance.Instance, error)
- func CreateKeyPair(symKey []byte) (string, string, error)
- func CreateMagicLinkCode(inst *instance.Instance) (string, error)
- func CreatePassphraseKey(masterKey []byte) (string, []byte, 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, from string) error
- func Reset(inst *instance.Instance) error
- func SendHint(inst *instance.Instance) error
- func SendMagicLink(inst *instance.Instance, redirect string) error
- func SendMailConfirmationCode(inst *instance.Instance) error
- func SendTwoFactorPasscode(inst *instance.Instance) ([]byte, error)
- func Unblock(inst *instance.Instance) error
- func UpdatePassphrase(inst *instance.Instance, current []byte, twoFactorPasscode string, ...) error
- func UpdateViewsAndIndex(inst *instance.Instance) error
- type Options
- type PassParameters
- type Store
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).
var ErrInvalidMagicLink = errors.New("invalid magic link")
ErrInvalidMagicLink is used when the code for a magic link is invalid
var ErrMagicLinkNotAvailable = errors.New("magic link is not available on this instance")
ErrMagicLinkNotAvailable is used when requesting a magic link on a Cozy where this feature has not been activated.
Functions ¶
func AskDeletion ¶
func CheckHint ¶
CheckHint returns true if the hint is valid, ie it is not the same as the password.
func CheckPassphraseRenewToken ¶
CheckPassphraseRenewToken checks whether the given token is good to use for resetting the passphrase.
func ChooseCouchCluster ¶
func ChooseCouchCluster(clusters []config.CouchDBCluster) (int, error)
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 DefineViewsAndIndex ¶
DefineViewsAndIndex can be used to ensure that the CouchDB views and indexes used by the stack are correctly set. It expects that most index/view don't exist. It is faster when creating a new instance for example.
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 UpdatePassphrase ¶
func UpdatePassphrase( inst *instance.Instance, current []byte, twoFactorPasscode string, twoFactorToken []byte, params PassParameters, ) error
UpdatePassphrase replace the passphrase
func UpdateViewsAndIndex ¶
UpdateViewsAndIndex can be used to ensure that the CouchDB views and indexes used by the stack are correctly set. It has the same effect as DefineViewsAndIndex, but it expect most index/views already exist.
Types ¶
type Options ¶
type Options struct { Domain string DomainAliases []string Locale string UUID string OIDCID string FranceConnectID string TOSSigned string TOSLatest string Timezone string ContextName string Sponsorships []string FeatureSets []string Email string PublicName string Settings string SettingsObj *couchdb.JSONDoc AuthMode string Passphrase string Key string KdfIterations int SwiftLayout int CouchCluster int DiskQuota int64 Apps []string AutoUpdate *bool MagicLink *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