Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@atproto/syntax
Advanced tools
Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc
Validation logic for atproto identifiers - DIDs, Handles, NSIDs, and AT URIs.
Syntax specification: https://atproto.com/specs/handle
import { isValidHandle, ensureValidHandle, isValidDid } from '@atproto/syntax'
isValidHandle('alice.test') // returns true
ensureValidHandle('alice.test') // returns void
isValidHandle('al!ce.test') // returns false
ensureValidHandle('al!ce.test') // throws
ensureValidDid('did:method:val') // returns void
ensureValidDid(':did:method:val') // throws
Syntax specification: https://atproto.com/specs/nsid
import { NSID } from '@atproto/syntax'
const id1 = NSID.parse('com.example.foo')
id1.authority // => 'example.com'
id1.name // => 'foo'
id1.toString() // => 'com.example.foo'
const id2 = NSID.create('example.com', 'foo')
id2.authority // => 'example.com'
id2.name // => 'foo'
id2.toString() // => 'com.example.foo'
const id3 = NSID.create('example.com', 'someRecord')
id3.authority // => 'example.com'
id3.name // => 'someRecord'
id3.toString() // => 'com.example.someRecord'
NSID.isValid('com.example.foo') // => true
NSID.isValid('com.example.someRecord') // => true
NSID.isValid('example.com/foo') // => false
NSID.isValid('foo') // => false
Syntax specification: https://atproto.com/specs/at-uri-scheme
import { AtUri } from '@atproto/syntax'
const uri = new AtUri('at://bob.com/com.example.post/1234')
uri.protocol // => 'at:'
uri.origin // => 'at://bob.com'
uri.hostname // => 'bob.com'
uri.collection // => 'com.example.post'
uri.rkey // => '1234'
This project is dual-licensed under MIT and Apache 2.0 terms:
Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
FAQs
Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc
The npm package @atproto/syntax receives a total of 23,941 weekly downloads. As such, @atproto/syntax popularity was classified as popular.
We found that @atproto/syntax demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.