@atproto/did 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 ADDED
@@ -0,0 +1,7 @@
1
+ # @atproto/did
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
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,335 @@
1
+ import { z } from 'zod';
2
+ import { Did } from './did.js';
3
+ /**
4
+ * Each service map MUST contain id, type, and serviceEndpoint properties.
5
+ * @see {@link https://www.w3.org/TR/did-core/#services}
6
+ */
7
+ declare const didServiceSchema: z.ZodObject<{
8
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
9
+ type: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
10
+ serviceEndpoint: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>]>, "atleastone">]>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ type: string | string[];
13
+ id: string;
14
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
15
+ }, {
16
+ type: string | string[];
17
+ id: string;
18
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
19
+ }>;
20
+ export type DidService = z.infer<typeof didServiceSchema>;
21
+ /**
22
+ * @note This schema is incomplete
23
+ * @see {@link https://www.w3.org/TR/did-core/#production-0}
24
+ */
25
+ export declare const didDocumentSchema: z.ZodObject<{
26
+ '@context': z.ZodUnion<[z.ZodLiteral<"https://www.w3.org/ns/did/v1">, z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>]>;
27
+ id: z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>;
28
+ controller: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, z.ZodArray<z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, "many">]>>;
29
+ alsoKnownAs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
30
+ service: z.ZodOptional<z.ZodArray<z.ZodObject<{
31
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
32
+ type: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
33
+ serviceEndpoint: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>]>, "atleastone">]>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ type: string | string[];
36
+ id: string;
37
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
38
+ }, {
39
+ type: string | string[];
40
+ id: string;
41
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
42
+ }>, "many">>;
43
+ authentication: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>, z.ZodObject<{
44
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
45
+ type: z.ZodString;
46
+ controller: z.ZodUnion<[z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, z.ZodArray<z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, "many">]>;
47
+ publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
48
+ publicKeyMultibase: z.ZodOptional<z.ZodString>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ type: string;
51
+ id: string;
52
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
53
+ publicKeyJwk?: Record<string, unknown> | undefined;
54
+ publicKeyMultibase?: string | undefined;
55
+ }, {
56
+ type: string;
57
+ id: string;
58
+ controller: string | string[];
59
+ publicKeyJwk?: Record<string, unknown> | undefined;
60
+ publicKeyMultibase?: string | undefined;
61
+ }>]>, "many">>;
62
+ verificationMethod: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
63
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
64
+ type: z.ZodString;
65
+ controller: z.ZodUnion<[z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, z.ZodArray<z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, "many">]>;
66
+ publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
67
+ publicKeyMultibase: z.ZodOptional<z.ZodString>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ type: string;
70
+ id: string;
71
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
72
+ publicKeyJwk?: Record<string, unknown> | undefined;
73
+ publicKeyMultibase?: string | undefined;
74
+ }, {
75
+ type: string;
76
+ id: string;
77
+ controller: string | string[];
78
+ publicKeyJwk?: Record<string, unknown> | undefined;
79
+ publicKeyMultibase?: string | undefined;
80
+ }>, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>]>, "many">>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ id: `did:${string}:${string}`;
83
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
84
+ controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
85
+ alsoKnownAs?: string[] | undefined;
86
+ service?: {
87
+ type: string | string[];
88
+ id: string;
89
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
90
+ }[] | undefined;
91
+ authentication?: (string | {
92
+ type: string;
93
+ id: string;
94
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
95
+ publicKeyJwk?: Record<string, unknown> | undefined;
96
+ publicKeyMultibase?: string | undefined;
97
+ })[] | undefined;
98
+ verificationMethod?: (string | {
99
+ type: string;
100
+ id: string;
101
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
102
+ publicKeyJwk?: Record<string, unknown> | undefined;
103
+ publicKeyMultibase?: string | undefined;
104
+ })[] | undefined;
105
+ }, {
106
+ id: string;
107
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
108
+ controller?: string | string[] | undefined;
109
+ alsoKnownAs?: string[] | undefined;
110
+ service?: {
111
+ type: string | string[];
112
+ id: string;
113
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
114
+ }[] | undefined;
115
+ authentication?: (string | {
116
+ type: string;
117
+ id: string;
118
+ controller: string | string[];
119
+ publicKeyJwk?: Record<string, unknown> | undefined;
120
+ publicKeyMultibase?: string | undefined;
121
+ })[] | undefined;
122
+ verificationMethod?: (string | {
123
+ type: string;
124
+ id: string;
125
+ controller: string | string[];
126
+ publicKeyJwk?: Record<string, unknown> | undefined;
127
+ publicKeyMultibase?: string | undefined;
128
+ })[] | undefined;
129
+ }>;
130
+ export type DidDocument<Method extends string = string> = z.infer<typeof didDocumentSchema> & {
131
+ id: Did<Method>;
132
+ };
133
+ export declare const didDocumentValidator: z.ZodEffects<z.ZodEffects<z.ZodObject<{
134
+ '@context': z.ZodUnion<[z.ZodLiteral<"https://www.w3.org/ns/did/v1">, z.ZodEffects<z.ZodArray<z.ZodString, "atleastone">, [string, ...string[]], [string, ...string[]]>]>;
135
+ id: z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>;
136
+ controller: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, z.ZodArray<z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, "many">]>>;
137
+ alsoKnownAs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
138
+ service: z.ZodOptional<z.ZodArray<z.ZodObject<{
139
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
140
+ type: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
141
+ serviceEndpoint: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodString, string, string>>]>, "atleastone">]>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ type: string | string[];
144
+ id: string;
145
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
146
+ }, {
147
+ type: string | string[];
148
+ id: string;
149
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
150
+ }>, "many">>;
151
+ authentication: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>, z.ZodObject<{
152
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
153
+ type: z.ZodString;
154
+ controller: z.ZodUnion<[z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, z.ZodArray<z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, "many">]>;
155
+ publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
156
+ publicKeyMultibase: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ type: string;
159
+ id: string;
160
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
161
+ publicKeyJwk?: Record<string, unknown> | undefined;
162
+ publicKeyMultibase?: string | undefined;
163
+ }, {
164
+ type: string;
165
+ id: string;
166
+ controller: string | string[];
167
+ publicKeyJwk?: Record<string, unknown> | undefined;
168
+ publicKeyMultibase?: string | undefined;
169
+ }>]>, "many">>;
170
+ verificationMethod: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
171
+ id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
172
+ type: z.ZodString;
173
+ controller: z.ZodUnion<[z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, z.ZodArray<z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>, "many">]>;
174
+ publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
175
+ publicKeyMultibase: z.ZodOptional<z.ZodString>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ type: string;
178
+ id: string;
179
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
180
+ publicKeyJwk?: Record<string, unknown> | undefined;
181
+ publicKeyMultibase?: string | undefined;
182
+ }, {
183
+ type: string;
184
+ id: string;
185
+ controller: string | string[];
186
+ publicKeyJwk?: Record<string, unknown> | undefined;
187
+ publicKeyMultibase?: string | undefined;
188
+ }>, z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>]>, "many">>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ id: `did:${string}:${string}`;
191
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
192
+ controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
193
+ alsoKnownAs?: string[] | undefined;
194
+ service?: {
195
+ type: string | string[];
196
+ id: string;
197
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
198
+ }[] | undefined;
199
+ authentication?: (string | {
200
+ type: string;
201
+ id: string;
202
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
203
+ publicKeyJwk?: Record<string, unknown> | undefined;
204
+ publicKeyMultibase?: string | undefined;
205
+ })[] | undefined;
206
+ verificationMethod?: (string | {
207
+ type: string;
208
+ id: string;
209
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
210
+ publicKeyJwk?: Record<string, unknown> | undefined;
211
+ publicKeyMultibase?: string | undefined;
212
+ })[] | undefined;
213
+ }, {
214
+ id: string;
215
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
216
+ controller?: string | string[] | undefined;
217
+ alsoKnownAs?: string[] | undefined;
218
+ service?: {
219
+ type: string | string[];
220
+ id: string;
221
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
222
+ }[] | undefined;
223
+ authentication?: (string | {
224
+ type: string;
225
+ id: string;
226
+ controller: string | string[];
227
+ publicKeyJwk?: Record<string, unknown> | undefined;
228
+ publicKeyMultibase?: string | undefined;
229
+ })[] | undefined;
230
+ verificationMethod?: (string | {
231
+ type: string;
232
+ id: string;
233
+ controller: string | string[];
234
+ publicKeyJwk?: Record<string, unknown> | undefined;
235
+ publicKeyMultibase?: string | undefined;
236
+ })[] | undefined;
237
+ }>, {
238
+ id: `did:${string}:${string}`;
239
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
240
+ controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
241
+ alsoKnownAs?: string[] | undefined;
242
+ service?: {
243
+ type: string | string[];
244
+ id: string;
245
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
246
+ }[] | undefined;
247
+ authentication?: (string | {
248
+ type: string;
249
+ id: string;
250
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
251
+ publicKeyJwk?: Record<string, unknown> | undefined;
252
+ publicKeyMultibase?: string | undefined;
253
+ })[] | undefined;
254
+ verificationMethod?: (string | {
255
+ type: string;
256
+ id: string;
257
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
258
+ publicKeyJwk?: Record<string, unknown> | undefined;
259
+ publicKeyMultibase?: string | undefined;
260
+ })[] | undefined;
261
+ }, {
262
+ id: string;
263
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
264
+ controller?: string | string[] | undefined;
265
+ alsoKnownAs?: string[] | undefined;
266
+ service?: {
267
+ type: string | string[];
268
+ id: string;
269
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
270
+ }[] | undefined;
271
+ authentication?: (string | {
272
+ type: string;
273
+ id: string;
274
+ controller: string | string[];
275
+ publicKeyJwk?: Record<string, unknown> | undefined;
276
+ publicKeyMultibase?: string | undefined;
277
+ })[] | undefined;
278
+ verificationMethod?: (string | {
279
+ type: string;
280
+ id: string;
281
+ controller: string | string[];
282
+ publicKeyJwk?: Record<string, unknown> | undefined;
283
+ publicKeyMultibase?: string | undefined;
284
+ })[] | undefined;
285
+ }>, {
286
+ id: `did:${string}:${string}`;
287
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
288
+ controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
289
+ alsoKnownAs?: string[] | undefined;
290
+ service?: {
291
+ type: string | string[];
292
+ id: string;
293
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
294
+ }[] | undefined;
295
+ authentication?: (string | {
296
+ type: string;
297
+ id: string;
298
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
299
+ publicKeyJwk?: Record<string, unknown> | undefined;
300
+ publicKeyMultibase?: string | undefined;
301
+ })[] | undefined;
302
+ verificationMethod?: (string | {
303
+ type: string;
304
+ id: string;
305
+ controller: `did:${string}:${string}` | `did:${string}:${string}`[];
306
+ publicKeyJwk?: Record<string, unknown> | undefined;
307
+ publicKeyMultibase?: string | undefined;
308
+ })[] | undefined;
309
+ }, {
310
+ id: string;
311
+ '@context': "https://www.w3.org/ns/did/v1" | [string, ...string[]];
312
+ controller?: string | string[] | undefined;
313
+ alsoKnownAs?: string[] | undefined;
314
+ service?: {
315
+ type: string | string[];
316
+ id: string;
317
+ serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
318
+ }[] | undefined;
319
+ authentication?: (string | {
320
+ type: string;
321
+ id: string;
322
+ controller: string | string[];
323
+ publicKeyJwk?: Record<string, unknown> | undefined;
324
+ publicKeyMultibase?: string | undefined;
325
+ })[] | undefined;
326
+ verificationMethod?: (string | {
327
+ type: string;
328
+ id: string;
329
+ controller: string | string[];
330
+ publicKeyJwk?: Record<string, unknown> | undefined;
331
+ publicKeyMultibase?: string | undefined;
332
+ })[] | undefined;
333
+ }>;
334
+ export {};
335
+ //# sourceMappingURL=did-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-document.d.ts","sourceRoot":"","sources":["../src/did-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,GAAG,EAAa,MAAM,UAAU,CAAA;AAqEzC;;;GAGG;AACH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;EAIpB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAQzD;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB5B,CAAA;AAEF,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC,KAAK,CAC/D,OAAO,iBAAiB,CACzB,GAAG;IAAE,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA;AAGvB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgC7B,CAAA"}
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.didDocumentValidator = exports.didDocumentSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const did_js_1 = require("./did.js");
6
+ /**
7
+ * RFC3968 compliant URI
8
+ *
9
+ * @see {@link https://www.rfc-editor.org/rfc/rfc3986}
10
+ */
11
+ const rfc3968UriSchema = zod_1.z.string().refine((data) => {
12
+ try {
13
+ new URL(data);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }, 'RFC3968 compliant URI');
20
+ const didControllerSchema = zod_1.z.union([did_js_1.didSchema, zod_1.z.array(did_js_1.didSchema)]);
21
+ /**
22
+ * @note this schema might be too permissive
23
+ */
24
+ const didRelativeUriSchema = zod_1.z.union([
25
+ rfc3968UriSchema,
26
+ zod_1.z.string().regex(/^#[^#]+$/),
27
+ ]);
28
+ const didVerificationMethodSchema = zod_1.z.object({
29
+ id: didRelativeUriSchema,
30
+ type: zod_1.z.string().min(1),
31
+ controller: didControllerSchema,
32
+ publicKeyJwk: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
33
+ publicKeyMultibase: zod_1.z.string().optional(),
34
+ });
35
+ /**
36
+ * The value of the id property MUST be a URI conforming to [RFC3986]. A
37
+ * conforming producer MUST NOT produce multiple service entries with the same
38
+ * id. A conforming consumer MUST produce an error if it detects multiple
39
+ * service entries with the same id.
40
+ *
41
+ * @note Normally, only rfc3968UriSchema should be allowed here. However, the
42
+ * did:plc uses relative URI. For this reason, we also allow relative URIs
43
+ * here.
44
+ */
45
+ const didServiceIdSchema = didRelativeUriSchema;
46
+ /**
47
+ * The value of the type property MUST be a string or a set of strings. In order
48
+ * to maximize interoperability, the service type and its associated properties
49
+ * SHOULD be registered in the DID Specification Registries
50
+ * [DID-SPEC-REGISTRIES].
51
+ */
52
+ const didServiceTypeSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]);
53
+ /**
54
+ * The value of the serviceEndpoint property MUST be a string, a map, or a set
55
+ * composed of one or more strings and/or maps. All string values MUST be valid
56
+ * URIs conforming to [RFC3986] and normalized according to the Normalization
57
+ * and Comparison rules in RFC3986 and to any normalization rules in its
58
+ * applicable URI scheme specification.
59
+ */
60
+ const didServiceEndpointSchema = zod_1.z.union([
61
+ rfc3968UriSchema,
62
+ zod_1.z.record(zod_1.z.string(), rfc3968UriSchema),
63
+ zod_1.z
64
+ .array(zod_1.z.union([rfc3968UriSchema, zod_1.z.record(zod_1.z.string(), rfc3968UriSchema)]))
65
+ .nonempty(),
66
+ ]);
67
+ /**
68
+ * Each service map MUST contain id, type, and serviceEndpoint properties.
69
+ * @see {@link https://www.w3.org/TR/did-core/#services}
70
+ */
71
+ const didServiceSchema = zod_1.z.object({
72
+ id: didServiceIdSchema,
73
+ type: didServiceTypeSchema,
74
+ serviceEndpoint: didServiceEndpointSchema,
75
+ });
76
+ const didAuthenticationSchema = zod_1.z.union([
77
+ //
78
+ didRelativeUriSchema,
79
+ didVerificationMethodSchema,
80
+ ]);
81
+ /**
82
+ * @note This schema is incomplete
83
+ * @see {@link https://www.w3.org/TR/did-core/#production-0}
84
+ */
85
+ exports.didDocumentSchema = zod_1.z.object({
86
+ '@context': zod_1.z.union([
87
+ zod_1.z.literal('https://www.w3.org/ns/did/v1'),
88
+ zod_1.z
89
+ .array(zod_1.z.string().url())
90
+ .nonempty()
91
+ .refine((data) => data[0] === 'https://www.w3.org/ns/did/v1', {
92
+ message: 'First @context must be https://www.w3.org/ns/did/v1',
93
+ }),
94
+ ]),
95
+ id: did_js_1.didSchema,
96
+ controller: didControllerSchema.optional(),
97
+ alsoKnownAs: zod_1.z.array(rfc3968UriSchema).optional(),
98
+ service: zod_1.z.array(didServiceSchema).optional(),
99
+ authentication: zod_1.z.array(didAuthenticationSchema).optional(),
100
+ verificationMethod: zod_1.z
101
+ .array(zod_1.z.union([didVerificationMethodSchema, didRelativeUriSchema]))
102
+ .optional(),
103
+ });
104
+ // @TODO: add other refinements ?
105
+ exports.didDocumentValidator = exports.didDocumentSchema
106
+ .superRefine((data, ctx) => {
107
+ if (data.service) {
108
+ for (let i = 0; i < data.service.length; i++) {
109
+ if (data.service[i].id === data.id) {
110
+ ctx.addIssue({
111
+ code: zod_1.z.ZodIssueCode.custom,
112
+ message: `Service id must be different from the document id`,
113
+ path: ['service', i, 'id'],
114
+ });
115
+ }
116
+ }
117
+ }
118
+ })
119
+ .superRefine((data, ctx) => {
120
+ if (data.service) {
121
+ const normalizedIds = data.service.map((s) => s.id?.startsWith('#') ? `${data.id}${s.id}` : s.id);
122
+ for (let i = 0; i < normalizedIds.length; i++) {
123
+ for (let j = i + 1; j < normalizedIds.length; j++) {
124
+ if (normalizedIds[i] === normalizedIds[j]) {
125
+ ctx.addIssue({
126
+ code: zod_1.z.ZodIssueCode.custom,
127
+ message: `Duplicate service id (${normalizedIds[j]}) found in the document`,
128
+ path: ['service', j, 'id'],
129
+ });
130
+ }
131
+ }
132
+ }
133
+ }
134
+ });
135
+ //# sourceMappingURL=did-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-document.js","sourceRoot":"","sources":["../src/did-document.ts"],"names":[],"mappings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AC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClD,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC1C,GAAG,CAAC,QAAQ,CAAC;wBACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;wBAC3B,OAAO,EAAE,yBAAyB,aAAa,CAAC,CAAC,CAAC,yBAAyB;wBAC3E,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC;qBAC3B,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ export declare class DidError extends Error {
2
+ readonly did: string;
3
+ readonly code: string;
4
+ readonly status: number;
5
+ constructor(did: string, message: string, code: string, status?: number, cause?: unknown);
6
+ /**
7
+ * For compatibility with error handlers in common HTTP frameworks.
8
+ */
9
+ get statusCode(): number;
10
+ toString(): string;
11
+ static from(cause: unknown, did: string): DidError;
12
+ }
13
+ export declare class InvalidDidError extends DidError {
14
+ constructor(did: string, message: string, cause?: unknown);
15
+ }
16
+ //# sourceMappingURL=did-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-error.d.ts","sourceRoot":"","sources":["../src/did-error.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;aAEf,GAAG,EAAE,MAAM;aAEX,IAAI,EAAE,MAAM;aACZ,MAAM;gBAHN,GAAG,EAAE,MAAM,EAC3B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,MAAM,SAAM,EAC5B,KAAK,CAAC,EAAE,OAAO;IAKjB;;OAEG;IACH,IAAI,UAAU,WAEb;IAEQ,QAAQ;IAIjB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ;CAoBnD;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAG1D"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidDidError = exports.DidError = void 0;
4
+ class DidError extends Error {
5
+ constructor(did, message, code, status = 400, cause) {
6
+ super(message, { cause });
7
+ Object.defineProperty(this, "did", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: did
12
+ });
13
+ Object.defineProperty(this, "code", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: code
18
+ });
19
+ Object.defineProperty(this, "status", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: status
24
+ });
25
+ }
26
+ /**
27
+ * For compatibility with error handlers in common HTTP frameworks.
28
+ */
29
+ get statusCode() {
30
+ return this.status;
31
+ }
32
+ toString() {
33
+ return `${this.constructor.name} ${this.code} (${this.did}): ${this.message}`;
34
+ }
35
+ static from(cause, did) {
36
+ if (cause instanceof DidError) {
37
+ return cause;
38
+ }
39
+ const message = cause instanceof Error
40
+ ? cause.message
41
+ : typeof cause === 'string'
42
+ ? cause
43
+ : 'An unknown error occurred';
44
+ const status = (typeof cause?.['statusCode'] === 'number'
45
+ ? cause['statusCode']
46
+ : undefined) ??
47
+ (typeof cause?.['status'] === 'number' ? cause['status'] : undefined);
48
+ return new DidError(did, message, 'did-unknown-error', status, cause);
49
+ }
50
+ }
51
+ exports.DidError = DidError;
52
+ class InvalidDidError extends DidError {
53
+ constructor(did, message, cause) {
54
+ super(did, message, 'did-invalid', 400, cause);
55
+ }
56
+ }
57
+ exports.InvalidDidError = InvalidDidError;
58
+ //# sourceMappingURL=did-error.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EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IACvE,CAAC;CACF;AA1CD,4BA0CC;AAED,MAAa,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,GAAW,EAAE,OAAe,EAAE,KAAe;QACvD,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF;AAJD,0CAIC"}
package/dist/did.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ declare const DID_PREFIX = "did:";
3
+ export { DID_PREFIX };
4
+ /**
5
+ * Type representation of a Did, with method.
6
+ *
7
+ * ```bnf
8
+ * did = "did:" method-name ":" method-specific-id
9
+ * method-name = 1*method-char
10
+ * method-char = %x61-7A / DIGIT
11
+ * method-specific-id = *( *idchar ":" ) 1*idchar
12
+ * idchar = ALPHA / DIGIT / "." / "-" / "_" / pct-encoded
13
+ * pct-encoded = "%" HEXDIG HEXDIG
14
+ * ```
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * type DidWeb = Did<'web'> // `did:web:${string}`
19
+ * type DidCustom = Did<'web' | 'plc'> // `did:${'web' | 'plc'}:${string}`
20
+ * type DidNever = Did<' invalid 🥴 '> // never
21
+ * type DidFoo = Did<'foo' | ' invalid 🥴 '> // `did:foo:${string}`
22
+ * ```
23
+ *
24
+ * @see {@link https://www.w3.org/TR/did-core/#did-syntax}
25
+ */
26
+ export type Did<M extends string = string> = `did:${AsDidMethod<M>}:${string}`;
27
+ /**
28
+ * DID Method
29
+ */
30
+ export type AsDidMethod<M> = string extends M ? string : AsDidMethodInternal<M, ''>;
31
+ type AlphanumericChar = DigitChar | LowerAlphaChar;
32
+ type DigitChar = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
33
+ type LowerAlphaChar = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
34
+ type AsDidMethodInternal<S, Acc extends string> = S extends `${infer H}${infer T}` ? H extends AlphanumericChar ? AsDidMethodInternal<T, `${Acc}${H}`> : never : Acc extends '' ? never : Acc;
35
+ /**
36
+ * DID Method-name check function.
37
+ *
38
+ * Check if the input is a valid DID method name, at the position between
39
+ * `start` (inclusive) and `end` (exclusive).
40
+ */
41
+ export declare function checkDidMethod(input: string, start?: number, end?: number): void;
42
+ /**
43
+ * This method assumes the input is a valid Did
44
+ */
45
+ export declare function extractDidMethod<D extends Did>(did: D): D extends `did:${AsDidMethod<infer M extends string>}:${string}` ? M : string;
46
+ /**
47
+ * DID Method-specific identifier check function.
48
+ *
49
+ * Check if the input is a valid DID method-specific identifier, at the position
50
+ * between `start` (inclusive) and `end` (exclusive).
51
+ */
52
+ export declare function checkDidMsid(input: string, start?: number, end?: number): void;
53
+ export declare function checkDid(input: unknown): asserts input is Did;
54
+ export declare function isDid(input: unknown): input is Did;
55
+ export declare const didSchema: z.ZodEffects<z.ZodString, `did:${string}:${string}`, string>;
56
+ //# sourceMappingURL=did.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did.d.ts","sourceRoot":"","sources":["../src/did.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,QAAA,MAAM,UAAU,SAAS,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAA;AAE9E;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,MAAM,SAAS,CAAC,GACzC,MAAM,GACN,mBAAmB,CAAC,CAAC,EAAE,EAAE,CAA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