bitw

package
v0.0.0-...-ebbfc2d Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT, BSD-3-Clause Imports: 37 Imported by: 0

README

This is a modified package of https://github.com/mvdan/bitw .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoLogin

func DoLogin(email string, password string, urlApi string, urlIdentity string) error

func GetEncKeyB64

func GetEncKeyB64() string

func GetUserID

func GetUserID() string

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"`
}

func (*Cipher) Match

func (c *Cipher) Match(attr, value string) bool

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
)

Taken from https://github.com/bitwarden/jslib/blob/f30d6f8027055507abfdefd1eeb5d9aab25cc601/src/enums/encryptionType.ts

func (CipherStringType) HasMAC

func (t CipherStringType) HasMAC() bool

type CipherType

type CipherType int
const (
	CipherLogin CipherType
	CipherCard
	CipherIdentity
	CipherNote
)

type Field

type Field struct {
	Type  FieldType
	Name  CipherString
	Value CipherString
}

type FieldType

type FieldType int

type Folder

type Folder struct {
	ID           uuid.UUID
	Name         string
	RevisionDate time.Time
}

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 KDFType

type KDFType int
const (
	KDFTypePBKDF2   KDFType = 0
	KDFTypeArgon2id KDFType = 1
)

type Login

type Login struct {
	Password CipherString
	URI      CipherString
	URIs     []URI
	Username CipherString `json:",omitempty"`
	Totp     string       `json:",omitempty"`
}

type Organization

type Organization struct {
	Object          string
	Id              uuid.UUID
	Name            string
	UseGroups       bool
	UseDirectory    bool
	UseEvents       bool
	UseTotp         bool
	Use2fa          bool
	UseApi          bool
	UsersGetPremium bool
	SelfHost        bool
	Seats           int
	MaxCollections  int
	MaxStorageGb    int
	Key             string
	Status          int
	Type            int
	Enabled         bool
}

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 SyncData

type SyncData struct {
	Profile Profile
	Folders []Folder
	Ciphers []Cipher
}

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
	WebAuthn        TwoFactorProvider = 7
)

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

type URI

type URI struct {
	URI   string
	Match URIMatch
}

type URIMatch

type URIMatch int

Jump to

Keyboard shortcuts

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