Metadata-Version: 2.2
Name: code_monger
Version: 0.1.3
Summary: A package for on-the-fly code generation and validation
Home-page: https://github.com/victhepythonista/code_monger
Author: Victor Kipkemboi
Author-email: scriptilapia@gmail.com
Project-URL: Bug Tracker, https://github.com/victhepythonista/code_monger/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: requires-python
Dynamic: summary


# Introduction
- **Code monger** is a simple Python package for generation and validation of authentication codes which are generated and stored in files . 
-  For example , you can use this package when generating authentication codes for authenticating user email addresses in a web application .
# Installation using pip
- You can install the package easily on the command using **pip**

## Windows OS installation
```
python3 -m pip install code_monger

```
alternatively 
```
pip install code_monger
```
or
```
py -m pip install code_monger
```
# Usage
### Simple code generation
- Let us generate a simple code based on the provided parameters

```

from code_monger import generate_code
# generates the code and returns it as a string object
my_code = generate_code(length = 20  )

print(my_code)
```
### Custom code generation
- Let us generate a custom code 

```


# A code comprising of numbers only 
code = generate_code(numbers = True , letters = False)

# Letters only code
code generate_code(numbers = False , letters = True )

# Uppercase Letters only code
code generate_code(numbers = False , letters = True , capitalize = True )

# Lowercase Letters only code
code generate_code(numbers = False , letters = True ,capitalize = False )

# code made up of letters, numbers and punctuation marks
# Letters only code
code generate_code(numbers = True , letters = True  , punctuation  = True)
```
> Please __NOTE__  :  generate_code function and __CodeGenerator.NewCode__  method require the same keyword arguments  with the exception that  __CodeGeneratorNewCode__ requires the __key_string__ argument 


### Code generation and validation in files
- The class __CodeGenerator__ is what we will use for this functionality
```
from code_monger import CodeGenerator
# specify the path you want to store the codes 
# If the path doesnt exist , the program will attempt to make it 
# Let's replicate a scenario where you want to authenticate a user's email in a web app

user_email = "somerandom@email.com"
codes_file = "codes/my_codes.txt"
cm = CodeGenerator(storage_file = codes_file)

# let us generate a new code and store it in the specified file 
code = cm.NewCode(key_string = user_email )

# validation can be done through the CodeGenerator.ValidateCode method like so:
cm.ValidateCode(user_email , code) # will return a Boolean 
```
 

