square-authentication 4.0.1__py3-none-any.whl → 4.1.0__py3-none-any.whl

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.
@@ -1,5 +1,61 @@
1
- from fastapi import APIRouter
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
2
8
 
3
9
  router = APIRouter(
4
10
  tags=["utility"],
5
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
@@ -43,6 +43,10 @@ pip install square_authentication
43
43
 
44
44
  ## changelog
45
45
 
46
+ ### v4.1.0
47
+
48
+ - add get_text_hash/v0 in utils.
49
+
46
50
  ### v4.0.1
47
51
 
48
52
  - bugfix in pydantic model import.
@@ -7,11 +7,11 @@ square_authentication/pydantic_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
7
7
  square_authentication/pydantic_models/core.py,sha256=Hwzr-YJH6GVGLp4Z29iHItOEhiEvk65MjsttmCaDTe4,431
8
8
  square_authentication/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  square_authentication/routes/core.py,sha256=Yki554LnBEv1RkwwPkSTksCbXMtgheka4_No41XVbe0,44742
10
- square_authentication/routes/utility.py,sha256=Kx4S4tZ1GKsPoC8CoZ4fkLEebvr02KeFEPePtTHtpnQ,75
10
+ square_authentication/routes/utility.py,sha256=ocLWj39JbKVOxgyTsM0xBUgTpHFmKIvvaT3UnjFvuOY,1783
11
11
  square_authentication/utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
12
12
  square_authentication/utils/encryption.py,sha256=T6BShoUr_xeGpbfPgTK-GxTlXPwcjwU4c4KW7KPzrF8,1865
13
13
  square_authentication/utils/token.py,sha256=Y_arg5LegX-aprMj9YweUK8jjNZLGDjLUGgxbUA12w4,560
14
- square_authentication-4.0.1.dist-info/METADATA,sha256=jJswgaCL5ieluh7o0KkQ4THyr0FlaKdc57-1hQNfttA,2858
15
- square_authentication-4.0.1.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
16
- square_authentication-4.0.1.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
17
- square_authentication-4.0.1.dist-info/RECORD,,
14
+ square_authentication-4.1.0.dist-info/METADATA,sha256=sLSqlgWDugaTf3y3APLXF9_xUDx5vO7CqmG6__hdr7c,2904
15
+ square_authentication-4.1.0.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
16
+ square_authentication-4.1.0.dist-info/top_level.txt,sha256=wDssVJIl9KIEJPj5rR3rv4uRI7yCndMBrvHd_6BGXQA,22
17
+ square_authentication-4.1.0.dist-info/RECORD,,