square-authentication 4.0.1__tar.gz → 4.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {square_authentication-4.0.1 → square_authentication-4.1.0}/PKG-INFO +5 -1
  2. {square_authentication-4.0.1 → square_authentication-4.1.0}/README.md +4 -0
  3. {square_authentication-4.0.1 → square_authentication-4.1.0}/setup.py +1 -1
  4. square_authentication-4.1.0/square_authentication/routes/utility.py +61 -0
  5. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication.egg-info/PKG-INFO +5 -1
  6. square_authentication-4.0.1/square_authentication/routes/utility.py +0 -5
  7. {square_authentication-4.0.1 → square_authentication-4.1.0}/setup.cfg +0 -0
  8. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/__init__.py +0 -0
  9. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/configuration.py +0 -0
  10. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/data/config.ini +0 -0
  11. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/main.py +0 -0
  12. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/messages.py +0 -0
  13. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/pydantic_models/__init__.py +0 -0
  14. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/pydantic_models/core.py +0 -0
  15. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/routes/__init__.py +0 -0
  16. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/routes/core.py +0 -0
  17. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/utils/__init__.py +0 -0
  18. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/utils/encryption.py +0 -0
  19. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication/utils/token.py +0 -0
  20. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication.egg-info/SOURCES.txt +0 -0
  21. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication.egg-info/dependency_links.txt +0 -0
  22. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication.egg-info/requires.txt +0 -0
  23. {square_authentication-4.0.1 → square_authentication-4.1.0}/square_authentication.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square_authentication
3
- Version: 4.0.1
3
+ Version: 4.1.0
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -32,6 +32,10 @@ pip install square_authentication
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v4.1.0
36
+
37
+ - add get_text_hash/v0 in utils.
38
+
35
39
  ### v4.0.1
36
40
 
37
41
  - bugfix in pydantic model import.
@@ -16,6 +16,10 @@ pip install square_authentication
16
16
 
17
17
  ## changelog
18
18
 
19
+ ### v4.1.0
20
+
21
+ - add get_text_hash/v0 in utils.
22
+
19
23
  ### v4.0.1
20
24
 
21
25
  - bugfix in pydantic model import.
@@ -4,7 +4,7 @@ package_name = "square_authentication"
4
4
 
5
5
  setup(
6
6
  name=package_name,
7
- version="4.0.1",
7
+ version="4.1.0",
8
8
  packages=find_packages(),
9
9
  package_data={
10
10
  package_name: ["data/*"],
@@ -0,0 +1,61 @@
1
+ import bcrypt
2
+ from fastapi import APIRouter, status, HTTPException
3
+ from fastapi.responses import JSONResponse
4
+ from square_commons import get_api_output_in_standard_format
5
+
6
+ from square_authentication.configuration import global_object_square_logger
7
+ from square_authentication.messages import messages
8
+
9
+ router = APIRouter(
10
+ tags=["utility"],
11
+ )
12
+
13
+
14
+ @router.get("/get_text_hash/v0")
15
+ @global_object_square_logger.async_auto_logger
16
+ async def get_text_hash_v0(plain_text: str):
17
+
18
+ try:
19
+ """
20
+ validation
21
+ """
22
+ # pass
23
+ """
24
+ main process
25
+ """
26
+ local_str_hashed_text = bcrypt.hashpw(
27
+ plain_text.encode("utf-8"), bcrypt.gensalt()
28
+ ).decode("utf-8")
29
+ """
30
+ return value
31
+ """
32
+ output_content = get_api_output_in_standard_format(
33
+ message=messages["GENERIC_READ_SUCCESSFUL"],
34
+ data={"main": local_str_hashed_text},
35
+ )
36
+ return JSONResponse(
37
+ status_code=status.HTTP_200_OK,
38
+ content=output_content,
39
+ )
40
+ except HTTPException as http_exception:
41
+ global_object_square_logger.logger.error(http_exception, exc_info=True)
42
+ """
43
+ rollback logic
44
+ """
45
+ # pass
46
+ return JSONResponse(
47
+ status_code=http_exception.status_code, content=http_exception.detail
48
+ )
49
+ except Exception as e:
50
+ global_object_square_logger.logger.error(e, exc_info=True)
51
+ """
52
+ rollback logic
53
+ """
54
+ # pass
55
+ output_content = get_api_output_in_standard_format(
56
+ message=messages["GENERIC_500"],
57
+ log=str(e),
58
+ )
59
+ return JSONResponse(
60
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=output_content
61
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: square-authentication
3
- Version: 4.0.1
3
+ Version: 4.1.0
4
4
  Summary: authentication layer for my personal server.
5
5
  Home-page: https://github.com/thepmsquare/square_authentication
6
6
  Author: thePmSquare
@@ -32,6 +32,10 @@ pip install square_authentication
32
32
 
33
33
  ## changelog
34
34
 
35
+ ### v4.1.0
36
+
37
+ - add get_text_hash/v0 in utils.
38
+
35
39
  ### v4.0.1
36
40
 
37
41
  - bugfix in pydantic model import.
@@ -1,5 +0,0 @@
1
- from fastapi import APIRouter
2
-
3
- router = APIRouter(
4
- tags=["utility"],
5
- )