steemengine package¶
Subpackages¶
Submodules¶
steemengine.helpers module¶
Various helper functions for use in CryptoToken Converter.
Copyright:
+===================================================+
| © 2019 Privex Inc. |
| https://www.privex.io |
+===================================================+
| |
| CryptoToken Converter |
| |
| Core Developer(s): |
| |
| (+) Chris (@someguy123) [Privex] |
| |
+===================================================+
-
steemengine.helpers.
decrypt_str
(data: Union[str, bytes], key: Union[str, bytes] = None) → str[source]¶ Decrypts
data
previously encrypted usingencrypt_str()
with the same Fernet compatiblekey
, and returns the decrypted version as a string.The
key
cannot just be a random “password”, it must be a 32-byte key encoded with URL Safe base64. Use the management command./manage.py generate_key
to create a Fernet compatible encryption key.Under the hood, Fernet uses AES-128 CBC to encrypt the data, with PKCS7 padding and HMAC_SHA256 authentication.
If the
key
parameter isn’t passed, or is empty (None / “”), then it will attempt to fall back tosettings.ENCRYPT_KEY
- if that’s also empty, EncryptKeyMissing will be raised.Parameters: Raises: - EncryptKeyMissing – Either no key was passed, or something is wrong with the key.
- EncryptionError – Something went wrong while attempting to decrypt the data
Return str decrypted_data: The decrypted data as a string
-
steemengine.helpers.
empty
(v, zero=False, itr=False) → bool[source]¶ Quickly check if a variable is empty or not. By default only ‘’ and None are checked, use itr and zero to test for empty iterable’s and zeroed variables.
Returns True if a variable is None or ‘’, returns False if variable passes the tests
Parameters: - v – The variable to check if it’s empty
- zero – if zero=True, then return True if the variable is 0
- itr – if itr=True, then return True if the variable is
[]
,{}
, or is an iterable and has 0 length
Return bool is_blank: True if a variable is blank (
None
,''
,0
,[]
etc.)Return bool is_blank: False if a variable has content (or couldn’t be checked properly)
-
steemengine.helpers.
encrypt_str
(data: Union[str, bytes], key: Union[str, bytes] = None) → str[source]¶ Encrypts a piece of data
data
passed as a string or bytes using Fernet with the passed 32-bit symmetric encryption keykey
. Outputs the encrypted data as a Base64 string for easy storage.The
key
cannot just be a random “password”, it must be a 32-byte key encoded with URL Safe base64. Use the management command./manage.py generate_key
to create a Fernet compatible encryption key.Under the hood, Fernet uses AES-128 CBC to encrypt the data, with PKCS7 padding and HMAC_SHA256 authentication.
If the
key
parameter isn’t passed, or is empty (None / “”), then it will attempt to fall back tosettings.ENCRYPT_KEY
- if that’s also empty, EncryptKeyMissing will be raised.Parameters: Raises: - EncryptKeyMissing – Either no key was passed, or something is wrong with the key.
- EncryptionError – Something went wrong while attempting to encrypt the data
Return str encrypted_data: The encrypted version of the passed
data
as a base64 encoded string.
-
steemengine.helpers.
get_fernet
(key: Union[str, bytes] = None) → cryptography.fernet.Fernet[source]¶ Used internally for getting Fernet instance with auto-fallback to settings.ENCRYPT_KEY and exception handling.
Parameters: key (str) – Base64 Fernet symmetric key for en/decrypting data. If empty, will fallback to settings.ENCRYPT_KEY Raises: EncryptKeyMissing – Either no key was passed, or something is wrong with the key. Return Fernet f: Instance of Fernet using passed key
or settings.ENCRYPT_KEY for encryption.
-
steemengine.helpers.
is_encrypted
(data: Union[str, bytes], key: Union[str, bytes] = None) → bool[source]¶ Returns True if the passed
data
appears to be encrypted. Can only verify encryption if the samekey
that was used to encrypt the data is passed.Parameters: Raises: EncryptKeyMissing – Either no key was passed, or something is wrong with the key.
Return bool is_encrypted: True if the data is encrypted, False if it’s not encrypted or wrong key used.
steemengine.urls module¶
steemengine URL Configuration
- The urlpatterns list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/2.1/topics/http/urls/
Copyright:
+===================================================+
| © 2019 Privex Inc. |
| https://www.privex.io |
+===================================================+
| |
| CryptoToken Converter |
| |
| Core Developer(s): |
| |
| (+) Chris (@someguy123) [Privex] |
| |
+===================================================+
-
steemengine.urls.
path
(route, view, kwargs=None, name=None, *, Pattern=<class 'django.urls.resolvers.RoutePattern'>)¶
-
steemengine.urls.
re_path
(route, view, kwargs=None, name=None, *, Pattern=<class 'django.urls.resolvers.RegexPattern'>)¶
steemengine.wsgi module¶
WSGI config for steemengine project.
It exposes the WSGI callable as a module-level variable named application
.
For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/