Metadata-Version: 2.4
Name: core-identity
Version: 0.1.3
Summary: Centralized and robust service to manage unique identifiers (UUID) inside the Python ecosystem
License: MIT License
        
        Copyright (c) 2026 Bruno Barroso
        
        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: Homepage, https://github.com/BrunoBarroso09/core-identity-service
Project-URL: Repository, https://github.com/BrunoBarroso09/core-identity-service
Keywords: uuid,identifier,microservices,python
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Core Identifiers 🚀


![Tests](https://github.com/BrunoBarroso09/core-identity/actions/workflows/tests.yml/badge.svg)

Centralized and robust service to manage unique identifiers (UUID) inside the Python ecosystem.

This component was designed to be **agnostic**, allowing multiple projects (APIs, microservices) 
to use the same logic to generate IDs, ensuring consistency.

## ✨ Functionalities

- **UUID v4**: Generates totally random IDs for sessions and transactions
- **UUID v4 Hex**: Compact version (without dashes), ideal for file names or URL keys
- **UUID v5**: Generates IDs based on *Namespace* and *Input* (e.g. email). The same input always generates the same ID — perfect to avoid duplicates in databases like MongoDB or MySQL

## 🛠️ How to use

### 1. Project structure
Copy the `UUID` folder to the root of your project:
```text
your_project/
├── UUID/
│   ├── __init__.py
│   └── identifier.py
```

### 2. Usage examples
```python
from UUID.identifier import Identifier

# Random UUID v4
print(Identifier.v4())    # "550e8400-e29b-41d4-a716-446655440000"

# UUID v4 Hex (no dashes)
print(Identifier.hex())   # "550e8400e29b41d4a716446655440000"

# Deterministic UUID v5 (same input = same ID)
print(Identifier.v5("user@email.com"))  # always the same
```

## 🧪 Running Tests

Install pytest:
```bash
pip install pytest
```

Run all tests:
```bash
pytest tests/
```

Expected output:
```
tests/test_identifiers.py .....   5 passed in 0.02s
```

### Test coverage

| Test | Description |
|------|-------------|
| `test_uuid4_is_string` | Checks that UUID v4 returns a string |
| `test_uuid4_format_valido` | Validates UUID v4 format |
| `test_uuid4_hex` | Checks that hex version has no dashes |
| `test_uuid5_deterministic` | Same input always returns same ID |
| `test_uuid_v5_inputs_different` | Different inputs return different IDs |

## 📁 Project Structure
```text
core-uuid/
├── UUID/
│   ├── __init__.py
│   └── identifier.py
├── tests/
│   ├── __init__.py
│   └── test_identifiers.py
├── README.md
└── LICENSE
```
