function encrypt(PersonalData $data, CryptographicDetails $crypto): EncryptedPersonalData {

        if ( ! $crypto->encryption() == 'libsodium') {
            throw new CryptographicDetailsNotCompatibleWithEncryption("{$crypto->encryption()} received, expected 'libsodium'");
        }

        $dataString = $data->toString();
        $secretKey  = $crypto->key('secretKey');
        $nonce      = $crypto->key('nonce');

        $encrypted = sodium_crypto_secretbox($dataString, $nonce, $secretKey);

        return EncryptedPersonalData::fromString($encrypted);
    }