@atproto/syntax 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +15 -4
- package/package.json +12 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @atproto/syntax: validation helpers for identifier strings
|
|
2
2
|
|
|
3
|
-
Validation logic for
|
|
3
|
+
Validation logic for [atproto](https://atproto.com) identifiers - DIDs, Handles, NSIDs, and AT URIs.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@atproto/syntax)
|
|
6
|
+
[](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)
|
|
4
7
|
|
|
5
8
|
## Usage
|
|
6
9
|
|
|
10
|
+
### Handles
|
|
11
|
+
|
|
12
|
+
Syntax specification: <https://atproto.com/specs/handle>
|
|
13
|
+
|
|
7
14
|
```typescript
|
|
8
15
|
import { isValidHandle, ensureValidHandle, isValidDid } from '@atproto/syntax'
|
|
9
16
|
|
|
@@ -17,7 +24,9 @@ ensureValidDid('did:method:val') // returns void
|
|
|
17
24
|
ensureValidDid(':did:method:val') // throws
|
|
18
25
|
```
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
### NameSpaced IDs (NSID)
|
|
28
|
+
|
|
29
|
+
Syntax specification: <https://atproto.com/specs/nsid>
|
|
21
30
|
|
|
22
31
|
```typescript
|
|
23
32
|
import { NSID } from '@atproto/syntax'
|
|
@@ -43,7 +52,9 @@ NSID.isValid('example.com/foo') // => false
|
|
|
43
52
|
NSID.isValid('foo') // => false
|
|
44
53
|
```
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
### AT URI
|
|
56
|
+
|
|
57
|
+
Syntax specification: <https://atproto.com/specs/at-uri-scheme>
|
|
47
58
|
|
|
48
59
|
```typescript
|
|
49
60
|
import { AtUri } from '@atproto/syntax'
|
package/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/syntax",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "dist/index.js",
|
|
3
|
+
"version": "0.1.2",
|
|
5
4
|
"license": "MIT",
|
|
5
|
+
"description": "Validation for atproto identifiers and formats: DID, handle, NSID, AT URI, etc",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"atproto",
|
|
8
|
+
"did",
|
|
9
|
+
"nsid",
|
|
10
|
+
"at-uri"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://atproto.com",
|
|
6
13
|
"repository": {
|
|
7
14
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/bluesky-social/atproto
|
|
15
|
+
"url": "https://github.com/bluesky-social/atproto",
|
|
9
16
|
"directory": "packages/syntax"
|
|
10
17
|
},
|
|
18
|
+
"main": "dist/index.js",
|
|
11
19
|
"dependencies": {
|
|
12
|
-
"@atproto/common-web": "^0.2.
|
|
20
|
+
"@atproto/common-web": "^0.2.1"
|
|
13
21
|
},
|
|
14
22
|
"browser": {
|
|
15
23
|
"dns/promises": false
|