Metakit / @doeixd/metakit/artifact

fingerprint

function · packages/metakit/src/artifactCanonical.ts:393

function fingerprint(
  input: Expr<never, unknown> | PortableArtifactV1,
  options?: EncodeOptions,
): Effect.Effect<ArtifactFingerprint, Unhashable | EncodeError>

Compute the deterministic ArtifactFingerprint (sha256:<hex>, domain metakit/expr@3) of an Expr or an already-encoded PortableArtifactV1: its canonical artifact, the interface of the Schema each path reads (schemaInterface), so one tree over Schema.Int and over Schema.String has two fingerprints, and the operationFingerprint of each derived operation it calls, so a changed body changes the fingerprint of every caller. An encoded artifact carries no Schemas or definitions, so each of its paths reads as one with none and each foreign call as a named leaf.

Fails with Unhashable where the expression holds an Opaque node, a literal that is not portable, reads a Schema holding a check with no representation identity, or calls a definition that reaches itself, and with the encoder's other errors (a limit, an arity) as themselves.

A fingerprint identifies one canonical portable definition — it is neither an authorization token nor a proof of correctness.