feat: add did:plc parse method#38
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class parsing/validation for did:plc identifiers in the PLC DID package, making it easy to safely accept external DID strings (not just ones generated by plc.New) while centralizing the identifier-length invariant.
Changes:
- Introduces
plc.Parseto parse a DID string, enforce theplcmethod, enforce a 24-character identifier, and validate base32-lower/no-padding encoding. - Adds
IdentifierLengthconstant and uses it when slicing the generated identifier inplc.New. - Adds comprehensive unit tests covering valid parsing and common invalid inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| did/plc/plc.go | Adds Parse and a shared IdentifierLength constant; updates New to use the constant. |
| did/plc/plc_test.go | Adds TestParse to validate acceptance/rejection behavior for plc.Parse. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pyropy
approved these changes
Jul 13, 2026
alanshaw
added a commit
to fil-forge/sprue
that referenced
this pull request
Jul 17, 2026
This PR allows `did:plc` accounts to provision spaces. This requires a `did:plc` resolver. Context: Hilt uses the `/customer/add` method to add it's tenants to Sprue. Hilts tenants are `did:plc` addressed, so that their keys can be rotated easily. Unfortunately the addition of `/customer/add` to Sprue did not also include this change to allow the kinds of DID that were going to be used (`did:plc`) to provision spaces. Hence this PR. Depends on: * fil-forge/ucantone#38 * fil-forge/ucantone#39
…capabilityDelegation` silent (#39) If the document is silent about `capabilityInvocation` or `capabilityDelegation` then fallback to all `verificationMethods`, do not fail signature verification entirely. Context: `did:plc` documents from the official DID PLC server do not carry these properties and so the signatures are currently unverifiable. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a parse method for
did:plcDIDs.https://github.com/did-method-plc/did-method-plc/blob/main/website/spec/v0.1/did-plc.md