Function: toNSID()
toNSID(
nsid):null|NSID
Defined in: src/types/atproto-validators.ts:131
Validates and brands an NSID string.
Parameters
nsid
string
Potential NSID string
Returns
null | NSID
Branded NSID if valid, null otherwise
Remarks
NSID format: authority.name.subname (reverse domain notation)
Validation rules:
- Lowercase alphabetic segments separated by periods
- At least two segments (e.g., "pub.chive")
- Each segment must be non-empty
- No leading or trailing periods
Common Chive NSIDs:
pub.chive.preprint.submissionpub.chive.review.commentpub.chive.graph.fieldProposal
Example
const valid = toNSID('pub.chive.preprint.submission');
console.log(valid); // 'pub.chive.preprint.submission'
const invalid = toNSID('InvalidNSID');
console.log(invalid); // null