masked-input


Namemasked-input JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/ree-verse/masked-input
SummaryCross-platform library to read password input with various masking options.
upload_time2025-07-27 18:03:02
maintainerNone
docs_urlNone
authorRee-verse
requires_python>=3.9
licenseMIT
keywords console cross-platform getpass input linux macos mask masked masked-input password python secure security shell terminal windows
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <h1 align="center"><code>masked-input</code> - Cross-Platform Password Input with Various Masking Options</h1>

<p align="center">
  <img src="assets/masked-input.svg" alt="masked-input logo" width="350">
</p>

<p align="center">
  <a href="#overview">Overview</a> •
  <a href="#why-use-masked-input">Why use <code>masked-input</code>?</a> •
  <a href="#features">Features</a> •
  <a href="#prerequisites">Prerequisites</a> •
  <a href="#installation">Installation</a> •
  <a href="#usage">Usage</a> •
  <a href="#api-reference">API Reference</a> •
  <a href="#parameters">Parameters</a> •
  <a href="#return-value">Return Value</a> •
  <a href="#exceptions">Exceptions</a> •
  <a href="#implementation-details">Implementation Details</a> •
  <a href="#notes">Notes</a> •
  <a href="#known-issues-and-limitations">Known Issues and Limitations</a> •
  <a href="#examples">Examples</a> •
  <a href="#credits--inspiration">Credits & Inspiration</a> •
  <a href="#license">License</a> •
  <a href="#star-history">Star History</a>
</p>

[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/ree-verse/masked-input)](https://github.com/ree-verse/masked-input/commits)
[![GitHub Issues](https://img.shields.io/github/issues/ree-verse/masked-input.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/ree-verse/masked-input/issues)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/ree-verse/masked-input/blob/main/LICENSE)
[![Discord](https://img.shields.io/discord/1262386017202212996?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/ZZfqH9Z4uQ)

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/masked-input)](https://pypi.org/project/masked-input/)
[![PyPI Status](https://badge.fury.io/py/masked-input.svg)](https://badge.fury.io/py/masked-input)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/masked-input)](https://pepy.tech/project/masked-input)

---

## Overview

The `masked-input` function provides **a secure way to read passwords** or other sensitive input from the command line with **customizable masking**. It works across **different operating systems** and **handles various edge cases**.

## Why Use `masked-input`?

Unlike `getpass`, `masked-input` provides **visual feedback through masking**, improving UX during password entry, especially in CLI tools. It also offers **full customization** and **graceful fallback behavior**.

## Features

- 🌐 **Cross-platform compatibility** - Works on Windows and POSIX-based systems
- 🎭 **Customizable masking character** - Define your own character to mask input (like *, •, or nothing at all)
- 🔢 **Adjustable mask repeat count** - Control how many masking characters appear per typed character, from single to multiple symbols, or even none
- ⌫ **Proper handling of backspace and special keys** - Properly deletes characters and gracefully skips over arrow keys, escape sequences, and other exotic key combos without breaking the mask flow
- ⏱️ **Per-character delay** - Optionally pauses after each typed character
- ⌛ **Global input timeout** - Abort password input after a defined total duration and optionally show a custom message when time runs out
- 🔐 **Character limit** - Define a maximum password length
- 🧭 **Selectable input mode** - Choose between:
  - **standard**: masks each char normally
  - **last-char-temporary**: briefly shows the last char before masking
  - **invisible**: shows nothing at all
  - **pixel-lock**: masks then deletes instantly
- 🧪 **Fallback to standard `getpass` when necessary** - Automatically switches to `getpass` when masking isn’t feasible
- ✍️ **Clear and concise docstrings** - Parameters documented with no fluff, easy to read and maintain
- ✅ **Built-in unit tests** - Comes with a robust suite of unit tests covering key usage scenarios to ensure reliability

## Prerequisites

- **Python 3.9** or higher
- **No external dependencies** (uses only standard library modules)
- **Terminal or command-line environment** that supports interactive input
- On Windows: **A terminal that supports ANSI escape sequences** for best results
- On POSIX: **Terminal with standard TTY capabilities**

## Installation

### Option 1: PyPI

```bash
pip install masked-input
```

### Option 2: Manual Installation

Clone the repository or download the source code, then navigate to the project directory:

```bash
git clone https://github.com/ree-verse/masked-input.git
cd path/to/your/folder
pip install .
```

## Usage

```python
from masked_input import masked_input

# Basic usage with default settings
password = masked_input()  # Displays "Password: " with "•" masking

# Custom prompt, mask character, and mask repeat count
password = masked_input(
    prompt="Enter secret key: ",
    mask="*",
    mask_repeat=2
)

# Hide input completely (no masking character)
password = masked_input(mask="")
```

## API Reference

```python
masked_input(
    prompt: str = 'Password: ',
    mask: str = '•',
    mask_repeat: int = 1,
    char_timeout: Optional[Union[int, float]] = None,
    timeout: Optional[Union[int, float]] = None,
    timeout_prompt: Optional[str] = None,
    char_limit: Optional[int] = None,
    mode: Literal['standard', 'last-char-temporary', 'invisible', 'pixel-lock'] = 'standard',
    last_char_visible_duration: Union[int, float] = 0.1
) -> str
```

## Parameters

| Parameter                    | Type                   | Default        | Description                                                                              |
| ---------------------------- | ---------------------- | -------------- | ---------------------------------------------------------------------------------------- |
| `prompt`                     | `str`                  | `'Password: '` | The text displayed to prompt the user for input                                          |
| `mask`                       | `str`                  | `'•'`          | Character used to mask each input character (use empty string to hide completely)        |
| `mask_repeat`                | `int`                  | `1`            | Number of mask symbols displayed per each input character (1-100)                        |
| `char_timeout`               | `int`, `float`, `None` | `None`         | Delay in seconds after each character input                                              |
| `timeout`                    | `int`, `float`, `None` | `None`         | Total timeout in seconds for the whole input                                             |
| `timeout_prompt`             | `str`, `None`          | `None`         | Message displayed on timeout; requires timeout to be set                                 |
| `char_limit`                 | `int`, `None`          | `None`         | Maximum number of input characters allowed                                               |
| `mode`                       | `str`                  | `'standard'`   | Input display mode with various options [^*]                                             |
| `last_char_visible_duration` | `int`, `float`         | `0.1`          | Duration in seconds the last typed character is visible (only for `last-char-temporary`) |

[^*]
- `'standard'`: Shows mask character for each typed character
- `'last-char-temporary'`: Briefly shows each character before masking it
- `'invisible'`: No visual feedback (no mask, no cursor movement)
- `'pixel-lock'`: No cursor movement to prevent revealing input length

## Return Value

The function returns a string containing the user's input without the masking.

## Exceptions

- `TypeError`:
  - Raised:
    - If `prompt` or `mask` are not strings
    - If `mask_repeat` is not an integer
    - If `char_timeout`, `timeout`, or `last_char_visible_duration` are not int or float
    - If `timeout_prompt` is not a string
    - If `char_limit` is not an integer
    - If `mode` is not a string

- `ValueError`:
  - Raised:
    - If `mask` contains more than one character
    - If `mask` is an empty string but `mode` is not `invisible`
    - If `mask` is not one of `''` or `'•'` when mode is `invisible`
    - If `mask_repeat` is not between 1 and 100
    - If `timeout_prompt` is provided without setting `timeout`
    - If `timeout_prompt` is an empty string
    - If `char_limit` is set but not positive
    - If `mode` is not one of: `standard`, `last-char-temporary`, `invisible`, `pixel-lock`
    - If `mode` is `invisible` or `mask` is empty and `mask_repeat`, `char_timeout`, or `last_char_visible_duration` are set to non-default values
    - If `last_char_visible_duration` is set while `mode` is not `last-char-temporary`
    - If `last_char_visible_duration` is not greater than zero

- `KeyboardInterrupt`:
  - Raised:
    - If the user interrupts input (e.g., by pressing Ctrl+C)

## Implementation Details

- On Windows systems, the function uses the `msvcrt` module to read characters
- On POSIX-based systems, it uses `termios` and `tty` to set the terminal to raw mode
- Falls back to `getpass` when the script is not run in an interactive terminal

## Notes

- Special keys (arrows, function keys, etc.) are properly handled and ignored
- The function correctly processes backspace to remove the last character
- Only printable characters are added to the password
- The terminal is restored to its original state even if an exception occurs
- The `mask_repeat` parameter must be an integer between 1 and 100 to avoid overflow errors or memory issues during mask repetition. Values outside this range may raise an `OverflowError` or `MemoryError`

## Known Issues and Limitations

- Windows Character Input: On Windows systems, certain characters like "à" and other accented characters require pressing the key twice to be registered correctly. This is due to how the Windows console handles special characters.
- Very long passwords may cause display issues in terminals with limited width. This does not affect password entry itself, only its visual representation.
- On Windows and POSIX, `Ctrl+M` and `Ctrl+J` send the same sequences as `Enter` (`\r`) and `Line Feed` (`\n`), so they behave like pressing Enter. Similarly, `Ctrl+H` sends the same sequence as Backspace (`\b`), which deletes a character. Since `masked-input` focuses on handling individual key inputs (not complex shortcuts), these overlaps are expected and not treated specially just like in `getpass` and Python’s standard `input`.
- Input with non-standard keyboard layouts may have unexpected behavior on some platforms.
- Some terminal emulators may not properly handle the masking behavior, especially when using uncommon terminal settings.
- No error is raised if `last_char_visible_duration` is set while mode isn’t `last-char-temporary`, as long as its value remains at 0.1 (the default).

## Examples

```python
# Standard masking:
password = masked_input(prompt="Enter password: ", mask="*")

# Temporarily showing each character before masking:
password = masked_input(
    prompt="Enter password: ",
    mask="*",
    mode="last-char-temporary",
    last_char_visible_duration=0.2
)

# Invisible input (no visual feedback):
password = masked_input(mode="invisible")

# Input with timeout:
password = masked_input(
    timeout=30,
    timeout_prompt="Input timed out!"
)

# Character limit:
password = masked_input(char_limit=12)

# Delay between each character input (slows down rendering intentionally):
password = masked_input(
    prompt="Password: ",
    char_timeout=0.3
)

# Mask repeated for each character (e.g., "**" instead of "*"):
password = masked_input(
    mask ="*",
    mask_repeat=2
)
```

```python
# Example usage:
password = masked_input(prompt='Enter your password: ', mask='*', mask_repeat=2)
print(f'Your password is: {password}')
```

## Credits & Inspiration

This project was inspired by [pwinput](https://github.com/asweigart/pwinput), which provided the initial idea and implementation of cross-platform masked input in Python.

Big respect to Al Sweigart for his contributions to the open-source ecosystem.

## License

Released under the [MIT License](https://github.com/Ree-verse/masked-input/blob/main/LICENSE) © 2025 [Ree-verse](https://github.com/ree-verse).

## Star History

<a href="https://star-history.com/#Ree-verse/masked-input&Timeline">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Ree-verse/masked-input&type=Timeline&theme=dark" />
    <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Ree-verse/masked-input&type=Timeline" />
    <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Ree-verse/masked-input&type=Timeline" />
  </picture>
</a>

Disclaimer: This program may contain bugs. It has only been tested on AZERTY keyboards and may not function correctly on QWERTY layouts. If you encounter any issues, please open an issue to report them.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ree-verse/masked-input",
    "name": "masked-input",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "console, cross-platform, getpass, input, linux, macOS, mask, masked, masked-input, password, python, secure, security, shell, terminal, windows",
    "author": "Ree-verse",
    "author_email": "reeversesoft@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/04/c0/07afe7627a3fc55c01da41f7f5f3d431c5e8a8d07081bc3cdf271a34b221/masked_input-1.0.0.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\"><code>masked-input</code> - Cross-Platform Password Input with Various Masking Options</h1>\r\n\r\n<p align=\"center\">\r\n  <img src=\"assets/masked-input.svg\" alt=\"masked-input logo\" width=\"350\">\r\n</p>\r\n\r\n<p align=\"center\">\r\n  <a href=\"#overview\">Overview</a> \u2022\r\n  <a href=\"#why-use-masked-input\">Why use <code>masked-input</code>?</a> \u2022\r\n  <a href=\"#features\">Features</a> \u2022\r\n  <a href=\"#prerequisites\">Prerequisites</a> \u2022\r\n  <a href=\"#installation\">Installation</a> \u2022\r\n  <a href=\"#usage\">Usage</a> \u2022\r\n  <a href=\"#api-reference\">API Reference</a> \u2022\r\n  <a href=\"#parameters\">Parameters</a> \u2022\r\n  <a href=\"#return-value\">Return Value</a> \u2022\r\n  <a href=\"#exceptions\">Exceptions</a> \u2022\r\n  <a href=\"#implementation-details\">Implementation Details</a> \u2022\r\n  <a href=\"#notes\">Notes</a> \u2022\r\n  <a href=\"#known-issues-and-limitations\">Known Issues and Limitations</a> \u2022\r\n  <a href=\"#examples\">Examples</a> \u2022\r\n  <a href=\"#credits--inspiration\">Credits & Inspiration</a> \u2022\r\n  <a href=\"#license\">License</a> \u2022\r\n  <a href=\"#star-history\">Star History</a>\r\n</p>\r\n\r\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/ree-verse/masked-input)](https://github.com/ree-verse/masked-input/commits)\r\n[![GitHub Issues](https://img.shields.io/github/issues/ree-verse/masked-input.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/ree-verse/masked-input/issues)\r\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/ree-verse/masked-input/blob/main/LICENSE)\r\n[![Discord](https://img.shields.io/discord/1262386017202212996?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/ZZfqH9Z4uQ)\r\n\r\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/masked-input)](https://pypi.org/project/masked-input/)\r\n[![PyPI Status](https://badge.fury.io/py/masked-input.svg)](https://badge.fury.io/py/masked-input)\r\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/masked-input)](https://pepy.tech/project/masked-input)\r\n\r\n---\r\n\r\n## Overview\r\n\r\nThe `masked-input` function provides **a secure way to read passwords** or other sensitive input from the command line with **customizable masking**. It works across **different operating systems** and **handles various edge cases**.\r\n\r\n## Why Use `masked-input`?\r\n\r\nUnlike `getpass`, `masked-input` provides **visual feedback through masking**, improving UX during password entry, especially in CLI tools. It also offers **full customization** and **graceful fallback behavior**.\r\n\r\n## Features\r\n\r\n- \ud83c\udf10 **Cross-platform compatibility** - Works on Windows and POSIX-based systems\r\n- \ud83c\udfad **Customizable masking character** - Define your own character to mask input (like *, \u2022, or nothing at all)\r\n- \ud83d\udd22 **Adjustable mask repeat count** - Control how many masking characters appear per typed character, from single to multiple symbols, or even none\r\n- \u232b **Proper handling of backspace and special keys** - Properly deletes characters and gracefully skips over arrow keys, escape sequences, and other exotic key combos without breaking the mask flow\r\n- \u23f1\ufe0f **Per-character delay** - Optionally pauses after each typed character\r\n- \u231b **Global input timeout** - Abort password input after a defined total duration and optionally show a custom message when time runs out\r\n- \ud83d\udd10 **Character limit** - Define a maximum password length\r\n- \ud83e\udded **Selectable input mode** - Choose between:\r\n  - **standard**: masks each char normally\r\n  - **last-char-temporary**: briefly shows the last char before masking\r\n  - **invisible**: shows nothing at all\r\n  - **pixel-lock**: masks then deletes instantly\r\n- \ud83e\uddea **Fallback to standard `getpass` when necessary** - Automatically switches to `getpass` when masking isn\u2019t feasible\r\n- \u270d\ufe0f **Clear and concise docstrings** - Parameters documented with no fluff, easy to read and maintain\r\n- \u2705 **Built-in unit tests** - Comes with a robust suite of unit tests covering key usage scenarios to ensure reliability\r\n\r\n## Prerequisites\r\n\r\n- **Python 3.9** or higher\r\n- **No external dependencies** (uses only standard library modules)\r\n- **Terminal or command-line environment** that supports interactive input\r\n- On Windows: **A terminal that supports ANSI escape sequences** for best results\r\n- On POSIX: **Terminal with standard TTY capabilities**\r\n\r\n## Installation\r\n\r\n### Option 1: PyPI\r\n\r\n```bash\r\npip install masked-input\r\n```\r\n\r\n### Option 2: Manual Installation\r\n\r\nClone the repository or download the source code, then navigate to the project directory:\r\n\r\n```bash\r\ngit clone https://github.com/ree-verse/masked-input.git\r\ncd path/to/your/folder\r\npip install .\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom masked_input import masked_input\r\n\r\n# Basic usage with default settings\r\npassword = masked_input()  # Displays \"Password: \" with \"\u2022\" masking\r\n\r\n# Custom prompt, mask character, and mask repeat count\r\npassword = masked_input(\r\n    prompt=\"Enter secret key: \",\r\n    mask=\"*\",\r\n    mask_repeat=2\r\n)\r\n\r\n# Hide input completely (no masking character)\r\npassword = masked_input(mask=\"\")\r\n```\r\n\r\n## API Reference\r\n\r\n```python\r\nmasked_input(\r\n    prompt: str = 'Password: ',\r\n    mask: str = '\u2022',\r\n    mask_repeat: int = 1,\r\n    char_timeout: Optional[Union[int, float]] = None,\r\n    timeout: Optional[Union[int, float]] = None,\r\n    timeout_prompt: Optional[str] = None,\r\n    char_limit: Optional[int] = None,\r\n    mode: Literal['standard', 'last-char-temporary', 'invisible', 'pixel-lock'] = 'standard',\r\n    last_char_visible_duration: Union[int, float] = 0.1\r\n) -> str\r\n```\r\n\r\n## Parameters\r\n\r\n| Parameter                    | Type                   | Default        | Description                                                                              |\r\n| ---------------------------- | ---------------------- | -------------- | ---------------------------------------------------------------------------------------- |\r\n| `prompt`                     | `str`                  | `'Password: '` | The text displayed to prompt the user for input                                          |\r\n| `mask`                       | `str`                  | `'\u2022'`          | Character used to mask each input character (use empty string to hide completely)        |\r\n| `mask_repeat`                | `int`                  | `1`            | Number of mask symbols displayed per each input character (1-100)                        |\r\n| `char_timeout`               | `int`, `float`, `None` | `None`         | Delay in seconds after each character input                                              |\r\n| `timeout`                    | `int`, `float`, `None` | `None`         | Total timeout in seconds for the whole input                                             |\r\n| `timeout_prompt`             | `str`, `None`          | `None`         | Message displayed on timeout; requires timeout to be set                                 |\r\n| `char_limit`                 | `int`, `None`          | `None`         | Maximum number of input characters allowed                                               |\r\n| `mode`                       | `str`                  | `'standard'`   | Input display mode with various options [^*]                                             |\r\n| `last_char_visible_duration` | `int`, `float`         | `0.1`          | Duration in seconds the last typed character is visible (only for `last-char-temporary`) |\r\n\r\n[^*]\r\n- `'standard'`: Shows mask character for each typed character\r\n- `'last-char-temporary'`: Briefly shows each character before masking it\r\n- `'invisible'`: No visual feedback (no mask, no cursor movement)\r\n- `'pixel-lock'`: No cursor movement to prevent revealing input length\r\n\r\n## Return Value\r\n\r\nThe function returns a string containing the user's input without the masking.\r\n\r\n## Exceptions\r\n\r\n- `TypeError`:\r\n  - Raised:\r\n    - If `prompt` or `mask` are not strings\r\n    - If `mask_repeat` is not an integer\r\n    - If `char_timeout`, `timeout`, or `last_char_visible_duration` are not int or float\r\n    - If `timeout_prompt` is not a string\r\n    - If `char_limit` is not an integer\r\n    - If `mode` is not a string\r\n\r\n- `ValueError`:\r\n  - Raised:\r\n    - If `mask` contains more than one character\r\n    - If `mask` is an empty string but `mode` is not `invisible`\r\n    - If `mask` is not one of `''` or `'\u2022'` when mode is `invisible`\r\n    - If `mask_repeat` is not between 1 and 100\r\n    - If `timeout_prompt` is provided without setting `timeout`\r\n    - If `timeout_prompt` is an empty string\r\n    - If `char_limit` is set but not positive\r\n    - If `mode` is not one of: `standard`, `last-char-temporary`, `invisible`, `pixel-lock`\r\n    - If `mode` is `invisible` or `mask` is empty and `mask_repeat`, `char_timeout`, or `last_char_visible_duration` are set to non-default values\r\n    - If `last_char_visible_duration` is set while `mode` is not `last-char-temporary`\r\n    - If `last_char_visible_duration` is not greater than zero\r\n\r\n- `KeyboardInterrupt`:\r\n  - Raised:\r\n    - If the user interrupts input (e.g., by pressing Ctrl+C)\r\n\r\n## Implementation Details\r\n\r\n- On Windows systems, the function uses the `msvcrt` module to read characters\r\n- On POSIX-based systems, it uses `termios` and `tty` to set the terminal to raw mode\r\n- Falls back to `getpass` when the script is not run in an interactive terminal\r\n\r\n## Notes\r\n\r\n- Special keys (arrows, function keys, etc.) are properly handled and ignored\r\n- The function correctly processes backspace to remove the last character\r\n- Only printable characters are added to the password\r\n- The terminal is restored to its original state even if an exception occurs\r\n- The `mask_repeat` parameter must be an integer between 1 and 100 to avoid overflow errors or memory issues during mask repetition. Values outside this range may raise an `OverflowError` or `MemoryError`\r\n\r\n## Known Issues and Limitations\r\n\r\n- Windows Character Input: On Windows systems, certain characters like \"\u00e0\" and other accented characters require pressing the key twice to be registered correctly. This is due to how the Windows console handles special characters.\r\n- Very long passwords may cause display issues in terminals with limited width. This does not affect password entry itself, only its visual representation.\r\n- On Windows and POSIX, `Ctrl+M` and `Ctrl+J` send the same sequences as `Enter` (`\\r`) and `Line Feed` (`\\n`), so they behave like pressing Enter. Similarly, `Ctrl+H` sends the same sequence as Backspace (`\\b`), which deletes a character. Since `masked-input` focuses on handling individual key inputs (not complex shortcuts), these overlaps are expected and not treated specially just like in `getpass` and Python\u2019s standard `input`.\r\n- Input with non-standard keyboard layouts may have unexpected behavior on some platforms.\r\n- Some terminal emulators may not properly handle the masking behavior, especially when using uncommon terminal settings.\r\n- No error is raised if `last_char_visible_duration` is set while mode isn\u2019t `last-char-temporary`, as long as its value remains at 0.1 (the default).\r\n\r\n## Examples\r\n\r\n```python\r\n# Standard masking:\r\npassword = masked_input(prompt=\"Enter password: \", mask=\"*\")\r\n\r\n# Temporarily showing each character before masking:\r\npassword = masked_input(\r\n    prompt=\"Enter password: \",\r\n    mask=\"*\",\r\n    mode=\"last-char-temporary\",\r\n    last_char_visible_duration=0.2\r\n)\r\n\r\n# Invisible input (no visual feedback):\r\npassword = masked_input(mode=\"invisible\")\r\n\r\n# Input with timeout:\r\npassword = masked_input(\r\n    timeout=30,\r\n    timeout_prompt=\"Input timed out!\"\r\n)\r\n\r\n# Character limit:\r\npassword = masked_input(char_limit=12)\r\n\r\n# Delay between each character input (slows down rendering intentionally):\r\npassword = masked_input(\r\n    prompt=\"Password: \",\r\n    char_timeout=0.3\r\n)\r\n\r\n# Mask repeated for each character (e.g., \"**\" instead of \"*\"):\r\npassword = masked_input(\r\n    mask =\"*\",\r\n    mask_repeat=2\r\n)\r\n```\r\n\r\n```python\r\n# Example usage:\r\npassword = masked_input(prompt='Enter your password: ', mask='*', mask_repeat=2)\r\nprint(f'Your password is: {password}')\r\n```\r\n\r\n## Credits & Inspiration\r\n\r\nThis project was inspired by [pwinput](https://github.com/asweigart/pwinput), which provided the initial idea and implementation of cross-platform masked input in Python.\r\n\r\nBig respect to Al Sweigart for his contributions to the open-source ecosystem.\r\n\r\n## License\r\n\r\nReleased under the [MIT License](https://github.com/Ree-verse/masked-input/blob/main/LICENSE) \u00a9 2025 [Ree-verse](https://github.com/ree-verse).\r\n\r\n## Star History\r\n\r\n<a href=\"https://star-history.com/#Ree-verse/masked-input&Timeline\">\r\n  <picture>\r\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=Ree-verse/masked-input&type=Timeline&theme=dark\" />\r\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=Ree-verse/masked-input&type=Timeline\" />\r\n    <img alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=Ree-verse/masked-input&type=Timeline\" />\r\n  </picture>\r\n</a>\r\n\r\nDisclaimer: This program may contain bugs. It has only been tested on AZERTY keyboards and may not function correctly on QWERTY layouts. If you encounter any issues, please open an issue to report them.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Cross-platform library to read password input with various masking options.",
    "version": "1.0.0",
    "project_urls": {
        "Docs": "https://github.com/ree-verse/masked-input/blob/main/README.md",
        "Homepage": "https://github.com/ree-verse/masked-input",
        "Issues": "https://github.com/ree-verse/masked-input/issues",
        "Source": "https://github.com/ree-verse/masked-input"
    },
    "split_keywords": [
        "console",
        " cross-platform",
        " getpass",
        " input",
        " linux",
        " macos",
        " mask",
        " masked",
        " masked-input",
        " password",
        " python",
        " secure",
        " security",
        " shell",
        " terminal",
        " windows"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9a38c0fa2494c45531482868f3b040b3ac3de1c25ae888825fb7f3183f3d3ba8",
                "md5": "db35bd4c9a4a9699198eeca6bd712af6",
                "sha256": "cf735722418e7cf4b77f9799e796aa2a3a1f6cbf0446bcfce582609885b7369a"
            },
            "downloads": -1,
            "filename": "masked_input-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db35bd4c9a4a9699198eeca6bd712af6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11458,
            "upload_time": "2025-07-27T18:03:01",
            "upload_time_iso_8601": "2025-07-27T18:03:01.544999Z",
            "url": "https://files.pythonhosted.org/packages/9a/38/c0fa2494c45531482868f3b040b3ac3de1c25ae888825fb7f3183f3d3ba8/masked_input-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "04c007afe7627a3fc55c01da41f7f5f3d431c5e8a8d07081bc3cdf271a34b221",
                "md5": "f7e9f7c7c5741b099d9d886961dd0445",
                "sha256": "307edb146728f1fade694b2dcafeb8a27cae74b7080d48594145bc21e138080a"
            },
            "downloads": -1,
            "filename": "masked_input-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f7e9f7c7c5741b099d9d886961dd0445",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 17062,
            "upload_time": "2025-07-27T18:03:02",
            "upload_time_iso_8601": "2025-07-27T18:03:02.992682Z",
            "url": "https://files.pythonhosted.org/packages/04/c0/07afe7627a3fc55c01da41f7f5f3d431c5e8a8d07081bc3cdf271a34b221/masked_input-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-27 18:03:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ree-verse",
    "github_project": "masked-input",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "masked-input"
}
        
Elapsed time: 2.11774s