flip_api.trusts_services.admin_create_trust

Attributes

router

Functions

admin_create_trust(, token_id)

Create a trust and return its newly-generated plaintext keys (returned once).

Module Contents

flip_api.trusts_services.admin_create_trust.router
flip_api.trusts_services.admin_create_trust.admin_create_trust(body: flip_api.domain.interfaces.trust.ICreateTrust, db: sqlmodel.Session = Depends(get_session), token_id: uuid.UUID = Depends(verify_token)) flip_api.domain.interfaces.trust.ICreatedTrust

Create a trust and return its newly-generated plaintext keys (returned once).

Thin HTTP wrapper over register_trust — translates service errors to 400 / 409 / 500 responses. The hub stores only the SHA-256 hash of the trust API key. The trust internal service key is returned to the caller but not stored on the hub — it only lives in the trust-side environment and protects trust-internal services (imaging-api, data-access-api).

Parameters:
  • body (ICreateTrust) – Request body — trust name plus optional code / region.

  • db (Session) – Database session.

  • token_id (UUID) – Authenticated user ID, used for the admin permission check.

Returns:

The new trust plus plaintext trust_api_key and trust_internal_service_key — surface to the admin once, then discard.

Return type:

ICreatedTrust

Raises:

HTTPException – 403 if the caller lacks CAN_ACCESS_ADMIN_PANEL; 400 if the name or code is empty; 409 if a trust with the given name exists or no FL kit slot is available; 500 on database error.