Documentation ¶
Overview ¶
modified from https://www.thepolyglotdeveloper.com/2018/02/encrypt-decrypt-data-golang-application-crypto-packages/
Generated by https://quicktype.io
Index ¶
- Constants
- func BWDelete(BITWARDENCLI_APPDATA_DIR string) error
- func BWGetAllAttachments(outputDir, sessionKey string, pws []PortWardenElement, sleepMilliseconds int) error
- func BWGetAttachment(outputDir, itemID, attachmentID, sessionKey string) error
- func BWListFoldersRawBytes(sessionKey string) ([]byte, error)
- func BWListItemsRawBytes(sessionKey string) ([]byte, error)
- func BWLoginGetSessionKey(lc *LoginCredentials) (string, error)
- func BWLoginGetSessionKeyAndDataJSON(lc *LoginCredentials, BITWARDENCLI_APPDATA_DIR string) (string, []byte, error)
- func BWLogout() error
- func CreateBackupBytes(passphrase, sessionKey string, sleepMilliseconds int) ([]byte, error)
- func CreateBackupBytesUsingBitwardenLocalJSON(dataJson []byte, BITWARDENCLI_APPDATA_DIR, passphrase, sessionKey string, ...) ([]byte, error)
- func CreateBackupFile(fileName, passphrase, sessionKey string, sleepMilliseconds int, noLogout bool) error
- func DecryptBackupFile(fileName, passphrase string) error
- func DecryptBytes(data []byte, passphrase string) ([]byte, error)
- func DeriveKey(passphrase string) []byte
- func EncryptBytes(data []byte, passphrase string) ([]byte, error)
- func ExtractSessionKey(stdout string) (string, error)
- func RestoreBackupFile(fileName, passphrase, sessionKey string, sleepMilliseconds int, noLogout bool) error
- func Unzip(src, dest string) error
- type Attachment
- type Card
- type Field
- type Identity
- type Login
- type LoginCredentials
- type Object
- type PasswordHistory
- type PortWarden
- type PortWardenElement
- type PortWardenFolder
- type PortWardenFolderElement
- type SecureNote
- type Uris
Constants ¶
View Source
const ( BackupFolderName = "./portwarden_backup/" ErrVaultIsLocked = "vault is locked" ErrNoPhassPhraseProvided = "no passphrase provided" ErrNoFilenameProvided = "no filename provided" ErrSessionKeyExtractionFailed = "session key extraction failed" ErrVaultNotEmptyForRestore = "account's valut not empty! you have to restore the backup to an empty Bitwarden account" BWErrNotLoggedIn = "You are not logged in." BWErrInvalidMasterPassword = "Invalid master password." BWEnterEmailAddress = "? Email address:" BWEnterMasterPassword = "? Master password:" LoginCredentialMethodNone = 100 LoginCredentialMethodAuthenticator = 0 LoginCredentialMethodEmail = 1 LoginCredentialMethodYubikey = 3 ItemsJsonFileName = "items.json" FoldersJSONFileName = "folders.json" )
View Source
const ( ErrMessageAuthenticationFailed = "cipher: message authentication failed" ErrWrongBackupPassphrase = "wrong backup passphrase entered" )
Variables ¶
This section is empty.
Functions ¶
func BWGetAllAttachments ¶
func BWGetAllAttachments(outputDir, sessionKey string, pws []PortWardenElement, sleepMilliseconds int) error
func BWGetAttachment ¶
func BWListFoldersRawBytes ¶
func BWListItemsRawBytes ¶
func BWLoginGetSessionKey ¶
func BWLoginGetSessionKey(lc *LoginCredentials) (string, error)
func BWLoginGetSessionKeyAndDataJSON ¶
func BWLoginGetSessionKeyAndDataJSON(lc *LoginCredentials, BITWARDENCLI_APPDATA_DIR string) (string, []byte, error)
func CreateBackupBytes ¶
func CreateBackupFile ¶
func DecryptBackupFile ¶
func ExtractSessionKey ¶
func RestoreBackupFile ¶
Types ¶
type Attachment ¶
type Identity ¶
type Identity struct { Title interface{} `json:"title"` FirstName interface{} `json:"firstName"` MiddleName interface{} `json:"middleName"` LastName interface{} `json:"lastName"` Address1 interface{} `json:"address1"` Address2 interface{} `json:"address2"` Address3 interface{} `json:"address3"` City interface{} `json:"city"` State interface{} `json:"state"` PostalCode interface{} `json:"postalCode"` Country interface{} `json:"country"` Company interface{} `json:"company"` Email interface{} `json:"email"` Phone interface{} `json:"phone"` Ssn interface{} `json:"ssn"` Username interface{} `json:"username"` PassportNumber interface{} `json:"passportNumber"` LicenseNumber interface{} `json:"licenseNumber"` }
type LoginCredentials ¶
type LoginCredentials struct { Email string `json:"email"` Password string `json:"password"` Method int `json:"method"` Code string `json:"code"` }
LoginCredentials is used to login to the `bw` cli. See documentation https://help.bitwarden.com/article/cli/ The possible `Method` values are None 100 Authenticator 0 Email 1 Yubikey 3
type PasswordHistory ¶
type PortWarden ¶
type PortWarden []PortWardenElement
type PortWardenElement ¶
type PortWardenElement struct { Object Object `json:"object"` ID string `json:"id"` OrganizationID *string `json:"organizationId"` FolderID *string `json:"folderId"` Type int64 `json:"type"` Name string `json:"name"` Notes *string `json:"notes"` Favorite bool `json:"favorite"` SecureNote *SecureNote `json:"secureNote,omitempty"` CollectionIDS []string `json:"collectionIds"` Attachments []Attachment `json:"attachments"` RevisionDate string `json:"revisionDate"` Login *Login `json:"login,omitempty"` PasswordHistory []PasswordHistory `json:"passwordHistory"` Fields []Field `json:"fields"` Card *Card `json:"card,omitempty"` Identity *Identity `json:"identity,omitempty"` }
type PortWardenFolder ¶
type PortWardenFolder []PortWardenFolderElement
type PortWardenFolderElement ¶
type SecureNote ¶
type SecureNote struct {
Type int64 `json:"type"`
}
Click to show internal directories.
Click to hide internal directories.