Package bitwarden exposes an API compatible with the Bitwarden Open-Soure apps.



This section is empty.


This section is empty.


func ChangeSecurityStamp

func ChangeSecurityStamp(c echo.Context) error

ChangeSecurityStamp is used by the client to change the security stamp, which will deconnect all the clients.

func CreateCipher

func CreateCipher(c echo.Context) error

CreateCipher is the handler for creating a cipher: login, secure note, etc.

func CreateFolder

func CreateFolder(c echo.Context) error

CreateFolder is the route to add a folder via the Bitwarden API.

func CreateSharedCipher

func CreateSharedCipher(c echo.Context) error

CreateSharedCipher is the handler for creating a shared cipher.

func DeleteCipher

func DeleteCipher(c echo.Context) error

DeleteCipher is the handler for the route to delete a cipher.

func DeleteFolder

func DeleteFolder(c echo.Context) error

DeleteFolder is the handler for the route to delete a folder.

func GetCipher

func GetCipher(c echo.Context) error

GetCipher returns information about a single cipher.

func GetCozy

func GetCozy(c echo.Context) error

GetCozy returns the information about the cozy organization, including the organization key.

func GetDomains

func GetDomains(c echo.Context) error

GetDomains is the handler for listing the domains in settings.

func GetFolder

func GetFolder(c echo.Context) error

GetFolder returns information about a single folder.

func GetIcon

func GetIcon(c echo.Context) error

GetIcon returns an icon for the given domain, to be used by the bitwarden clients.

func GetProfile

func GetProfile(c echo.Context) error

GetProfile is the handler for the route to get profile information.

func GetRevisionDate

func GetRevisionDate(c echo.Context) error

GetRevisionDate returns the date of the last synchronization (as a number of milliseconds).

func GetToken

func GetToken(c echo.Context) error

GetToken is used by the clients to get an access token. There are two supported grant types: password and refresh_token. Password is used the first time to register the client, and gets the initial credentials, by sending a hash of the user password. Refresh token is used later to get a new access token by sending the refresh token.

func ImportCiphers

func ImportCiphers(c echo.Context) error

ImportCiphers is used to import ciphers and folders in bulk.

func ListCiphers

func ListCiphers(c echo.Context) error

ListCiphers is the route for listing the Bitwarden ciphers. No pagination yet.

func ListFolders

func ListFolders(c echo.Context) error

ListFolders is the route for listing the Bitwarden folders. No pagination yet.

func NegotiateHub

func NegotiateHub(c echo.Context) error

NegotiateHub is the handler for negotiating between the server and the client which transport to use for bitwarden notifications. Currently, only websocket is supported.

func Prelogin

func Prelogin(c echo.Context) error

Prelogin tells to the client how many KDF iterations it must apply when hashing the master password.

func RenameFolder

func RenameFolder(c echo.Context) error

RenameFolder is the route for changing the (encrypted) name of a folder.

func RestoreCipher

func RestoreCipher(c echo.Context) error

RestoreCipher is the handler for the route to restore a soft-deleted cipher. See for the bitwarden implementation

func Routes

func Routes(router *echo.Group)

Routes sets the routing for the Bitwarden-like API

func SendHint

func SendHint(c echo.Context) error

SendHint is the handler for sending the hint when the user has forgot their password.

func SetKeyPair

func SetKeyPair(c echo.Context) error

SetKeyPair is the handler for setting the key pair: public and private keys.

func ShareCipher

func ShareCipher(c echo.Context) error

ShareCipher is used to share a cipher with an organization.

func SoftDeleteCipher

func SoftDeleteCipher(c echo.Context) error

SoftDeleteCipher is the handler for the route to soft delete a cipher. See for the bitwarden implementation

func Sync

func Sync(c echo.Context) error

Sync is the handler for the main endpoint of the bitwarden API. It is used by the client as a one-way sync: it fetches all objects from the server to update its local database.

func UpdateCipher

func UpdateCipher(c echo.Context) error

UpdateCipher is the route for changing a cipher.

func UpdateDomains

func UpdateDomains(c echo.Context) error

UpdateDomains is the handler for updating the domains in settings.

func UpdateProfile

func UpdateProfile(c echo.Context) error

UpdateProfile is the handler for the route to update the profile. Currently, only the hint for the master password can be changed.

func WebsocketHub

func WebsocketHub(c echo.Context) error

WebsocketHub is the websocket handler for the hub to send notifications in real-time for bitwarden stuff.


type AccessTokenReponse

type AccessTokenReponse struct {
	ClientID  string `json:"client_id,omitempty"`
	RegToken  string `json:"registration_access_token,omitempty"`
	Type      string `json:"token_type"`
	ExpiresIn int    `json:"expires_in"`
	Access    string `json:"access_token"`
	Refresh   string `json:"refresh_token"`
	Key       string `json:"Key"`

AccessTokenReponse is the stuct used for serializing to JSON the response for an access token.