@atproto-labs/identity-resolver 0.1.16 → 0.1.18
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
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atproto-labs/identity-resolver
|
|
2
2
|
|
|
3
|
+
## 0.1.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3933](https://github.com/bluesky-social/atproto/pull/3933) [`192f3ab89`](https://github.com/bluesky-social/atproto/commit/192f3ab89c943216683541f42cc1332e9c305eee) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Return atproto handle in identity resolution result
|
|
8
|
+
|
|
9
|
+
## 0.1.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies []:
|
|
14
|
+
- @atproto-labs/did-resolver@0.1.13
|
|
15
|
+
|
|
3
16
|
## 0.1.16
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Dual MIT/Apache-2.0 License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-2025 Bluesky PBC, and Contributors
|
|
3
|
+
Copyright (c) 2022-2025 Bluesky Social PBC, and Contributors
|
|
4
4
|
|
|
5
5
|
Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
|
|
6
6
|
|
|
@@ -3,6 +3,7 @@ import { AtprotoIdentityDidMethods, HandleResolver, ResolveHandleOptions, Resolv
|
|
|
3
3
|
export type ResolvedIdentity = {
|
|
4
4
|
did: NonNullable<ResolvedHandle>;
|
|
5
5
|
pds: URL;
|
|
6
|
+
handle?: string;
|
|
6
7
|
};
|
|
7
8
|
export type ResolveIdentityOptions = ResolveDidOptions & ResolveHandleOptions;
|
|
8
9
|
export declare class IdentityResolver {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-resolver.d.ts","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EACX,WAAW,EAEX,iBAAiB,EAClB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,cAAc,EAEf,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IAChC,GAAG,EAAE,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"identity-resolver.d.ts","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EACX,WAAW,EAEX,iBAAiB,EAClB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,cAAc,EAEf,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,oBAAoB,CAAA;AAE7E,qBAAa,gBAAgB;IAEzB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,yBAAyB,CAAC;IAC5D,QAAQ,CAAC,cAAc,EAAE,cAAc;gBAD9B,WAAW,EAAE,WAAW,CAAC,yBAAyB,CAAC,EACnD,cAAc,EAAE,cAAc;IAG5B,OAAO,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAuBf,kBAAkB,CAC7B,GAAG,EAAE,WAAW,CAAC,cAAc,CAAC,EAChC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAIrC,qBAAqB,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;CAyBnD"}
|
|
@@ -29,6 +29,7 @@ class IdentityResolver {
|
|
|
29
29
|
return {
|
|
30
30
|
did: document.id,
|
|
31
31
|
pds: new URL(service.serviceEndpoint),
|
|
32
|
+
handle: extractHandle(document),
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
async getDocumentFromDid(did, options) {
|
|
@@ -52,6 +53,18 @@ class IdentityResolver {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
exports.IdentityResolver = IdentityResolver;
|
|
56
|
+
function extractHandle(document) {
|
|
57
|
+
if (document.alsoKnownAs) {
|
|
58
|
+
for (const h of document.alsoKnownAs) {
|
|
59
|
+
if (h.startsWith('at://')) {
|
|
60
|
+
const handle = h.slice(5);
|
|
61
|
+
if ((0, syntax_1.isValidHandle)(handle))
|
|
62
|
+
return handle;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
55
68
|
function isAtprotoPersonalDataServerService(s) {
|
|
56
69
|
return (typeof s.serviceEndpoint === 'string' &&
|
|
57
70
|
s.type === 'AtprotoPersonalDataServer' &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-resolver.js","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"identity-resolver.js","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":";;;AAAA,4CAA8E;AAQ9E,mEAMsC;AAUtC,MAAa,gBAAgB;IAC3B,YACW,WAAmD,EACnD,cAA8B;QADvC;;;;mBAAS,WAAW;WAAwC;QAC5D;;;;mBA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version": "0.1.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A library resolving ATPROTO identities",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atproto-labs/did-resolver": "0.1.
|
|
28
|
+
"@atproto-labs/did-resolver": "0.1.13",
|
|
29
29
|
"@atproto-labs/handle-resolver": "0.1.8",
|
|
30
30
|
"@atproto/syntax": "0.4.0"
|
|
31
31
|
},
|
package/src/identity-resolver.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeAndEnsureValidHandle } from '@atproto/syntax'
|
|
1
|
+
import { isValidHandle, normalizeAndEnsureValidHandle } from '@atproto/syntax'
|
|
2
2
|
import {
|
|
3
3
|
Did,
|
|
4
4
|
DidDocument,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
export type ResolvedIdentity = {
|
|
18
18
|
did: NonNullable<ResolvedHandle>
|
|
19
19
|
pds: URL
|
|
20
|
+
handle?: string
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export type ResolveIdentityOptions = ResolveDidOptions & ResolveHandleOptions
|
|
@@ -49,6 +50,7 @@ export class IdentityResolver {
|
|
|
49
50
|
return {
|
|
50
51
|
did: document.id,
|
|
51
52
|
pds: new URL(service.serviceEndpoint),
|
|
53
|
+
handle: extractHandle(document),
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -89,6 +91,21 @@ export class IdentityResolver {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
function extractHandle(
|
|
95
|
+
document: DidDocument<AtprotoIdentityDidMethods>,
|
|
96
|
+
): string | undefined {
|
|
97
|
+
if (document.alsoKnownAs) {
|
|
98
|
+
for (const h of document.alsoKnownAs) {
|
|
99
|
+
if (h.startsWith('at://')) {
|
|
100
|
+
const handle = h.slice(5)
|
|
101
|
+
if (isValidHandle(handle)) return handle
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return undefined
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
function isAtprotoPersonalDataServerService<M extends string>(
|
|
93
110
|
this: DidDocument<M>,
|
|
94
111
|
s: DidService,
|