rj-api 0.0.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.
- rj_api-0.0.0/PKG-INFO +5 -0
- rj_api-0.0.0/pyproject.toml +11 -0
- rj_api-0.0.0/rj_api/api_keys.py +34 -0
- rj_api-0.0.0/rj_api.egg-info/PKG-INFO +5 -0
- rj_api-0.0.0/rj_api.egg-info/SOURCES.txt +7 -0
- rj_api-0.0.0/rj_api.egg-info/dependency_links.txt +1 -0
- rj_api-0.0.0/rj_api.egg-info/requires.txt +1 -0
- rj_api-0.0.0/rj_api.egg-info/top_level.txt +1 -0
- rj_api-0.0.0/setup.cfg +4 -0
rj_api-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from rj.settings import DEFAULT_SETTINGS_DICT as settings
|
|
2
|
+
try:
|
|
3
|
+
import bcrypt
|
|
4
|
+
|
|
5
|
+
except ModuleNotFoundError:
|
|
6
|
+
print("bcrypt is not installed. Please install.")
|
|
7
|
+
|
|
8
|
+
class Secrets:
|
|
9
|
+
@staticmethod
|
|
10
|
+
def hash_password(string):
|
|
11
|
+
password_bytes = string.encode("utf-8")
|
|
12
|
+
salt = bcrypt.gensalt(12)
|
|
13
|
+
hashed_password = bcrypt.hashpw(password_bytes,salt)
|
|
14
|
+
return hashed_password.decode("utf-8")
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def check_password(string1, string2):
|
|
18
|
+
return bcrypt.checkpw(
|
|
19
|
+
string1.encode("utf-8"),
|
|
20
|
+
string2.encode("utf-8")
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
class API:
|
|
24
|
+
@staticmethod
|
|
25
|
+
def generate_api_key():
|
|
26
|
+
|
|
27
|
+
import secrets
|
|
28
|
+
from rj.settings import API_SIGNATURE as api_signature
|
|
29
|
+
token =secrets.token_urlsafe(64)
|
|
30
|
+
start = api_signature["start"]
|
|
31
|
+
end = api_signature["end"]
|
|
32
|
+
api_key = f"{start} {token} {end}"
|
|
33
|
+
return api_key
|
|
34
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rj-home
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rj_api
|
rj_api-0.0.0/setup.cfg
ADDED