GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • RSRegistry StackDocsv0.48.0
  • GitHub ↗
  • Four ways to adopt
  • How the products fit together
  • Overview
  • Your first assertion
  • How Evidence works
  • Return a governed value
  • Control who can request evidence
  • Assert a role-bound relationship
  • Request evidence as an SD-JWT VC
  • Request an assertion
  • Request an access token
  • Verify an assertion

This view

  • Original page
  • New address

GeezerVison is showing docs.registrystack.org — Create your first registry

Released docs. You are viewing the documentation published with v0.48.0. Development docs are available at Latest.

Create your first registry

For the data publisher

View as Markdown

In about fifteen minutes you will have a registry running on your machine with one test contact in it, readable by your own staff and hidden from staff elsewhere. You write no code: you create the registry, describe two test callers, start it, and read back the contact that start adds.

Outcome
A running local registry holding one test contact that only the callers allowed to read it can see.
Time
About 15 minutes, plus image downloads
Level
Local evaluation only
Prerequisites
Running DockerA shell and an editorThe tools required by the release verification procedure

Install Registry Stack

Section titled “Install Registry Stack”

Download one exact rstack-vX.Y.Z-install.sh and the verification material from the same Registry Stack release. Follow the release verification procedure before running the installer. From the verified release directory, install the breg component:

Terminal window
tag="vX.Y.Z"
bash "rstack-${tag}-install.sh" breg
rstack breg --version

The managed installation exposes rstack on your PATH. The breg component supplies the Base Registry Engine runtime and its command-line tools from the same release.

Create a project

Section titled “Create a project”
Terminal window
mkdir -p tutorial-work
rstack breg init tutorial-work/project
cd tutorial-work/project
registry.yaml
runtime.example.yaml
tests/journeys.yaml

A project is a directory of YAML files that describes one registry. registry.yaml holds what the registry stores and who may read and change it, and tests/journeys.yaml holds the checks the registry must pass before it serves requests. Run the remaining commands from this directory.

Check the project

Section titled “Check the project”
Terminal window
rstack breg check .
Authoring check passed; registry revision sha256:<digest>.
0 errors, 0 warnings in 3 files

Open registry.yaml. It declares one Record type, contact, with three fields. Each contact you store is a Record of that type.

registry.yaml
recordTypes:
contact:
route: contacts
primaryDataset: directory
mutationMode: mutable
display: {label: Contact, description: A named institutional contact.}
fields:
- {id: name, type: string, required: true, minimumLength: 1, maximumLength: 160, classification: internal}
- {id: email, type: string, required: true, minimumLength: 1, maximumLength: 254, classification: internal}
- {id: jurisdiction, type: string, required: true, minimumLength: 1, maximumLength: 40, classification: internal}

Further down, an access profile says who may read and change contacts. A caller needs the registry:directory:write scope, may create, read, list and change contacts, and only reaches contacts whose jurisdiction equals the jurisdiction claim in its token:

registry.yaml
accessProfiles:
directory-editor:
default: true
principalClaim: registry_principal
requiredScopes: ["registry:directory:write"]
requiredPurposes: [directory-administration]
permissions:
records:
- recordType: contact
operations: [create, get, list, patch]
readableFields: [name, email, jurisdiction]
writableFields: [name, email, jurisdiction]
rowBoundaries:
- {field: jurisdiction, claim: jurisdiction, operator: equals}

Describe the test callers

Section titled “Describe the test callers”

rstack dev runs the project on your machine from a development plan. The plan lists the products to run and the synthetic people who call them, with the claims each person’s test token carries. Create dev.yaml. It gives the test caller editor the claim zone-a and foreign-editor the claim zone-b:

dev.yaml
apiVersion: id.registrystack.org/formats/rstack/dev/v1alpha1
kind: RStackDev
issuer: https://identity.directory.example.test
products:
- {product: breg, project: ., audience: "urn:example:local-directory"}
people:
editor:
subject: synthetic-directory-editor
client: directory-editor
grants:
breg:
profile: directory-editor
scopes: ["registry:directory:write"]
claims:
registry_actor_kind: human
registry_purpose: directory-administration
jurisdiction: zone-a
foreign-editor:
subject: synthetic-foreign-editor
client: directory-editor
grants:
breg:
profile: directory-editor
scopes: ["registry:directory:write"]
claims:
registry_actor_kind: human
registry_purpose: directory-administration
jurisdiction: zone-b
# Both people match the profile, so each journey step names its person.
schemaTestPeople:
directory-contact:
create-contact: editor
read-contact: editor
conceal-contact-outside-jurisdiction: foreign-editor
obtain-email-condition: editor
update-contact-email: editor
read-updated-contact: editor
start-registration: editor
submit-registration: editor
scenarioFile: dev/scenarios.yaml

The plan also names a scenario file: requests that rstack dev sends once the registry is running. It sits in dev/ because the registry reads every file under tests/ as one of its own checks. This scenario adds one contact in zone-a as editor and reads it back:

Terminal window
mkdir dev
dev/scenarios.yaml
apiVersion: id.registrystack.org/formats/rstack/scenarios/v1alpha1
kind: RStackScenarios
scenarios:
- id: directory-contact
steps:
- id: create-contact
product: breg
as: editor
method: POST
path: /v1/records/contacts
headers: {Idempotency-Key: create-contact}
body: {data: {name: Example contact, email: [email protected], jurisdiction: zone-a}}
expect: {status: 201}
capture: {contact: {type: pointer, pointer: /data/recordIdentifier}}
- id: read-contact
product: breg
as: editor
method: GET
path: "/v1/records/contacts/{{contact}}"
expect:
status: 200
json: {/data/domainData/name: Example contact}

Check the plan:

Terminal window
rstack dev check .
Development plan is valid
0 errors, 0 warnings in 1 file

Start the registry

Section titled “Start the registry”
Terminal window
rstack dev start . --ttl 4h | tee dev-run.txt
Run <run-id> ready
breg http://127.0.0.1:<port>
Runtime config breg <runtime-config>
Scenario directory-contact passed
Logs <logs-directory>
rstack dev token <run-id> --as editor
rstack dev token <run-id> --as foreign-editor

rstack dev started a PostgreSQL server in Docker for this run, ran the project’s tests, started the registry at the breg address, and sent the scenario, which added the test contact. The first start downloads the PostgreSQL image and takes longer. Each run gets a free port of its own, so your address differs. The run ends after four hours, or when you stop it, and removes its database, test keys and files with it.

Read the contact as two callers

Section titled “Read the contact as two callers”

Keep the run ID and the registry address from the report. token writes a short-lived header file for a test caller, and rstack breg api sends one request with it. List the contacts as editor:

Terminal window
RUN="$(awk '$1 == "Run" {print $2}' dev-run.txt)"
BREG_URL="$(awk '$1 == "breg" {print $2}' dev-run.txt)"
EDITOR_HEADERS="$(rstack dev token "$RUN" --as editor | awk '$2 == "headers" {print $3}')"
rstack breg api /v1/records/contacts --url "$BREG_URL" --header @"$EDITOR_HEADERS"
{
"items": [
{
"domainData": {
"email": "[email protected]",
"jurisdiction": "zone-a",
"name": "Example contact"
},
"recordIdentifier": "<record-id>",
"revisionIdentifier": "1"
}
],
"meta": {
"datasetIdentifier": "directory",
"recordTypeIdentifier": "contact",
"registryIdentifier": "local-directory"
},
"pageInfo": {
"nextCursor": null
}
}

The Record carries a stable identifier and a revision number beside the fields. Tokens last five minutes: when a request is refused with status 401, run the token command again. Now list the same contacts as foreign-editor, whose token says zone-b:

Terminal window
FOREIGN_HEADERS="$(rstack dev token "$RUN" --as foreign-editor | awk '$2 == "headers" {print $3}')"
rstack breg api /v1/records/contacts --url "$BREG_URL" --header @"$FOREIGN_HEADERS"
{
"items": [],
"meta": {
"datasetIdentifier": "directory",
"recordTypeIdentifier": "contact",
"registryIdentifier": "local-directory"
},
"pageInfo": {
"nextCursor": null
}
}

The registry applied the access profile: the contact exists, and foreign-editor cannot see it.

Leave the registry running

Section titled “Leave the registry running”

The next tutorial continues with this project, and its first step restarts the run. When you are finished with the registry, run rstack dev stop "$RUN" to stop it and delete its data. A run you forget ends by itself after its time to live.

Next

Section titled “Next”

Change a registry with an Action

Cookies on Registry Stack

We use optional cookies to understand how you use the main Registry Stack website and this documentation. If you contact us, we may link this activity to your enquiry. You can change your choice at any time. Read the privacy policy.

Your browser asks sites not to track you, so optional tracking stays off.

We could not use or save that choice. Optional tracking remains off.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.