Getting ./bin/pyl to pass

This commit is contained in:
Jon Herron 2023-03-06 19:36:37 -05:00
parent 6bdc174264
commit 75402d7740
2 changed files with 5 additions and 6 deletions

View File

@ -13,7 +13,7 @@ from apscheduler.schedulers.base import BaseScheduler # type: ignore
from flask.json.provider import DefaultJSONProvider
from flask_cors import CORS # type: ignore
from flask_mail import Mail # type: ignore
from flask_simple_crypt import SimpleCrypt
from flask_simple_crypt import SimpleCrypt # type: ignore
from werkzeug.exceptions import NotFound
import spiffworkflow_backend.load_database_models # noqa: F401
@ -135,9 +135,9 @@ def create_app() -> flask.app.Flask:
configure_sentry(app)
cipher = SimpleCrypt()
app.config['FSC_EXPANSION_COUNT'] = 2048
app.config["FSC_EXPANSION_COUNT"] = 2048
cipher.init_app(app)
app.config['CIPHER'] = cipher
app.config["CIPHER"] = cipher
app.before_request(verify_token)
app.before_request(AuthorizationService.check_for_permission)

View File

@ -2,7 +2,6 @@
from typing import Optional
from flask import current_app
from flask_simple_crypt import SimpleCrypt
from spiffworkflow_backend.exceptions.api_error import ApiError
from spiffworkflow_backend.models.db import db
@ -16,13 +15,13 @@ class SecretService:
@classmethod
def _encrypt(cls, value: str) -> str:
encrypted_bytes = current_app.config["CIPHER"].encrypt(value)
encrypted_bytes: bytes = current_app.config["CIPHER"].encrypt(value)
return encrypted_bytes.decode(cls.CIPHER_ENCODING)
@classmethod
def _decrypt(cls, value: str) -> str:
bytes_to_decrypt = bytes(value, cls.CIPHER_ENCODING)
decrypted_bytes = current_app.config["CIPHER"].decrypt(bytes_to_decrypt)
decrypted_bytes: bytes = current_app.config["CIPHER"].decrypt(bytes_to_decrypt)
return decrypted_bytes.decode(cls.CIPHER_ENCODING)
@classmethod