bankai/service_auth

Capability authentication for Bankai’s resident service.

AaronDB supplies the authority vocabulary and subsumption policy. Bankai authenticates provenance first: capability claims are HMAC-signed with a workspace-local 0600 secret, expire, and are then decoded/authorized by aarondb/auth. Domain handlers never receive credentials.

Types

pub type Access {
  ReadOnly
  WriteOnly
  Administrator
}

Constructors

  • ReadOnly
  • WriteOnly
  • Administrator

Values

pub fn access_from_string(role: String) -> Result(Access, String)
pub fn authorize_request(
  workspace: String,
  signed_token: String,
  method: String,
  params: List(String),
) -> Result(Nil, String)

Authenticate and authorize one protocol method. Every dispatched method has an explicit policy; unknown methods fail closed before dispatch.

pub fn local_admin_token(
  workspace: String,
) -> Result(String, String)

Local CLI requests bootstrap with a short-lived admin capability derived from the workspace secret. The secret itself is never put on the wire.

pub fn mint(
  workspace: String,
  role: String,
  ttl_seconds: Int,
) -> Result(String, String)

Mint a signed, expiring capability token. The workspace secret never leaves this module; callers receive only an attenuated bearer capability.

pub fn mint_default(
  workspace: String,
  role: String,
) -> Result(String, String)
pub fn reset_for_test(workspace: String) -> Nil
Search Document