• Stars
    star
    225
  • Rank 177,187 (Top 4 %)
  • Language
    Rust
  • License
    Other
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bitwarden SDK

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.

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.

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 '[email protected]',
    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 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Ww2chogqCpaAR7Uw448am4b7vDFXiM5kXjFlGfXBlrAdAqTTggEvTDlMNYqPlCo+mBM6iFmTTUY9rpZBvFskMnKvsvpJ47/fehAH2o2e3Ulv/5NFevaVCMCmpkBDtbMbO1A4a3btdRtCP8DsKWMefHauEpaoLxNTLWnOIZVfCMjsSgx2EvUL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DD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+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
  );

More Repositories

1

server

Bitwarden infrastructure/backend (API, database, Docker, etc).
C#
15,127
star
2

clients

Bitwarden client apps (web, browser extension, desktop, and cli).
TypeScript
8,924
star
3

android

Bitwarden mobile app for Android.
Kotlin
6,129
star
4

desktop

The desktop vault (Windows, macOS, & Linux).
TypeScript
3,545
star
5

web

The website vault (vault.bitwarden.com).
TypeScript
2,570
star
6

cli

The command line vault (Windows, macOS, & Linux).
TypeScript
1,622
star
7

self-host

Bitwarden's self-hosted release repository
Shell
322
star
8

authenticator-android

Bitwarden Authenticator mobile app for Android.
Kotlin
306
star
9

directory-connector

A tool for syncing a directory (AD, LDAP, Azure, G Suite, Okta) to an organization.
TypeScript
249
star
10

jslib

Common code referenced across Bitwarden JavaScript projects.
TypeScript
133
star
11

help

The help website/knowledgebase (bitwarden.com/help).
HTML
132
star
12

authenticator-ios

Bitwarden Authenticator mobile app for iOS.
Swift
122
star
13

passkeys-index

A collection of sites and services that support passkeys
Astro
115
star
14

ios

Bitwarden mobile app for iOS.
Swift
100
star
15

brand

Logos, icons, screenshots, and other media related to the Bitwarden brand.
SCSS
89
star
16

docs

Bitwarden application and API documentation.
HTML
82
star
17

passwordless-server

Bitwarden Passwordless.dev infrastructure/backend (API, database, Docker, etc).
C#
79
star
18

mobile

Retired Bitwarden mobile app for iOS and Android (MAUI/Xamarin).
C#
65
star
19

passwordless-client-js

Bitwarden Passwordless.dev JavaScript SDK.
TypeScript
51
star
20

sm-action

Github Action for Secrets Manager
TypeScript
45
star
21

passwordless-dotnet

Bitwarden Passwordless.dev .NET SDK.
C#
32
star
22

key-connector

An agent that stores and provides cryptographic keys to Bitwarden clients.
C#
32
star
23

gh-actions

JavaScript
29
star
24

importer

Bitwarden standalone importer tool.
C#
28
star
25

contributing-docs

Contributing documentation
TypeScript
24
star
26

helm-charts

Smarty
22
star
27

passwordless-docs

Bitwarden Passwordless.dev documentation.
CSS
18
star
28

passwordless-python

Bitwarden Passwordless.dev Python SDK.
Python
14
star
29

devops-exercise

Python
14
star
30

splunk

Splunk app for reporting Bitwarden event logs.
Python
12
star
31

passwordless-react-example

Bitwarden Passwordless.dev React example.
JavaScript
11
star
32

passwordless-nodejs

Bitwarden Passwordless.dev Node.js SDK.
TypeScript
10
star
33

passwordless-java

Bitwarden Passwordless.dev Java SDK.
Java
7
star
34

passwordless-android

Bitwarden Passwordless.dev Android SDK.
Kotlin
7
star
35

sm-ansible

Ansible integration for Secrets Manager
Python
7
star
36

sdk-go

Go
6
star
37

Handlebars.conf

Handlebars templates for config files.
C#
5
star
38

sm-kubernetes

Kubernetes Operator for Bitwarden Secrets Manager.
Go
5
star
39

test-the-web

Test the Web enables anyone to quickly test common browser interactions on the web with mock interfaces.
TypeScript
5
star
40

sdk-swift

Swift
5
star
41

sdk-internal

Rust
4
star
42

passwordless-caniuse

Bitwarden Passwordless.dev site testing.
Vue
4
star
43

api-docs

3
star
44

passwordless-ios

Bitwarden Passwordless.dev iOS SDK.
Swift
3
star
45

passwordless-blazor

Bitwarden Passwordless.dev Blazor SDK.
C#
3
star
46

passwordless-blazor-webassembly

Bitwarden Passwordless.dev Blazor WebAssembly SDK.
C#
2
star
47

adr

Architectural Decision Records
HTML
2
star
48

template

Template repository
2
star
49

renovate-config

2
star
50

dotnet-extensions

.NET extensions.
C#
1
star
51

autopush-manager

A module to subscribe to Mozilla Autopush and receive notifications
TypeScript
1
star
52

server-test-arch

C#
1
star
53

workflow-linter

Python
1
star