npm package: @openverifiable/open-verifiable-id-cli
Description: Unified CLI for Open Verifiable operations (Identity + Engine)
Author: OpenVerifiable
Latest version: 0.0.5

# 🚀 `open-verifiable-id-cli` - Unified Open Verifiable CLI

A unified command-line interface for Open Verifiable operations:
- **Engine Management**: Initialize, start, stop, and manage the Open Verifiable Engine
- **Identity Operations**: Create DIDs, issue/verify credentials, manage keys

## Installation

### Local Development
```bash
cd open-verifiable-id-cli
npm install
npm link  # Makes 'ove' available globally
```

## Usage

```bash
ove --help
ove identity --help
```

## Architecture

This CLI is maintained in the `open-verifiable-id-cli` repository and depends on:
- `@openverifiable/open-verifiable-id-sdk` - For identity operations

The engine references this CLI directly via file path (no npm package needed). See [ARCHITECTURE.md](./ARCHITECTURE.md) for details.

## Commands

### Initialize Engine

```bash
# Interactive setup with custom credentials
ove init

# Use defaults without prompts
ove init --skip-prompts
```

**What it does:**
- Prompts for admin username/password
- Resets database
- Provisions Logto
- Creates admin user
- Configures SPA application
- Saves configuration

### Start Services

```bash
# Start all Docker services
ove start

# Start only infrastructure
ove start --infra

# Start infrastructure and show app start commands
ove start --all
```

### Stop Services

```bash
ove stop
```

### Check Status

```bash
ove status
```

Shows:
- Initialization status
- Admin credentials (password hidden)
- Docker service status
- Last reset time

### View Configuration

```bash
# Show config (password hidden)
ove config

# Show config with password
ove config --show-password
```

### View Logs

```bash
# View all logs
ove logs

# Follow logs (live)
ove logs -f

# View specific service
ove logs logto
ove logs postgres
```

### Reset Engine

```bash
ove reset
```

Prompts for confirmation before resetting.

### Social Connectors

```bash
ove connector
```

Shows link to interactive connector setup script.

---

## Identity Commands

### Create DID

```bash
# Create a DID (default: did:key)
ove identity did:create

# Create DID with specific method
ove identity did:create --method cheqd:testnet

# Create DID with alias
ove identity did:create --method key --alias my-did
```

### Resolve DID

```bash
ove identity did:resolve did:key:z6Mk...
```

### List DIDs

```bash
ove identity did:list
```

### Issue Verifiable Credential

```bash
ove identity vc:issue \
  --issuer did:key:z6Mk... \
  --subject did:key:z6Mk... \
  --type EmployeeCredential \
  --attributes '{"role":"engineer","department":"engineering"}'
```

### Verify Credential

```bash
# From JSON string
ove identity vc:verify '{"@context":["https://www.w3.org/2018/credentials/v1"],...}'

# From file
ove identity vc:verify credential.json --file
```

### Generate Key Pair

```bash
# Generate Ed25519 key (default)
ove identity key:generate

# Generate Secp256k1 key
ove identity key:generate --type Secp256k1

# Save private key to file
ove identity key:generate --output private-key.pem
```

## Configuration File

The CLI stores configuration in `.ove-config.json` at the engine root:

```json
{
  "adminUsername": "admin",
  "adminPassword": "your-password",
  "initialized": true,
  "lastReset": "2025-11-23T18:00:00.000Z",
  "spaAppId": "ov-put-web-app"
}
```

## Quick Start

```bash
# 1. Initialize the engine
ove init
# Enter admin credentials when prompted

# 2. Start services
ove start

# 3. View status
ove status

# 4. Start applications (in separate terminals)
cd apps/server-cloud && npm run dev
cd apps/put-web && npm run dev

# 5. Visit http://localhost:5173
```

## Development

```bash
# Run in development mode
npm run dev -- init

# Build for production
npm run build

# Clean build artifacts
npm run clean
```

## Features

- ✅ Interactive credential setup
- ✅ Configuration persistence
- ✅ Service management
- ✅ Status monitoring
- ✅ Log viewing
- ✅ Colored, friendly output
- ✅ Password masking
- ✅ Confirmation prompts
- ✅ Error handling

## Comparison with Manual Setup

| Task | Manual | With CLI |
|------|--------|----------|
| Initialize | Run script, set env vars | `ove init` |
| Remember credentials | Check script output | `ove config` |
| Start services | `cd tools/dev-cluster && docker compose up -d` | `ove start` |
| Check status | `docker compose ps` | `ove status` |
| View logs | `cd tools/dev-cluster && docker compose logs` | `ove logs` |

## License

Apache-2.0