Metadata-Version: 2.1
Name: clixmlcreds
Version: 1.0.post1
Summary: Call Windows prompt for credentials with Python through PowerShell command Get-Credential.
Author-email: Anisimov Vladislav <pan.vlados.w@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Vladislav Anisimov
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        
Project-URL: repository, https://github.com/pan-vlados/clixmlcreds
Keywords: WDPAPI,Export-Clixml,Get-Credential,PSCredential,clixml,credential,Windows,Protection
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Security
Requires-Python: >=3.8.5
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pywin32
Provides-Extra: dev
Requires-Dist: ruff ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'

# clixmlcreds

<p align="center">
  <img alt="Static Badge" src="https://img.shields.io/badge/WDP-API-badge?style=flat&color=blue">
  <img alt="Static Badge" src="https://img.shields.io/badge/Credentials-Clixml?style=plastic&color=white">
  <img alt="Static Badge" src="https://img.shields.io/badge/XML-hashed?style=flat-square&color=purple">
</p>


Simple solution to call Windows prompt for credentials through PowerShell command Get-Credential. Result of command above will be exported in xml using Windows Data Protection API (Export-Clixml PowerShell command).

<p align="center">
  <img src="https://raw.githubusercontent.com/pan-vlados/clixmlcreds/master/image.png">
</p>

You can store your credentials and reuse it in scripts by `CredentialManager.read(...)`.

Very handy when you just need to store credentials for different services and call them based on different `<cred_name>`.


## Usage

```python
from clixmlcreds import Credential, CredentialManager


cred_name: str = 'Name_of_secret_xml_file'  # cred name without file extension


if not Credential.exists(name=cred_name):
    CredentialManager.write(
        cred_name=cred_name,
        username='Your_username',
        prompt_message='Input username and password:'
    )
cred = CredentialManager.read(cred_name=cred_name)
username = cred.username
password = cred.get_password()  # return unsecure password string
```


## Secrets storage


The default `secrets` storage is the corresponding [folder](src/clixmlcreds/secrets) inside the package. All credentials are hashed and stored in this folder as a `<cred_name>.xml` file.
You can change this behavior using:
```python
from pathlib import Path
from clixmlcreds import CredentialManager


CredentialManager.path = Path('your_own_secrets_storage_folder')
```
