The project is in a healthy, maintained state
Ruby wrapper for Bitwarden secrets manager SDK.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.7
~> 1.15
~> 2.6
~> 13.0
~> 1.21
 Project Readme

Bitwarden SDK

This repository houses the Bitwarden SDKs. We currently provide a public Secrets Manager SDK and an internal SDK for the Bitwarden Password Manager which is used for the native mobile applications. The SDK is written in Rust and provides a Rust API, CLI and various language bindings.

Disclaimer

The password manager SDK is not intended for public use and is not supported by Bitwarden at this stage. It is solely intended to centralize the business logic and to provide a single source of truth for the internal applications. As the SDK evolves into a more stable and feature complete state we will re-evaluate the possibility of publishing stable bindings for the public. The password manager interface is unstable and will change without warning.

We're Hiring!

Interested in contributing in a big way? Consider joining our team! We're hiring for many positions. Please take a look at our Careers page to see what opportunities are currently open as well as what it's like to work at Bitwarden.

Getting Started

cargo build

Crates

The project is structured as a monorepo using cargo workspaces. Some of the more noteworthy crates are:

Schemas

To minimize the amount of work required to support additional bindings the project is structured around a json based API. With every binding only needing to implement one method, namely run_command.

To ensure type safety in the API, json schemas are generated from the rust structs in bitwarden using schemars. The json schemas are later used to generate the API bindings for each language using QuickType.

npm run schemas

API Bindings

We autogenerate the server bindings using openapi-generator. To do this we first need to build the internal swagger documentation.

Swagger generation

The first step is to generate the swagger documents from the server repository.

# src/Api
dotnet swagger tofile --output ../../api.json ./bin/Debug/net8.0/Api.dll internal

# src/Identity
ASPNETCORE_ENVIRONMENT=development dotnet swagger tofile --output ../../identity.json ./bin/Debug/net8.0/Identity.dll v1

OpenApi Generator

To generate a new version of the bindings run the following script from the root of the SDK project.

./support/build-api.sh

This project uses customized templates which lives in the support/openapi-templates directory. These templates resolves some outstanding issues we've experienced with the rust generator. But we strive towards modifying the templates as little as possible to ease future upgrades.

Note: If you don't have the nightly toolchain installed, the build-api.sh script will install it for you.

Tests

Many of the SDK tests are based on encrypted data provided by the other Bitwarden clients. In order to provide a consistent method of retrieving the data we provide a test account with user keys.

Disclaimer: The server typically encrypts and protects certain fields. In order to allow accounts to be used on other servers this protection was explicitly removed from these data dumps.

test@bitwarden.com

  • Email: test@bitwarden.com
  • Password: asdfasdfasdf
  • PBKDF2: 600_000 iterations
INSERT INTO vault_dev.dbo.[User] (
  Id, Name, Email, EmailVerified, MasterPassword,
  MasterPasswordHint, Culture, SecurityStamp,
  TwoFactorProviders, TwoFactorRecoveryCode,
  EquivalentDomains, ExcludedGlobalEquivalentDomains,
  AccountRevisionDate, [Key], PublicKey,
  PrivateKey, Premium, PremiumExpirationDate,
  Storage, MaxStorageGb, Gateway, GatewayCustomerId,
  GatewaySubscriptionId, LicenseKey,
  CreationDate, RevisionDate, RenewalReminderDate,
  Kdf, KdfIterations, ReferenceData,
  ApiKey, ForcePasswordReset, UsesKeyConnector,
  FailedLoginCount, LastFailedLoginDate,
  AvatarColor, KdfMemory, KdfParallelism,
  LastPasswordChangeDate, LastKdfChangeDate,
  LastKeyRotationDate, LastEmailChangeDate
)
VALUES
  (
    N 'b1fd4bf2-9643-4787-87f3-b0f00189c33b',
    N 'Test', N 'test@bitwarden.com',
    0, N 'AQAAAAEAAYagAAAAEJ3ky9F/Zt5sy3/UAHVvBarMR+tBXYOM5IGgXy4/mx82uptgHgItauyCN+UZTvAqiA==',
    null, N 'en-US', N 'F3KL7SCJKEXO4LJFVLGZITPEHM7SAVSZ',
    null, null, null, null, N '2024-01-07 23:56:48.2600000',
    N '2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=',
    N 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Ww2chogqCpaAR7Uw448am4b7vDFXiM5kXjFlGfXBlrAdA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8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=',
    0, null, null, null, null, null, null,
    null, N '2024-01-07 23:53:38.5900000',
    N '2024-01-07 23:53:38.5900000',
    null, 0, 600000, N '{"id":null}', N '7gp59kKHt9kMlks0BuNC4IjNXYkljR',
    0, 0, 0, null, null, null, null, null,
    null, null, null
  );

Developer tools

This project recommends the use of certain developer tools, and also includes configurations for them to make developers lives easier. The use of these tools is optional and they might require a separate installation step.

The list of developer tools is:

  • Visual Studio Code: We provide a recommended extension list which should show under the Extensions tab when opening this project with the editor. We also offer a few launch settings and tasks to build and run the SDK
  • bacon: This is a CLI background code checker. We provide a configuration file with some of the most common tasks to run (check, clippy, test, doc - run bacon -l to see them all). This tool needs to be installed separately by running cargo install bacon --locked.
  • nexttest: This is a new and faster test runner, capable of running tests in parallel and with a much nicer output compared to cargo test. This tool needs to be installed separately by running cargo install cargo-nextest --locked. It can be manually run using cargo nextest run --all-features