rj-api 0.0.1__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.
rj_api/api_keys.py 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,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: rj-api
3
+ Version: 0.0.1
4
+ Author: rahul
5
+ Requires-Dist: rj-home
@@ -0,0 +1,5 @@
1
+ rj_api/api_keys.py,sha256=1kymmqycRWF4uF0bXdkZCcu4VRLCywTmfzN74oruF_0,932
2
+ rj_api-0.0.1.dist-info/METADATA,sha256=hTzsVviEOFi-3XyUa6wlmkFeWVhpUsWDWsxZO8bemkc,87
3
+ rj_api-0.0.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
4
+ rj_api-0.0.1.dist-info/top_level.txt,sha256=zKJA3__mBKYiVl-oKOnUB2PdD--d6wpHBNG-fWFTx3c,7
5
+ rj_api-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ rj_api