bankai/gates/facts

Signed external evidence for satisfying a Bankai gate.

This module only authenticates and validates a fact. Persisting it and marking its signature as seen belong to the caller’s transaction.

Types

A verified fact. Author and signature are retained so the parent can store and replay-mark the evidence in the same transaction as its gate update.

pub type Fact {
  Fact(
    gate_id: String,
    state: State,
    observed_at: Int,
    expires_at: Int,
    author: String,
    signature: String,
  )
}

Constructors

  • Fact(
      gate_id: String,
      state: State,
      observed_at: Int,
      expires_at: Int,
      author: String,
      signature: String,
    )

The only gate-fact state accepted by this protocol version.

pub type State {
  Satisfied
}

Constructors

  • Satisfied

The complete signed value exchanged between workspaces.

pub type Wire {
  Wire(
    domain: String,
    gate_id: String,
    state: State,
    observed_at: Int,
    expires_at: Int,
    author: String,
    signature: String,
  )
}

Constructors

  • Wire(
      domain: String,
      gate_id: String,
      state: State,
      observed_at: Int,
      expires_at: Int,
      author: String,
      signature: String,
    )

Values

pub fn decode(value: String) -> Result(Wire, String)
pub const domain: String
pub fn encode(wire: Wire) -> String
pub fn issuer_status(
  receiver_workspace: String,
  issuer: String,
) -> Result(#(Bool, Bool), String)

Read explicit local trust/revocation state without attempting verification.

pub fn public_key(workspace: String) -> Result(String, String)
pub fn reset_for_test(workspace: String) -> Result(Nil, String)

Delete this workspace’s shared Bankai identity, trust, and revocation files. Intended only for isolated test workspaces.

pub fn revoke_issuer(
  receiver_workspace: String,
  issuer: String,
) -> Result(Nil, String)

Add an issuer’s Ed25519 public key to the receiver workspace’s revocation store. Revocation takes precedence if a key is present in both stores.

pub fn sign(
  signer_workspace: String,
  gate_id: String,
  state: State,
  observed_at: Int,
  expires_at: Int,
) -> Result(Wire, String)

Sign all gate-fact fields with the workspace’s persistent Ed25519 identity.

pub fn trust_issuer(
  receiver_workspace: String,
  issuer: String,
) -> Result(Nil, String)

Add an issuer’s Ed25519 public key to the receiver workspace’s explicit trust store. Verification never trusts an issuer as a side effect.

pub fn verify(
  receiver_workspace: String,
  wire: Wire,
  expected_gate_id: String,
  expected_issuer: String,
  now: Int,
) -> Result(Fact, String)

Verify domain separation, expected gate and issuer, trust and revocation, validity times, canonical key/signature encodings, and the Ed25519 signature. This function intentionally does not mark the signature as seen.

Search Document