#!/bin/bash

_TYPE_=ed25519
_USER_=${USER}
_HOST_=$(hostname -f)
_EMAIL_="${_USER_}@${_HOST_}"
_DIR_="${HOME}/.ssh"
_FILE_=${_EMAIL_//@/_at_}
_FILE_=${_DIR_}/id_${_TYPE_}.${_FILE_//./_dot_}

if [ ! -d "${_DIR_}" ] ; then
  mkdir -m 0700 "${_DIR_}" || exit 1
fi

ssh-keygen -t ed25519 -m RFC4716 -C "${_EMAIL_}" -f "${_FILE_}"
