sh_cpl/src_old/sh_edraft/utils/credential_manager.py
2021-03-03 10:47:52 +01:00

18 lines
440 B
Python

import base64
class CredentialManager:
@staticmethod
def encrypt(string: str) -> str:
return base64.b64encode(string.encode('utf-8')).decode('utf-8')
@staticmethod
def decrypt(string: str) -> str:
return base64.b64decode(string).decode('utf-8')
@staticmethod
def build_string(string: str, credentials: str):
return string.replace('$credentials', CredentialManager.decrypt(credentials))