@cef-ebsi/ebsi-uri 0.1.0-alpha.1 → 0.1.1-alpha.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/index.d.ts +16 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +102 -97
- package/dist/constants.d.ts +0 -19
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -20
- package/dist/constants.js.map +0 -1
- package/dist/errors.d.ts +0 -30
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -34
- package/dist/errors.js.map +0 -1
- package/dist/resolver.d.ts +0 -6
- package/dist/resolver.d.ts.map +0 -1
- package/dist/resolver.js +0 -34
- package/dist/resolver.js.map +0 -1
- package/dist/resolvers/v1.d.ts +0 -3
- package/dist/resolvers/v1.d.ts.map +0 -1
- package/dist/resolvers/v1.js +0 -109
- package/dist/resolvers/v1.js.map +0 -1
- package/dist/util.d.ts +0 -3
- package/dist/util.d.ts.map +0 -1
- package/dist/util.js +0 -13
- package/dist/util.js.map +0 -1
- package/dist/validator.d.ts +0 -2
- package/dist/validator.d.ts.map +0 -1
- package/dist/validator.js +0 -35
- package/dist/validator.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,30 +2,32 @@ export declare const SCHEME = "ebsi";
|
|
|
2
2
|
export declare const PRODUCTION_NETWORK = "production";
|
|
3
3
|
export declare const NETWORKS: readonly ["production", "preprod", "conformance", "pilot", "test"];
|
|
4
4
|
export declare const HOSTS: {
|
|
5
|
-
readonly test: "api-test.ebsi.eu";
|
|
6
|
-
readonly pilot: "api-pilot.ebsi.";
|
|
7
5
|
readonly conformance: "api-conformance.ebsi.eu";
|
|
6
|
+
readonly pilot: "api-pilot.ebsi.";
|
|
8
7
|
readonly preprod: "api-preprod.ebsi.";
|
|
9
8
|
readonly production: "api.ebsi.";
|
|
9
|
+
readonly test: "api-test.ebsi.eu";
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export type EBSIURIComponents = {
|
|
11
|
+
export interface EBSIURIComponents {
|
|
13
12
|
network?: Network;
|
|
14
|
-
service?: string;
|
|
15
13
|
resource?: string;
|
|
16
|
-
|
|
14
|
+
service?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IFromUrlOptions {
|
|
17
|
+
services?: SupportedServices;
|
|
18
|
+
}
|
|
19
|
+
export interface IToUrlOptions {
|
|
20
|
+
readonly hosts: Partial<Record<Network, string>>;
|
|
21
|
+
readonly services: SupportedServices;
|
|
22
|
+
}
|
|
23
|
+
export type Network = (typeof NETWORKS)[number];
|
|
17
24
|
export type SupportedServices = Record<string, string>;
|
|
25
|
+
export declare function fromUrl(url: string, options?: IFromUrlOptions): string;
|
|
18
26
|
export declare function parse(uriString: string): {
|
|
19
27
|
network: "production" | "preprod" | "conformance" | "pilot" | "test";
|
|
20
|
-
service: string;
|
|
21
28
|
resource: string;
|
|
29
|
+
service: string;
|
|
22
30
|
};
|
|
23
31
|
export declare function serialize(components: EBSIURIComponents): string;
|
|
24
|
-
export declare function toUrl(uriString: string, options:
|
|
25
|
-
readonly services: SupportedServices;
|
|
26
|
-
readonly hosts: Partial<Record<Network, string>>;
|
|
27
|
-
}): string;
|
|
28
|
-
export declare function fromUrl(url: string, options?: {
|
|
29
|
-
services?: SupportedServices;
|
|
30
|
-
}): string;
|
|
32
|
+
export declare function toUrl(uriString: string, options: IToUrlOptions): string;
|
|
31
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAE/C,eAAO,MAAM,QAAQ,oEAMX,CAAC;AAEX,eAAO,MAAM,KAAK;;;;;;CAM0B,CAAC;AAE7C,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAE/C,eAAO,MAAM,QAAQ,oEAMX,CAAC;AAEX,eAAO,MAAM,KAAK;;;;;;CAM0B,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,eAAe;IAI9B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAGD,MAAM,WAAW,aAAa;IAI5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAKjD,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAavD,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,UAsD7D;AAmBD,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM;;;;EAgCtC;AAgBD,wBAAgB,SAAS,CAAC,UAAU,EAAE,iBAAiB,UAOtD;AAgBD,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAmBvE"}
|
package/dist/index.js
CHANGED
|
@@ -8,14 +8,49 @@ export const NETWORKS = [
|
|
|
8
8
|
"test",
|
|
9
9
|
];
|
|
10
10
|
export const HOSTS = {
|
|
11
|
-
test: "api-test.ebsi.eu",
|
|
12
|
-
pilot: "api-pilot.ebsi.",
|
|
13
11
|
conformance: "api-conformance.ebsi.eu",
|
|
12
|
+
pilot: "api-pilot.ebsi.",
|
|
14
13
|
preprod: "api-preprod.ebsi.",
|
|
15
14
|
production: "api.ebsi.",
|
|
15
|
+
test: "api-test.ebsi.eu",
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
export function fromUrl(url, options) {
|
|
18
|
+
let urlObject;
|
|
19
|
+
try {
|
|
20
|
+
urlObject = new URL(url);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
throw new Error("Invalid URL");
|
|
24
|
+
}
|
|
25
|
+
const { hash, host, pathname, search } = urlObject;
|
|
26
|
+
const network = Object.keys(HOSTS).find((n) => host.includes(HOSTS[n]));
|
|
27
|
+
if (!network) {
|
|
28
|
+
throw new Error(`No network configured for host ${host}`);
|
|
29
|
+
}
|
|
30
|
+
const [service, serviceVersion, ...rest] = pathname
|
|
31
|
+
.split("/")
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
const resource = rest.join("/");
|
|
34
|
+
if (!service) {
|
|
35
|
+
throw new Error(`No service found in EBSI URI ${url}`);
|
|
36
|
+
}
|
|
37
|
+
if (!serviceVersion) {
|
|
38
|
+
throw new Error(`No service version found in EBSI URI ${url}`);
|
|
39
|
+
}
|
|
40
|
+
if (options?.services) {
|
|
41
|
+
const supportedServiceVersion = options.services[service];
|
|
42
|
+
if (!supportedServiceVersion) {
|
|
43
|
+
throw new Error(`Unsupported service '${service}'`);
|
|
44
|
+
}
|
|
45
|
+
if (serviceVersion !== supportedServiceVersion) {
|
|
46
|
+
throw new Error(`Unsupported version '${serviceVersion}' of service '${service}'`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return serialize({
|
|
50
|
+
network,
|
|
51
|
+
resource: `/${resource}${search}${hash}`,
|
|
52
|
+
service,
|
|
53
|
+
});
|
|
19
54
|
}
|
|
20
55
|
export function parse(uriString) {
|
|
21
56
|
const [scheme, firstComponent, secondComponent, ...rest] = uriString.split(":");
|
|
@@ -35,17 +70,17 @@ export function parse(uriString) {
|
|
|
35
70
|
}
|
|
36
71
|
return {
|
|
37
72
|
network,
|
|
38
|
-
service,
|
|
39
73
|
resource,
|
|
74
|
+
service,
|
|
40
75
|
};
|
|
41
76
|
}
|
|
42
77
|
export function serialize(components) {
|
|
43
|
-
const { network,
|
|
78
|
+
const { network, resource, service } = components;
|
|
44
79
|
const networkName = network === PRODUCTION_NETWORK ? "" : `${network}:`;
|
|
45
80
|
return `${SCHEME}:${networkName}${service}:${resource}`;
|
|
46
81
|
}
|
|
47
82
|
export function toUrl(uriString, options) {
|
|
48
|
-
const { network,
|
|
83
|
+
const { network, resource, service } = parse(uriString);
|
|
49
84
|
const host = options.hosts[network];
|
|
50
85
|
if (!host) {
|
|
51
86
|
throw new Error(`No host for network ${network}`);
|
|
@@ -56,42 +91,7 @@ export function toUrl(uriString, options) {
|
|
|
56
91
|
}
|
|
57
92
|
return `https://${host}/${service}/${serviceVersion}${resource}`;
|
|
58
93
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
urlObject = new URL(url);
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
throw new Error("Invalid URL");
|
|
66
|
-
}
|
|
67
|
-
const { host, pathname, search, hash } = urlObject;
|
|
68
|
-
const network = Object.keys(HOSTS).find((n) => host.includes(HOSTS[n]));
|
|
69
|
-
if (!network) {
|
|
70
|
-
throw new Error(`No network configured for host ${host}`);
|
|
71
|
-
}
|
|
72
|
-
const [service, serviceVersion, ...rest] = pathname
|
|
73
|
-
.split("/")
|
|
74
|
-
.filter(Boolean);
|
|
75
|
-
const resource = rest.join("/");
|
|
76
|
-
if (!service) {
|
|
77
|
-
throw new Error(`No service found in EBSI URI ${url}`);
|
|
78
|
-
}
|
|
79
|
-
if (!serviceVersion) {
|
|
80
|
-
throw new Error(`No service version found in EBSI URI ${url}`);
|
|
81
|
-
}
|
|
82
|
-
if (options?.services) {
|
|
83
|
-
const supportedServiceVersion = options.services[service];
|
|
84
|
-
if (!supportedServiceVersion) {
|
|
85
|
-
throw new Error(`Unsupported service '${service}'`);
|
|
86
|
-
}
|
|
87
|
-
if (serviceVersion !== supportedServiceVersion) {
|
|
88
|
-
throw new Error(`Unsupported version '${serviceVersion}' of service '${service}'`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return serialize({
|
|
92
|
-
network,
|
|
93
|
-
service,
|
|
94
|
-
resource: `/${resource}${search}${hash}`,
|
|
95
|
-
});
|
|
94
|
+
function isNetwork(network) {
|
|
95
|
+
return network !== undefined && NETWORKS.includes(network);
|
|
96
96
|
}
|
|
97
97
|
//# 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,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,kBAAkB;IAClB,SAAS;IACT,aAAa;IACb,OAAO;IACP,MAAM;CACE,CAAC;AAEX,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,kBAAkB;IAClB,SAAS;IACT,aAAa;IACb,OAAO;IACP,MAAM;CACE,CAAC;AAEX,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,WAAW,EAAE,yBAAyB;IACtC,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,mBAAmB;IAC5B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i/ebsi-uri",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-alpha.0",
|
|
4
4
|
"description": "EBSI URIs parser and serializer",
|
|
5
5
|
"license": "EUPL-1.2",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"test:e2e": "echo \"Info: there's no e2e tests for @cef-ebsi/ebsi-uri\" && exit 0",
|
|
31
31
|
"test:ci": "yarn test:unit --coverage --reporter=default"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "4900bd20f6d6ee78709b0f7f04a5f4e4f11e0b67"
|
|
34
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,25 +11,109 @@ export const NETWORKS = [
|
|
|
11
11
|
] as const;
|
|
12
12
|
|
|
13
13
|
export const HOSTS = {
|
|
14
|
-
test: "api-test.ebsi.eu",
|
|
15
|
-
pilot: "api-pilot.ebsi.",
|
|
16
14
|
conformance: "api-conformance.ebsi.eu",
|
|
15
|
+
pilot: "api-pilot.ebsi.",
|
|
17
16
|
preprod: "api-preprod.ebsi.",
|
|
18
17
|
production: "api.ebsi.",
|
|
18
|
+
test: "api-test.ebsi.eu",
|
|
19
19
|
} as const satisfies Record<Network, string>;
|
|
20
20
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
export type EBSIURIComponents = {
|
|
21
|
+
export interface EBSIURIComponents {
|
|
24
22
|
network?: Network;
|
|
25
|
-
service?: string;
|
|
26
23
|
resource?: string;
|
|
27
|
-
|
|
24
|
+
service?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Options for the `fromUrl()` function */
|
|
28
|
+
export interface IFromUrlOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Map of supported services and their versions
|
|
31
|
+
*/
|
|
32
|
+
services?: SupportedServices;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Options for the `toUrl()` function */
|
|
36
|
+
export interface IToUrlOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Map of supported networks and their hosts
|
|
39
|
+
*/
|
|
40
|
+
readonly hosts: Partial<Record<Network, string>>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Map of supported services and their versions
|
|
44
|
+
*/
|
|
45
|
+
readonly services: SupportedServices;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type Network = (typeof NETWORKS)[number];
|
|
28
49
|
|
|
29
50
|
export type SupportedServices = Record<string, string>;
|
|
30
51
|
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Transform a URL into an EBSI URI.
|
|
54
|
+
* @example
|
|
55
|
+
* ```js
|
|
56
|
+
* fromUrl("https://api-test.ebsi.eu/did-registry/v4/identifiers/did:ebsi:zx23VhpbGYeqF2MRJk3HzPw")
|
|
57
|
+
* ```
|
|
58
|
+
* returns `ebsi:test:did-registry:/identifiers/did:ebsi:zx23VhpbGYeqF2MRJk3HzPw`
|
|
59
|
+
* @param url - URL to transform
|
|
60
|
+
* @param options - Supported services
|
|
61
|
+
* @returns EBSI URI
|
|
62
|
+
*/
|
|
63
|
+
export function fromUrl(url: string, options?: IFromUrlOptions) {
|
|
64
|
+
// Parse URL
|
|
65
|
+
let urlObject: URL;
|
|
66
|
+
try {
|
|
67
|
+
urlObject = new URL(url);
|
|
68
|
+
} catch {
|
|
69
|
+
throw new Error("Invalid URL");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const { hash, host, pathname, search } = urlObject;
|
|
73
|
+
|
|
74
|
+
// Identify network
|
|
75
|
+
const network = (Object.keys(HOSTS) as (keyof typeof HOSTS)[]).find((n) =>
|
|
76
|
+
host.includes(HOSTS[n]),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if (!network) {
|
|
80
|
+
throw new Error(`No network configured for host ${host}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Extract service and resource from pathname: /<service>/<serviceVersion>/<resource>
|
|
84
|
+
const [service, serviceVersion, ...rest] = pathname
|
|
85
|
+
.split("/")
|
|
86
|
+
.filter(Boolean); // Remove empty path segments
|
|
87
|
+
const resource = rest.join("/");
|
|
88
|
+
|
|
89
|
+
if (!service) {
|
|
90
|
+
throw new Error(`No service found in EBSI URI ${url}`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!serviceVersion) {
|
|
94
|
+
throw new Error(`No service version found in EBSI URI ${url}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Check if the service and its version are supported
|
|
98
|
+
if (options?.services) {
|
|
99
|
+
const supportedServiceVersion = options.services[service];
|
|
100
|
+
|
|
101
|
+
if (!supportedServiceVersion) {
|
|
102
|
+
throw new Error(`Unsupported service '${service}'`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (serviceVersion !== supportedServiceVersion) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Unsupported version '${serviceVersion}' of service '${service}'`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return serialize({
|
|
113
|
+
network,
|
|
114
|
+
resource: `/${resource}${search}${hash}`,
|
|
115
|
+
service,
|
|
116
|
+
});
|
|
33
117
|
}
|
|
34
118
|
|
|
35
119
|
/**
|
|
@@ -78,8 +162,8 @@ export function parse(uriString: string) {
|
|
|
78
162
|
// Return EBSI URI components
|
|
79
163
|
return {
|
|
80
164
|
network,
|
|
81
|
-
service,
|
|
82
165
|
resource,
|
|
166
|
+
service,
|
|
83
167
|
} satisfies EBSIURIComponents;
|
|
84
168
|
}
|
|
85
169
|
|
|
@@ -98,7 +182,7 @@ export function parse(uriString: string) {
|
|
|
98
182
|
* @returns EBSI URI
|
|
99
183
|
*/
|
|
100
184
|
export function serialize(components: EBSIURIComponents) {
|
|
101
|
-
const { network,
|
|
185
|
+
const { network, resource, service } = components;
|
|
102
186
|
|
|
103
187
|
const networkName = network === PRODUCTION_NETWORK ? "" : `${network}:`;
|
|
104
188
|
|
|
@@ -120,21 +204,8 @@ export function serialize(components: EBSIURIComponents) {
|
|
|
120
204
|
* @param options - Supported services and hosts
|
|
121
205
|
* @returns URL
|
|
122
206
|
*/
|
|
123
|
-
export function toUrl(
|
|
124
|
-
|
|
125
|
-
options: {
|
|
126
|
-
/**
|
|
127
|
-
* Map of supported services and their versions
|
|
128
|
-
*/
|
|
129
|
-
readonly services: SupportedServices;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Map of supported networks and their hosts
|
|
133
|
-
*/
|
|
134
|
-
readonly hosts: Partial<Record<Network, string>>;
|
|
135
|
-
},
|
|
136
|
-
): string {
|
|
137
|
-
const { network, service, resource } = parse(uriString);
|
|
207
|
+
export function toUrl(uriString: string, options: IToUrlOptions): string {
|
|
208
|
+
const { network, resource, service } = parse(uriString);
|
|
138
209
|
|
|
139
210
|
// Replace host
|
|
140
211
|
const host = options.hosts[network];
|
|
@@ -155,76 +226,10 @@ export function toUrl(
|
|
|
155
226
|
}
|
|
156
227
|
|
|
157
228
|
/**
|
|
158
|
-
*
|
|
159
|
-
* @
|
|
160
|
-
*
|
|
161
|
-
* fromUrl("https://api-test.ebsi.eu/did-registry/v4/identifiers/did:ebsi:zx23VhpbGYeqF2MRJk3HzPw")
|
|
162
|
-
* ```
|
|
163
|
-
* returns `ebsi:test:did-registry:/identifiers/did:ebsi:zx23VhpbGYeqF2MRJk3HzPw`
|
|
164
|
-
* @param url - URL to transform
|
|
165
|
-
* @param options - Supported services
|
|
166
|
-
* @returns EBSI URI
|
|
229
|
+
* Typeguard that checks if the given string is a supported network.
|
|
230
|
+
* @param network - String to check
|
|
231
|
+
* @returns - network is Network
|
|
167
232
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
options?: {
|
|
171
|
-
/**
|
|
172
|
-
* Map of supported services and their versions
|
|
173
|
-
*/
|
|
174
|
-
services?: SupportedServices;
|
|
175
|
-
},
|
|
176
|
-
) {
|
|
177
|
-
// Parse URL
|
|
178
|
-
let urlObject: URL;
|
|
179
|
-
try {
|
|
180
|
-
urlObject = new URL(url);
|
|
181
|
-
} catch {
|
|
182
|
-
throw new Error("Invalid URL");
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const { host, pathname, search, hash } = urlObject;
|
|
186
|
-
|
|
187
|
-
// Identify network
|
|
188
|
-
const network = (Object.keys(HOSTS) as (keyof typeof HOSTS)[]).find((n) =>
|
|
189
|
-
host.includes(HOSTS[n]),
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
if (!network) {
|
|
193
|
-
throw new Error(`No network configured for host ${host}`);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Extract service and resource from pathname: /<service>/<serviceVersion>/<resource>
|
|
197
|
-
const [service, serviceVersion, ...rest] = pathname
|
|
198
|
-
.split("/")
|
|
199
|
-
.filter(Boolean); // Remove empty path segments
|
|
200
|
-
const resource = rest.join("/");
|
|
201
|
-
|
|
202
|
-
if (!service) {
|
|
203
|
-
throw new Error(`No service found in EBSI URI ${url}`);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (!serviceVersion) {
|
|
207
|
-
throw new Error(`No service version found in EBSI URI ${url}`);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Check if the service and its version are supported
|
|
211
|
-
if (options?.services) {
|
|
212
|
-
const supportedServiceVersion = options.services[service];
|
|
213
|
-
|
|
214
|
-
if (!supportedServiceVersion) {
|
|
215
|
-
throw new Error(`Unsupported service '${service}'`);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (serviceVersion !== supportedServiceVersion) {
|
|
219
|
-
throw new Error(
|
|
220
|
-
`Unsupported version '${serviceVersion}' of service '${service}'`,
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return serialize({
|
|
226
|
-
network,
|
|
227
|
-
service,
|
|
228
|
-
resource: `/${resource}${search}${hash}`,
|
|
229
|
-
});
|
|
233
|
+
function isNetwork(network: string | undefined): network is Network {
|
|
234
|
+
return network !== undefined && NETWORKS.includes(network as Network);
|
|
230
235
|
}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const EBSI_DID_METHOD_PREFIX = "did:ebsi:";
|
|
2
|
-
export declare const LEGAL_ENTITY = "LEGAL_ENTITY";
|
|
3
|
-
export declare const SUPPORTED_VERSIONS: readonly ["LEGAL_ENTITY"];
|
|
4
|
-
export declare const EBSI_DID_SPECS: Record<(typeof SUPPORTED_VERSIONS)[number], {
|
|
5
|
-
VERSION_ID: number;
|
|
6
|
-
BYTE_LENGTH: number;
|
|
7
|
-
PREFIX: string;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const DID_RESOLUTION_ERROR_CODES: {
|
|
10
|
-
readonly INVALID_DID: "invalidDid";
|
|
11
|
-
readonly NOT_FOUND: "notFound";
|
|
12
|
-
readonly REPRESENTATION_NOT_SUPPORTED: "representationNotSupported";
|
|
13
|
-
readonly UNKNOWN_ERROR: "unknownError";
|
|
14
|
-
readonly INTERNAL_SERVER_ERROR: "internalServerError";
|
|
15
|
-
readonly CONFIGURATION_ERROR: "configurationError";
|
|
16
|
-
readonly INVALID_JWK: "invalidJwk";
|
|
17
|
-
};
|
|
18
|
-
export type DidResolutionErrorCode = (typeof DID_RESOLUTION_ERROR_CODES)[keyof typeof DID_RESOLUTION_ERROR_CODES];
|
|
19
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,kBAAkB,2BAA0B,CAAC;AAC1D,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,EACnC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAOnD,CAAC;AAIX,eAAO,MAAM,0BAA0B;;;;;;;;CAU7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC"}
|
package/dist/constants.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const EBSI_DID_METHOD_PREFIX = "did:ebsi:";
|
|
2
|
-
export const LEGAL_ENTITY = "LEGAL_ENTITY";
|
|
3
|
-
export const SUPPORTED_VERSIONS = [LEGAL_ENTITY];
|
|
4
|
-
export const EBSI_DID_SPECS = {
|
|
5
|
-
[LEGAL_ENTITY]: {
|
|
6
|
-
VERSION_ID: 0x01,
|
|
7
|
-
BYTE_LENGTH: 16,
|
|
8
|
-
PREFIX: EBSI_DID_METHOD_PREFIX,
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
export const DID_RESOLUTION_ERROR_CODES = {
|
|
12
|
-
INVALID_DID: "invalidDid",
|
|
13
|
-
NOT_FOUND: "notFound",
|
|
14
|
-
REPRESENTATION_NOT_SUPPORTED: "representationNotSupported",
|
|
15
|
-
UNKNOWN_ERROR: "unknownError",
|
|
16
|
-
INTERNAL_SERVER_ERROR: "internalServerError",
|
|
17
|
-
CONFIGURATION_ERROR: "configurationError",
|
|
18
|
-
INVALID_JWK: "invalidJwk",
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,YAAY,CAAU,CAAC;AAC1D,MAAM,CAAC,MAAM,cAAc,GAGvB;IACF,CAAC,YAAY,CAAC,EAAE;QACd,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,sBAAsB;KAC/B;CACO,CAAC;AAIX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IAExC,WAAW,EAAE,YAAY;IACzB,SAAS,EAAE,UAAU;IACrB,4BAA4B,EAAE,4BAA4B;IAE1D,aAAa,EAAE,cAAc;IAC7B,qBAAqB,EAAE,qBAAqB;IAC5C,mBAAmB,EAAE,oBAAoB;IACzC,WAAW,EAAE,YAAY;CACjB,CAAC"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface ErrorOptions {
|
|
2
|
-
type?: string;
|
|
3
|
-
detail?: string;
|
|
4
|
-
instance?: string;
|
|
5
|
-
extensions?: {
|
|
6
|
-
[x: string]: unknown;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export declare class ProblemDetailsError extends Error {
|
|
10
|
-
status: number;
|
|
11
|
-
title: string;
|
|
12
|
-
type?: string;
|
|
13
|
-
detail?: string;
|
|
14
|
-
instance?: string;
|
|
15
|
-
extensions?: {
|
|
16
|
-
[x: string]: unknown;
|
|
17
|
-
};
|
|
18
|
-
constructor(status: number, title: string, options?: ErrorOptions);
|
|
19
|
-
toJSON(): {
|
|
20
|
-
title: string;
|
|
21
|
-
status: number;
|
|
22
|
-
type?: string;
|
|
23
|
-
detail?: string;
|
|
24
|
-
instance?: string;
|
|
25
|
-
[x: string]: unknown;
|
|
26
|
-
};
|
|
27
|
-
toString(): string;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAKA,UAAU,YAAY;IAEpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACvC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACrC,MAAM,EAAE,MAAM,CAAC;IAEf,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;gBAOjC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;IAkBjE,MAAM,IAAI;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB;IAWQ,QAAQ,IAAI,MAAM;CAG5B"}
|
package/dist/errors.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export class ProblemDetailsError extends Error {
|
|
2
|
-
constructor(status, title, options) {
|
|
3
|
-
super(title);
|
|
4
|
-
this.name = "ProblemDetailsError";
|
|
5
|
-
this.status = status;
|
|
6
|
-
this.title = title;
|
|
7
|
-
if (options) {
|
|
8
|
-
if (options.type)
|
|
9
|
-
this.type = options.type;
|
|
10
|
-
if (options.detail)
|
|
11
|
-
this.detail = options.detail;
|
|
12
|
-
if (options.instance)
|
|
13
|
-
this.instance = options.instance;
|
|
14
|
-
if (options.extensions)
|
|
15
|
-
this.extensions = options.extensions;
|
|
16
|
-
}
|
|
17
|
-
if (!this.type)
|
|
18
|
-
this.type = "about:blank";
|
|
19
|
-
}
|
|
20
|
-
toJSON() {
|
|
21
|
-
return {
|
|
22
|
-
title: this.title,
|
|
23
|
-
status: this.status,
|
|
24
|
-
...(this.type && { type: this.type }),
|
|
25
|
-
...(this.detail && { detail: this.detail }),
|
|
26
|
-
...(this.instance && { instance: this.instance }),
|
|
27
|
-
...this.extensions,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
toString() {
|
|
31
|
-
return `${this.status} - ${this.title}`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAgBA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAkB5C,YAAY,MAAc,EAAE,KAAa,EAAE,OAAsB;QAC/D,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAGnB,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,OAAO,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAC3C,IAAI,OAAO,CAAC,MAAM;gBAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YACjD,IAAI,OAAO,CAAC,QAAQ;gBAAE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YACvD,IAAI,OAAO,CAAC,UAAU;gBAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAC/D,CAAC;QAGD,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5C,CAAC;IAED,MAAM;QAQJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;YACrC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjD,GAAG,IAAI,CAAC,UAAU;SACnB,CAAC;IACJ,CAAC;IAEQ,QAAQ;QACf,OAAO,GAAG,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/resolver.d.ts
DELETED
package/dist/resolver.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,eAAe;IAI9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,wBAAgB,WAAW,CACzB,eAAe,EAAE,eAAe,GAC/B,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAqC7B"}
|
package/dist/resolver.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { DID_RESOLUTION_ERROR_CODES } from "./constants.js";
|
|
2
|
-
import { resolve as resolveV1 } from "./resolvers/v1.js";
|
|
3
|
-
import { validate } from "./validator.js";
|
|
4
|
-
export function getResolver(resolverOptions) {
|
|
5
|
-
async function resolve(did, _, __, didResolutionOptions) {
|
|
6
|
-
if (!resolverOptions || typeof resolverOptions !== "object") {
|
|
7
|
-
return {
|
|
8
|
-
didDocument: null,
|
|
9
|
-
didDocumentMetadata: {},
|
|
10
|
-
didResolutionMetadata: {
|
|
11
|
-
error: DID_RESOLUTION_ERROR_CODES.CONFIGURATION_ERROR,
|
|
12
|
-
message: "Invalid or missing resolver options",
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
validate(did);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
const message = e instanceof Error ? e.message : "Unknown error";
|
|
21
|
-
return {
|
|
22
|
-
didDocument: null,
|
|
23
|
-
didDocumentMetadata: {},
|
|
24
|
-
didResolutionMetadata: {
|
|
25
|
-
error: "invalidDid",
|
|
26
|
-
message,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return resolveV1(did, resolverOptions.registry, didResolutionOptions);
|
|
31
|
-
}
|
|
32
|
-
return { ebsi: resolve };
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=resolver.js.map
|
package/dist/resolver.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAY1C,MAAM,UAAU,WAAW,CACzB,eAAgC;IAEhC,KAAK,UAAU,OAAO,CACpB,GAAW,EACX,CAAY,EACZ,EAAW,EACX,oBAA2C;QAE3C,IAAI,CAAC,eAAe,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YAC5D,OAAO;gBACL,WAAW,EAAE,IAAI;gBACjB,mBAAmB,EAAE,EAAE;gBACvB,qBAAqB,EAAE;oBACrB,KAAK,EAAE,0BAA0B,CAAC,mBAAmB;oBACrD,OAAO,EAAE,qCAAqC;iBAC/C;aACF,CAAC;QACJ,CAAC;QAGD,IAAI,CAAC;YACH,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACjE,OAAO;gBACL,WAAW,EAAE,IAAI;gBACjB,mBAAmB,EAAE,EAAE;gBACvB,qBAAqB,EAAE;oBACrB,KAAK,EAAE,YAAY;oBACnB,OAAO;iBACR;aACF,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC,GAAG,EAAE,eAAe,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/resolvers/v1.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../src/resolvers/v1.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAyDtB,wBAAsB,OAAO,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,EACjB,oBAAoB,CAAC,EAAE,oBAAoB,GAC1C,OAAO,CAAC,mBAAmB,CAAC,CA+E9B"}
|
package/dist/resolvers/v1.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { ProblemDetailsError } from "../errors.js";
|
|
3
|
-
import { DID_RESOLUTION_ERROR_CODES, } from "../constants.js";
|
|
4
|
-
const AXIOS_TIMEOUT = 15_000;
|
|
5
|
-
const SUPPORTED_CONTENT_TYPES = [
|
|
6
|
-
"application/did+ld+json",
|
|
7
|
-
"application/did+json",
|
|
8
|
-
];
|
|
9
|
-
function isSupportedContentType(contentType) {
|
|
10
|
-
return SUPPORTED_CONTENT_TYPES.includes(contentType);
|
|
11
|
-
}
|
|
12
|
-
async function get(url, contentType, timeout) {
|
|
13
|
-
try {
|
|
14
|
-
const response = await axios.get(url, {
|
|
15
|
-
headers: {
|
|
16
|
-
accept: contentType,
|
|
17
|
-
},
|
|
18
|
-
timeout: timeout || AXIOS_TIMEOUT,
|
|
19
|
-
});
|
|
20
|
-
return response.data;
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
let message = "";
|
|
24
|
-
if (axios.isAxiosError(e)) {
|
|
25
|
-
try {
|
|
26
|
-
const { detail, title } = e.response?.data;
|
|
27
|
-
message = detail || title;
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
message = e.message;
|
|
31
|
-
}
|
|
32
|
-
throw new ProblemDetailsError(e.response?.status || 500, e.response?.statusText || "", {
|
|
33
|
-
detail: message,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
throw e;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export async function resolve(did, registry, didResolutionOptions) {
|
|
40
|
-
if (!registry) {
|
|
41
|
-
return {
|
|
42
|
-
didDocument: null,
|
|
43
|
-
didDocumentMetadata: {},
|
|
44
|
-
didResolutionMetadata: {
|
|
45
|
-
error: DID_RESOLUTION_ERROR_CODES.CONFIGURATION_ERROR,
|
|
46
|
-
message: "A DID registry must be defined in order to resolve EBSI DID method v1 documents",
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
let accept = "application/did+ld+json";
|
|
51
|
-
if (didResolutionOptions && didResolutionOptions.accept) {
|
|
52
|
-
if (!isSupportedContentType(didResolutionOptions.accept)) {
|
|
53
|
-
return {
|
|
54
|
-
didDocument: null,
|
|
55
|
-
didDocumentMetadata: {},
|
|
56
|
-
didResolutionMetadata: {
|
|
57
|
-
error: DID_RESOLUTION_ERROR_CODES.REPRESENTATION_NOT_SUPPORTED,
|
|
58
|
-
message: `Representation ${didResolutionOptions.accept} is not supported. Valid representations include: ${SUPPORTED_CONTENT_TYPES.join(", ")}`,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
accept = didResolutionOptions.accept;
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
const timeout = didResolutionOptions &&
|
|
66
|
-
typeof didResolutionOptions["timeout"] === "number"
|
|
67
|
-
? didResolutionOptions["timeout"]
|
|
68
|
-
: AXIOS_TIMEOUT;
|
|
69
|
-
const didDocument = await get(`${registry}/${did}`, accept, timeout);
|
|
70
|
-
return {
|
|
71
|
-
didDocument,
|
|
72
|
-
didDocumentMetadata: {},
|
|
73
|
-
didResolutionMetadata: { contentType: accept },
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
let error = DID_RESOLUTION_ERROR_CODES.UNKNOWN_ERROR;
|
|
78
|
-
let message = "";
|
|
79
|
-
if (e instanceof ProblemDetailsError) {
|
|
80
|
-
if (e.status === 400) {
|
|
81
|
-
error = DID_RESOLUTION_ERROR_CODES.INVALID_DID;
|
|
82
|
-
message = e.detail || e.title || "Bad Request";
|
|
83
|
-
}
|
|
84
|
-
else if (e.status === 404) {
|
|
85
|
-
error = DID_RESOLUTION_ERROR_CODES.NOT_FOUND;
|
|
86
|
-
message = e.detail || e.title || "Not Found";
|
|
87
|
-
}
|
|
88
|
-
else if (e.status === 500) {
|
|
89
|
-
error = DID_RESOLUTION_ERROR_CODES.INTERNAL_SERVER_ERROR;
|
|
90
|
-
message = e.detail || e.title || "Internal Server Error";
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
message = e.detail || e.title || "unknown";
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (e instanceof Error) {
|
|
97
|
-
message = e.message;
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
didDocument: null,
|
|
101
|
-
didDocumentMetadata: {},
|
|
102
|
-
didResolutionMetadata: {
|
|
103
|
-
error,
|
|
104
|
-
message: `${message} | Registry used: ${registry}`,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=v1.js.map
|
package/dist/resolvers/v1.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v1.js","sourceRoot":"","sources":["../../src/resolvers/v1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,0BAA0B,GAE3B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAM,uBAAuB,GAAG;IAC9B,yBAAyB;IACzB,sBAAsB;CACd,CAAC;AAGX,SAAS,sBAAsB,CAC7B,WAAmB;IAEnB,OAAO,uBAAuB,CAAC,QAAQ,CAAC,WAA0B,CAAC,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,GAAG,CAChB,GAAW,EACX,WAAwB,EACxB,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAc,GAAG,EAAE;YACjD,OAAO,EAAE;gBACP,MAAM,EAAE,WAAW;aACpB;YACD,OAAO,EAAE,OAAO,IAAI,aAAa;SAClC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC;gBACH,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,IAA2B,CAAC;gBAClE,OAAO,GAAG,MA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AAC,OAAO,CAAC;QACtB,CAAC;QAED,OAAO;YACL,WAAW,EAAE,IAAI;YACjB,mBAAmB,EAAE,EAAE;YACvB,qBAAqB,EAAE;gBACrB,KAAK;gBACL,OAAO,EAAE,GAAG,OAAO,qBAAqB,QAAQ,EAAE;aACnD;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/util.d.ts
DELETED
package/dist/util.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AASxB,wBAAgB,SAAS,CACvB,sBAAsB,EAAE,SAAS,CAAC,MAAM,CAAC,EACzC,OAAO,GAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAgB,GAC1D,MAAM,CAmBR"}
|
package/dist/util.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { base58btc } from "multiformats/bases/base58";
|
|
2
|
-
import { EBSI_DID_METHOD_PREFIX, EBSI_DID_SPECS, LEGAL_ENTITY, } from "./constants.js";
|
|
3
|
-
export function createDid(subjectIdentifierBytes, version = LEGAL_ENTITY) {
|
|
4
|
-
const bytesArray = new Uint8Array(1 + EBSI_DID_SPECS[version].BYTE_LENGTH);
|
|
5
|
-
bytesArray.set([EBSI_DID_SPECS[version].VERSION_ID]);
|
|
6
|
-
if (subjectIdentifierBytes.length !== EBSI_DID_SPECS[version].BYTE_LENGTH) {
|
|
7
|
-
throw new Error(`Invalid subject identifier length. Expected: ${EBSI_DID_SPECS[version].BYTE_LENGTH} bytes. Received: ${subjectIdentifierBytes.length} bytes.`);
|
|
8
|
-
}
|
|
9
|
-
bytesArray.set(subjectIdentifierBytes, 1);
|
|
10
|
-
const methodSpecificIdentifier = base58btc.encode(bytesArray);
|
|
11
|
-
return `${EBSI_DID_METHOD_PREFIX}${methodSpecificIdentifier}`;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,YAAY,GAEb,MAAM,gBAAgB,CAAC;AASxB,MAAM,UAAU,SAAS,CACvB,sBAAyC,EACzC,UAA+C,YAAY;IAG3D,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;IAG3E,UAAU,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAErD,IAAI,sBAAsB,CAAC,MAAM,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CACb,gDAAgD,cAAc,CAAC,OAAO,CAAC,CAAC,WAAW,qBAAqB,sBAAsB,CAAC,MAAM,SAAS,CAC/I,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;IAG1C,MAAM,wBAAwB,GAAG,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE9D,OAAO,GAAG,sBAAsB,GAAG,wBAAwB,EAAE,CAAC;AAChE,CAAC"}
|
package/dist/validator.d.ts
DELETED
package/dist/validator.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAaA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsD5C"}
|
package/dist/validator.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { base58btc } from "multiformats/bases/base58";
|
|
2
|
-
import { EBSI_DID_METHOD_PREFIX, EBSI_DID_SPECS, SUPPORTED_VERSIONS, } from "./constants.js";
|
|
3
|
-
export function validate(did) {
|
|
4
|
-
if (!did || typeof did !== "string") {
|
|
5
|
-
throw new Error("The DID must be a string");
|
|
6
|
-
}
|
|
7
|
-
if (!did.startsWith(EBSI_DID_METHOD_PREFIX)) {
|
|
8
|
-
throw new Error(`The DID must start with "${EBSI_DID_METHOD_PREFIX}"`);
|
|
9
|
-
}
|
|
10
|
-
const methodSpecificIdentifier = did.substring(EBSI_DID_METHOD_PREFIX.length);
|
|
11
|
-
if (!methodSpecificIdentifier.startsWith("z")) {
|
|
12
|
-
throw new Error('The method-specific identifier must start with "z" (multibase base58btc-encoded)');
|
|
13
|
-
}
|
|
14
|
-
let decodedIdentifier;
|
|
15
|
-
try {
|
|
16
|
-
decodedIdentifier = base58btc.decode(methodSpecificIdentifier);
|
|
17
|
-
}
|
|
18
|
-
catch (e) {
|
|
19
|
-
throw new Error("The method-specific identifier is not a valid multibase base58btc-encoded string");
|
|
20
|
-
}
|
|
21
|
-
const version = decodedIdentifier[0];
|
|
22
|
-
if (!version) {
|
|
23
|
-
throw new Error("No version found");
|
|
24
|
-
}
|
|
25
|
-
const didSpecsKey = SUPPORTED_VERSIONS.find((specKey) => version === EBSI_DID_SPECS[specKey].VERSION_ID);
|
|
26
|
-
if (!didSpecsKey) {
|
|
27
|
-
throw new Error(`Unsupported version "${version}"`);
|
|
28
|
-
}
|
|
29
|
-
if (decodedIdentifier.byteLength - 1 !==
|
|
30
|
-
EBSI_DID_SPECS[didSpecsKey].BYTE_LENGTH) {
|
|
31
|
-
throw new Error(`The subject identifier length (${decodedIdentifier.byteLength - 1} bytes) does not match the expected length (${EBSI_DID_SPECS[didSpecsKey].BYTE_LENGTH} bytes)`);
|
|
32
|
-
}
|
|
33
|
-
return version;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=validator.js.map
|
package/dist/validator.js.map
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