Coder Social home page Coder Social logo

tnkemdilim-forks / bitwarden-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitwarden/sdk

0.0 0.0 0.0 506 KB

Secrets Manager SDK

License: Other

Shell 0.10% JavaScript 0.43% Python 3.15% C# 2.28% Rust 87.07% TypeScript 4.77% CSS 0.01% HTML 0.01% Mustache 2.18%

bitwarden-sdk's Introduction

Bitwarden Secrets Manager SDK

This repository houses the Bitwarden Secrets Manager SDK. The core SDK is written in Rust and provides a Rust API, CLI and Node-API bindings. In the future more language bindings might be added.

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.

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\net6.0\Api.dll internal

# src/Identity
dotnet swagger tofile --output ../../identity.json .\bin\Debug\net6.0\Identity.dll v1

OpenApi Generator

Runs from the root of the SDK project.

npx openapi-generator-cli generate `
    -i ../server/api.json `
    -g rust `
    -o crates/bitwarden-api-api `
    --package-name bitwarden-api-api `
    -t ./support/openapi-template `
    --additional-properties=packageVersion=1.0.0

npx openapi-generator-cli generate `
    -i ../server/identity.json `
    -g rust `
    -o crates/bitwarden-api-identity `
    --package-name bitwarden-api-identity `
    -t ./support/openapi-template `
    --additional-properties=packageVersion=1.0.0

OpenApi Generator works using templates, we have customized our templates to work better with our codebase.

There is also a scenario where we have a negative integer enum which completely breaks the openapi generation. In that case we excluded the file from being generated and manually patched it. crates/bitwarden-api-api/src/models/organization_user_status_type.rs

The hope going forward is that we can continue to use the generator with minimal manual intervention.

bitwarden-sdk's People

Contributors

renovate[bot] avatar github-actions[bot] avatar hinton avatar michalchecinski avatar dani-garcia avatar patrick-bitwarden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.