Categorygithub.com/bitwarden/sdk-go
modulepackage
1.0.2
Repository: https://github.com/bitwarden/sdk-go.git
Documentation: pkg.go.dev

# README

Bitwarden SDK in Go

This SDK is designed to interact with Bitwarden services in Go. It includes implementations for managing projects and secrets, as well as a client interface to facilitate operations like login.

Prerequisites

  • Go installed
  • C environment to run CGO

Installation

Follow the installation instructions here.

Table of Contents


Initialization

To initialize the client, you need to import the SDK and create a new BitwardenClient instance.

import "github.com/bitwarden/sdk-go"

bitwardenClient, _ := sdk.NewBitwardenClient(&apiURL, &identityURL)

Login

To login using an access token. Define some stateFile and pass it to use state, or pass nil instead to not use state.

stateFile := os.Getenv("STATE_FILE")

err := bitwardenClient.AccessTokenLogin(accessToken, &stateFile)

Projects

Create a Project

project, err := bitwardenClient.Projects().Create("organization_id", "project_name")

List Projects

projects, err := bitwardenClient.Projects().List("organization_id")

Get a Project

project, err := bitwardenClient.Projects().Get("project_id")

Update a Project

project, err := bitwardenClient.Projects().Update("project_id", "organization_id", "new_project_name")

Delete Projects

project, err := bitwardenClient.Projects().Delete([]string{"project_id_1", "project_id_2"})

Secrets

Create a Secret

secret, err := bitwardenClient.Secrets().Create("key", "value", "note", "organization_id", []string{"project_id"})

List Secrets

secrets, err := bitwardenClient.Secrets().List("organization_id")

Get a Secret

secret, err := bitwardenClient.Secrets().Get("secret_id")

Get Multiple Secrets by IDs

secrets, err := bitwardenClient.Secrets().GetByIDS([]string{"secret_ids"})

Update a Secret

secret, err := bitwardenClient.Secrets().Update("secret_id", "new_key", "new_value", "new_note", "organization_id", []string{"project_id"})

Delete Secrets

secret, err := bitwardenClient.Secrets().Delete([]string{"secret_id_1", "secret_id_2"})

Secrets Sync

secretsSync, err := bitwardenClient.Secrets().Sync("organization_id", nil)

lastSyncedDate := time.Now()
secretsSync, err = bitwardenClient.Secrets().Sync("organization_id", lastSyncedDate)

Close Client

To free up resources:

defer bitwardenClient.Close()

For more detailed information, refer to the code comments and method signatures.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Login to Bitwarden with access token.
No description provided by the author
Login to Bitwarden with Api Key.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Basic client behavior settings.
No description provided by the author
Login with username and password This command is for initiating an authentication handshake with Bitwarden.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Generate a password Returns: [String].
No description provided by the author
No description provided by the author
Kdf from prelogin Key Derivation Function for Bitwarden Account In Bitwarden accounts can use multiple KDFs to derive their master key from their password.
No description provided by the author
No description provided by the author
No description provided by the author
Password generator request options.
No description provided by the author
Login to Bitwarden with Username and Password.
No description provided by the author
No description provided by the author
No description provided by the author
Data about the user, including their encryption keys and the organizations they are a part of.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a project by the provided identifier Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new project in the provided organization using the given data Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all projects of the given organization Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing project with the provided ID using the given data Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones Returns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a secret by the provided identifier Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve secrets by the provided identifiers Returns: [SecretsResponse](bitwarden::secrets_manager::secrets::SecretsResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new secret in the provided organization using the given data Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all secret identifiers of the given organization, to then retrieve each secret, use `CreateSecret` Returns: [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing secret with the provided ID using the given data Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones Returns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) > Requires Authentication > Requires using an Access Token for login Retrieve the secrets accessible by the authenticated machine account Optionally, provide the last synced date to assess whether any changes have occurred If changes are detected, retrieves all the secrets accessible by the authenticated machine account Returns: [SecretsSyncResponse](bitwarden::secrets_manager::secrets::SecretsSyncResponse).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
Device type to send to Bitwarden.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Two-factor provider.
No description provided by the author