{"_id":"@bluesky-social/syntax","_rev":"2-95f71192243dae4f98e3843b538ebe09","name":"@bluesky-social/syntax","dist-tags":{"latest":"0.4.1"},"versions":{"0.4.0":{"name":"@bluesky-social/syntax","version":"0.4.0","keywords":["atproto","did","nsid","at-uri"],"license":"MIT","_id":"@bluesky-social/syntax@0.4.0","maintainers":[{"name":"openweb3.io","email":"mtsocialdao@gmail.com"},{"name":"web3km","email":"web3km@proton.me"}],"homepage":"https://atproto.com","bugs":{"url":"https://github.com/bluesky-social/atproto/issues"},"dist":{"shasum":"052c63bd1cba9fbd04403fa5f53477a0f721c022","tarball":"https://registry.npmjs.org/@bluesky-social/syntax/-/syntax-0.4.0.tgz","fileCount":62,"integrity":"sha512-+HOiMkMbXJVn/6ddQ2x/Mew8ZVsr4cHuvwdoi4BuSWiZHt4ayh2XTR23QEmdivWkfV3JN/lFR6oYurNyBssmKw==","signatures":[{"sig":"MEYCIQDzW3Lfuml48gVrSE63+tj+KClJ5v6tiKIt/x8Nms4q8wIhAOgoHH/1up9yeiGUI9z3LhDVBdNEctM7shGsbGfDDJhJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":125318},"main":"dist/index.js","_from":"file:bluesky-social-syntax-0.4.0.tgz","types":"dist/index.d.ts","browser":{"dns/promises":false},"scripts":{"test":"jest","build":"tsc --build tsconfig.build.json"},"_npmUser":{"name":"web3km","email":"web3km@proton.me"},"_resolved":"/private/var/folders/cb/7sst87dj7jd40nc7b7q7h76r0000gn/T/c6bc3789a69b66d0caa55aa3e57078d9/bluesky-social-syntax-0.4.0.tgz","_integrity":"sha512-+HOiMkMbXJVn/6ddQ2x/Mew8ZVsr4cHuvwdoi4BuSWiZHt4ayh2XTR23QEmdivWkfV3JN/lFR6oYurNyBssmKw==","repository":{"url":"git+https://github.com/bluesky-social/atproto.git","type":"git","directory":"packages/syntax"},"_npmVersion":"10.7.0","description":"Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc","directories":{},"_nodeVersion":"20.15.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^28.1.2","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/syntax_0.4.0_1753693256026_0.11826586157424224","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@bluesky-social/syntax","version":"0.4.1","license":"MIT","description":"Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc","keywords":["atproto","did","nsid","at-uri"],"homepage":"https://atproto.com","repository":{"type":"git","url":"git+https://github.com/bluesky-social/atproto.git","directory":"packages/syntax"},"main":"dist/index.js","types":"dist/index.d.ts","devDependencies":{"jest":"^28.1.3","typescript":"^5.9.3"},"browser":{"dns/promises":false},"scripts":{"test":"jest","build":"tsc --build tsconfig.build.json"},"_id":"@bluesky-social/syntax@0.4.1","bugs":{"url":"https://github.com/bluesky-social/atproto/issues"},"_integrity":"sha512-MyJRZWzK4Qkbngpbsr1ANP1DfkZWrQvBFBl4taleaw15/qdoKBnF/niQZzjX4/A+MDh2ODz9MZukz0v+MTqa2g==","_resolved":"/private/var/folders/cb/7sst87dj7jd40nc7b7q7h76r0000gn/T/abf6a528cf7ae9768f04a7609748edc5/bluesky-social-syntax-0.4.1.tgz","_from":"file:bluesky-social-syntax-0.4.1.tgz","_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-MyJRZWzK4Qkbngpbsr1ANP1DfkZWrQvBFBl4taleaw15/qdoKBnF/niQZzjX4/A+MDh2ODz9MZukz0v+MTqa2g==","shasum":"c189eed66e261b06eed9124307f194f95d526820","tarball":"https://registry.npmjs.org/@bluesky-social/syntax/-/syntax-0.4.1.tgz","fileCount":62,"unpackedSize":164838,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCwmFQjz3p1kbgmVCYSPuBK4xIX4yGw4GXTiX6PDX1hDAIhAKWiAAg68VCQ89ybgD9qgUuMjQEMS0y95aqZXhExIxxm"}]},"_npmUser":{"name":"web3km","email":"web3km@proton.me"},"directories":{},"maintainers":[{"name":"openweb3.io","email":"mtsocialdao@gmail.com"},{"name":"web3km","email":"web3km@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/syntax_0.4.1_1761039233573_0.6288014690850217"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-28T09:00:55.915Z","modified":"2025-10-21T09:33:54.317Z","0.4.0":"2025-07-28T09:00:56.202Z","0.4.1":"2025-10-21T09:33:53.759Z"},"bugs":{"url":"https://github.com/bluesky-social/atproto/issues"},"license":"MIT","homepage":"https://atproto.com","keywords":["atproto","did","nsid","at-uri"],"repository":{"type":"git","url":"git+https://github.com/bluesky-social/atproto.git","directory":"packages/syntax"},"description":"Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc","maintainers":[{"name":"openweb3.io","email":"mtsocialdao@gmail.com"},{"name":"web3km","email":"web3km@proton.me"}],"readme":"# @bluesky-social/syntax: validation helpers for identifier strings\n\nValidation logic for [atproto](https://atproto.com) identifiers - DIDs, Handles, NSIDs, and AT URIs.\n\n[![NPM](https://img.shields.io/npm/v/@bluesky-social/crypto)](https://www.npmjs.com/package/@bluesky-social/syntax)\n[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)\n\n## Usage\n\n### Handles\n\nSyntax specification: <https://atproto.com/specs/handle>\n\n```typescript\nimport { isValidHandle, ensureValidHandle, isValidDid } from '@bluesky-social/syntax'\n\nisValidHandle('alice.test') // returns true\nensureValidHandle('alice.test') // returns void\n\nisValidHandle('al!ce.test') // returns false\nensureValidHandle('al!ce.test') // throws\n\nensureValidDid('did:method:val') // returns void\nensureValidDid(':did:method:val') // throws\n```\n\n### NameSpaced IDs (NSID)\n\nSyntax specification: <https://atproto.com/specs/nsid>\n\n```typescript\nimport { NSID } from '@bluesky-social/syntax'\n\nconst id1 = NSID.parse('com.example.foo')\nid1.authority // => 'example.com'\nid1.name // => 'foo'\nid1.toString() // => 'com.example.foo'\n\nconst id2 = NSID.create('example.com', 'foo')\nid2.authority // => 'example.com'\nid2.name // => 'foo'\nid2.toString() // => 'com.example.foo'\n\nconst id3 = NSID.create('example.com', 'someRecord')\nid3.authority // => 'example.com'\nid3.name // => 'someRecord'\nid3.toString() // => 'com.example.someRecord'\n\nNSID.isValid('com.example.foo') // => true\nNSID.isValid('com.example.someRecord') // => true\nNSID.isValid('example.com/foo') // => false\nNSID.isValid('foo') // => false\n```\n\n### AT URI\n\nSyntax specification: <https://atproto.com/specs/at-uri-scheme>\n\n```typescript\nimport { AtUri } from '@bluesky-social/syntax'\n\nconst uri = new AtUri('at://bob.com/com.example.post/1234')\nuri.protocol // => 'at:'\nuri.origin // => 'at://bob.com'\nuri.hostname // => 'bob.com'\nuri.collection // => 'com.example.post'\nuri.rkey // => '1234'\n```\n\n## License\n\nThis project is dual-licensed under MIT and Apache 2.0 terms:\n\n- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)\n- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)\n\nDownstream 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.\n","readmeFilename":"README.md"}