# SSH Key Management

## Overview

Manage SSH key pairs for authenticating with git remotes. Keys are generated and stored securely, with the private key encrypted.

## How to Use

### Generating a Key Pair

1. Navigate to **Settings** → **SSH Keys**
2. Click **"Generate New Key"**
3. Enter a **name** for the key (e.g., "GitHub Work Account")
4. Click **"Generate"**

The system will:
- Generate an Ed25519 key pair
- Encrypt the private key
- Store both keys securely
- Display the public key

### Copying Public Key

1. Find the key in the list
2. Click the **"Copy"** button next to the public key
3. Paste into your git host (GitHub, GitLab, etc.)

### Adding to Git Hosts

#### GitHub
1. Go to Settings → SSH and GPG keys
2. Click "New SSH key"
3. Paste the public key
4. Give it a title
5. Click "Add SSH key"

#### GitLab
1. Go to Preferences → SSH Keys
2. Paste the public key
3. Set expiration (optional)
4. Click "Add key"

### Deleting Keys

1. Find the key in the list
2. Click the **"Delete"** button
3. Confirm deletion

**Note:** Deleting a key removes both public and private keys. This cannot be undone.

## Security

- **Ed25519 algorithm**: Modern, secure key type
- **Encrypted storage**: Private keys are encrypted at rest
- **No export**: Private keys cannot be exported
- **One-way generation**: Keys are generated server-side, never transmitted

## API Reference

### Endpoints

- `GET /ssh-keys` - List SSH keys
- `POST /ssh-keys` - Generate new key
- `DELETE /ssh-keys/{id}` - Delete key

See [SSH Keys API](../api/ssh-keys.md) for detailed endpoint documentation.

## Related Features

- [Git Repositories](repositories.md) - Use SSH keys for repository access
