# Keypo CLI

A command-line interface tool for using Keypo. Protect your login credentials, API keys, and more without trusting an intermediary.

## Installation

```bash
npm install -g @keypo/cli
```

## Usage

After installation, you can use the `keypo` command from anywhere in your terminal:

```bash
keypo --help
```

### Available Commands

#### Setup
Initialize and configure your Keypo CLI environment:
```bash
keypo setup
```

This will prompt you for:
- Private key
- RPC URL (with a default option)

#### Sync
Synchronize files with the Keypo network by replacing placeholders with decrypted values:

```bash
keypo sync <input-file> <output-file>
```

The sync command:
- Reads from the input file
- Finds placeholders in the format `${key_name}`
- Searches for each key in the Keypo network
- Decrypts the values using your wallet
- Replaces placeholders with decrypted values
- Writes the result to the output file

**Example:**
```bash
# Input file (config.txt) contains:
# API_KEY=${api_key}
# DATABASE_URL=${database_url}

keypo sync config.txt config-decrypted.txt

# Output file (config-decrypted.txt) will contain:
# API_KEY=actual_decrypted_api_key_value
# DATABASE_URL=actual_decrypted_database_url_value
```

**Features:**
- Interactive selection when multiple results are found for a key
- Shows "Owner: you" for keys you own
- Preserves original input file
- Handles multiple placeholders in a single file

#### List
List your keys stored in the Keypo network:

```bash
keypo list
```

Shows all keys with:
- Data identifier
- Name
- Owner (shows "you" for keys you own)
- Only displays keys with `fileUseType: key` in metadata

## Features

- Secure file storage and retrieval
- Decentralized storage management
- Easy-to-use command-line interface
- Integration with Keypo core functionality
- Interactive key selection for multiple results
- Placeholder-based file synchronization
- Automatic decryption and replacement

## Requirements

- Node.js (v14 or higher)
- npm (v6 or higher)

## Dependencies

- @keypo/typescript-sdk
- ethers
- commander