Expand description
The bot.did.policy and bot.did.policyBinding records, as didbot reads
and writes them.
Both records are written by an operator into the operator’s own
repository, which this server can read but never write to — the same
asymmetry didbot-pds’s operator::OperatorClaim relies on. So, like that
claim, each is parsed here by hand from a foreign repository’s JSON, and
a malformed record reads as no record at all rather than charitably. The
failure carries a path, exactly as the lexicon checker’s own
InvalidRecord does, because the reader is an operator looking at
their own record and the field that matters is where.
§Two checks, one stricter than the other
The lexicon documents under lexicons/bot/did/ are the first check, run
by didbot_schema::validate_shape. They bound lengths, check formats
and require fields. This module is the second: it refuses a field
neither record declares, because a field silently dropped is a narrowing
the operator wrote and the server never applied. What the lexicon leaves
open — an action outside its known values, a document of a $type it
does not name — is carried here as written; whether this server can
answer the action or read the document is the policy build’s question,
not the reader’s. The one open value refused here is an includes word
outside subjects and descendants: it names a set of accounts this
server cannot enumerate, so no later step could apply it.
Structs§
- Includes
- The set a binding’s
includesnames. At least one member is set, and the set with every member set writes every word the reader accepts. - Lookup
- One record a policy reads from a repository this server does not hold.
- Policy
Binding - One
bot.did.policyBindingrecord. - Policy
Record - One
bot.did.policyrecord. - Policy
Ref - One
bot.did.policyrecord a binding names, by the repository it is in and its record key: the parts of theat://URI it is written as.
Enums§
- Accounts
- Whose repositories a
Lookupreads. Open: the lexicon names one word and carries any other, so the reader does too, and a word this build does not know reads nothing. - Action
- One action a policy is consulted on. Open: the lexicon names some and carries any other, so the reader does too.
- Document
- A policy’s document, by the
$typethat names its engine.
Constants§
- BINDING_
COLLECTION - The collection a
PolicyBindingis written under. - BINDING_
FIELDS 🔒 - The fields a
bot.did.policyBindingrecord declares. - CEDAR_
DOCUMENT - The
$typeof aDocument::Cedar. - COUNT_
DOCUMENT - The
$typeof aDocument::Count. - DESCENDANTS 🔒
- The
includesword for every account admitted beneath a subject. - LOOKUP_
FIELDS 🔒 - The fields one
lookupsentry declares. - NAMED 🔒
- The
accountsword for the accounts the written record names. - POLICY_
COLLECTION - The collection a
PolicyRecordis written under. - POLICY_
FIELDS 🔒 - The fields a
bot.did.policyrecord declares. - REGEX_
DOCUMENT - The
$typeof aDocument::Regex. - SUBJECTS 🔒
- The
includesword for the subjects themselves.
Functions§
- array 🔒
- datetime 🔒
- did 🔒
- dids 🔒
- Reads an array of DIDs at
name. - expected 🔒
- index 🔒
- kind_of 🔒
- lookups_
of - The
lookupsa record’s JSON declares, read the wayPolicyRecord::from_jsonreads them. - object 🔒
- only_
fields 🔒 - Refuses any field of
objectoutsidedeclared(and$type). - optional_
string 🔒 - policy_
ref 🔒 - Reads one
policiesentry: anat://URI naming abot.did.policyrecord by the DID of its repository and its record key. - required 🔒
- string 🔒
- typed_
as 🔒 - Refuses a
$typenaming anything butcollection. A record listed out of a repository carries its collection as$type; a record body built by hand may omit it.