zenodo_accessrequests/tokens.py
def engine(self):
        """Get cryptographic engine."""
        if not hasattr(self, '_engine'):
            from cryptography.fernet import Fernet
            from cryptography.hazmat.backends import default_backend
            from cryptography.hazmat.primitives import hashes

            digest = hashes.Hash(hashes.SHA256(), backend=default_backend())
            digest.update(current_app.config['SECRET_KEY'].encode('utf8'))
            fernet_key = urlsafe_b64encode(digest.finalize())
            self._engine = Fernet(fernet_key)
        return self._engine
def engine(self):
        if not hasattr(self, '_engine'):
            from cryptography.fernet import Fernet
            from cryptography.hazmat.backends import default_backend
            from cryptography.hazmat.primitives import hashes

            digest = hashes.Hash(hashes.SHA256(), backend=default_backend())
            digest.update(current_app.config['SECRET_KEY'].encode('utf8'))
            fernet_key = urlsafe_b64encode(digest.finalize())
            self._engine = Fernet(fernet_key)
        return self._engine
def engine ( self ) : if not hasattr ( self , '_engine' ) : from cryptography . fernet import Fernet from cryptography . hazmat . backends import default_backend from cryptography . hazmat . primitives import hashes digest = hashes . Hash ( hashes . SHA256 ( ) , backend = default_backend ( ) ) digest . update ( current_app . config [ 'SECRET_KEY' ] . encode ( 'utf8' ) ) fernet_key = urlsafe_b64encode ( digest . finalize ( ) ) self . _engine = Fernet ( fernet_key ) return self . _engine
Get cryptographic engine.
Get cryptographic engine .