example on orm typing (#23322)

This commit is contained in:
Asuka Minato
2025-08-26 19:16:58 +09:00
committed by GitHub
parent dac72b078d
commit 58165c3951
4 changed files with 10 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ def encrypt_token(tenant_id: str, token: str):
if not (tenant := db.session.query(Tenant).where(Tenant.id == tenant_id).first()):
raise ValueError(f"Tenant with id {tenant_id} not found")
assert tenant.encrypt_public_key is not None
encrypted_token = rsa.encrypt(token, tenant.encrypt_public_key)
return base64.b64encode(encrypted_token).decode()