Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK docs after move to sdk-internal #470

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 3 additions & 84 deletions docs/getting-started/sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,92 +5,11 @@ sidebar_position: 5
# SDK

Bitwarden provides a public Software Development Kit (SDK) for [Secrets Manager][sm] and an internal
SDK for the Bitwarden [Password Manager][pm]. The SDK is written in Rust and provides bindings for
SDK for the Bitwarden [Password Manager][pm]. The SDKs are written in Rust and provides bindings for
multiple languages.

For more in-depth documentation please review the [SDK Architecture](../../architecture/sdk) page
and the project's [`README`](https://github.com/bitwarden/sdk).

## Requirements

- [Rust](https://www.rust-lang.org/tools/install) latest stable version - (preferably installed via
[rustup](https://rustup.rs/))
- NodeJS and NPM.

See the [Tools and Libraries](../tools/index.md) page for more information.

## Setup instructions

1. Clone the repository:

```bash
git clone https://github.com/bitwarden/sdk.git
cd sdk
```

2. Install the dependencies:

```bash
npm ci
```

## Building the SDK

To build the SDK, run the following command:

```bash
cargo build
```

## Linking the SDK to clients

After modifying the SDK, it can be beneficial to test the changes in the client applications. To do
so you will need to update the SDK reference in the client applications.

These instructions assumes you have a directory structure similar to:

```text
sdk/
clients/
ios/
android/
```

### Web clients

The web clients uses NPM to install the SDK as a dependency. NPM offers a dedicated command
[`link`][npm-link] which can be used to temporarily replace the packages with a local version.

```bash
npm link ../sdk/languages/js/sdk-internal
```

:::warning

Running `npm ci` or `npm install` will replace the linked packages with the published version.

:::

### Mobile

#### Android

1. Build and publish the SDK to the local Maven repository:

```bash
../sdk/languages/kotlin/publish-local.sh
```

2. Set the user property `localSdk=true` in the `user.properties` file.

#### iOS

Run the bootstrap script with the `LOCAL_SDK` environment variable set to true in order to use the
local SDK build:

```bash
LOCAL_SDK=true ./Scripts/bootstrap.sh
```
- [Internal SDK](./internal)
- [Secrets Manager SDK](./secrets-manager)

[npm-link]: https://docs.npmjs.com/cli/v9/commands/npm-link
[sm]: https://bitwarden.com/products/secrets-manager/
Expand Down
93 changes: 93 additions & 0 deletions docs/getting-started/sdk/internal/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
sidebar_position: 5
---

# Internal SDK

For more in-depth documentation please review the [SDK Architecture](../../../architecture/sdk) and
the Internal SDK project's [`README`](https://github.com/bitwarden/sdk-internal).

## Requirements

- [Rust](https://www.rust-lang.org/tools/install) latest stable version - (preferably installed via
[rustup](https://rustup.rs/))
- NodeJS and NPM.

See the [Tools and Libraries](../../tools/index.md) page for more information.

## Setup instructions

1. Clone the repository:

```bash
git clone https://github.com/bitwarden/sdk-internal.git
cd sdk
```

2. Install the dependencies:

```bash
npm ci
```

## Building the SDK

To build the SDK, run the following command:

```bash
cargo build
```

## Linking the SDK to clients

After modifying the SDK, it can be beneficial to test the changes in the client applications. To do
so you will need to update the SDK reference in the client applications.

These instructions assumes you have a directory structure similar to:

```text
sdk/
clients/
ios/
android/
```

### Web clients

The web clients uses NPM to install the SDK as a dependency. NPM offers a dedicated command
[`link`][npm-link] which can be used to temporarily replace the packages with a local version.

```bash
npm link ../sdk-internal/crates/bitwarden-wasm-internal/npm
```

:::warning

Running `npm ci` or `npm install` will replace the linked packages with the published version.

:::

### Mobile

#### Android

1. Build and publish the SDK to the local Maven repository:

```bash
../sdk-internal/crates/bitwarden-uniffi/kotlin/publish-local.sh
```

2. Set the user property `localSdk=true` in the `user.properties` file.

#### iOS

Run the bootstrap script with the `LOCAL_SDK` environment variable set to true in order to use the
local SDK build:

```bash
LOCAL_SDK=true ./Scripts/bootstrap.sh
```

[npm-link]: https://docs.npmjs.com/cli/v9/commands/npm-link
[sm]: https://bitwarden.com/products/secrets-manager/
[pm]: https://bitwarden.com/
38 changes: 37 additions & 1 deletion docs/getting-started/sdk/secrets-manager/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,40 @@
This section contains development information for the Bitwarden Secrets Manager CLI, language
wrappers, and integrations based on the SDK.

For more in-depth documentation please review the [SDK Architecture](../../../architecture/sdk),
Secrets Manager SDK project's [`README`](https://github.com/bitwarden/sdk).

## Requirements

- [Rust](https://www.rust-lang.org/tools/install) latest stable version - (preferably installed via
[rustup](https://rustup.rs/))
- NodeJS and NPM.

See the [Tools and Libraries](../../tools/index.md) page for more information.

## Setup instructions

1. Clone the repository:

```bash
git clone https://github.com/bitwarden/sdk.git
cd sdk
```

2. Install the dependencies:

```bash
npm ci
```

## Building the SDK

To build the SDK, run the following command:

```bash
cargo build
```

## Web client

To start the web client, follow the
Expand All @@ -17,4 +51,6 @@ If you have enabled Secrets Manager for your org and do not see Secrets Manager
switcher, you may need to manually enable it for your user by going to **Admin Console** ->
**Members** -> check _"This user can access Secrets Manager"_ for your user.

::: ![Enable for user](enable-sm.png)
![Enable for user](enable-sm.png)

:::