aarondb/gateway

gateway — authorized access to the core

The in-process authorization boundary over the database: checks a Token’s capabilities via auth, then transacts or queries the core. authorize_and_transact/4 and authorize_and_query/4. No HTTP — this is the programmatic surface the MCP server is built on.

Types

pub type GatewayError {
  Unauthorized(String)
  TransactError(String)
  QueryError(String)
}

Constructors

  • Unauthorized(String)
  • TransactError(String)
  • QueryError(String)

Values

pub fn authorize_and_query(
  db: process.Subject(transactor.Message),
  token_str: String,
  query_ast: List(ast.BodyClause),
  required_caps: List(auth.Capability),
) -> Result(query_types.QueryResult, GatewayError)
pub fn authorize_and_transact(
  db: process.Subject(transactor.Message),
  token_str: String,
  facts: List(#(fact.Eid, String, fact.Value)),
  required_caps: List(auth.Capability),
) -> Result(Int, GatewayError)

Rich Hickey 🧙🏾‍♂️: The Gateway is a pure authorization boundary. It verifies capabilities before any AST reaches the internal logic.

Search Document