@atproto/identity 0.1.0 → 0.2.1

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 ADDED
@@ -0,0 +1,8 @@
1
+ # @atproto/identity
2
+
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`41ee177f`](https://github.com/bluesky-social/atproto/commit/41ee177f5a440490280d17acd8a89bcddaffb23b)]:
8
+ - @atproto/common-web@0.2.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-2023 Bluesky PBC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,40 @@
1
- # ATP DID Resolver
1
+ # @atproto/identity
2
2
 
3
- A library for resolving ATP's Decentralized ID methods.
3
+ TypeScript library for decentralized identities in [atproto](https://atproto.com) using DIDs and handles
4
+
5
+ [![NPM](https://img.shields.io/npm/v/@atproto/identity)](https://www.npmjs.com/package/@atproto/identity)
6
+ [![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)
7
+
8
+ ## Example
9
+
10
+ Resolving a Handle and verifying against DID document:
11
+
12
+ ```typescript
13
+ const didres = new DidResolver({})
14
+ const hdlres = new HandleResolver({})
15
+
16
+ const handle = 'atproto.com'
17
+ const did = await hdlres.resolve(handle)
18
+
19
+ if (did == undefined) {
20
+ throw new Error('expected handle to resolve')
21
+ }
22
+ console.log(did) // did:plc:ewvi7nxzyoun6zhxrhs64oiz
23
+
24
+ const doc = await didres.resolve(did)
25
+ console.log(doc)
26
+
27
+ // additional resolutions of same DID will be cached for some time, unless forceRefresh flag is used
28
+ const doc2 = await didres.resolve(did, true)
29
+
30
+ // helper methods use the same cache
31
+ const data = await didres.resolveAtprotoData(did)
32
+
33
+ if (data.handle != handle) {
34
+ throw new Error('invalid handle (did not match DID document)')
35
+ }
36
+ ```
37
+
38
+ ## License
39
+
40
+ MIT License
package/build.js CHANGED
@@ -1,16 +1,8 @@
1
- const pkgJson = require('@npmcli/package-json')
2
1
  const { nodeExternalsPlugin } = require('esbuild-node-externals')
3
2
 
4
3
  const buildShallow =
5
4
  process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true'
6
5
 
7
- if (process.argv.includes('--update-main-to-dist')) {
8
- return pkgJson
9
- .load(__dirname)
10
- .then((pkg) => pkg.update({ main: 'dist/index.js' }))
11
- .then((pkg) => pkg.save())
12
- }
13
-
14
6
  require('esbuild').build({
15
7
  logLevel: 'info',
16
8
  entryPoints: ['src/index.ts'],
@@ -4,5 +4,6 @@ export declare const getKey: (doc: DidDocument) => string | undefined;
4
4
  export declare const getHandle: (doc: DidDocument) => string | undefined;
5
5
  export declare const getPds: (doc: DidDocument) => string | undefined;
6
6
  export declare const getFeedGen: (doc: DidDocument) => string | undefined;
7
+ export declare const getNotif: (doc: DidDocument) => string | undefined;
7
8
  export declare const parseToAtprotoDocument: (doc: DidDocument) => Partial<AtprotoData>;
8
9
  export declare const ensureAtpDocument: (doc: DidDocument) => AtprotoData;