@atproto-labs/identity-resolver 0.0.1 → 0.1.0
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 +8 -7
- package/dist/identity-resolver.d.ts +7 -6
- package/dist/identity-resolver.d.ts.map +1 -1
- package/dist/identity-resolver.js +23 -13
- package/dist/identity-resolver.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
- package/src/identity-resolver.ts +53 -10
- package/src/index.ts +0 -1
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +2 -6
- package/dist/universal-identity-resolver.d.ts +0 -23
- package/dist/universal-identity-resolver.d.ts.map +0 -1
- package/dist/universal-identity-resolver.js +0 -24
- package/dist/universal-identity-resolver.js.map +0 -1
- package/src/universal-identity-resolver.ts +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# @atproto-labs/identity-resolver
|
|
2
2
|
|
|
3
|
-
## 0.0
|
|
3
|
+
## 0.1.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2482](https://github.com/bluesky-social/atproto/pull/2482) [`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add OAuth provider capability & support for DPoP signed tokens
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
### Patch Changes
|
|
8
10
|
|
|
9
|
-
- Updated dependencies [[`
|
|
10
|
-
- @atproto-labs/handle-resolver@0.0
|
|
11
|
-
- @atproto-labs/
|
|
12
|
-
- @atproto-labs/did@0.0.1
|
|
11
|
+
- Updated dependencies [[`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646)]:
|
|
12
|
+
- @atproto-labs/handle-resolver@0.1.0
|
|
13
|
+
- @atproto-labs/did-resolver@0.1.0
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { DidResolver } from '@atproto-labs/did';
|
|
2
|
-
import { HandleResolver, ResolvedHandle } from '@atproto-labs/handle-resolver';
|
|
1
|
+
import { ResolveOptions as DidResolveOptions, DidResolver } from '@atproto-labs/did-resolver';
|
|
2
|
+
import { ResolveOptions as HandleResolveOptions, HandleResolver, ResolvedHandle } from '@atproto-labs/handle-resolver';
|
|
3
3
|
export type ResolvedIdentity = {
|
|
4
4
|
did: NonNullable<ResolvedHandle>;
|
|
5
|
-
|
|
5
|
+
pds: URL;
|
|
6
6
|
};
|
|
7
|
+
export type ResolveOptions = DidResolveOptions & HandleResolveOptions;
|
|
7
8
|
export declare class IdentityResolver {
|
|
8
|
-
readonly handleResolver: HandleResolver;
|
|
9
9
|
readonly didResolver: DidResolver<'plc' | 'web'>;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
readonly handleResolver: HandleResolver;
|
|
11
|
+
constructor(didResolver: DidResolver<'plc' | 'web'>, handleResolver: HandleResolver);
|
|
12
|
+
resolve(input: string, options?: ResolveOptions): Promise<ResolvedIdentity>;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=identity-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-resolver.d.ts","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"identity-resolver.d.ts","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,IAAI,iBAAiB,EACnC,WAAW,EAEZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,cAAc,IAAI,oBAAoB,EACtC,cAAc,EACd,cAAc,EAEf,MAAM,+BAA+B,CAAA;AAGtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IAChC,GAAG,EAAE,GAAG,CAAA;CACT,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,oBAAoB,CAAA;AAErE,qBAAa,gBAAgB;IAEzB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;IAChD,QAAQ,CAAC,cAAc,EAAE,cAAc;gBAD9B,WAAW,EAAE,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,EACvC,cAAc,EAAE,cAAc;IAG5B,OAAO,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC;CA+B7B"}
|
|
@@ -4,31 +4,41 @@ exports.IdentityResolver = void 0;
|
|
|
4
4
|
const handle_resolver_1 = require("@atproto-labs/handle-resolver");
|
|
5
5
|
const syntax_1 = require("@atproto/syntax");
|
|
6
6
|
class IdentityResolver {
|
|
7
|
-
constructor(
|
|
8
|
-
Object.defineProperty(this, "
|
|
7
|
+
constructor(didResolver, handleResolver) {
|
|
8
|
+
Object.defineProperty(this, "didResolver", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
configurable: true,
|
|
11
11
|
writable: true,
|
|
12
|
-
value:
|
|
12
|
+
value: didResolver
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(this, "
|
|
14
|
+
Object.defineProperty(this, "handleResolver", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
configurable: true,
|
|
17
17
|
writable: true,
|
|
18
|
-
value:
|
|
18
|
+
value: handleResolver
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
async resolve(input,
|
|
21
|
+
async resolve(input, options) {
|
|
22
22
|
const did = (0, handle_resolver_1.isResolvedHandle)(input)
|
|
23
23
|
? input // Already a did
|
|
24
|
-
: await this.handleResolver.resolve((0, syntax_1.normalizeAndEnsureValidHandle)(input));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
: await this.handleResolver.resolve((0, syntax_1.normalizeAndEnsureValidHandle)(input), options);
|
|
25
|
+
options?.signal?.throwIfAborted();
|
|
26
|
+
if (!did) {
|
|
27
|
+
throw new TypeError(`Handle "${input}" does not resolve to a DID`);
|
|
28
|
+
}
|
|
29
|
+
const document = await this.didResolver.resolve(did, options);
|
|
30
|
+
const service = document.service?.find((isAtprotoPersonalDataServerService), document);
|
|
31
|
+
if (!service) {
|
|
32
|
+
throw new TypeError(`No valid "AtprotoPersonalDataServer" service found in "${did}" DID document`);
|
|
33
|
+
}
|
|
34
|
+
const pds = new URL(service.serviceEndpoint);
|
|
35
|
+
return { did, pds };
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
exports.IdentityResolver = IdentityResolver;
|
|
39
|
+
function isAtprotoPersonalDataServerService(s) {
|
|
40
|
+
return (typeof s.serviceEndpoint === 'string' &&
|
|
41
|
+
s.type === 'AtprotoPersonalDataServer' &&
|
|
42
|
+
(s.id === '#atproto_pds' || s.id === `${this.id}#atproto_pds`));
|
|
43
|
+
}
|
|
34
44
|
//# sourceMappingURL=identity-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-resolver.js","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"identity-resolver.js","sourceRoot":"","sources":["../src/identity-resolver.ts"],"names":[],"mappings":";;;AAOA,mEAKsC;AACtC,4CAA+D;AAS/D,MAAa,gBAAgB;IAC3B,YACW,WAAuC,EACvC,cAA8B;QADvC;;;;mBAAS,WAAW;WAA4B;QAChD;;;;mBAAS,cAAc;WAAgB;IACtC,CAAC;IAEG,KAAK,CAAC,OAAO,CAClB,KAAa,EACb,OAAwB;QAExB,MAAM,GAAG,GAAG,IAAA,kCAAgB,EAAC,KAAK,CAAC;YACjC,CAAC,CAAC,KAAK,CAAC,gBAAgB;YACxB,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC/B,IAAA,sCAA6B,EAAC,KAAK,CAAC,EACpC,OAAO,CACR,CAAA;QAEL,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;QAEjC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,SAAS,CAAC,WAAW,KAAK,6BAA6B,CAAC,CAAA;QACpE,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAE7D,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CACpC,CAAA,kCAAiD,CAAA,EACjD,QAAQ,CACT,CAAA;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,SAAS,CACjB,0DAA0D,GAAG,gBAAgB,CAC9E,CAAA;QACH,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;QAE5C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;IACrB,CAAC;CACF;AAxCD,4CAwCC;AAED,SAAS,kCAAkC,CAEzC,CAAa;IAMb,OAAO,CACL,OAAO,CAAC,CAAC,eAAe,KAAK,QAAQ;QACrC,CAAC,CAAC,IAAI,KAAK,2BAA2B;QACtC,CAAC,CAAC,CAAC,EAAE,KAAK,cAAc,IAAI,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,EAAE,cAAc,CAAC,CAC/D,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./identity-resolver.js"), exports);
|
|
18
|
-
__exportStar(require("./universal-identity-resolver.js"), exports);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto-labs/identity-resolver",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A library resolving ATPROTO identities",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "https://github.com/bluesky-social/atproto",
|
|
16
|
-
"directory": "packages/identity-resolver"
|
|
16
|
+
"directory": "packages/internal/identity-resolver"
|
|
17
17
|
},
|
|
18
18
|
"type": "commonjs",
|
|
19
19
|
"main": "dist/index.js",
|
|
@@ -25,9 +25,8 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atproto-labs/did": "0.0
|
|
29
|
-
"@atproto-labs/
|
|
30
|
-
"@atproto-labs/handle-resolver": "0.0.1",
|
|
28
|
+
"@atproto-labs/did-resolver": "0.1.0",
|
|
29
|
+
"@atproto-labs/handle-resolver": "0.1.0",
|
|
31
30
|
"@atproto/syntax": "0.3.0"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
package/src/identity-resolver.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { DidResolver } from '@atproto-labs/did'
|
|
2
1
|
import {
|
|
2
|
+
Did,
|
|
3
|
+
DidDocument,
|
|
4
|
+
ResolveOptions as DidResolveOptions,
|
|
5
|
+
DidResolver,
|
|
6
|
+
DidService,
|
|
7
|
+
} from '@atproto-labs/did-resolver'
|
|
8
|
+
import {
|
|
9
|
+
ResolveOptions as HandleResolveOptions,
|
|
3
10
|
HandleResolver,
|
|
4
11
|
ResolvedHandle,
|
|
5
12
|
isResolvedHandle,
|
|
@@ -8,28 +15,64 @@ import { normalizeAndEnsureValidHandle } from '@atproto/syntax'
|
|
|
8
15
|
|
|
9
16
|
export type ResolvedIdentity = {
|
|
10
17
|
did: NonNullable<ResolvedHandle>
|
|
11
|
-
|
|
18
|
+
pds: URL
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
export type ResolveOptions = DidResolveOptions & HandleResolveOptions
|
|
22
|
+
|
|
14
23
|
export class IdentityResolver {
|
|
15
24
|
constructor(
|
|
16
|
-
readonly handleResolver: HandleResolver,
|
|
17
25
|
readonly didResolver: DidResolver<'plc' | 'web'>,
|
|
26
|
+
readonly handleResolver: HandleResolver,
|
|
18
27
|
) {}
|
|
19
28
|
|
|
20
29
|
public async resolve(
|
|
21
30
|
input: string,
|
|
22
|
-
|
|
31
|
+
options?: ResolveOptions,
|
|
23
32
|
): Promise<ResolvedIdentity> {
|
|
24
33
|
const did = isResolvedHandle(input)
|
|
25
34
|
? input // Already a did
|
|
26
|
-
: await this.handleResolver.resolve(
|
|
27
|
-
|
|
35
|
+
: await this.handleResolver.resolve(
|
|
36
|
+
normalizeAndEnsureValidHandle(input),
|
|
37
|
+
options,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
options?.signal?.throwIfAborted()
|
|
41
|
+
|
|
42
|
+
if (!did) {
|
|
43
|
+
throw new TypeError(`Handle "${input}" does not resolve to a DID`)
|
|
44
|
+
}
|
|
28
45
|
|
|
29
|
-
const
|
|
30
|
-
type: serviceType,
|
|
31
|
-
})
|
|
46
|
+
const document = await this.didResolver.resolve(did, options)
|
|
32
47
|
|
|
33
|
-
|
|
48
|
+
const service = document.service?.find(
|
|
49
|
+
isAtprotoPersonalDataServerService<'plc' | 'web'>,
|
|
50
|
+
document,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if (!service) {
|
|
54
|
+
throw new TypeError(
|
|
55
|
+
`No valid "AtprotoPersonalDataServer" service found in "${did}" DID document`,
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const pds = new URL(service.serviceEndpoint)
|
|
60
|
+
|
|
61
|
+
return { did, pds }
|
|
34
62
|
}
|
|
35
63
|
}
|
|
64
|
+
|
|
65
|
+
function isAtprotoPersonalDataServerService<M extends string>(
|
|
66
|
+
this: DidDocument<M>,
|
|
67
|
+
s: DidService,
|
|
68
|
+
): s is {
|
|
69
|
+
id: '#atproto_pds' | `${Did<M>}#atproto_pds`
|
|
70
|
+
type: 'AtprotoPersonalDataServer'
|
|
71
|
+
serviceEndpoint: string
|
|
72
|
+
} {
|
|
73
|
+
return (
|
|
74
|
+
typeof s.serviceEndpoint === 'string' &&
|
|
75
|
+
s.type === 'AtprotoPersonalDataServer' &&
|
|
76
|
+
(s.id === '#atproto_pds' || s.id === `${this.id}#atproto_pds`)
|
|
77
|
+
)
|
|
78
|
+
}
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DidCache, IsomorphicDidResolverOptions } from '@atproto-labs/did';
|
|
2
|
-
import { Fetch } from '@atproto-labs/fetch';
|
|
3
|
-
import { HandleResolverCache, UniversalHandleResolverOptions } from '@atproto-labs/handle-resolver';
|
|
4
|
-
import { IdentityResolver } from './identity-resolver.js';
|
|
5
|
-
export type { DidCache, DidDocument } from '@atproto-labs/did';
|
|
6
|
-
export type { HandleResolverCache, ResolvedHandle, } from '@atproto-labs/handle-resolver';
|
|
7
|
-
export type UniversalIdentityResolverOptions = {
|
|
8
|
-
fetch?: Fetch;
|
|
9
|
-
didCache?: DidCache;
|
|
10
|
-
handleCache?: HandleResolverCache;
|
|
11
|
-
/**
|
|
12
|
-
* @see {@link IsomorphicDidResolverOptions.plcDirectoryUrl}
|
|
13
|
-
*/
|
|
14
|
-
plcDirectoryUrl?: IsomorphicDidResolverOptions['plcDirectoryUrl'];
|
|
15
|
-
/**
|
|
16
|
-
* @see {@link UniversalHandleResolverOptions.atprotoLexiconUrl}
|
|
17
|
-
*/
|
|
18
|
-
atprotoLexiconUrl?: UniversalHandleResolverOptions['atprotoLexiconUrl'];
|
|
19
|
-
};
|
|
20
|
-
export declare class UniversalIdentityResolver extends IdentityResolver {
|
|
21
|
-
static from({ fetch, didCache, handleCache, plcDirectoryUrl, atprotoLexiconUrl, }: UniversalIdentityResolverOptions): UniversalIdentityResolver;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=universal-identity-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"universal-identity-resolver.d.ts","sourceRoot":"","sources":["../src/universal-identity-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,4BAA4B,EAC7B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAgC,EAC9B,mBAAmB,EACnB,8BAA8B,EAC/B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC9D,YAAY,EACV,mBAAmB,EACnB,cAAc,GACf,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,gCAAgC,GAAG;IAC7C,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,WAAW,CAAC,EAAE,mBAAmB,CAAA;IAEjC;;OAEG;IACH,eAAe,CAAC,EAAE,4BAA4B,CAAC,iBAAiB,CAAC,CAAA;IAEjE;;OAEG;IACH,iBAAiB,CAAC,EAAE,8BAA8B,CAAC,mBAAmB,CAAC,CAAA;CACxE,CAAA;AAED,qBAAa,yBAA0B,SAAQ,gBAAgB;IAC7D,MAAM,CAAC,IAAI,CAAC,EACV,KAAwB,EACxB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,iBAAiB,GAClB,EAAE,gCAAgC;CAcpC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UniversalIdentityResolver = void 0;
|
|
7
|
-
const did_1 = require("@atproto-labs/did");
|
|
8
|
-
const handle_resolver_1 = __importDefault(require("@atproto-labs/handle-resolver"));
|
|
9
|
-
const identity_resolver_js_1 = require("./identity-resolver.js");
|
|
10
|
-
class UniversalIdentityResolver extends identity_resolver_js_1.IdentityResolver {
|
|
11
|
-
static from({ fetch = globalThis.fetch, didCache, handleCache, plcDirectoryUrl, atprotoLexiconUrl, }) {
|
|
12
|
-
return new this(new handle_resolver_1.default({
|
|
13
|
-
fetch,
|
|
14
|
-
cache: handleCache,
|
|
15
|
-
atprotoLexiconUrl,
|
|
16
|
-
}), new did_1.IsomorphicDidResolver({
|
|
17
|
-
fetch, //
|
|
18
|
-
cache: didCache,
|
|
19
|
-
plcDirectoryUrl,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.UniversalIdentityResolver = UniversalIdentityResolver;
|
|
24
|
-
//# sourceMappingURL=universal-identity-resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"universal-identity-resolver.js","sourceRoot":"","sources":["../src/universal-identity-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,2CAI0B;AAE1B,oFAGsC;AACtC,iEAAyD;AAyBzD,MAAa,yBAA0B,SAAQ,uCAAgB;IAC7D,MAAM,CAAC,IAAI,CAAC,EACV,KAAK,GAAG,UAAU,CAAC,KAAK,EACxB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,iBAAiB,GACgB;QACjC,OAAO,IAAI,IAAI,CACb,IAAI,yBAAuB,CAAC;YAC1B,KAAK;YACL,KAAK,EAAE,WAAW;YAClB,iBAAiB;SAClB,CAAC,EACF,IAAI,2BAAqB,CAAC;YACxB,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,QAAQ;YACf,eAAe;SAChB,CAAC,CACH,CAAA;IACH,CAAC;CACF;AArBD,8DAqBC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DidCache,
|
|
3
|
-
IsomorphicDidResolver,
|
|
4
|
-
IsomorphicDidResolverOptions,
|
|
5
|
-
} from '@atproto-labs/did'
|
|
6
|
-
import { Fetch } from '@atproto-labs/fetch'
|
|
7
|
-
import UniversalHandleResolver, {
|
|
8
|
-
HandleResolverCache,
|
|
9
|
-
UniversalHandleResolverOptions,
|
|
10
|
-
} from '@atproto-labs/handle-resolver'
|
|
11
|
-
import { IdentityResolver } from './identity-resolver.js'
|
|
12
|
-
|
|
13
|
-
export type { DidCache, DidDocument } from '@atproto-labs/did'
|
|
14
|
-
export type {
|
|
15
|
-
HandleResolverCache,
|
|
16
|
-
ResolvedHandle,
|
|
17
|
-
} from '@atproto-labs/handle-resolver'
|
|
18
|
-
|
|
19
|
-
export type UniversalIdentityResolverOptions = {
|
|
20
|
-
fetch?: Fetch
|
|
21
|
-
|
|
22
|
-
didCache?: DidCache
|
|
23
|
-
handleCache?: HandleResolverCache
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @see {@link IsomorphicDidResolverOptions.plcDirectoryUrl}
|
|
27
|
-
*/
|
|
28
|
-
plcDirectoryUrl?: IsomorphicDidResolverOptions['plcDirectoryUrl']
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @see {@link UniversalHandleResolverOptions.atprotoLexiconUrl}
|
|
32
|
-
*/
|
|
33
|
-
atprotoLexiconUrl?: UniversalHandleResolverOptions['atprotoLexiconUrl']
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export class UniversalIdentityResolver extends IdentityResolver {
|
|
37
|
-
static from({
|
|
38
|
-
fetch = globalThis.fetch,
|
|
39
|
-
didCache,
|
|
40
|
-
handleCache,
|
|
41
|
-
plcDirectoryUrl,
|
|
42
|
-
atprotoLexiconUrl,
|
|
43
|
-
}: UniversalIdentityResolverOptions) {
|
|
44
|
-
return new this(
|
|
45
|
-
new UniversalHandleResolver({
|
|
46
|
-
fetch,
|
|
47
|
-
cache: handleCache,
|
|
48
|
-
atprotoLexiconUrl,
|
|
49
|
-
}),
|
|
50
|
-
new IsomorphicDidResolver({
|
|
51
|
-
fetch, //
|
|
52
|
-
cache: didCache,
|
|
53
|
-
plcDirectoryUrl,
|
|
54
|
-
}),
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
}
|