gleamunison/evidence

Types

pub type AttachError {
  StoreFailed(String)
}

Constructors

  • StoreFailed(String)

A fact about a definition hash, stored as a CAS chunk. The chunk’s own hash is the evidence identity; the subject is the hash it attests to.

pub type Evidence {
  Evidence(
    subject: String,
    kind: Kind,
    verdict: String,
    payload: String,
    ts: Int,
  )
}

Constructors

  • Evidence(
      subject: String,
      kind: Kind,
      verdict: String,
      payload: String,
      ts: Int,
    )

What kind of evidence this is. Deploy gates ask for these by name.

pub type Kind {
  Test
  Review
  PropertyCheck
}

Constructors

  • Test
  • Review
  • PropertyCheck

Values

pub fn attach(
  adapter: storage.StorageAdapter,
  subject subject: String,
  kind kind: Kind,
  verdict verdict: String,
  payload payload: String,
  ts ts: Int,
) -> Result(#(identity.DefinitionRef, String), AttachError)

Store an evidence record. Returns the evidence ref and its hex hash.

pub fn for_subject(
  adapter: storage.StorageAdapter,
  subject: String,
) -> List(Evidence)

Every well-formed, untampered evidence record for a subject hash. Tampered chunks (content hash ≠ ref hash) and non-evidence chunks are silently excluded: evidence is only meaningful when integrity holds.

pub fn verified(
  adapter: storage.StorageAdapter,
  subject: String,
  kind: Kind,
) -> Bool

Is there at least one passing attestation of this kind for the subject? Passing verdicts are explicit: “pass” for tests/properties, “approved” for reviews. Anything else is not verification.

✨ Search Document