Skip to content

Commit

Permalink
Merge pull request #5 from princenyeche/code-review MIS-5
Browse files Browse the repository at this point in the history
Patch to exception error
  • Loading branch information
princenyeche authored Jun 4, 2022
2 parents 8ee47f8 + d6b66eb commit eb6edf5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Mistyfy change log

**Release 2.0.5** - 2022-06-04
### Patch
* Patches
* Added a defined exception error for encoding and decoding functions

**Release 2.0.4** - 2022-04-16
### Patch
* Patches
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ secret = b'somesecretkey' # create any secret key, easier if you use os.urandom(
# secret = os.urandom(16)
a = "This is a secret message or password"
b = encode(a, secret, gn)
# output is a dictionary which contains a signed value when decrypting:
# output is a string which contains a signed value when decrypting:
# 'eyJtaXN0eWZ5IjogWzQ5Nxxxxxx...
c = decode(b, secret, gn)
# Output:
Expand Down
7 changes: 4 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
Below shows the list of supported version for the mistyfy library

| Version | Supported |
| ------- | ------------------ |
|---------|--------------------|
| 2.0.5 | :white_check_mark: |
| 2.0.4 | :white_check_mark: |
| 2.0.3 | :white_check_mark: |
| 2.0.2 | :white_check_mark: |
| 2.0.3 | :x: |
| 2.0.2 | :x: |
| 2.0.1 | :x: |
| 2.0.0 | :x: |
| 1.0.1 | :x: |
Expand Down
2 changes: 1 addition & 1 deletion mistyfy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
from mistyfy.misty import encode, decode, ciphers, signs, verify_signs, generator

__all__ = ["encode", "decode", "ciphers", "signs", "verify_signs", "generator"]
__version__ = "v2.0.4"
__version__ = "v2.0.5"
__author__ = "Prince Nyeche"
__copyright__ = "MIT License"
12 changes: 6 additions & 6 deletions mistyfy/misty.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ def encode(
results = b.b64encode(encode_export.encode("utf-8")) # bs64 the data again
_do_results = results.decode("utf-8") # ensure its in strings
return _do_results
except ValueError as error:
if error:
return "You are seem to be using some wrong data format. Check your entered data."
except Exception as error:
if isinstance(error, ValueError):
return "You seem to be using some wrong data format. Check your entered data."
return "Failure encrypting data."


Expand Down Expand Up @@ -335,9 +335,9 @@ def decode(
return "".join(parse)
else:
return "Unable to decrypt data, incorrect value detected."
except ValueError as error:
if error:
return "You are seem to be using the wrong data value or maybe the data " \
except Exception as error:
if isinstance(error, ValueError):
return "You seem to be using the wrong data value or maybe the data " \
"used as value in the data argument is incorrect."
return "Failure decrypting data."

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="mistyfy",
version="2.0.4",
version="2.0.5",
author="Prince Nyeche",
author_email="support@elfapp.website",
description="A package that helps encrypt any given string and returns an encrypted string with a signed hash."
Expand Down

0 comments on commit eb6edf5

Please sign in to comment.