Skip to content

Easily prompt your users for passwords on Windows, Linux or MacOS without having them revealed in the terminal

License

Notifications You must be signed in to change notification settings

alphazframework/secret-input

Repository files navigation

GNU GCC Build Matrix Create Branch

secret-input

This simple library enable to prompt users in interactive CLI apps for passwords without it being printed in the terminal.

Easily prompt your users for passwords on Windows, Linux or MacOS without having them revealed in the terminal

Example

// $main.cpp
#include <string>
#include <cstring>
#include "src/input.h"

int main(int argc, char *argv[]) {
    bool show_asterisk = false;
    if (argc > 1) {
        if (strcmp(argv[1], "-s") == 0) {
            show_asterisk = true;
        }

    }
    std::string inp;
    inp = lablnet::getpass(show_asterisk);

    std::cout << inp;
    return 0;
}

Build

Install GNU GCC on Ubuntu

sudo apt update && sudo apt install build-essential

Install GCC on MacOS

brew install gcc

Install MinGW GCC on Windows,

choco install mingw

Now finallly, Build

g++ main.cpp -o main

Usage

Show asterisk when user typing.

./main -s

If you do not want to show asterisk do not pass -s flag.

Contributing

Thank you for considering contributing to the Zest framework! Feel free to create a pull request.

Contrubuting guide

Contribution Guidelines

LICENSE

  • MIT

About

Easily prompt your users for passwords on Windows, Linux or MacOS without having them revealed in the terminal

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks