@atcute/identity-resolver 1.2.3 → 2.0.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/dist/did/methods/xrpc.js +2 -2
- package/dist/did/methods/xrpc.js.map +1 -1
- package/dist/did/utils.d.ts +41 -1
- package/dist/did/utils.d.ts.map +1 -1
- package/dist/did/utils.js +1 -1
- package/dist/did/utils.js.map +1 -1
- package/dist/handle/methods/xrpc.js +4 -4
- package/dist/handle/methods/xrpc.js.map +1 -1
- package/lib/did/methods/xrpc.ts +2 -2
- package/lib/did/utils.ts +1 -1
- package/lib/handle/methods/xrpc.ts +5 -5
- package/package.json +7 -7
package/dist/did/methods/xrpc.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defs } from '@atcute/identity';
|
|
2
2
|
import { FailedResponseError, isResponseOk, parseResponseAsJson, pipe, validateJsonWith, } from '@atcute/util-fetch';
|
|
3
|
-
import * as v from '
|
|
3
|
+
import * as v from 'valibot';
|
|
4
4
|
import * as err from '../../errors.js';
|
|
5
|
-
const fetchXrpcHandler = pipe(isResponseOk, parseResponseAsJson(/^application\/json$/, 20 * 1024 + 16), validateJsonWith(v.
|
|
5
|
+
const fetchXrpcHandler = pipe(isResponseOk, parseResponseAsJson(/^application\/json$/, 20 * 1024 + 16), validateJsonWith(v.looseObject({ didDoc: defs.didDocument })));
|
|
6
6
|
export class XrpcDidDocumentResolver {
|
|
7
7
|
serviceUrl;
|
|
8
8
|
#fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xrpc.js","sourceRoot":"","sources":["../../../lib/did/methods/xrpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,IAAI,EACJ,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,CAAC,M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C,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;gBAChD,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;aACvC,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAEjD,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,KAAK,YAAY,mBAAmB,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAClE,MAAM,IAAI,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;YAC1C,CAAC;YAED,MAAM,IAAI,GAAG,CAAC,6BAA6B,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
|
package/dist/did/utils.d.ts
CHANGED
|
@@ -1,2 +1,42 @@
|
|
|
1
|
-
export declare const fetchDocHandler: (input: Response) => Promise<import("@atcute/util-fetch").ParsedJsonResponse<
|
|
1
|
+
export declare const fetchDocHandler: (input: Response) => Promise<import("@atcute/util-fetch").ParsedJsonResponse<{
|
|
2
|
+
'@context'?: string[] | undefined;
|
|
3
|
+
id: `did:${string}:${string}`;
|
|
4
|
+
alsoKnownAs?: string[] | undefined;
|
|
5
|
+
verificationMethod?: ({
|
|
6
|
+
id: string;
|
|
7
|
+
type: string;
|
|
8
|
+
controller: `did:${string}:${string}`;
|
|
9
|
+
publicKeyMultibase?: string | undefined;
|
|
10
|
+
publicKeyJwk?: {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
} | undefined;
|
|
13
|
+
} & {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
})[] | undefined;
|
|
16
|
+
service?: ({
|
|
17
|
+
id: string;
|
|
18
|
+
type: string | string[];
|
|
19
|
+
serviceEndpoint: string | (string | {
|
|
20
|
+
[x: string]: string;
|
|
21
|
+
})[] | {
|
|
22
|
+
[x: string]: string;
|
|
23
|
+
};
|
|
24
|
+
} & {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
})[] | undefined;
|
|
27
|
+
controller?: `did:${string}:${string}`[] | `did:${string}:${string}` | undefined;
|
|
28
|
+
authentication?: (string | ({
|
|
29
|
+
id: string;
|
|
30
|
+
type: string;
|
|
31
|
+
controller: `did:${string}:${string}`;
|
|
32
|
+
publicKeyMultibase?: string | undefined;
|
|
33
|
+
publicKeyJwk?: {
|
|
34
|
+
[x: string]: unknown;
|
|
35
|
+
} | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}))[] | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}>>;
|
|
2
42
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/did/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/did/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/did/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAI3B,CAAC"}
|
package/dist/did/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { defs } from '@atcute/identity';
|
|
2
2
|
import { isResponseOk, parseResponseAsJson, pipe, validateJsonWith } from '@atcute/util-fetch';
|
|
3
|
-
export const fetchDocHandler = pipe(isResponseOk, parseResponseAsJson(/^application\/(did\+ld\+)?json$/, 20 * 1024), validateJsonWith(defs.didDocument
|
|
3
|
+
export const fetchDocHandler = pipe(isResponseOk, parseResponseAsJson(/^application\/(did\+ld\+)?json$/, 20 * 1024), validateJsonWith(defs.didDocument));
|
|
4
4
|
//# sourceMappingURL=utils.js.map
|
package/dist/did/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/did/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAClC,YAAY,EACZ,mBAAmB,CAAC,iCAAiC,EAAE,EAAE,GAAG,IAAI,CAAC,EACjE,gBAAgB,CAAC,IAAI,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/did/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAClC,YAAY,EACZ,mBAAmB,CAAC,iCAAiC,EAAE,EAAE,GAAG,IAAI,CAAC,EACjE,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAClC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isAtprotoDid } from '@atcute/identity';
|
|
2
2
|
import { FailedResponseError, isResponseOk, parseResponseAsJson, pipe, validateJsonWith, } from '@atcute/util-fetch';
|
|
3
|
-
import * as v from '
|
|
3
|
+
import * as v from 'valibot';
|
|
4
4
|
import * as err from '../../errors.js';
|
|
5
|
-
const response = v.
|
|
6
|
-
did: v.
|
|
5
|
+
const response = v.looseObject({
|
|
6
|
+
did: v.custom(isAtprotoDid),
|
|
7
7
|
});
|
|
8
|
-
const fetchXrpcHandler = pipe(isResponseOk, parseResponseAsJson(/^application\/json$/, 4 * 1024), validateJsonWith(response
|
|
8
|
+
const fetchXrpcHandler = pipe(isResponseOk, parseResponseAsJson(/^application\/json$/, 4 * 1024), validateJsonWith(response));
|
|
9
9
|
export class XrpcHandleResolver {
|
|
10
10
|
serviceUrl;
|
|
11
11
|
#fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xrpc.js","sourceRoot":"","sources":["../../../lib/handle/methods/xrpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,IAAI,EACJ,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"xrpc.js","sourceRoot":"","sources":["../../../lib/handle/methods/xrpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,IAAI,EACJ,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC;IAC9B,GAAG,EAAE,CAAC,CAAC,MAAM,CAAa,YAAY,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,IAAI,CAC5B,YAAY,EACZ,mBAAmB,CAAC,qBAAqB,EAAE,CAAC,GAAG,IAAI,CAAC,EACpD,gBAAgB,CAAC,QAAQ,CAAC,CAC1B,CAAC;AAOF,MAAM,OAAO,kBAAkB;IACrB,UAAU,CAAS;IAC5B,MAAM,CAAe;IAErB,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,KAAK,EAA6B;QAC9E,IAAI,CAAC,UAAU,GAAG,UAAU,CA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
12
12
|
|
|
13
13
|
import * as err from '../../errors.ts';
|
|
14
14
|
import type { DidDocumentResolver, ResolveDidDocumentOptions } from '../../types.ts';
|
|
@@ -16,7 +16,7 @@ import type { DidDocumentResolver, ResolveDidDocumentOptions } from '../../types
|
|
|
16
16
|
const fetchXrpcHandler = pipe(
|
|
17
17
|
isResponseOk,
|
|
18
18
|
parseResponseAsJson(/^application\/json$/, 20 * 1024 + 16),
|
|
19
|
-
validateJsonWith(v.
|
|
19
|
+
validateJsonWith(v.looseObject({ didDoc: defs.didDocument })),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
export interface XrpcDidDocumentResolverOptions {
|
package/lib/did/utils.ts
CHANGED
|
@@ -4,5 +4,5 @@ import { isResponseOk, parseResponseAsJson, pipe, validateJsonWith } from '@atcu
|
|
|
4
4
|
export const fetchDocHandler = pipe(
|
|
5
5
|
isResponseOk,
|
|
6
6
|
parseResponseAsJson(/^application\/(did\+ld\+)?json$/, 20 * 1024),
|
|
7
|
-
validateJsonWith(defs.didDocument
|
|
7
|
+
validateJsonWith(defs.didDocument),
|
|
8
8
|
);
|
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
validateJsonWith,
|
|
9
9
|
} from '@atcute/util-fetch';
|
|
10
10
|
|
|
11
|
-
import * as v from '
|
|
11
|
+
import * as v from 'valibot';
|
|
12
12
|
|
|
13
13
|
import * as err from '../../errors.ts';
|
|
14
14
|
import type { HandleResolver, ResolveHandleOptions } from '../../types.ts';
|
|
15
15
|
|
|
16
|
-
const response = v.
|
|
17
|
-
did: v.
|
|
16
|
+
const response = v.looseObject({
|
|
17
|
+
did: v.custom<AtprotoDid>(isAtprotoDid),
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const fetchXrpcHandler = pipe(
|
|
21
21
|
isResponseOk,
|
|
22
22
|
parseResponseAsJson(/^application\/json$/, 4 * 1024),
|
|
23
|
-
validateJsonWith(response
|
|
23
|
+
validateJsonWith(response),
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
export interface XrpcHandleResolverOptions {
|
|
@@ -38,7 +38,7 @@ export class XrpcHandleResolver implements HandleResolver {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
async resolve(handle: Handle, options?: ResolveHandleOptions): Promise<AtprotoDid> {
|
|
41
|
-
let json: v.
|
|
41
|
+
let json: v.InferOutput<typeof response>;
|
|
42
42
|
|
|
43
43
|
try {
|
|
44
44
|
const url = new URL(`/xrpc/com.atproto.identity.resolveHandle`, this.serviceUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atcute/identity-resolver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "atproto handle and DID document resolution",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atproto",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"@atcute/lexicons": "^
|
|
32
|
-
"@atcute/util-fetch": "^
|
|
30
|
+
"valibot": "^1.4.0",
|
|
31
|
+
"@atcute/lexicons": "^2.0.0",
|
|
32
|
+
"@atcute/util-fetch": "^2.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@vitest/coverage-v8": "^4.1.5",
|
|
36
36
|
"vitest": "^4.1.5",
|
|
37
|
-
"@atcute/identity": "^
|
|
37
|
+
"@atcute/identity": "^2.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@atcute/identity": "^
|
|
41
|
-
"@atcute/lexicons": "^
|
|
40
|
+
"@atcute/identity": "^2.0.0",
|
|
41
|
+
"@atcute/lexicons": "^2.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsgo",
|