Documentation ¶
Index ¶
- Constants
- Variables
- func CreateAccessJWT(i *instance.Instance, c *oauth.Client) (string, error)
- func CreateRefreshJWT(i *instance.Instance, c *oauth.Client) (string, error)
- func DeleteUnrecoverableCiphers(inst *instance.Instance) error
- func IsBitwardenScope(scope string) bool
- func ParseBitwardenDeviceType(deviceType string) (string, string)
- type Cipher
- type CipherType
- type Collection
- type Contact
- type Field
- type Folder
- type GlobalEquivalentDomainsType
- type Icon
- type LoginData
- type LoginURI
- type MapData
- type OrgMember
- type OrgMemberStatus
- type Organization
- func (o *Organization) Clone() couchdb.Doc
- func (o *Organization) Delete(inst *instance.Instance) error
- func (o *Organization) DocType() string
- func (o *Organization) FindCiphers(inst *instance.Instance) ([]*Cipher, error)
- func (o *Organization) ID() string
- func (o *Organization) Rev() string
- func (o *Organization) SetID(id string)
- func (o *Organization) SetRev(rev string)
Constants ¶
const ( LoginType = 1 SecureNoteType = 2 CardType = 3 IdentityType = 4 )
LoginType, SecureNoteType, CardType, and IdentityType are the 4 possible types of ciphers.
const ( FieldTypeText = 0 FieldTypeHidden = 1 FieldTypeBoolean = 2 )
Possible types for ciphers additional fields
const DocTypeVersion = "1"
DocTypeVersion represents the doctype version. Each time this document structure is modified, update this value
Variables ¶
var BitwardenScope = strings.Join([]string{ consts.BitwardenProfiles, consts.BitwardenCiphers, consts.BitwardenFolders, consts.BitwardenOrganizations, consts.BitwardenContacts, consts.Konnectors, consts.AppsSuggestion, consts.Support, }, " ")
BitwardenScope is the OAuth scope, and it is hard-coded with the doctypes needed by the Bitwarden apps.
var GlobalDomains = map[GlobalEquivalentDomainsType][]string{ Ameritrade: {"ameritrade.com", "tdameritrade.com"}, BoA: {"bankofamerica.com", "bofa.com", "mbna.com", "usecfo.com"}, Sprint: {"sprint.com", "sprintpcs.com", "nextel.com"}, Google: {"youtube.com", "google.com", "gmail.com"}, Apple: {"apple.com", "icloud.com"}, WellsFargo: {"wellsfargo.com", "wf.com"}, Merrill: {"mymerrill.com", "ml.com", "merrilledge.com"}, Citi: {"accountonline.com", "citi.com", "citibank.com", "citicards.com", "citibankonline.com"}, Cnet: {"cnet.com", "cnettv.com", "com.com", "download.com", "news.com", "search.com", "upload.com"}, Gap: {"bananarepublic.com", "gap.com", "oldnavy.com", "piperlime.com"}, Microsoft: {"bing.com", "hotmail.com", "live.com", "microsoft.com", "msn.com", "passport.net", "windows.com", "microsoftonline.com", "office365.com", "microsoftstore.com", "xbox.com"}, United: {"ua2go.com", "ual.com", "united.com", "unitedwifi.com"}, Yahoo: {"overture.com", "yahoo.com"}, Zonelabs: {"zonealarm.com", "zonelabs.com"}, PayPal: {"paypal.com", "paypal-search.com"}, Avon: {"avon.com", "youravon.com"}, Diapers: {"diapers.com", "soap.com", "wag.com", "yoyo.com", "beautybar.com", "casa.com", "afterschool.com", "vine.com", "bookworm.com", "look.com", "vinemarket.com"}, Contacts: {"1800contacts.com", "800contacts.com"}, Amazon: {"amazon.com", "amazon.co.uk", "amazon.ca", "amazon.de", "amazon.fr", "amazon.es", "amazon.it", "amazon.com.au", "amazon.co.nz", "amazon.in"}, Cox: {"cox.com", "cox.net", "coxbusiness.com"}, Norton: {"mynortonaccount.com", "norton.com"}, Verizon: {"verizon.com", "verizon.net"}, Buy: {"rakuten.com", "buy.com"}, Sirius: {"siriusxm.com", "sirius.com"}, Ea: {"ea.com", "origin.com", "play4free.com", "tiberiumalliance.com"}, Basecamp: {"37signals.com", "basecamp.com", "basecamphq.com", "highrisehq.com"}, Steam: {"steampowered.com", "steamcommunity.com", "steamgames.com"}, Chart: {"chart.io", "chartio.com"}, Gotomeeting: {"gotomeeting.com", "citrixonline.com"}, Gogo: {"gogoair.com", "gogoinflight.com"}, Oracle: {"mysql.com", "oracle.com"}, Discover: {"discover.com", "discovercard.com"}, Dcu: {"dcu.org", "dcu-online.org"}, Healthcare: {"healthcare.gov", "cms.gov"}, Pepco: {"pepco.com", "pepcoholdings.com"}, Century21: {"century21.com", "21online.com"}, Comcast: {"comcast.com", "comcast.net", "xfinity.com"}, Cricket: {"cricketwireless.com", "aiowireless.com"}, Mtb: {"mandtbank.com", "mtb.com"}, Dropbox: {"dropbox.com", "getdropbox.com"}, Snapfish: {"snapfish.com", "snapfish.ca"}, Alibaba: {"alibaba.com", "aliexpress.com", "aliyun.com", "net.cn", "www.net.cn"}, Playstation: {"playstation.com", "sonyentertainmentnetwork.com"}, Mercado: {"mercadolivre.com", "mercadolivre.com.br", "mercadolibre.com", "mercadolibre.com.ar", "mercadolibre.com.mx"}, Zendesk: {"zendesk.com", "zopim.com"}, Autodesk: {"autodesk.com", "tinkercad.com"}, RailNation: {"railnation.ru", "railnation.de", "rail-nation.com", "railnation.gr", "railnation.us", "trucknation.de", "traviangames.com"}, Wpcu: {"wpcu.coop", "wpcuonline.com"}, Mathletics: {"mathletics.com", "mathletics.com.au", "mathletics.co.uk"}, Discountbank: {"discountbank.co.il", "telebank.co.il"}, Mi: {"mi.com", "xiaomi.com"}, Postepay: {"postepay.it", "poste.it"}, Facebook: {"facebook.com", "messenger.com"}, Skysports: {"skysports.com", "skybet.com", "skyvegas.com"}, Disney: {"disneymoviesanywhere.com", "go.com", "disney.com", "dadt.com"}, Pokemon: {"pokemon-gl.com", "pokemon.com"}, Uv: {"myuv.com", "uvvu.com"}, Mdsol: {"mdsol.com", "imedidata.com"}, Yahavo: {"bank-yahav.co.il", "bankhapoalim.co.il"}, Sears: {"sears.com", "shld.net"}, Xiami: {"xiami.com", "alipay.com"}, Belkin: {"belkin.com", "seedonk.com"}, Turbotax: {"turbotax.com", "intuit.com"}, Shopify: {"shopify.com", "myshopify.com"}, Ebay: {"ebay.com", "ebay.de", "ebay.ca", "ebay.in", "ebay.co.uk", "ebay.com.au"}, Techdata: {"techdata.com", "techdata.ch"}, Schwab: {"schwab.com", "schwabplan.com"}, Tesla: {"tesla.com", "teslamotors.com"}, MorganStanley: {"morganstanley.com", "morganstanleyclientserv.com", "stockplanconnect.com", "ms.com"}, TaxAct: {"taxact.com", "taxactonline.com"}, Wikimedia: {"mediawiki.org", "wikibooks.org", "wikidata.org", "wikimedia.org", "wikinews.org", "wikipedia.org", "wikiquote.org", "wikisource.org", "wikiversity.org", "wikivoyage.org", "wiktionary.org"}, Airbnb: {"airbnb.at", "airbnb.be", "airbnb.ca", "airbnb.ch", "airbnb.cl", "airbnb.co.cr", "airbnb.co.id", "airbnb.co.in", "airbnb.co.kr", "airbnb.co.nz", "airbnb.co.uk", "airbnb.co.ve", "airbnb.com", "airbnb.com.ar", "airbnb.com.au", "airbnb.com.bo", "airbnb.com.br", "airbnb.com.bz", "airbnb.com.co", "airbnb.com.ec", "airbnb.com.gt", "airbnb.com.hk", "airbnb.com.hn", "airbnb.com.mt", "airbnb.com.my", "airbnb.com.ni", "airbnb.com.pa", "airbnb.com.pe", "airbnb.com.py", "airbnb.com.sg", "airbnb.com.sv", "airbnb.com.tr", "airbnb.com.tw", "airbnb.cz", "airbnb.de", "airbnb.dk", "airbnb.es", "airbnb.fi", "airbnb.fr", "airbnb.gr", "airbnb.gy", "airbnb.hu", "airbnb.ie", "airbnb.is", "airbnb.it", "airbnb.jp", "airbnb.mx", "airbnb.nl", "airbnb.no", "airbnb.pl", "airbnb.pt", "airbnb.ru", "airbnb.se"}, Eventbrite: {"eventbrite.at", "eventbrite.be", "eventbrite.ca", "eventbrite.ch", "eventbrite.cl", "eventbrite.co.id", "eventbrite.co.in", "eventbrite.co.kr", "eventbrite.co.nz", "eventbrite.co.uk", "eventbrite.co.ve", "eventbrite.com", "eventbrite.com.au", "eventbrite.com.bo", "eventbrite.com.br", "eventbrite.com.co", "eventbrite.com.hk", "eventbrite.com.hn", "eventbrite.com.pe", "eventbrite.com.sg", "eventbrite.com.tr", "eventbrite.com.tw", "eventbrite.cz", "eventbrite.de", "eventbrite.dk", "eventbrite.fi", "eventbrite.fr", "eventbrite.gy", "eventbrite.hu", "eventbrite.ie", "eventbrite.is", "eventbrite.it", "eventbrite.jp", "eventbrite.mx", "eventbrite.nl", "eventbrite.no", "eventbrite.pl", "eventbrite.pt", "eventbrite.ru", "eventbrite.se"}, StackExchange: {"stackexchange.com", "superuser.com", "stackoverflow.com", "serverfault.com", "mathoverflow.net", "askubuntu.com"}, }
GlobalDomains is the list of the global equivalent domains. https://github.com/bitwarden/server/blob/master/src/Core/Utilities/StaticStore.cs
Functions ¶
func CreateAccessJWT ¶
CreateAccessJWT returns a new JSON Web Token that can be used with Bitwarden apps. It is an access token, with some additional custom fields. See https://github.com/bitwarden/jslib/blob/master/common/src/services/token.service.ts
func CreateRefreshJWT ¶
CreateRefreshJWT returns a new JSON Web Token that can be used with Bitwarden apps. It is a refresh token, with an additional security stamp.
func DeleteUnrecoverableCiphers ¶
DeleteUnrecoverableCiphers will delete all the ciphers that are not shared with the cozy organization. It should be called when the master password is lost, as there are no ways to recover those encrypted ciphers.
func IsBitwardenScope ¶
IsBitwardenScope returns true if it is the right scope for refreshing a bitwarden token.
func ParseBitwardenDeviceType ¶
ParseBitwardenDeviceType takes a deviceType (Bitwarden) and transforms it into a client_kind and a software_id (Cozy). See https://github.com/bitwarden/server/blob/f37f33512046707eef69a2cb3944338de819439d/src/Core/Enums/DeviceType.cs
Types ¶
type Cipher ¶
type Cipher struct { CouchID string `json:"_id,omitempty"` CouchRev string `json:"_rev,omitempty"` Type CipherType `json:"type"` Favorite bool `json:"favorite,omitempty"` Name string `json:"name"` Notes string `json:"notes,omitempty"` FolderID string `json:"folder_id,omitempty"` OrganizationID string `json:"organization_id,omitempty"` CollectionID string `json:"collection_id,omitempty"` Login *LoginData `json:"login,omitempty"` Data *MapData `json:"data,omitempty"` Fields []Field `json:"fields"` Metadata *metadata.CozyMetadata `json:"cozyMetadata,omitempty"` DeletedDate *time.Time `json:"deletedDate,omitempty"` }
Cipher is an encrypted item that can be a login, a secure note, a card or an identity.
func FindCiphersInFolder ¶
FindCiphersInFolder finds the ciphers in the given folder.
type CipherType ¶
type CipherType int
CipherType is used to know what contains the cipher: a login, a secure note, a card or an identity.
type Collection ¶
Collection is used to regroup ciphers.
type Contact ¶
type Contact struct { UserID string `json:"_id,omitempty"` CouchRev string `json:"_rev,omitempty"` Email string `json:"email"` PublicKey string `json:"public_key"` Confirmed bool `json:"confirmed,omitempty"` Metadata metadata.CozyMetadata `json:"cozyMetadata"` }
Contact is used to add users to an organization.
type Field ¶
type Field struct { // See https://github.com/bitwarden/jslib/blob/master/common/src/enums/fieldType.ts Type int `json:"type"` Name string `json:"name"` Value string `json:"value"` }
Field is used to store some additional fields.
type Folder ¶
type Folder struct { CouchID string `json:"_id,omitempty"` CouchRev string `json:"_rev,omitempty"` Name string `json:"name"` Metadata *metadata.CozyMetadata `json:"cozyMetadata,omitempty"` }
Folder is a space to organize ciphers. Its name is encrypted on client-side.
type GlobalEquivalentDomainsType ¶
type GlobalEquivalentDomainsType int
GlobalEquivalentDomainsType is an enum for global domain identifiers.
const ( Google GlobalEquivalentDomainsType = 0 Apple GlobalEquivalentDomainsType = 1 Ameritrade GlobalEquivalentDomainsType = 2 BoA GlobalEquivalentDomainsType = 3 Sprint GlobalEquivalentDomainsType = 4 WellsFargo GlobalEquivalentDomainsType = 5 Merrill GlobalEquivalentDomainsType = 6 Citi GlobalEquivalentDomainsType = 7 Cnet GlobalEquivalentDomainsType = 8 Gap GlobalEquivalentDomainsType = 9 Microsoft GlobalEquivalentDomainsType = 10 United GlobalEquivalentDomainsType = 11 Yahoo GlobalEquivalentDomainsType = 12 Zonelabs GlobalEquivalentDomainsType = 13 PayPal GlobalEquivalentDomainsType = 14 Avon GlobalEquivalentDomainsType = 15 Diapers GlobalEquivalentDomainsType = 16 Contacts GlobalEquivalentDomainsType = 17 Amazon GlobalEquivalentDomainsType = 18 Cox GlobalEquivalentDomainsType = 19 Norton GlobalEquivalentDomainsType = 20 Verizon GlobalEquivalentDomainsType = 21 Buy GlobalEquivalentDomainsType = 22 Sirius GlobalEquivalentDomainsType = 23 Ea GlobalEquivalentDomainsType = 24 Basecamp GlobalEquivalentDomainsType = 25 Steam GlobalEquivalentDomainsType = 26 Chart GlobalEquivalentDomainsType = 27 Gotomeeting GlobalEquivalentDomainsType = 28 Gogo GlobalEquivalentDomainsType = 29 Oracle GlobalEquivalentDomainsType = 30 Discover GlobalEquivalentDomainsType = 31 Dcu GlobalEquivalentDomainsType = 32 Healthcare GlobalEquivalentDomainsType = 33 Pepco GlobalEquivalentDomainsType = 34 Century21 GlobalEquivalentDomainsType = 35 Comcast GlobalEquivalentDomainsType = 36 Cricket GlobalEquivalentDomainsType = 37 Mtb GlobalEquivalentDomainsType = 38 Dropbox GlobalEquivalentDomainsType = 39 Snapfish GlobalEquivalentDomainsType = 40 Alibaba GlobalEquivalentDomainsType = 41 Playstation GlobalEquivalentDomainsType = 42 Mercado GlobalEquivalentDomainsType = 43 Zendesk GlobalEquivalentDomainsType = 44 Autodesk GlobalEquivalentDomainsType = 45 RailNation GlobalEquivalentDomainsType = 46 Wpcu GlobalEquivalentDomainsType = 47 Mathletics GlobalEquivalentDomainsType = 48 Discountbank GlobalEquivalentDomainsType = 49 Mi GlobalEquivalentDomainsType = 50 Facebook GlobalEquivalentDomainsType = 51 Postepay GlobalEquivalentDomainsType = 52 Skysports GlobalEquivalentDomainsType = 53 Disney GlobalEquivalentDomainsType = 54 Pokemon GlobalEquivalentDomainsType = 55 Uv GlobalEquivalentDomainsType = 56 Yahavo GlobalEquivalentDomainsType = 57 Mdsol GlobalEquivalentDomainsType = 58 Sears GlobalEquivalentDomainsType = 59 Xiami GlobalEquivalentDomainsType = 60 Belkin GlobalEquivalentDomainsType = 61 Turbotax GlobalEquivalentDomainsType = 62 Shopify GlobalEquivalentDomainsType = 63 Ebay GlobalEquivalentDomainsType = 64 Techdata GlobalEquivalentDomainsType = 65 Schwab GlobalEquivalentDomainsType = 66 Mozilla GlobalEquivalentDomainsType = 67 // deprecated Tesla GlobalEquivalentDomainsType = 68 MorganStanley GlobalEquivalentDomainsType = 69 TaxAct GlobalEquivalentDomainsType = 70 Wikimedia GlobalEquivalentDomainsType = 71 Airbnb GlobalEquivalentDomainsType = 72 Eventbrite GlobalEquivalentDomainsType = 73 StackExchange GlobalEquivalentDomainsType = 74 )
The list of all the global domain identifiers https://github.com/bitwarden/server/blob/master/src/Core/Enums/GlobalEquivalentDomainsType.cs
type LoginData ¶
type LoginData struct { URIs []LoginURI `json:"uris,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` RevDate string `json:"passwordRevisionDate,omitempty"` TOTP string `json:"totp,omitempty"` }
LoginData is the encrypted data for a cipher with the login type.
type LoginURI ¶
type LoginURI struct { URI string `json:"uri"` Match interface{} `json:"match,omitempty"` }
LoginURI is a field for an URI. See https://github.com/bitwarden/jslib/blob/master/common/src/models/api/loginUriApi.ts
type MapData ¶
type MapData map[string]interface{}
MapData is used for the data of secure note, card, and identity.
type OrgMember ¶
type OrgMember struct { UserID string `json:"user_id"` Email string `json:"email"` Name string `json:"name"` OrgKey string `json:"key,omitempty"` // The organization key encrypted with the public key of the user Status OrgMemberStatus `json:"status"` Owner bool `json:"owner,omitempty"` ReadOnly bool `json:"read_only,omitempty"` }
OrgMember is a struct for describing a member of an organization.
type OrgMemberStatus ¶
type OrgMemberStatus int
OrgMemberStatus is a type for the status of an organization member
const ( // OrgMemberInvited is used when the member is invited but has not yet // accepted the invitation. OrgMemberInvited OrgMemberStatus = 0 // OrgMemberAccepted is used when the member is accepted but the owner has // not yet confirmed that the fingerprint is OK. OrgMemberAccepted OrgMemberStatus = 1 // OrgMemberConfirmed is used when the member is confirmed, and has access // to the organization key to decrypt/encrypt ciphers. OrgMemberConfirmed OrgMemberStatus = 2 )
type Organization ¶
type Organization struct { CouchID string `json:"_id,omitempty"` CouchRev string `json:"_rev,omitempty"` Name string `json:"name"` Members map[string]OrgMember `json:"members"` // the keys are the instances domains Collection Collection `json:"defaultCollection"` Metadata metadata.CozyMetadata `json:"cozyMetadata"` }
Organization is used to make collections of ciphers and can be used for sharing them with other users with cryptography mechanisms.
func FindAllOrganizations ¶
func FindAllOrganizations(inst *instance.Instance, setting *settings.Settings) ([]*Organization, error)
FindAllOrganizations returns all the organizations, including the Cozy one.
func GetCozyOrganization ¶
func GetCozyOrganization(inst *instance.Instance, setting *settings.Settings) (*Organization, error)
GetCozyOrganization returns the organization used to store the credentials for the konnectors running on the Cozy server.
func (*Organization) Clone ¶
func (o *Organization) Clone() couchdb.Doc
Clone implements couchdb.Doc
func (*Organization) Delete ¶
func (o *Organization) Delete(inst *instance.Instance) error
Delete will delete the organization and the ciphers inside it.
func (*Organization) DocType ¶
func (o *Organization) DocType() string
DocType returns the organization document type
func (*Organization) FindCiphers ¶
func (o *Organization) FindCiphers(inst *instance.Instance) ([]*Cipher, error)
FindCiphers returns the ciphers for this organization.
func (*Organization) Rev ¶
func (o *Organization) Rev() string
Rev returns the organization revision
func (*Organization) SetID ¶
func (o *Organization) SetID(id string)
SetID changes the organization identifier
func (*Organization) SetRev ¶
func (o *Organization) SetRev(rev string)
SetRev changes the organization revision