# s-bit-agent

> s.BitAgent is a simple Bitwarden CLI wrapper which provides a SSH2 Key Agent solution for Bitwarden.

Latest version **0.0.6** (published 2024-04-01) · GPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install s-bit-agent
pnpm add s-bit-agent
yarn add s-bit-agent
bun add s-bit-agent
```

Provides the command `s-bit-agent`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2024-04-01 |
| First published | 2024-02-24 |
| Weekly downloads | 0 |
| License | GPL-3.0-only |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 630.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joschua Becker EDV |
| Maintainers | scolastico |
| Keywords | bitwarden, sshpk, ssh-agent, ssh, cli, ipc |

## Links

- npm: https://www.npmjs.com/package/s-bit-agent
- Repository: https://github.com/scolastico-dev/s.BitAgent
- Homepage: https://scolasti.co/go/s-bit-agent
- Issues: https://github.com/scolastico-dev/s.BitAgent/issues
- npm.io page: https://npm.io/package/s-bit-agent

## Dependencies (15)

- [open](https://npm.io/package/open.md) ^9.1.0
- [rxjs](https://npm.io/package/rxjs.md) ^7.8.1
- [plist](https://npm.io/package/plist.md) ^3.1.0
- [sshpk](https://npm.io/package/sshpk.md) ^1.18.0
- [colors](https://npm.io/package/colors.md) ^1.4.0
- [express](https://npm.io/package/express.md) ^4.18.2
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.6
- [node-ipc](https://npm.io/package/node-ipc.md) ^10.1.0
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^10.0.0
- [@types/plist](https://npm.io/package/@types/plist.md) ^3.0.5
- [@bitwarden/cli](https://npm.io/package/@bitwarden/cli.md) ^2024.2.0
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^10.0.0
- [nest-commander](https://npm.io/package/nest-commander.md) ^3.12.5
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.2.0
- [@nestjs/platform-express](https://npm.io/package/@nestjs/platform-express.md) ^10.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2024-04-01
- 0.0.5 — 2024-03-02
- 0.0.4 — 2024-02-25
- 0.0.3 — 2024-02-24
- 0.0.2 — 2024-02-24
- 0.0.1 — 2024-02-24

## README

# s.BitAgent

*wip*

A wrapper arround the Bitwarden CLI to provide a SSH Key Agent IPC interface.

## Installation

```bash
npm i -g s-bit-agent
s-bit-agent -- bw config server https://<your-server>
s-bit-agent -- bw login
s-bit-agent -- bw lock <token from login>
```

Run `s-bit-agent daemon` in autostart.

```bash
s-bit-agent setup # shows which automatic autostart installation is possible
s-bit-agent daemon --help # See possible config options for the daemon
s-bit-agent setup --type SystemdAutostartService --args "--session-timeout 900" # for example
```

Add the socket to your `.bashrc` or `.profile`:
```bash
export SSH_AUTH_SOCK=~/.ssh/s-bit-agent.sock
```

## Usage

```bash
s-bit-agent --help
s-bit-agent -- bw --help
s-bit-agent -- bwa --help
s-bit-agent status
```

## Differences to `bw` and `bwa`

```bash
user@example:~$ s-bit-agent -- bw status
{..., "status": "locked"}

user@example:~$ s-bit-agent -- bwa status
Requesting session
Connected to server
Sent S_BIT_AGENT_REQUEST_SESSION
Received session
{..., "status": "unlocked"}
``` 


## TODO
- [X] Add basic IPC communication to talk accordingly to [draft-miller-ssh-agent](https://datatracker.ietf.org/doc/html/draft-miller-ssh-agent)
- [X] Add caching for the session
- [X] add a `key add` command
- [X] Add a `key import` command
- [X] Add a `status` command
- [X] Implement S_BIT_AGENT_REQUEST_SESSION into IPC
- [X] Add a `bw` and `bwa` command
- [X] Add a `setup` command to automatically install the daemon in the autostart
- [X] Expand the S_BIT_AGENT_REQUEST_SESSION to also handle some other requests
- [X] Add a public key local cache to speed up the key lookup, and reduce the password requests
- [X] Handle detection of dead pipes and automatic removal of them
- [X] Support for multiple IPC connections at once
- [ ] Look into the secure heap implementation possibilitys
- [ ] Add a `lock` command
- [ ] Add setting to disable approval requests, or at least to set a timeout
- [ ] Add a `key list` command
- [ ] Add a `key delete` command
- [ ] Add a `key rename` command
- [ ] Add a `key export` command
- [ ] Add tests
- [ ] [Maybe™] Test or add support for windows.
- [ ] [Maybe™] Develop a Tauri frontend/client, which internally uses the `s-bit-agent` to communicate with the server.
- [ ] [Maybe™] Add capability to unlock the agent through bitwarden remote approval
- [ ] [Maybe™] Add capability to unlock the agent through webauthn

## Windows Support

Theoretically, the agent should work on windows, but it is not tested.
If you want to help, please open an issue. If you encounter any problems,
try to use wsl, that should work.

Also if you do not use wsl, you will need to manually register the agent in
the autostart. Lastly as a tipp: you can modify the pipe name the daemon
creates, by passing the `SSH_AUTH_SOCK` environment variable to the daemon.

---
_Source: https://npm.io/package/s-bit-agent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
