Skip to content

WiFiCreds v1.0.4

Latest

Choose a tag to compare

@me-RK me-RK released this 24 Aug 15:26

πŸš€ WiFiCreds v1.0.4 Released!

Secure Your Arduino Wi-Fi Projects with Confidence πŸ”
Version
πŸ“… Release Date: August 24, 2025

🧩 What is WiFiCreds?

WiFiCreds is a simple and modular Arduino library that allows you to manage Wi-Fi credentials securely and separately from your main project code β€” ideal for open-source sharing, classrooms, and client projects.
No more hardcoding credentials into your sketches!

βœ… Highlights

  • πŸ”’ Keeps SSID and password out of your codebase
  • πŸ’Ό Supports multiple credential sets (e.g., home, office, guest)
  • 🧠 Smart default: Automatically picks the first credential set when no name is specified
  • πŸ“¦ Designed for ESP32, ESP8266, Raspberry Pi Pico W, Arduino UNO R4 WiFi, and more
  • πŸ§ͺ Built-in validation to avoid connection errors
  • πŸ“š Clean API: WiFiCreds::getSSID(), WiFiCreds::getByName("office"), WiFiCreds::isValid(), etc.
  • πŸ› οΈ Multiple examples included for quick testing
  • ⚑ NEW: Robust implementation with enhanced memory safety

πŸ†• What's New in v1.0.4

πŸ”§ Fixed multiple credential support issues
πŸ”„ Improved fallback logic for invalid credential names
πŸ“ Added proper string.h includes and safety checks
πŸ›‘οΈ Enhanced memory safety with bounds checking
βœ… Added comprehensive test examples
πŸ“– Updated documentation with troubleshooting guide

πŸ”§ How to Use

  1. Install the library via Arduino Library Manager or manually from GitHub
  2. Create your credentials.h file in WiFiCreds/src/:
const CredentialSet CREDENTIAL_SETS[] = {
    // First set is always the default
    {
        .name = "home",
        .ssid = "MyHomeWiFi",
        .password = "HomePassword123"
    },
    {
        .name = "office",
        .ssid = "OfficeNetwork",
        .password = "OfficePassword456"
    },
    {
        .name = "guest",
        .ssid = "GuestWiFi",
        .password = "GuestPassword789"
    },
    {
        .name = "mobile",
        .ssid = "MyPhoneHotspot",
        .password = "MobilePassword"
    },
    // Terminator entry - must be last!
    {
        .name = nullptr,
        .ssid = nullptr,
        .password = nullptr
    }
};
  1. In your sketch, include the library and call:
#include <WiFiCreds.h>

// Use default credentials (first set)
WiFi.begin(WiFiCreds::getSSID(), WiFiCreds::getPassword());

// OR use a specific profile
WiFi.begin(WiFiCreds::getSSID("office"), WiFiCreds::getPassword("office"));

// Check if credentials exist before using
if (WiFiCreds::hasCredential("home")) {
    WiFi.begin(WiFiCreds::getSSID("home"), WiFiCreds::getPassword("home"));
} else {
    // Falls back to default automatically
    WiFi.begin(WiFiCreds::getSSID(), WiFiCreds::getPassword());
}

πŸ” Test Your Setup

Use this simple test to verify your credentials are working:

#include <WiFiCreds.h>

void setup() {
    Serial.begin(115200);
    
    // Check credential count
    Serial.print("Available credentials: ");
    Serial.println(WiFiCreds::getCredentialCount());
    
    // Test default credentials
    Serial.print("Default network: ");
    Serial.println(WiFiCreds::getSSID());
    
    // Test specific credentials
    if (WiFiCreds::hasCredential("home")) {
        Serial.println("Home network: Available");
    } else {
        Serial.println("Home network: Not configured");
    }
}

πŸ“š What's Included

  • πŸ“ Modular credential handling with optional named access
  • βš™οΈ Static access functions for performance and simplicity
  • πŸ§ͺ Examples for multiple boards and credential sets
  • 🧾 Full Doxygen documentation
  • πŸ” Git-safe setup with .gitignore support
  • πŸ›‘οΈ NEW: Enhanced error handling and memory safety
  • βœ… NEW: Comprehensive test examples and troubleshooting guide

πŸ“Œ Best Practices

  • πŸ” Always add credentials.h to your .gitignore
  • βœ… Use WiFiCreds::isValid() before connecting
  • 🧱 First credential set is used by default if no name is given
  • πŸ” Use WiFiCreds::hasCredential() to check if specific credentials exist
  • πŸ›‘οΈ Invalid credential names automatically fall back to default

πŸ”§ Troubleshooting

  • ❌ No credentials found: Ensure credentials.h is in WiFiCreds/src/ directory
  • ❌ Only default works: Check credential names are case-sensitive and exact
  • ❌ Compilation errors: Library now includes proper headers automatically
  • ❌ Invalid credentials: Use the test example above to debug your setup

πŸ‘¨β€πŸ’» Author

Made with ❀️ by [Rithik Krisna M](https://github.com/me-RK)
πŸ“Œ [GitHub Repository](https://github.com/me-RK/WiFiCreds)
πŸ“¬ [Submit an Issue](https://github.com/me-RK/WiFiCreds/issues)

πŸ›‘οΈ This library is designed for development and educational use. For production-grade applications, implement advanced credential storage and encryption strategies.