Documentation ¶
Overview ¶
Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc> This file is covered by the license at https://github.com/mvdan/bitw/blob/master/LICENSE
Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc> This file is covered by the license at https://github.com/mvdan/bitw/blob/master/LICENSE
Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc> This file is covered by the license at https://github.com/mvdan/bitw/blob/master/LICENSE
- Copyright 2022 Martin Proffitt <mproffitt@choclab.net> *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc> This file is covered by the license at https://github.com/mvdan/bitw/blob/master/LICENSE
- Copyright 2022 Martin Proffitt <mproffitt@choclab.net> *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc> This file is covered by the license at https://github.com/mvdan/bitw/blob/master/LICENSE
Index ¶
- Constants
- Variables
- func DeriveHttpGetAPIKey(partial string) string
- func GetFolder(path string) uuid.UUID
- func Prelogin(email string) (*preLoginResponse, error)
- func ReadLine(prompt string) (string, error)
- func ReadPassword(prompt string) (string, error)
- func SetMasterPassword(password, email string, plr *preLoginResponse) string
- func Sync(ctx context.Context) error
- type AuthToken
- type Card
- type Cipher
- type CipherString
- type CipherStringType
- type CipherType
- type DataFile
- type DecryptedCipher
- type Field
- type FieldType
- type Folder
- type Identity
- type Login
- type LoginResponse
- type Organization
- type Profile
- type SecureNote
- type SecureNoteType
- type SyncData
- type TwoFactorProvider
- type URI
- type URIMatch
Constants ¶
const CHUNKSIZE int = 5
const MAX_RETRIES = 5
Variables ¶
var ( ApiServer string IdtServer string EmailAddr string )
Functions ¶
func DeriveHttpGetAPIKey ¶
func ReadPassword ¶
func SetMasterPassword ¶
Types ¶
type Card ¶
type Card struct { CardholderName CipherString Brand CipherString Number CipherString ExpMonth CipherString ExpYear CipherString Code CipherString }
type Cipher ¶
type Cipher struct { Type CipherType ID uuid.UUID Name CipherString Edit bool RevisionDate time.Time FolderID *uuid.UUID `json:",omitempty"` OrganizationID *uuid.UUID `json:",omitempty"` Favorite bool `json:",omitempty"` Attachments interface{} `json:",omitempty"` OrganizationUseTotp bool `json:",omitempty"` CollectionIDs []string `json:",omitempty"` Fields []Field `json:",omitempty"` Card *Card `json:",omitempty"` Identity *Identity `json:",omitempty"` Login *Login `json:",omitempty"` Notes *CipherString `json:",omitempty"` SecureNote *SecureNote `json:",omitempty"` }
type CipherString ¶
type CipherString struct { Type CipherStringType IV, CT, MAC []byte }
func (CipherString) IsZero ¶
func (s CipherString) IsZero() bool
func (CipherString) MarshalText ¶
func (s CipherString) MarshalText() ([]byte, error)
func (CipherString) String ¶
func (s CipherString) String() string
func (*CipherString) UnmarshalText ¶
func (s *CipherString) UnmarshalText(data []byte) error
type CipherStringType ¶
type CipherStringType int
const ( AesCbc256_B64 CipherStringType = 0 AesCbc128_HmacSha256_B64 CipherStringType = 1 AesCbc256_HmacSha256_B64 CipherStringType = 2 Rsa2048_OaepSha256_B64 CipherStringType = 3 Rsa2048_OaepSha1_B64 CipherStringType = 4 Rsa2048_OaepSha256_HmacSha256_B64 CipherStringType = 5 Rsa2048_OaepSha1_HmacSha256_B64 CipherStringType = 6 )
func (CipherStringType) HasMAC ¶
func (t CipherStringType) HasMAC() bool
type CipherType ¶
type CipherType int
const ( CipherLogin CipherType CipherCard CipherIdentity CipherNote )
type DecryptedCipher ¶
type DecryptedCipher struct { Type int `json:"type"` ID uuid.UUID `json:"id"` RevisionDate time.Time `json:"revision_date"` Name string `json:"name"` Fields map[string]string `json:"fields"` FolderID *uuid.UUID `json:"folder_id,omitempty"` OrganizationID *uuid.UUID `json:"org_id,omitempty"` Username string `json:"username"` Password string `json:"password"` }
func Get ¶
func Get(path string) ([]DecryptedCipher, bool)
func (*DecryptedCipher) Get ¶
func (d *DecryptedCipher) Get(what string) (value interface{})
type Field ¶
type Field struct { Type FieldType Name CipherString Value CipherString }
type Identity ¶
type Identity struct { Title CipherString FirstName CipherString MiddleName CipherString LastName CipherString Username CipherString Company CipherString SSN CipherString PassportNumber CipherString LicenseNumber CipherString Email CipherString Phone CipherString Address1 CipherString Address2 CipherString Address3 CipherString City CipherString State CipherString PostalCode CipherString Country CipherString }
type Login ¶
type Login struct { Password CipherString URI CipherString URIs []URI Username CipherString `json:",omitempty"` Totp string `json:",omitempty"` }
type LoginResponse ¶
type LoginResponse struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` TokenType string `json:"token_type"` RefreshToken string `json:"refresh_token"` Key string `json:"key"` }
func ApiLogin ¶
func ApiLogin(clientId, clientSecret string) (*LoginResponse, error)
func UserLogin ¶
func UserLogin(hashedPassword, email string) (*LoginResponse, error)
type Organization ¶
type Profile ¶
type Profile struct { ID uuid.UUID Name string Email string EmailVerified bool Premium bool MasterPasswordHint string Culture string TwoFactorEnabled bool Key CipherString PrivateKey CipherString SecurityStamp string Organizations []Organization }
type SecureNote ¶
type SecureNote struct {
Type SecureNoteType
}
type SecureNoteType ¶
type SecureNoteType int
type TwoFactorProvider ¶
type TwoFactorProvider int
const ( Authenticator TwoFactorProvider = 0 Email TwoFactorProvider = 1 Duo TwoFactorProvider = 2 YubiKey TwoFactorProvider = 3 U2f TwoFactorProvider = 4 Remember TwoFactorProvider = 5 OrganizationDuo TwoFactorProvider = 6 )
Enum values copied from https://github.com/bitwarden/server/blob/f311f40d9333442a727eb8b77f3859597de199da/src/Core/Enums/TwoFactorProviderType.cs. Do not use iota, to clarify that these integer values are defined elsewhere.
func (TwoFactorProvider) Line ¶
func (t TwoFactorProvider) Line(extra map[string]interface{}) string
func (*TwoFactorProvider) UnmarshalText ¶
func (t *TwoFactorProvider) UnmarshalText(text []byte) error