# SSH Key Management Specification ## Purpose Generate and manage SSH keys for git operations with external providers. ## Requirements ### Requirement: Key Generation The system SHALL generate Ed25519 SSH key pairs. #### Scenario: Generate key - GIVEN an authenticated user - WHEN they request a new SSH key - THEN an Ed25519 key pair is generated - AND the private key is encrypted with Fernet - AND the public key is stored in OpenSSH format ### Requirement: Key Association The system SHALL support user-level and project-level keys. #### Scenario: User-level key - GIVEN an authenticated user - WHEN they generate a key without specifying a project - THEN it's associated with their user account #### Scenario: Project-level key - GIVEN an authenticated user with a project - WHEN they generate a key for that project - THEN it's associated with the project ### Requirement: Key Display The system SHALL display public keys for copying. #### Scenario: Copy public key - GIVEN an authenticated user - WHEN they view their SSH keys - THEN each public key is displayed in OpenSSH format - AND a copy button is available ### Requirement: Key Deletion The system SHALL support key removal. #### Scenario: Delete key - GIVEN an authenticated user - WHEN they delete an SSH key - THEN it's removed from the database - AND the key files are deleted ## Dependencies - Database models: SSHKey, User, Project - cryptography library for key generation ## Quality Gates - `pytest` must pass - `mypy .` must pass - `ruff check .` must pass - `npm run typecheck` must pass - `npm run lint` must pass