@atproto-labs/did-resolver 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 +16 -0
- package/LICENSE.txt +7 -0
- package/dist/did-cache-memory.d.ts +8 -0
- package/dist/did-cache-memory.d.ts.map +1 -0
- package/dist/did-cache-memory.js +15 -0
- package/dist/did-cache-memory.js.map +1 -0
- package/dist/did-cache.d.ts +15 -0
- package/dist/did-cache.d.ts.map +1 -0
- package/dist/did-cache.js +21 -0
- package/dist/did-cache.js.map +1 -0
- package/dist/did-method.d.ts +12 -0
- package/dist/did-method.d.ts.map +1 -0
- package/dist/did-method.js +3 -0
- package/dist/did-method.js.map +1 -0
- package/dist/did-resolver-base.d.ts +10 -0
- package/dist/did-resolver-base.d.ts.map +1 -0
- package/dist/did-resolver-base.js +43 -0
- package/dist/did-resolver-base.js.map +1 -0
- package/dist/did-resolver-common.d.ts +9 -0
- package/dist/did-resolver-common.d.ts.map +1 -0
- package/dist/did-resolver-common.js +16 -0
- package/dist/did-resolver-common.js.map +1 -0
- package/dist/did-resolver.d.ts +7 -0
- package/dist/did-resolver.d.ts.map +1 -0
- package/dist/did-resolver.js +3 -0
- package/dist/did-resolver.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/methods/plc.d.ts +44 -0
- package/dist/methods/plc.d.ts.map +1 -0
- package/dist/methods/plc.js +38 -0
- package/dist/methods/plc.js.map +1 -0
- package/dist/methods/web.d.ts +41 -0
- package/dist/methods/web.d.ts.map +1 -0
- package/dist/methods/web.js +46 -0
- package/dist/methods/web.js.map +1 -0
- package/dist/methods.d.ts +3 -0
- package/dist/methods.d.ts.map +1 -0
- package/dist/methods.js +19 -0
- package/dist/methods.js.map +1 -0
- package/dist/util.d.ts +4 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +3 -0
- package/dist/util.js.map +1 -0
- package/package.json +40 -0
- package/src/did-cache-memory.ts +25 -0
- package/src/did-cache.ts +31 -0
- package/src/did-method.ts +17 -0
- package/src/did-resolver-base.ts +66 -0
- package/src/did-resolver-common.ts +20 -0
- package/src/did-resolver.ts +15 -0
- package/src/index.ts +9 -0
- package/src/methods/plc.ts +56 -0
- package/src/methods/web.ts +58 -0
- package/src/methods.ts +2 -0
- package/src/util.ts +1 -0
- package/tsconfig.build.json +8 -0
- package/tsconfig.json +4 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @atproto-labs/did-resolver
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
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
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646)]:
|
|
12
|
+
- @atproto-labs/simple-store-memory@0.1.0
|
|
13
|
+
- @atproto-labs/simple-store@0.1.0
|
|
14
|
+
- @atproto-labs/fetch@0.1.0
|
|
15
|
+
- @atproto-labs/pipe@0.1.0
|
|
16
|
+
- @atproto/did@0.1.0
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Dual MIT/Apache-2.0 License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2024 Bluesky PBC, and Contributors
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
Downstream 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.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Did, DidDocument } from '@atproto/did';
|
|
2
|
+
import { SimpleStoreMemory, SimpleStoreMemoryOptions } from '@atproto-labs/simple-store-memory';
|
|
3
|
+
import { DidCache } from './did-cache.js';
|
|
4
|
+
export type DidCacheMemoryOptions = SimpleStoreMemoryOptions<Did, DidDocument>;
|
|
5
|
+
export declare class DidCacheMemory extends SimpleStoreMemory<Did, DidDocument> implements DidCache {
|
|
6
|
+
constructor(options?: DidCacheMemoryOptions);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=did-cache-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-cache-memory.d.ts","sourceRoot":"","sources":["../src/did-cache-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAKzC,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;AAE9E,qBAAa,cACX,SAAQ,iBAAiB,CAAC,GAAG,EAAE,WAAW,CAC1C,YAAW,QAAQ;gBAEP,OAAO,CAAC,EAAE,qBAAqB;CAO5C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DidCacheMemory = void 0;
|
|
4
|
+
const simple_store_memory_1 = require("@atproto-labs/simple-store-memory");
|
|
5
|
+
const DEFAULT_TTL = 3600 * 1000; // 1 hour
|
|
6
|
+
const DEFAULT_MAX_SIZE = 50 * 1024 * 1024; // ~50MB
|
|
7
|
+
class DidCacheMemory extends simple_store_memory_1.SimpleStoreMemory {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super(options?.max == null
|
|
10
|
+
? { ttl: DEFAULT_TTL, maxSize: DEFAULT_MAX_SIZE, ...options }
|
|
11
|
+
: { ttl: DEFAULT_TTL, ...options });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.DidCacheMemory = DidCacheMemory;
|
|
15
|
+
//# sourceMappingURL=did-cache-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-cache-memory.js","sourceRoot":"","sources":["../src/did-cache-memory.ts"],"names":[],"mappings":";;;AACA,2EAG0C;AAI1C,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,SAAS;AACzC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,QAAQ;AAIlD,MAAa,cACX,SAAQ,uCAAmC;IAG3C,YAAY,OAA+B;QACzC,KAAK,CACH,OAAO,EAAE,GAAG,IAAI,IAAI;YAClB,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,EAAE;YAC7D,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CACrC,CAAA;IACH,CAAC;CACF;AAXD,wCAWC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CachedGetter, SimpleStore } from '@atproto-labs/simple-store';
|
|
2
|
+
import { Did, DidDocument } from '@atproto/did';
|
|
3
|
+
import { DidMethod, ResolveOptions } from './did-method.js';
|
|
4
|
+
import { DidResolver, ResolvedDocument } from './did-resolver.js';
|
|
5
|
+
export type { DidMethod, ResolveOptions, ResolvedDocument };
|
|
6
|
+
export type DidCache = SimpleStore<Did, DidDocument>;
|
|
7
|
+
export type DidResolverCachedOptions = {
|
|
8
|
+
cache?: DidCache;
|
|
9
|
+
};
|
|
10
|
+
export declare class DidResolverCached<M extends string = string> implements DidResolver<M> {
|
|
11
|
+
protected readonly getter: CachedGetter<Did, DidDocument>;
|
|
12
|
+
constructor(resolver: DidResolver<M>, cache?: DidCache);
|
|
13
|
+
resolve<D extends Did>(did: D, options?: ResolveOptions): Promise<ResolvedDocument<D, M>>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=did-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-cache.d.ts","sourceRoot":"","sources":["../src/did-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEjE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAA;AAE3D,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;AAEpD,MAAM,MAAM,wBAAwB,GAAG;IAAE,KAAK,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAA;AAE3D,qBAAa,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACtD,YAAW,WAAW,CAAC,CAAC,CAAC;IAEzB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;gBAEvD,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EACxB,KAAK,GAAE,QAA+B;IAQ3B,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;CAGrE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DidResolverCached = void 0;
|
|
4
|
+
const simple_store_1 = require("@atproto-labs/simple-store");
|
|
5
|
+
const did_cache_memory_js_1 = require("./did-cache-memory.js");
|
|
6
|
+
class DidResolverCached {
|
|
7
|
+
constructor(resolver, cache = new did_cache_memory_js_1.DidCacheMemory()) {
|
|
8
|
+
Object.defineProperty(this, "getter", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
this.getter = new simple_store_1.CachedGetter((did, options) => resolver.resolve(did, options), cache);
|
|
15
|
+
}
|
|
16
|
+
async resolve(did, options) {
|
|
17
|
+
return this.getter.get(did, options);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.DidResolverCached = DidResolverCached;
|
|
21
|
+
//# sourceMappingURL=did-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-cache.js","sourceRoot":"","sources":["../src/did-cache.ts"],"names":[],"mappings":";;;AAAA,6DAAsE;AAGtE,+DAAsD;AAUtD,MAAa,iBAAiB;IAI5B,YACE,QAAwB,EACxB,QAAkB,IAAI,oCAAc,EAAE;QAHrB;;;;;WAAsC;QAKvD,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAY,CAC5B,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,EAChD,KAAK,CACN,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,OAAO,CAAgB,GAAM,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAoC,CAAA;IACzE,CAAC;CACF;AAjBD,8CAiBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Did, DidDocument } from '@atproto/did';
|
|
2
|
+
export type ResolveOptions = {
|
|
3
|
+
signal?: AbortSignal;
|
|
4
|
+
noCache?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface DidMethod<Method extends string> {
|
|
7
|
+
resolve: (did: Did<Method>, options?: ResolveOptions) => DidDocument | PromiseLike<DidDocument>;
|
|
8
|
+
}
|
|
9
|
+
export type DidMethods<M extends string> = {
|
|
10
|
+
[K in M]: DidMethod<K>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=did-method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-method.d.ts","sourceRoot":"","sources":["../src/did-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,WAAW,SAAS,CAAC,MAAM,SAAS,MAAM;IAC9C,OAAO,EAAE,CACP,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,EAChB,OAAO,CAAC,EAAE,cAAc,KACrB,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;CAC5C;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI;KACxC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;CACvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-method.js","sourceRoot":"","sources":["../src/did-method.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Did } from '@atproto/did';
|
|
2
|
+
import { DidMethod, DidMethods, ResolveOptions } from './did-method.js';
|
|
3
|
+
import { DidResolver, ResolvedDocument } from './did-resolver.js';
|
|
4
|
+
export type { DidMethod, ResolveOptions, ResolvedDocument };
|
|
5
|
+
export declare class DidResolverBase<M extends string = string> implements DidResolver<M> {
|
|
6
|
+
protected readonly methods: Map<string, DidMethod<M>>;
|
|
7
|
+
constructor(methods: DidMethods<M>);
|
|
8
|
+
resolve<D extends Did>(did: D, options?: ResolveOptions): Promise<ResolvedDocument<D, M>>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=did-resolver-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolver-base.d.ts","sourceRoot":"","sources":["../src/did-resolver-base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAA8B,MAAM,cAAc,CAAA;AAG9D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEjE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAA;AAE3D,qBAAa,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACpD,YAAW,WAAW,CAAC,CAAC,CAAC;IAEzB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;gBAEzC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAI5B,OAAO,CAAC,CAAC,SAAS,GAAG,EACzB,GAAG,EAAE,CAAC,EACN,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CA4CnC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DidResolverBase = void 0;
|
|
4
|
+
const fetch_1 = require("@atproto-labs/fetch");
|
|
5
|
+
const did_1 = require("@atproto/did");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
class DidResolverBase {
|
|
8
|
+
constructor(methods) {
|
|
9
|
+
Object.defineProperty(this, "methods", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
this.methods = new Map(Object.entries(methods));
|
|
16
|
+
}
|
|
17
|
+
async resolve(did, options) {
|
|
18
|
+
options?.signal?.throwIfAborted();
|
|
19
|
+
const method = (0, did_1.extractDidMethod)(did);
|
|
20
|
+
const resolver = this.methods.get(method);
|
|
21
|
+
if (!resolver) {
|
|
22
|
+
throw new did_1.DidError(did, `Unsupported DID method`, 'did-method-invalid', 400);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const document = await resolver.resolve(did, options);
|
|
26
|
+
if (document.id !== did) {
|
|
27
|
+
throw new did_1.DidError(did, `DID document id (${document.id}) does not match DID`, 'did-document-id-mismatch', 400);
|
|
28
|
+
}
|
|
29
|
+
return document;
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (err instanceof fetch_1.FetchRequestError) {
|
|
33
|
+
throw new did_1.DidError(did, err.message, 'did-fetch-error', 400, err);
|
|
34
|
+
}
|
|
35
|
+
if (err instanceof zod_1.ZodError) {
|
|
36
|
+
throw new did_1.DidError(did, err.message, 'did-document-format-error', 503, err);
|
|
37
|
+
}
|
|
38
|
+
throw did_1.DidError.from(err, did);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DidResolverBase = DidResolverBase;
|
|
43
|
+
//# sourceMappingURL=did-resolver-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolver-base.js","sourceRoot":"","sources":["../src/did-resolver-base.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AACvD,sCAA8D;AAC9D,6BAA8B;AAO9B,MAAa,eAAe;IAK1B,YAAY,OAAsB;QAFf;;;;;WAAkC;QAGnD,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,GAAM,EACN,OAAwB;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;QAEjC,MAAM,MAAM,GAAG,IAAA,sBAAgB,EAAC,GAAG,CAAC,CAAA;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,cAAQ,CAChB,GAAG,EACH,wBAAwB,EACxB,oBAAoB,EACpB,GAAG,CACJ,CAAA;QACH,CAAC;QAED,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,GAAa,EAAE,OAAO,CAAC,CAAA;YAC/D,IAAI,QAAQ,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC;gBACxB,MAAM,IAAI,cAAQ,CAChB,GAAG,EACH,oBAAoB,QAAQ,CAAC,EAAE,sBAAsB,EACrD,0BAA0B,EAC1B,GAAG,CACJ,CAAA;YACH,CAAC;YAED,OAAO,QAAkC,CAAA;QAC3C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,yBAAiB,EAAE,CAAC;gBACrC,MAAM,IAAI,cAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;YACnE,CAAC;YAED,IAAI,GAAG,YAAY,cAAQ,EAAE,CAAC;gBAC5B,MAAM,IAAI,cAAQ,CAChB,GAAG,EACH,GAAG,CAAC,OAAO,EACX,2BAA2B,EAC3B,GAAG,EACH,GAAG,CACJ,CAAA;YACH,CAAC;YAED,MAAM,cAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;CACF;AAxDD,0CAwDC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DidResolverBase } from './did-resolver-base.js';
|
|
2
|
+
import { DidPlcMethodOptions } from './methods/plc.js';
|
|
3
|
+
import { DidWebMethodOptions } from './methods/web.js';
|
|
4
|
+
import { Simplify } from './util.js';
|
|
5
|
+
export type DidResolverCommonOptions = Simplify<DidPlcMethodOptions & DidWebMethodOptions>;
|
|
6
|
+
export declare class DidResolverCommon extends DidResolverBase<'plc' | 'web'> implements DidResolverBase<'plc' | 'web'> {
|
|
7
|
+
constructor(options?: DidResolverCommonOptions);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=did-resolver-common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolver-common.d.ts","sourceRoot":"","sources":["../src/did-resolver-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAgB,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAgB,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAC7C,mBAAmB,GAAG,mBAAmB,CAC1C,CAAA;AAED,qBAAa,iBACX,SAAQ,eAAe,CAAC,KAAK,GAAG,KAAK,CACrC,YAAW,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC;gBAE7B,OAAO,CAAC,EAAE,wBAAwB;CAM/C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DidResolverCommon = void 0;
|
|
4
|
+
const did_resolver_base_js_1 = require("./did-resolver-base.js");
|
|
5
|
+
const plc_js_1 = require("./methods/plc.js");
|
|
6
|
+
const web_js_1 = require("./methods/web.js");
|
|
7
|
+
class DidResolverCommon extends did_resolver_base_js_1.DidResolverBase {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super({
|
|
10
|
+
plc: new plc_js_1.DidPlcMethod(options),
|
|
11
|
+
web: new web_js_1.DidWebMethod(options),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DidResolverCommon = DidResolverCommon;
|
|
16
|
+
//# sourceMappingURL=did-resolver-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolver-common.js","sourceRoot":"","sources":["../src/did-resolver-common.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AACxD,6CAAoE;AACpE,6CAAoE;AAOpE,MAAa,iBACX,SAAQ,sCAA8B;IAGtC,YAAY,OAAkC;QAC5C,KAAK,CAAC;YACJ,GAAG,EAAE,IAAI,qBAAY,CAAC,OAAO,CAAC;YAC9B,GAAG,EAAE,IAAI,qBAAY,CAAC,OAAO,CAAC;SAC/B,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,8CAUC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Did, DidDocument } from '@atproto/did';
|
|
2
|
+
import { ResolveOptions } from './did-method.js';
|
|
3
|
+
export type ResolvedDocument<D extends Did, M extends string = string> = D extends Did<infer N> ? DidDocument<N extends string ? M : N extends M ? N : never> : never;
|
|
4
|
+
export interface DidResolver<M extends string = string> {
|
|
5
|
+
resolve<D extends Did>(did: D, options?: ResolveOptions): Promise<ResolvedDocument<D, M>>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=did-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolver.d.ts","sourceRoot":"","sources":["../src/did-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IACnE,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GAClB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAC3D,KAAK,CAAA;AAEX,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACpD,OAAO,CAAC,CAAC,SAAS,GAAG,EACnB,GAAG,EAAE,CAAC,EACN,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-resolver.js","sourceRoot":"","sources":["../src/did-resolver.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from '@atproto/did';
|
|
2
|
+
export * from './did-cache-memory.js';
|
|
3
|
+
export * from './did-cache.js';
|
|
4
|
+
export * from './did-method.js';
|
|
5
|
+
export * from './did-resolver-common.js';
|
|
6
|
+
export * from './did-resolver.js';
|
|
7
|
+
export * from './methods.js';
|
|
8
|
+
export * from './util.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAE5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@atproto/did"), exports);
|
|
18
|
+
__exportStar(require("./did-cache-memory.js"), exports);
|
|
19
|
+
__exportStar(require("./did-cache.js"), exports);
|
|
20
|
+
__exportStar(require("./did-method.js"), exports);
|
|
21
|
+
__exportStar(require("./did-resolver-common.js"), exports);
|
|
22
|
+
__exportStar(require("./did-resolver.js"), exports);
|
|
23
|
+
__exportStar(require("./methods.js"), exports);
|
|
24
|
+
__exportStar(require("./util.js"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAE5B,wDAAqC;AACrC,iDAA8B;AAC9B,kDAA+B;AAC/B,2DAAwC;AACxC,oDAAiC;AACjC,+CAA4B;AAC5B,4CAAyB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Fetch } from '@atproto-labs/fetch';
|
|
2
|
+
import { Did } from '@atproto/did';
|
|
3
|
+
import { DidMethod, ResolveOptions } from '../did-method.js';
|
|
4
|
+
export type DidPlcMethodOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* @default globalThis.fetch
|
|
7
|
+
*/
|
|
8
|
+
fetch?: Fetch;
|
|
9
|
+
/**
|
|
10
|
+
* @default 'https://plc.directory/'
|
|
11
|
+
*/
|
|
12
|
+
plcDirectoryUrl?: string | URL;
|
|
13
|
+
};
|
|
14
|
+
export declare class DidPlcMethod implements DidMethod<'plc'> {
|
|
15
|
+
protected readonly fetch: Fetch<unknown>;
|
|
16
|
+
readonly plcDirectoryUrl: URL;
|
|
17
|
+
constructor(options?: DidPlcMethodOptions);
|
|
18
|
+
resolve(did: Did<'plc'>, options?: ResolveOptions): Promise<{
|
|
19
|
+
id: `did:${string}:${string}`;
|
|
20
|
+
'@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
|
|
21
|
+
controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
|
|
22
|
+
alsoKnownAs?: string[] | undefined;
|
|
23
|
+
service?: {
|
|
24
|
+
type: string | string[];
|
|
25
|
+
id: string;
|
|
26
|
+
serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
authentication?: (string | {
|
|
29
|
+
type: string;
|
|
30
|
+
id: string;
|
|
31
|
+
controller: `did:${string}:${string}` | `did:${string}:${string}`[];
|
|
32
|
+
publicKeyJwk?: Record<string, unknown> | undefined;
|
|
33
|
+
publicKeyMultibase?: string | undefined;
|
|
34
|
+
})[] | undefined;
|
|
35
|
+
verificationMethod?: (string | {
|
|
36
|
+
type: string;
|
|
37
|
+
id: string;
|
|
38
|
+
controller: `did:${string}:${string}` | `did:${string}:${string}`[];
|
|
39
|
+
publicKeyJwk?: Record<string, unknown> | undefined;
|
|
40
|
+
publicKeyMultibase?: string | undefined;
|
|
41
|
+
})[] | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=plc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plc.d.ts","sourceRoot":"","sources":["../../src/methods/plc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAKN,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAqC,MAAM,cAAc,CAAA;AAErE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAQ5D,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAC/B,CAAA;AAED,qBAAa,YAAa,YAAW,SAAS,CAAC,KAAK,CAAC;IACnD,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAExC,SAAgB,eAAe,EAAE,GAAG,CAAA;gBAExB,OAAO,CAAC,EAAE,mBAAmB;IAOnC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAaxD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DidPlcMethod = void 0;
|
|
4
|
+
const fetch_1 = require("@atproto-labs/fetch");
|
|
5
|
+
const pipe_1 = require("@atproto-labs/pipe");
|
|
6
|
+
const did_1 = require("@atproto/did");
|
|
7
|
+
const fetchSuccessHandler = (0, pipe_1.pipe)((0, fetch_1.fetchOkProcessor)(), (0, fetch_1.fetchJsonProcessor)(/^application\/(did\+ld\+)?json$/), (0, fetch_1.fetchJsonZodProcessor)(did_1.didDocumentValidator));
|
|
8
|
+
class DidPlcMethod {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
Object.defineProperty(this, "fetch", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "plcDirectoryUrl", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
this.plcDirectoryUrl = new URL(options?.plcDirectoryUrl || 'https://plc.directory/');
|
|
23
|
+
this.fetch = (0, fetch_1.bindFetch)(options?.fetch);
|
|
24
|
+
}
|
|
25
|
+
async resolve(did, options) {
|
|
26
|
+
// Although the did should start with `did:plc:` (thanks to typings), we
|
|
27
|
+
// should still check if the msid is valid.
|
|
28
|
+
(0, did_1.checkDidPlc)(did);
|
|
29
|
+
const url = new URL(`/${did}`, this.plcDirectoryUrl);
|
|
30
|
+
return this.fetch(url, {
|
|
31
|
+
redirect: 'error',
|
|
32
|
+
headers: { accept: 'application/did+ld+json,application/json' },
|
|
33
|
+
signal: options?.signal,
|
|
34
|
+
}).then(fetchSuccessHandler);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.DidPlcMethod = DidPlcMethod;
|
|
38
|
+
//# sourceMappingURL=plc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plc.js","sourceRoot":"","sources":["../../src/methods/plc.ts"],"names":[],"mappings":";;;AAAA,+CAM4B;AAC5B,6CAAyC;AACzC,sCAAqE;AAIrE,MAAM,mBAAmB,GAAG,IAAA,WAAI,EAC9B,IAAA,wBAAgB,GAAE,EAClB,IAAA,0BAAkB,EAAC,iCAAiC,CAAC,EACrD,IAAA,6BAAqB,EAAC,0BAAoB,CAAC,CAC5C,CAAA;AAcD,MAAa,YAAY;IAKvB,YAAY,OAA6B;QAJtB;;;;;WAAqB;QAExB;;;;;WAAoB;QAGlC,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,CAC5B,OAAO,EAAE,eAAe,IAAI,wBAAwB,CACrD,CAAA;QACD,IAAI,CAAC,KAAK,GAAG,IAAA,iBAAS,EAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAe,EAAE,OAAwB;QACrD,wEAAwE;QACxE,2CAA2C;QAC3C,IAAA,iBAAW,EAAC,GAAG,CAAC,CAAA;QAEhB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;QAEpD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;YACrB,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,EAAE,MAAM,EAAE,0CAA0C,EAAE;YAC/D,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC9B,CAAC;CACF;AAzBD,oCAyBC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Fetch } from '@atproto-labs/fetch';
|
|
2
|
+
import { Did } from '@atproto/did';
|
|
3
|
+
import { DidMethod, ResolveOptions } from '../did-method.js';
|
|
4
|
+
export type DidWebMethodOptions = {
|
|
5
|
+
fetch?: Fetch;
|
|
6
|
+
};
|
|
7
|
+
export declare class DidWebMethod implements DidMethod<'web'> {
|
|
8
|
+
protected readonly fetch: Fetch<unknown>;
|
|
9
|
+
constructor({ fetch }?: DidWebMethodOptions);
|
|
10
|
+
resolve(did: Did<'web'>, options?: ResolveOptions): Promise<{
|
|
11
|
+
id: `did:${string}:${string}`;
|
|
12
|
+
'@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
|
|
13
|
+
controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
|
|
14
|
+
alsoKnownAs?: string[] | undefined;
|
|
15
|
+
service?: {
|
|
16
|
+
type: string | string[];
|
|
17
|
+
id: string;
|
|
18
|
+
serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
|
|
19
|
+
}[] | undefined;
|
|
20
|
+
authentication?: (string | {
|
|
21
|
+
type: string;
|
|
22
|
+
id: string;
|
|
23
|
+
controller: `did:${string}:${string}` | `did:${string}:${string}`[];
|
|
24
|
+
publicKeyJwk?: Record<string, unknown> | undefined;
|
|
25
|
+
publicKeyMultibase?: string | undefined;
|
|
26
|
+
})[] | undefined;
|
|
27
|
+
verificationMethod?: (string | {
|
|
28
|
+
type: string;
|
|
29
|
+
id: string;
|
|
30
|
+
controller: `did:${string}:${string}` | `did:${string}:${string}`[];
|
|
31
|
+
publicKeyJwk?: Record<string, unknown> | undefined;
|
|
32
|
+
publicKeyMultibase?: string | undefined;
|
|
33
|
+
})[] | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc8615}
|
|
38
|
+
* @see {@link https://w3c-ccg.github.io/did-method-web/#create-register}
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildDidWebDocumentUrl(did: Did<'web'>): URL;
|
|
41
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/methods/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EAIN,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAqC,MAAM,cAAc,CAAA;AAErE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAQ5D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,qBAAa,YAAa,YAAW,SAAS,CAAC,KAAK,CAAC;IACnD,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;gBAE5B,EAAE,KAAwB,EAAE,GAAE,mBAAwB;IAI5D,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CASxD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,OAarD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDidWebDocumentUrl = exports.DidWebMethod = void 0;
|
|
4
|
+
const fetch_1 = require("@atproto-labs/fetch");
|
|
5
|
+
const pipe_1 = require("@atproto-labs/pipe");
|
|
6
|
+
const did_1 = require("@atproto/did");
|
|
7
|
+
const fetchSuccessHandler = (0, pipe_1.pipe)((0, fetch_1.fetchOkProcessor)(), (0, fetch_1.fetchJsonProcessor)(/^application\/(did\+ld\+)?json$/), (0, fetch_1.fetchJsonZodProcessor)(did_1.didDocumentValidator));
|
|
8
|
+
class DidWebMethod {
|
|
9
|
+
constructor({ fetch = globalThis.fetch } = {}) {
|
|
10
|
+
Object.defineProperty(this, "fetch", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
this.fetch = (0, fetch_1.bindFetch)(fetch);
|
|
17
|
+
}
|
|
18
|
+
async resolve(did, options) {
|
|
19
|
+
const didDocumentUrl = buildDidWebDocumentUrl(did);
|
|
20
|
+
return this.fetch(didDocumentUrl, {
|
|
21
|
+
redirect: 'error',
|
|
22
|
+
headers: { accept: 'application/did+ld+json,application/json' },
|
|
23
|
+
signal: options?.signal,
|
|
24
|
+
}).then(fetchSuccessHandler);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.DidWebMethod = DidWebMethod;
|
|
28
|
+
/**
|
|
29
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc8615}
|
|
30
|
+
* @see {@link https://w3c-ccg.github.io/did-method-web/#create-register}
|
|
31
|
+
*/
|
|
32
|
+
function buildDidWebDocumentUrl(did) {
|
|
33
|
+
const url = (0, did_1.didWebToUrl)(did); // Will throw if the DID is invalid
|
|
34
|
+
// Note: DID cannot end with an `:`, so they cannot end with a `/`. This is
|
|
35
|
+
// true unless when there is no path at all, in which case the URL constructor
|
|
36
|
+
// will set the pathname to `/`.
|
|
37
|
+
// https://w3c-ccg.github.io/did-method-web/#read-resolve
|
|
38
|
+
if (url.pathname === '/') {
|
|
39
|
+
return new URL(`/.well-known/did.json`, url);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return new URL(`${url.pathname}/did.json`, url);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.buildDidWebDocumentUrl = buildDidWebDocumentUrl;
|
|
46
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/methods/web.ts"],"names":[],"mappings":";;;AAAA,+CAM4B;AAC5B,6CAAyC;AACzC,sCAAqE;AAIrE,MAAM,mBAAmB,GAAG,IAAA,WAAI,EAC9B,IAAA,wBAAgB,GAAE,EAClB,IAAA,0BAAkB,EAAC,iCAAiC,CAAC,EACrD,IAAA,6BAAqB,EAAC,0BAAoB,CAAC,CAC5C,CAAA;AAMD,MAAa,YAAY;IAGvB,YAAY,EAAE,KAAK,GAAG,UAAU,CAAC,KAAK,KAA0B,EAAE;QAF/C;;;;;WAAqB;QAGtC,IAAI,CAAC,KAAK,GAAG,IAAA,iBAAS,EAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAe,EAAE,OAAwB;QACrD,MAAM,cAAc,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAA;QAElD,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE;YAChC,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,EAAE,MAAM,EAAE,0CAA0C,EAAE;YAC/D,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC9B,CAAC;CACF;AAhBD,oCAgBC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,GAAe;IACpD,MAAM,GAAG,GAAG,IAAA,iBAAW,EAAC,GAAG,CAAC,CAAA,CAAC,mCAAmC;IAEhE,2EAA2E;IAC3E,8EAA8E;IAC9E,gCAAgC;IAEhC,yDAAyD;IACzD,IAAI,GAAG,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;QACzB,OAAO,IAAI,GAAG,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAA;IAC9C,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,WAAW,EAAE,GAAG,CAAC,CAAA;IACjD,CAAC;AACH,CAAC;AAbD,wDAaC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
|
package/dist/methods.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./methods/plc.js"), exports);
|
|
18
|
+
__exportStar(require("./methods/web.js"), exports);
|
|
19
|
+
//# sourceMappingURL=methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../src/methods.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC;AAChC,mDAAgC"}
|
package/dist/util.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA"}
|
package/dist/util.js
ADDED
package/dist/util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atproto-labs/did-resolver",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "DID resolution and verification library",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"atproto",
|
|
8
|
+
"did",
|
|
9
|
+
"resolver"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://atproto.com",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/bluesky-social/atproto",
|
|
15
|
+
"directory": "packages/internal/did-resolver"
|
|
16
|
+
},
|
|
17
|
+
"type": "commonjs",
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"zod": "^3.23.8",
|
|
28
|
+
"@atproto-labs/fetch": "0.1.0",
|
|
29
|
+
"@atproto-labs/pipe": "0.1.0",
|
|
30
|
+
"@atproto-labs/simple-store": "0.1.0",
|
|
31
|
+
"@atproto-labs/simple-store-memory": "0.1.0",
|
|
32
|
+
"@atproto/did": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "^5.3.3"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc --build tsconfig.build.json"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Did, DidDocument } from '@atproto/did'
|
|
2
|
+
import {
|
|
3
|
+
SimpleStoreMemory,
|
|
4
|
+
SimpleStoreMemoryOptions,
|
|
5
|
+
} from '@atproto-labs/simple-store-memory'
|
|
6
|
+
|
|
7
|
+
import { DidCache } from './did-cache.js'
|
|
8
|
+
|
|
9
|
+
const DEFAULT_TTL = 3600 * 1000 // 1 hour
|
|
10
|
+
const DEFAULT_MAX_SIZE = 50 * 1024 * 1024 // ~50MB
|
|
11
|
+
|
|
12
|
+
export type DidCacheMemoryOptions = SimpleStoreMemoryOptions<Did, DidDocument>
|
|
13
|
+
|
|
14
|
+
export class DidCacheMemory
|
|
15
|
+
extends SimpleStoreMemory<Did, DidDocument>
|
|
16
|
+
implements DidCache
|
|
17
|
+
{
|
|
18
|
+
constructor(options?: DidCacheMemoryOptions) {
|
|
19
|
+
super(
|
|
20
|
+
options?.max == null
|
|
21
|
+
? { ttl: DEFAULT_TTL, maxSize: DEFAULT_MAX_SIZE, ...options }
|
|
22
|
+
: { ttl: DEFAULT_TTL, ...options },
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/did-cache.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CachedGetter, SimpleStore } from '@atproto-labs/simple-store'
|
|
2
|
+
import { Did, DidDocument } from '@atproto/did'
|
|
3
|
+
|
|
4
|
+
import { DidCacheMemory } from './did-cache-memory.js'
|
|
5
|
+
import { DidMethod, ResolveOptions } from './did-method.js'
|
|
6
|
+
import { DidResolver, ResolvedDocument } from './did-resolver.js'
|
|
7
|
+
|
|
8
|
+
export type { DidMethod, ResolveOptions, ResolvedDocument }
|
|
9
|
+
|
|
10
|
+
export type DidCache = SimpleStore<Did, DidDocument>
|
|
11
|
+
|
|
12
|
+
export type DidResolverCachedOptions = { cache?: DidCache }
|
|
13
|
+
|
|
14
|
+
export class DidResolverCached<M extends string = string>
|
|
15
|
+
implements DidResolver<M>
|
|
16
|
+
{
|
|
17
|
+
protected readonly getter: CachedGetter<Did, DidDocument>
|
|
18
|
+
constructor(
|
|
19
|
+
resolver: DidResolver<M>,
|
|
20
|
+
cache: DidCache = new DidCacheMemory(),
|
|
21
|
+
) {
|
|
22
|
+
this.getter = new CachedGetter<Did, DidDocument>(
|
|
23
|
+
(did, options) => resolver.resolve(did, options),
|
|
24
|
+
cache,
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async resolve<D extends Did>(did: D, options?: ResolveOptions) {
|
|
29
|
+
return this.getter.get(did, options) as Promise<ResolvedDocument<D, M>>
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Did, DidDocument } from '@atproto/did'
|
|
2
|
+
|
|
3
|
+
export type ResolveOptions = {
|
|
4
|
+
signal?: AbortSignal
|
|
5
|
+
noCache?: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DidMethod<Method extends string> {
|
|
9
|
+
resolve: (
|
|
10
|
+
did: Did<Method>,
|
|
11
|
+
options?: ResolveOptions,
|
|
12
|
+
) => DidDocument | PromiseLike<DidDocument>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type DidMethods<M extends string> = {
|
|
16
|
+
[K in M]: DidMethod<K>
|
|
17
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FetchRequestError } from '@atproto-labs/fetch'
|
|
2
|
+
import { Did, DidError, extractDidMethod } from '@atproto/did'
|
|
3
|
+
import { ZodError } from 'zod'
|
|
4
|
+
|
|
5
|
+
import { DidMethod, DidMethods, ResolveOptions } from './did-method.js'
|
|
6
|
+
import { DidResolver, ResolvedDocument } from './did-resolver.js'
|
|
7
|
+
|
|
8
|
+
export type { DidMethod, ResolveOptions, ResolvedDocument }
|
|
9
|
+
|
|
10
|
+
export class DidResolverBase<M extends string = string>
|
|
11
|
+
implements DidResolver<M>
|
|
12
|
+
{
|
|
13
|
+
protected readonly methods: Map<string, DidMethod<M>>
|
|
14
|
+
|
|
15
|
+
constructor(methods: DidMethods<M>) {
|
|
16
|
+
this.methods = new Map(Object.entries(methods))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async resolve<D extends Did>(
|
|
20
|
+
did: D,
|
|
21
|
+
options?: ResolveOptions,
|
|
22
|
+
): Promise<ResolvedDocument<D, M>> {
|
|
23
|
+
options?.signal?.throwIfAborted()
|
|
24
|
+
|
|
25
|
+
const method = extractDidMethod(did)
|
|
26
|
+
const resolver = this.methods.get(method)
|
|
27
|
+
if (!resolver) {
|
|
28
|
+
throw new DidError(
|
|
29
|
+
did,
|
|
30
|
+
`Unsupported DID method`,
|
|
31
|
+
'did-method-invalid',
|
|
32
|
+
400,
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const document = await resolver.resolve(did as Did<M>, options)
|
|
38
|
+
if (document.id !== did) {
|
|
39
|
+
throw new DidError(
|
|
40
|
+
did,
|
|
41
|
+
`DID document id (${document.id}) does not match DID`,
|
|
42
|
+
'did-document-id-mismatch',
|
|
43
|
+
400,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return document as ResolvedDocument<D, M>
|
|
48
|
+
} catch (err) {
|
|
49
|
+
if (err instanceof FetchRequestError) {
|
|
50
|
+
throw new DidError(did, err.message, 'did-fetch-error', 400, err)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (err instanceof ZodError) {
|
|
54
|
+
throw new DidError(
|
|
55
|
+
did,
|
|
56
|
+
err.message,
|
|
57
|
+
'did-document-format-error',
|
|
58
|
+
503,
|
|
59
|
+
err,
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
throw DidError.from(err, did)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DidResolverBase } from './did-resolver-base.js'
|
|
2
|
+
import { DidPlcMethod, DidPlcMethodOptions } from './methods/plc.js'
|
|
3
|
+
import { DidWebMethod, DidWebMethodOptions } from './methods/web.js'
|
|
4
|
+
import { Simplify } from './util.js'
|
|
5
|
+
|
|
6
|
+
export type DidResolverCommonOptions = Simplify<
|
|
7
|
+
DidPlcMethodOptions & DidWebMethodOptions
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
export class DidResolverCommon
|
|
11
|
+
extends DidResolverBase<'plc' | 'web'>
|
|
12
|
+
implements DidResolverBase<'plc' | 'web'>
|
|
13
|
+
{
|
|
14
|
+
constructor(options?: DidResolverCommonOptions) {
|
|
15
|
+
super({
|
|
16
|
+
plc: new DidPlcMethod(options),
|
|
17
|
+
web: new DidWebMethod(options),
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Did, DidDocument } from '@atproto/did'
|
|
2
|
+
|
|
3
|
+
import { ResolveOptions } from './did-method.js'
|
|
4
|
+
|
|
5
|
+
export type ResolvedDocument<D extends Did, M extends string = string> =
|
|
6
|
+
D extends Did<infer N>
|
|
7
|
+
? DidDocument<N extends string ? M : N extends M ? N : never>
|
|
8
|
+
: never
|
|
9
|
+
|
|
10
|
+
export interface DidResolver<M extends string = string> {
|
|
11
|
+
resolve<D extends Did>(
|
|
12
|
+
did: D,
|
|
13
|
+
options?: ResolveOptions,
|
|
14
|
+
): Promise<ResolvedDocument<D, M>>
|
|
15
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from '@atproto/did'
|
|
2
|
+
|
|
3
|
+
export * from './did-cache-memory.js'
|
|
4
|
+
export * from './did-cache.js'
|
|
5
|
+
export * from './did-method.js'
|
|
6
|
+
export * from './did-resolver-common.js'
|
|
7
|
+
export * from './did-resolver.js'
|
|
8
|
+
export * from './methods.js'
|
|
9
|
+
export * from './util.js'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Fetch,
|
|
3
|
+
bindFetch,
|
|
4
|
+
fetchJsonProcessor,
|
|
5
|
+
fetchJsonZodProcessor,
|
|
6
|
+
fetchOkProcessor,
|
|
7
|
+
} from '@atproto-labs/fetch'
|
|
8
|
+
import { pipe } from '@atproto-labs/pipe'
|
|
9
|
+
import { Did, checkDidPlc, didDocumentValidator } from '@atproto/did'
|
|
10
|
+
|
|
11
|
+
import { DidMethod, ResolveOptions } from '../did-method.js'
|
|
12
|
+
|
|
13
|
+
const fetchSuccessHandler = pipe(
|
|
14
|
+
fetchOkProcessor(),
|
|
15
|
+
fetchJsonProcessor(/^application\/(did\+ld\+)?json$/),
|
|
16
|
+
fetchJsonZodProcessor(didDocumentValidator),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export type DidPlcMethodOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* @default globalThis.fetch
|
|
22
|
+
*/
|
|
23
|
+
fetch?: Fetch
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @default 'https://plc.directory/'
|
|
27
|
+
*/
|
|
28
|
+
plcDirectoryUrl?: string | URL
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class DidPlcMethod implements DidMethod<'plc'> {
|
|
32
|
+
protected readonly fetch: Fetch<unknown>
|
|
33
|
+
|
|
34
|
+
public readonly plcDirectoryUrl: URL
|
|
35
|
+
|
|
36
|
+
constructor(options?: DidPlcMethodOptions) {
|
|
37
|
+
this.plcDirectoryUrl = new URL(
|
|
38
|
+
options?.plcDirectoryUrl || 'https://plc.directory/',
|
|
39
|
+
)
|
|
40
|
+
this.fetch = bindFetch(options?.fetch)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async resolve(did: Did<'plc'>, options?: ResolveOptions) {
|
|
44
|
+
// Although the did should start with `did:plc:` (thanks to typings), we
|
|
45
|
+
// should still check if the msid is valid.
|
|
46
|
+
checkDidPlc(did)
|
|
47
|
+
|
|
48
|
+
const url = new URL(`/${did}`, this.plcDirectoryUrl)
|
|
49
|
+
|
|
50
|
+
return this.fetch(url, {
|
|
51
|
+
redirect: 'error',
|
|
52
|
+
headers: { accept: 'application/did+ld+json,application/json' },
|
|
53
|
+
signal: options?.signal,
|
|
54
|
+
}).then(fetchSuccessHandler)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bindFetch,
|
|
3
|
+
Fetch,
|
|
4
|
+
fetchJsonProcessor,
|
|
5
|
+
fetchJsonZodProcessor,
|
|
6
|
+
fetchOkProcessor,
|
|
7
|
+
} from '@atproto-labs/fetch'
|
|
8
|
+
import { pipe } from '@atproto-labs/pipe'
|
|
9
|
+
import { Did, didDocumentValidator, didWebToUrl } from '@atproto/did'
|
|
10
|
+
|
|
11
|
+
import { DidMethod, ResolveOptions } from '../did-method.js'
|
|
12
|
+
|
|
13
|
+
const fetchSuccessHandler = pipe(
|
|
14
|
+
fetchOkProcessor(),
|
|
15
|
+
fetchJsonProcessor(/^application\/(did\+ld\+)?json$/),
|
|
16
|
+
fetchJsonZodProcessor(didDocumentValidator),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export type DidWebMethodOptions = {
|
|
20
|
+
fetch?: Fetch
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class DidWebMethod implements DidMethod<'web'> {
|
|
24
|
+
protected readonly fetch: Fetch<unknown>
|
|
25
|
+
|
|
26
|
+
constructor({ fetch = globalThis.fetch }: DidWebMethodOptions = {}) {
|
|
27
|
+
this.fetch = bindFetch(fetch)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async resolve(did: Did<'web'>, options?: ResolveOptions) {
|
|
31
|
+
const didDocumentUrl = buildDidWebDocumentUrl(did)
|
|
32
|
+
|
|
33
|
+
return this.fetch(didDocumentUrl, {
|
|
34
|
+
redirect: 'error',
|
|
35
|
+
headers: { accept: 'application/did+ld+json,application/json' },
|
|
36
|
+
signal: options?.signal,
|
|
37
|
+
}).then(fetchSuccessHandler)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc8615}
|
|
43
|
+
* @see {@link https://w3c-ccg.github.io/did-method-web/#create-register}
|
|
44
|
+
*/
|
|
45
|
+
export function buildDidWebDocumentUrl(did: Did<'web'>) {
|
|
46
|
+
const url = didWebToUrl(did) // Will throw if the DID is invalid
|
|
47
|
+
|
|
48
|
+
// Note: DID cannot end with an `:`, so they cannot end with a `/`. This is
|
|
49
|
+
// true unless when there is no path at all, in which case the URL constructor
|
|
50
|
+
// will set the pathname to `/`.
|
|
51
|
+
|
|
52
|
+
// https://w3c-ccg.github.io/did-method-web/#read-resolve
|
|
53
|
+
if (url.pathname === '/') {
|
|
54
|
+
return new URL(`/.well-known/did.json`, url)
|
|
55
|
+
} else {
|
|
56
|
+
return new URL(`${url.pathname}/did.json`, url)
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/methods.ts
ADDED
package/src/util.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Simplify<T> = { [K in keyof T]: T[K] } & NonNullable<unknown>
|
package/tsconfig.json
ADDED