-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lex: more string formats #688
Conversation
Might be a little side-quest, but I think we should be able to add support for CIDs to cbor-x with a custom extension. We have an open thread rvagg/cborg#75 on cborg (used by @ipld/dag-cbor) to support streaming cbor, but it's probably not the shortest path to getting this working yet. |
Yeah I thought about that 🤔 I'll take a look & see what i can cook up |
hot dog: #693 |
} | ||
|
||
export function uri(path: string, value: string): ValidationResult { | ||
const isUri = value.match(/\w+:(\/?\/?)[^\s]+/) !== null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since [^\s]+
covers \/?\/?
, I am not sure the (\/?\/?)
is affecting the result. But I also see why it's there / what it's getting at. Just to toss a close alternative out there:
const isUri = value.match(/\w+:(\/?\/?)[^\s]+/) !== null | |
const isUri = value.match(/\w+:(?:\/\/)?[^\s\/][^\s]*/) !== null |
If we're not 100% sure how we want it, I think it's also totally cool to leave it as-is and come back to it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice im game 👌
return [] | ||
} | ||
try { | ||
ident.ensureValidDid(subject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very glad about this, I felt a little dirty dipping into lexicon internals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 lovely
Co-authored-by: devin ivy <devinivy@gmail.com>
Co-authored-by: devin ivy <devinivy@gmail.com>
Lex: decode cids in concatenated cbor
This introduces 4 new string formats:
handle
nsid
uri
(generally, as opposed to the specific case ofat-uri
)at-identifier
(this is just the union ofdid
&handle
)I did not add the
at-uri
format to moderation method subjects. Wanted to coordinate with @devinivy on that to make sure it makes sense.I also briefly tried out switching cid references in the cbor-only
subscribeRepos
method tocid-internal-ref
but hit a hiccup because dag-cbor does not support concatenated cbor & cborx was not playing nicely with it.Closes #580