Skip to content

Commit

Permalink
Update SDK docs after move to sdk-internal (#470)
Browse files Browse the repository at this point in the history
* Update SDK docs after move to sdk-internal

* Update to new path

* Fix paths
  • Loading branch information
Hinton authored Nov 12, 2024
1 parent 61dc10f commit 94684a8
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 85 deletions.
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)

:::

0 comments on commit 94684a8

Please sign in to comment.