pub fn validate_plc_document(did: &str, doc: &Value) -> Result<()>Expand description
Validate that doc is a DID document for did — the subject binding
that prevents a substitution oracle (#1161).
Checks, in order (each fail-closed):
- The document is a JSON object.
- It carries a string
id. idis exactly the DID that was asked for (a fragment/query on the asked DID is ignored — resolution fetches the base document).- Recognized collection members, when present, have valid member shapes and no duplicate semantic identifiers.
Exact string equality is deliberate: a did:plc has no equivalent forms (lowercase base32, no path, no port), so any difference — case, padding, a different subject — is a mismatch.