#!/bin/sh

# Prompt user for player name
echo "Enter a player name:"
read player_name

# Check if key files already exist
if [ -f ~/.ssh/${player_name} ] && [ -f ~/.ssh/${player_name}.pub ]; then
    echo "Key files for player ${player_name} already exist. Please enter a different player name:"
    read player_name
fi

# Generate ssh key
ssh-keygen -t rsa -b 4096 -C "${player_name}@MUD" -f ~/.ssh/${player_name} -q -N ""

echo "New player ${player_name} created with ssh key files at ~/.ssh/${player_name} and ~/.ssh/${player_name}.pub"