Skip to content
Registry StackDocsDevelopment (unreleased)

Package a lookup over a registry

For the assertion provider

View as Markdown

If your institution keeps records in a Base Registry Engine (BReg) registry, Evidence can use one of its lookup routes as a fixed source and sign a narrow answer about the record it finds. You start a new project here, not one from either first tutorial. Evidence inherits none of the registry’s authorization: the registry decides what the source credential reads, and Evidence decides who may ask.

Outcome
A checked Evidence candidate with two Sources, three AssertionDefinitions, and 35 synthetic fixture cases.
Time
About 20 minutes after installing matching binaries
Level
Offline authoring with synthetic data
Prerequisites
Matching bregctl, evidencectl, and evidence binaries on PATHA shell, tar, yq version 4, and an editorThe downloaded BReg and Evidence teaching archive

Download the BReg and Evidence teaching files into a fresh working directory as breg-evidence-starter.tar.gz, then unpack them and check the registry:

Terminal window
mkdir teaching-inputs
tar -xzf breg-evidence-starter.tar.gz -C teaching-inputs
cp -R teaching-inputs/registry ./registry
bregctl check ./registry

The registry has one Record type, record, with two unique selectors, by-code and by-registration-number. Its evidence-source access profile may only look records up, and cannot read label. The two breg.access.profile-unrestricted-rows warnings are expected: both profiles set rowBoundaries: unrestricted.

The archive also holds offline-starter, a complete Evidence project, and starter, a fragment of assertion definitions. Start the project from the first:

Terminal window
evidencectl init ./evidence --starter ./teaching-inputs/offline-starter --profile local
evidencectl test ./evidence --target ./evidence/local-target.yaml
PASS: fixtures/extract-record-active.yaml (13 cases)

Those 13 cases prove a SQLite-extract Source, not registry access.

The registry writes the source description, so the lookup Evidence calls is the one the registry reviewed:

Terminal window
bregctl generate evidence-source ./registry \
--access-profile evidence-source --record-type record \
--selector by-code --selector by-registration-number \
--fields status --source-id registry-status --connection registry \
--output ./registry-status-export

It reports Generated 9 artifacts. The export names the profile, both selectors, and the status fact, and grants no registry authority. Asking for label is refused with breg.evidence-source.refused: the export describes only what the registry already lets that profile see.

Import it into the project:

Terminal window
evidencectl source import ./registry-status-export --project ./evidence
{
"affectedDefinitions": [],
"application": "accepted",
"conflicts": [],
"sources": ["registry-status"]
}

The import checks every artifact’s checksum, then adds the registry-status Source, its selector profiles, and two Functions. It adds no assertion definition and no caller grant: the registry’s profile does not become an Evidence permission. For a local registry with a stopped development session, evidencectl source add does both steps, driving the bregctl of the same version on your PATH.

Copy the fragment’s Functions and fixtures, then merge its definitions with yq version 4:

Terminal window
cp teaching-inputs/starter/functions/*.rhai evidence/functions/
cp teaching-inputs/starter/fixtures/*.yaml evidence/fixtures/
yq --inplace '
.functions += load("teaching-inputs/starter/definitions.yaml.fragment").functions
| .assertionDefinitions += load("teaching-inputs/starter/definitions.yaml.fragment").assertionDefinitions
' evidence/evidence.yaml
yq '.assertionDefinitions | keys' evidence/evidence.yaml
- extract-record-active
- record-active
- record-status-pair

record-active derives one boolean and record-status-pair the active and retired pair, both through the imported Source. Who may request them is Evidence’s grant ceiling and authority, reviewed in this project, not anything the registry granted.

Create a target for the project:

Terminal window
evidencectl target new ./configured-target --local --project ./evidence
Created Evidence target ./configured-target

Bind the registry connection the export named. Its credential is the source client’s own, issued by the registry’s identity provider; an Evidence caller never holds it:

configured-target/target.yaml
connections: {}
connections:
registry:
origin: http://127.0.0.1:8090
authentication:
type: oauth2-private-key-jwt
tokenEndpoint: http://127.0.0.1:8091/oauth2/token
clientIdRef: secret:file/registry-client-id
clientAssertionKeyRef: secret:file/registry-client-key
clientAssertionAudience: http://127.0.0.1:8091
scope: registry:evidence:lookup
maximumCacheSeconds: 60

Fixtures supply recorded responses, so nothing contacts these endpoints; bind the real origin, issuer, audience, scope, and secrets before live use. Prove the project and package it:

Terminal window
evidencectl test ./evidence --target ./configured-target
evidencectl package ./evidence --target ./configured-target --output ./candidate
4 passed, 0 failed (35 cases evaluated)

The package report lists the secrets to provision, the two registry client secrets among them.

A changed selector, fact, or profile needs a fresh export, a reviewed evidencectl source diff and source update, and a new package. How Evidence works explains the split.

Prove a Registry Evidence project