from typingimport Union
import uvicorn
from fastapiimport FastAPI
from pydanticimport BaseModel
from commonimport *
app= FastAPI()
class star(BaseModel):
payload: Union[str,dict]
key: str
iv: str
starsigsecret: str
class aes(BaseModel):
params: Union[str,dict]
key: str
iv: str
class R2sign(BaseModel):
params: Union[str,dict]
payloadkey: str
secretKey: str
@app.post("/notificationsbody/")
async def notifications_sign(star: star):
return notifications_body(star.payload,
star.key,
star.iv,
star.starsigsecret)
@app.post("/aesencrypt/")
async def aesencrypt(item: aes):
return aes_encrypt(item.params,
item.key,
item.iv)
@app.post("/aesDecrypt/")
async def aesDecrypt(item: aes):
return aes_Decrypt(item.params,
item.key,
item.iv)
@app.post("/R2sign/")
async def R2sign(item: R2sign):
return R2_sign(item.params,
item.payloadkey,
item.secretKey)
if __name__== '__main__':
uvicorn.run("727:app",host="19.244.48.43",port=9936,reload=True)