mirror of
				https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
				synced 2025-11-04 05:36:06 +00:00 
			
		
		
		
	helper.py moved to main.py
This commit is contained in:
		
							
								
								
									
										13
									
								
								app/main.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								app/main.py
									
									
									
									
									
								
							@@ -12,8 +12,19 @@ from calendar import timegm
 | 
			
		||||
from jose import jws, jwk, jwt
 | 
			
		||||
from jose.constants import ALGORITHMS
 | 
			
		||||
from starlette.responses import StreamingResponse, JSONResponse
 | 
			
		||||
from Crypto.PublicKey import RSA
 | 
			
		||||
from Crypto.PublicKey.RSA import RsaKey
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def load_file(filename) -> bytes:
 | 
			
		||||
    with open(filename, 'rb') as file:
 | 
			
		||||
        content = file.read()
 | 
			
		||||
    return content
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def load_key(filename) -> RsaKey:
 | 
			
		||||
    return RSA.import_key(extern_key=load_file(filename), passphrase=None)
 | 
			
		||||
 | 
			
		||||
from helper import load_key, private_bytes, public_key
 | 
			
		||||
 | 
			
		||||
# todo: initialize certificate (or should be done by user, and passed through "volumes"?)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user