@enbox/cli
v0.1.20
Published
CLI helpers and connect handlers for Enbox
Downloads
2,680
Maintainers
Readme
Enbox CLI
Research Preview — Enbox is under active development. APIs may change without notice.
@enbox/cli provides Node/Bun-specific helpers for terminal applications that
need Enbox sessions.
Install
bun add @enbox/cliUsage
import { CliConnectHandler, Enbox } from '@enbox/cli';
const { enbox, session } = await Enbox.connect({
connectHandler: CliConnectHandler({
appName : 'Notes CLI',
connectServerUrl : 'https://your-dwn.example/connect',
}),
protocols: [NotesProtocol],
});The handler uses the existing encrypted relay flow:
- The CLI pushes an encrypted request to the connect relay.
- The CLI prints a QR code and link for the wallet approval page.
- The user approves in the wallet and enters the wallet-displayed PIN in the terminal.
- The handler returns the delegated DID and grants to
Enbox.connect().
The relay URL resolves from connectServerUrl, then connectServerUrlProvider,
then the wallet origin's /.well-known/enbox-connect document
({ "connectServerUrl": "https://dwn.example/connect" }), then an interactive
prompt. Sessions request a 30-day TTL by default; wallets may clamp it.
Set openBrowser: true to open the generated wallet URL on the same machine
instead of printing a QR code.
