• Stars
    star
    152
  • Rank 237,081 (Top 5 %)
  • Language
    Rust
  • License
    Other
  • Created about 1 year ago
  • Updated 2 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

The core infrastructure backend (API, database, Docker, etc).
C#
14,178
star
2

clients

Bitwarden client applications (web, browser extension, desktop, and cli)
TypeScript
8,073
star
3

mobile

The mobile app vault (iOS and Android).
C#
5,501
star
4

desktop

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

web

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

cli

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

self-host

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

directory-connector

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

jslib

Common code referenced across Bitwarden JavaScript projects.
TypeScript
132
star
10

help

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

docs

Bitwarden application and API documentation.
HTML
81
star
12

brand

Logos, icons, screenshots, and other media related to the Bitwarden brand.
80
star
13

passkeys-index

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

passwordless-server

C#
65
star
15

passwordless-client-js

TypeScript
46
star
16

key-connector

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

passwordless-dotnet

Passwordless .NET SDK
C#
30
star
18

sm-action

Github Action for Secrets Manager
TypeScript
29
star
19

importer

Bitwarden standalone importer tool.
C#
28
star
20

gh-actions

Python
26
star
21

contributing-docs

Contributing documentation
TypeScript
20
star
22

passwordless-docs

CSS
12
star
23

helm-charts

Smarty
10
star
24

splunk

Splunk app for reporting Bitwarden event logs.
C#
10
star
25

passwordless-react-example

JavaScript
8
star
26

devops-exercise

Python
8
star
27

passwordless-python

Python
7
star
28

passwordless-nodejs

Passwordless.dev backend library for Node.js
TypeScript
6
star
29

Handlebars.conf

Handlebars templates for config files.
C#
2
star
30

api-docs

2
star
31

passwordless-java

Bitwarden Passwordless JAVA SDK
Java
2
star
32

passwordless-android

Passwordless.dev Android SDK
Kotlin
2
star
33

passwordless-caniuse

Vue
2
star
34

passwordless-blazor

C#
2
star
35

sdk-swift

Swift
2
star
36

server-test-arch

C#
1
star
37

adr

Architectural Decision Records
HTML
1
star