@cheqd/studio 3.13.0-develop.1 → 3.13.0-develop.11
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/app.d.ts.map +1 -1
- package/dist/app.js +4 -1
- package/dist/app.js.map +1 -1
- package/dist/controllers/api/accreditation.d.ts.map +1 -1
- package/dist/controllers/api/accreditation.js +2 -2
- package/dist/controllers/api/accreditation.js.map +1 -1
- package/dist/controllers/api/credential.d.ts +55 -0
- package/dist/controllers/api/credential.d.ts.map +1 -1
- package/dist/controllers/api/credential.js +145 -0
- package/dist/controllers/api/credential.js.map +1 -1
- package/dist/controllers/api/did.d.ts +77 -1
- package/dist/controllers/api/did.d.ts.map +1 -1
- package/dist/controllers/api/did.js +210 -93
- package/dist/controllers/api/did.js.map +1 -1
- package/dist/controllers/api/providers.controller.d.ts +62 -0
- package/dist/controllers/api/providers.controller.d.ts.map +1 -1
- package/dist/controllers/api/providers.controller.js +114 -0
- package/dist/controllers/api/providers.controller.js.map +1 -1
- package/dist/controllers/validator/service-create-request.js +3 -3
- package/dist/controllers/validator/service-create-request.js.map +1 -1
- package/dist/controllers/validator/service.js +2 -2
- package/dist/controllers/validator/service.js.map +1 -1
- package/dist/database/seeds/providers.seed.js +4 -4
- package/dist/database/seeds/providers.seed.js.map +1 -1
- package/dist/helpers/helpers.js +1 -1
- package/dist/helpers/helpers.js.map +1 -1
- package/dist/middleware/auth/routes/api/credential-auth.d.ts.map +1 -1
- package/dist/middleware/auth/routes/api/credential-auth.js +2 -0
- package/dist/middleware/auth/routes/api/credential-auth.js.map +1 -1
- package/dist/middleware/auth/routes/api/did-auth.d.ts.map +1 -1
- package/dist/middleware/auth/routes/api/did-auth.js +2 -0
- package/dist/middleware/auth/routes/api/did-auth.js.map +1 -1
- package/dist/middleware/auth/routes/api/provider-auth.d.ts.map +1 -1
- package/dist/middleware/auth/routes/api/provider-auth.js +2 -0
- package/dist/middleware/auth/routes/api/provider-auth.js.map +1 -1
- package/dist/services/api/credentials.d.ts.map +1 -1
- package/dist/services/api/credentials.js +36 -17
- package/dist/services/api/credentials.js.map +1 -1
- package/dist/services/api/identifier.d.ts +1 -1
- package/dist/services/api/identifier.d.ts.map +1 -1
- package/dist/services/api/identifier.js +2 -2
- package/dist/services/api/identifier.js.map +1 -1
- package/dist/services/api/provider.factory.js +4 -4
- package/dist/services/api/provider.factory.js.map +1 -1
- package/dist/services/api/provider.service.d.ts +2 -2
- package/dist/services/api/provider.service.d.ts.map +1 -1
- package/dist/services/api/provider.service.js +2 -2
- package/dist/services/api/provider.service.js.map +1 -1
- package/dist/services/api/{base-provider.service.d.ts → providers/base-provider.service.d.ts} +3 -3
- package/dist/services/api/providers/base-provider.service.d.ts.map +1 -0
- package/dist/services/api/{base-provider.service.js → providers/base-provider.service.js} +1 -1
- package/dist/services/api/providers/base-provider.service.js.map +1 -0
- package/dist/services/api/{dock-api.service.d.ts → providers/dock-api.service.d.ts} +4 -2
- package/dist/services/api/providers/dock-api.service.d.ts.map +1 -0
- package/dist/services/api/{dock-api.service.js → providers/dock-api.service.js} +2 -0
- package/dist/services/api/providers/dock-api.service.js.map +1 -0
- package/dist/services/api/{hovi-api.service.d.ts → providers/hovi-api.service.d.ts} +2 -2
- package/dist/services/api/providers/hovi-api.service.d.ts.map +1 -0
- package/dist/services/api/providers/hovi-api.service.js.map +1 -0
- package/dist/services/api/{paradym-api.service.d.ts → providers/paradym-api.service.d.ts} +2 -2
- package/dist/services/api/providers/paradym-api.service.d.ts.map +1 -0
- package/dist/services/api/providers/paradym-api.service.js.map +1 -0
- package/dist/services/api/{studio-api.service.d.ts → providers/studio-api.service.d.ts} +2 -2
- package/dist/services/api/providers/studio-api.service.d.ts.map +1 -0
- package/dist/services/api/{studio-api.service.js → providers/studio-api.service.js} +4 -4
- package/dist/services/api/providers/studio-api.service.js.map +1 -0
- package/dist/services/api/resource.d.ts +2 -2
- package/dist/services/api/resource.d.ts.map +1 -1
- package/dist/services/api/resource.js.map +1 -1
- package/dist/services/identity/abstract.d.ts +7 -3
- package/dist/services/identity/abstract.d.ts.map +1 -1
- package/dist/services/identity/abstract.js +9 -1
- package/dist/services/identity/abstract.js.map +1 -1
- package/dist/services/identity/default.js +1 -1
- package/dist/services/identity/default.js.map +1 -1
- package/dist/services/identity/index.d.ts +8 -4
- package/dist/services/identity/index.d.ts.map +1 -1
- package/dist/services/identity/index.js +2 -3
- package/dist/services/identity/index.js.map +1 -1
- package/dist/services/identity/providers/dock/identity.d.ts +25 -0
- package/dist/services/identity/providers/dock/identity.d.ts.map +1 -0
- package/dist/services/identity/providers/dock/identity.js +307 -0
- package/dist/services/identity/providers/dock/identity.js.map +1 -0
- package/dist/services/identity/providers/dock/types.d.ts +138 -0
- package/dist/services/identity/providers/dock/types.d.ts.map +1 -0
- package/dist/services/identity/providers/dock/types.js +2 -0
- package/dist/services/identity/providers/dock/types.js.map +1 -0
- package/dist/services/identity/providers/index.d.ts +3 -0
- package/dist/services/identity/providers/index.d.ts.map +1 -0
- package/dist/services/identity/providers/index.js +3 -0
- package/dist/services/identity/providers/index.js.map +1 -0
- package/dist/services/identity/{agent.d.ts → providers/studio/agent.d.ts} +8 -8
- package/dist/services/identity/providers/studio/agent.d.ts.map +1 -0
- package/dist/services/identity/{agent.js → providers/studio/agent.js} +7 -6
- package/dist/services/identity/providers/studio/agent.js.map +1 -0
- package/dist/services/identity/providers/studio/index.d.ts +3 -0
- package/dist/services/identity/providers/studio/index.d.ts.map +1 -0
- package/dist/services/identity/providers/studio/index.js +3 -0
- package/dist/services/identity/providers/studio/index.js.map +1 -0
- package/dist/services/identity/{local.d.ts → providers/studio/local.d.ts} +9 -9
- package/dist/services/identity/providers/studio/local.d.ts.map +1 -0
- package/dist/services/identity/{local.js → providers/studio/local.js} +3 -3
- package/dist/services/identity/providers/studio/local.js.map +1 -0
- package/dist/services/identity/{postgres.d.ts → providers/studio/postgres.d.ts} +24 -18
- package/dist/services/identity/providers/studio/postgres.d.ts.map +1 -0
- package/dist/services/identity/{postgres.js → providers/studio/postgres.js} +138 -17
- package/dist/services/identity/providers/studio/postgres.js.map +1 -0
- package/dist/services/identity/providers/studio/unauthorized.d.ts +6 -0
- package/dist/services/identity/providers/studio/unauthorized.d.ts.map +1 -0
- package/dist/services/identity/{unauthorized.js → providers/studio/unauthorized.js} +2 -2
- package/dist/services/identity/providers/studio/unauthorized.js.map +1 -0
- package/dist/services/track/api/resource-subscriber.js +1 -1
- package/dist/services/track/api/resource-subscriber.js.map +1 -1
- package/dist/static/swagger-api.json +423 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/constants.js +1 -0
- package/dist/types/constants.js.map +1 -1
- package/dist/types/credential.d.ts +35 -3
- package/dist/types/credential.d.ts.map +1 -1
- package/dist/types/credential.js +4 -2
- package/dist/types/credential.js.map +1 -1
- package/dist/types/did.d.ts +20 -1
- package/dist/types/did.d.ts.map +1 -1
- package/dist/types/swagger-api-types.d.ts +94 -0
- package/dist/types/swagger-api-types.d.ts.map +1 -1
- package/dist/types/swagger-api-types.js +94 -0
- package/dist/types/swagger-api-types.js.map +1 -1
- package/example.env +1 -1
- package/package.json +3 -2
- package/dist/services/api/base-provider.service.d.ts.map +0 -1
- package/dist/services/api/base-provider.service.js.map +0 -1
- package/dist/services/api/dock-api.service.d.ts.map +0 -1
- package/dist/services/api/dock-api.service.js.map +0 -1
- package/dist/services/api/hovi-api.service.d.ts.map +0 -1
- package/dist/services/api/hovi-api.service.js.map +0 -1
- package/dist/services/api/paradym-api.service.d.ts.map +0 -1
- package/dist/services/api/paradym-api.service.js.map +0 -1
- package/dist/services/api/studio-api.service.d.ts.map +0 -1
- package/dist/services/api/studio-api.service.js.map +0 -1
- package/dist/services/identity/agent.d.ts.map +0 -1
- package/dist/services/identity/agent.js.map +0 -1
- package/dist/services/identity/local.d.ts.map +0 -1
- package/dist/services/identity/local.js.map +0 -1
- package/dist/services/identity/postgres.d.ts.map +0 -1
- package/dist/services/identity/postgres.js.map +0 -1
- package/dist/services/identity/unauthorized.d.ts +0 -6
- package/dist/services/identity/unauthorized.d.ts.map +0 -1
- package/dist/services/identity/unauthorized.js.map +0 -1
- /package/dist/services/api/{hovi-api.service.js → providers/hovi-api.service.js} +0 -0
- /package/dist/services/api/{paradym-api.service.js → providers/paradym-api.service.js} +0 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { AbstractIdentityService } from '../../abstract.js';
|
|
2
|
+
import { ProviderService } from '../../../api/provider.service.js';
|
|
3
|
+
import { fromString, toString } from 'uint8arrays';
|
|
4
|
+
import { contentsFromEncryptedWalletCredential, passwordToKeypair } from '@docknetwork/universal-wallet';
|
|
5
|
+
import { IdentityServiceStrategySetup } from '../../index.js';
|
|
6
|
+
export class DockIdentityService extends AbstractIdentityService {
|
|
7
|
+
supportedProvider = 'dock';
|
|
8
|
+
defaultApiUrl = 'https://api-testnet.truvera.io';
|
|
9
|
+
async createDid(network, didDocument, customer) {
|
|
10
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
11
|
+
if (!provider) {
|
|
12
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
13
|
+
}
|
|
14
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
15
|
+
if (!providerConfig) {
|
|
16
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
17
|
+
}
|
|
18
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
19
|
+
const response = await fetch(`${this.defaultApiUrl}/dids`, {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
Authorization: `Bearer ${apiKey}`,
|
|
24
|
+
},
|
|
25
|
+
body: JSON.stringify({
|
|
26
|
+
type: 'cheqd',
|
|
27
|
+
keytype: 'ed25519',
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
const data = (await response.json());
|
|
31
|
+
if (response.status != 200) {
|
|
32
|
+
throw new Error(`Failed to create did with ${this.supportedProvider}: ${response.statusText}`);
|
|
33
|
+
}
|
|
34
|
+
// save in db
|
|
35
|
+
// Add a time delay before exporting
|
|
36
|
+
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
37
|
+
const exportedDid = await this.exportDid(data.data.did, '', customer);
|
|
38
|
+
if (exportedDid) {
|
|
39
|
+
const identityStrategySetup = new IdentityServiceStrategySetup(customer.customerId);
|
|
40
|
+
const kp = await passwordToKeypair(process.env.PROVIDER_EXPORT_PASSWORD);
|
|
41
|
+
const decyptedContent = (await contentsFromEncryptedWalletCredential(exportedDid, kp));
|
|
42
|
+
const keys = decyptedContent
|
|
43
|
+
.filter((c) => typeof c.type === 'string' && c.privateKeyBase58)
|
|
44
|
+
.map((c) => ({
|
|
45
|
+
type: 'Ed25519',
|
|
46
|
+
privateKeyHex: toString(fromString(c.privateKeyBase58, 'base58btc'), 'hex'),
|
|
47
|
+
}));
|
|
48
|
+
const didDocument = decyptedContent.find((c) => c.didDocument)
|
|
49
|
+
?.didDocument;
|
|
50
|
+
const vm = didDocument.verificationMethod[0];
|
|
51
|
+
const pkBase58 = vm.publicKeyBase58;
|
|
52
|
+
const controllerKeyId = toString(fromString(pkBase58, 'base58btc'), 'hex');
|
|
53
|
+
return await identityStrategySetup.agent.importDid(didDocument.id, keys, controllerKeyId, customer, `did:cheqd:${network || 'testnet'}`);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
did: data.data.did,
|
|
57
|
+
provider: this.supportedProvider,
|
|
58
|
+
controllerKeyId: data.data.controller,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async getDid(did, customer) {
|
|
62
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
63
|
+
if (!provider) {
|
|
64
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
65
|
+
}
|
|
66
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
67
|
+
if (!providerConfig) {
|
|
68
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
69
|
+
}
|
|
70
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
71
|
+
const response = await fetch(`${this.defaultApiUrl}/dids/${did}/metadata`, {
|
|
72
|
+
method: 'GET',
|
|
73
|
+
headers: {
|
|
74
|
+
'Content-Type': 'application/json',
|
|
75
|
+
Authorization: `Bearer ${apiKey}`,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
if (response.status != 200) {
|
|
79
|
+
throw new Error(`Failed to fetch DIDs with ${this.supportedProvider}: ${response.statusText}`);
|
|
80
|
+
}
|
|
81
|
+
const data = (await response.json());
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
84
|
+
async listDids(options, customer) {
|
|
85
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
86
|
+
if (!provider) {
|
|
87
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
88
|
+
}
|
|
89
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
90
|
+
if (!providerConfig) {
|
|
91
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
92
|
+
}
|
|
93
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
94
|
+
const response = await fetch(`${this.defaultApiUrl}/dids`, {
|
|
95
|
+
method: 'GET',
|
|
96
|
+
headers: {
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
Authorization: `Bearer ${apiKey}`,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
if (!response.ok) {
|
|
102
|
+
throw new Error(`Failed to fetch DIDs with ${this.supportedProvider}: ${response.statusText}`);
|
|
103
|
+
}
|
|
104
|
+
const data = (await response.json());
|
|
105
|
+
return {
|
|
106
|
+
dids: data.map((item) => item.did),
|
|
107
|
+
total: data.length,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async createCredential(credential, format, statusOptions, customer) {
|
|
111
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
112
|
+
if (!provider) {
|
|
113
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
114
|
+
}
|
|
115
|
+
if (format === 'anoncreds') {
|
|
116
|
+
throw new Error(`Credential format ${format} not supported with provider ${this.supportedProvider}`);
|
|
117
|
+
}
|
|
118
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
119
|
+
if (!providerConfig) {
|
|
120
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
121
|
+
}
|
|
122
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
123
|
+
const { issuer, subject, issuanceDate, expirationDate, ...payload } = credential;
|
|
124
|
+
const response = await fetch(`${this.defaultApiUrl}/credentials`, {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
headers: {
|
|
127
|
+
'Content-Type': 'application/json',
|
|
128
|
+
Authorization: `Bearer ${apiKey}`,
|
|
129
|
+
},
|
|
130
|
+
body: JSON.stringify({
|
|
131
|
+
persist: false,
|
|
132
|
+
format: format === 'sd-jwt-vc' ? 'sdjwt' : format,
|
|
133
|
+
distribute: true,
|
|
134
|
+
credential: {
|
|
135
|
+
...payload,
|
|
136
|
+
issuer: typeof credential.issuer === 'string' ? credential.issuer : credential.issuer.id,
|
|
137
|
+
subject: credential.credentialSubject,
|
|
138
|
+
issuanceDate: issuanceDate?.toLocaleString() || new Date().toISOString(),
|
|
139
|
+
expirationDate: expirationDate?.toLocaleString() || undefined,
|
|
140
|
+
status: statusOptions || undefined,
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
144
|
+
if (response.status != 200) {
|
|
145
|
+
const responseText = await response.text();
|
|
146
|
+
throw new Error(`Failed to create credential with ${this.supportedProvider}: ${responseText}`);
|
|
147
|
+
}
|
|
148
|
+
let credentialJson = await response.json();
|
|
149
|
+
// Decode JWT to VerifiableCredential
|
|
150
|
+
if (typeof credential === 'string') {
|
|
151
|
+
const [, payloadBase64] = credentialJson.split('.');
|
|
152
|
+
credentialJson = JSON.parse(Buffer.from(payloadBase64, 'base64').toString('utf8'));
|
|
153
|
+
}
|
|
154
|
+
const vc = credentialJson;
|
|
155
|
+
return vc;
|
|
156
|
+
}
|
|
157
|
+
async exportDid(did, _password, customer) {
|
|
158
|
+
if (!process.env.PROVIDER_EXPORT_PASSWORD) {
|
|
159
|
+
throw new Error('Provider export requires a password');
|
|
160
|
+
}
|
|
161
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
162
|
+
if (!provider) {
|
|
163
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
164
|
+
}
|
|
165
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
166
|
+
if (!providerConfig) {
|
|
167
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
168
|
+
}
|
|
169
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
170
|
+
const response = await fetch(`${this.defaultApiUrl}/dids/${did}/export`, {
|
|
171
|
+
method: 'POST',
|
|
172
|
+
headers: {
|
|
173
|
+
'Content-Type': 'application/json',
|
|
174
|
+
Authorization: `Bearer ${apiKey}`,
|
|
175
|
+
},
|
|
176
|
+
body: JSON.stringify({
|
|
177
|
+
password: process.env.PROVIDER_EXPORT_PASSWORD,
|
|
178
|
+
}),
|
|
179
|
+
});
|
|
180
|
+
const result = await response.json();
|
|
181
|
+
if (!response.ok) {
|
|
182
|
+
throw new Error(`Failed to create did with ${this.supportedProvider}: ${response.statusText}`);
|
|
183
|
+
}
|
|
184
|
+
const [didDocument, ...keys] = result;
|
|
185
|
+
return {
|
|
186
|
+
...didDocument,
|
|
187
|
+
keys,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
async listCredentials(options, customer) {
|
|
191
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
192
|
+
if (!provider) {
|
|
193
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
194
|
+
}
|
|
195
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
196
|
+
if (!providerConfig) {
|
|
197
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
198
|
+
}
|
|
199
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
200
|
+
const response = await fetch(`${this.defaultApiUrl}/credentials`, {
|
|
201
|
+
method: 'GET',
|
|
202
|
+
headers: {
|
|
203
|
+
'Content-Type': 'application/json',
|
|
204
|
+
Authorization: `Bearer ${apiKey}`,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
if (!response.ok) {
|
|
208
|
+
throw new Error(`Failed to fetch DIDs with ${this.supportedProvider}: ${response.statusText}`);
|
|
209
|
+
}
|
|
210
|
+
const data = (await response.json());
|
|
211
|
+
return {
|
|
212
|
+
credentials: data.map((credential) => ({
|
|
213
|
+
status: credential.revoked ? 'revoked' : 'issued',
|
|
214
|
+
providerId: provider.providerId,
|
|
215
|
+
id: credential.id,
|
|
216
|
+
issuerDid: credential.issuerKey.split('#')[0],
|
|
217
|
+
subjectDid: credential.subjectRef,
|
|
218
|
+
type: credential.type,
|
|
219
|
+
format: 'jwt',
|
|
220
|
+
createdAt: credential.createdAt,
|
|
221
|
+
expirationDate: credential.expirationDate,
|
|
222
|
+
credentialStatus: credential.revocationRegistry
|
|
223
|
+
? {
|
|
224
|
+
id: credential.revocationRegistry,
|
|
225
|
+
index: credential.index,
|
|
226
|
+
}
|
|
227
|
+
: undefined,
|
|
228
|
+
})),
|
|
229
|
+
total: data.length,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
async importDid(did, keys, controllerKeyId, customer) {
|
|
233
|
+
if (!process.env.PROVIDER_EXPORT_PASSWORD) {
|
|
234
|
+
throw new Error('Provider export requires a password');
|
|
235
|
+
}
|
|
236
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, { deprecated: false });
|
|
237
|
+
if (!provider) {
|
|
238
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
239
|
+
}
|
|
240
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider?.providerId);
|
|
241
|
+
if (!providerConfig) {
|
|
242
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
243
|
+
}
|
|
244
|
+
const identityStrategySetup = new IdentityServiceStrategySetup(customer.customerId);
|
|
245
|
+
const exportedDid = await identityStrategySetup.agent.exportDid(did, '', customer);
|
|
246
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
247
|
+
const response = await fetch(`${this.defaultApiUrl}/dids/${did}/import`, {
|
|
248
|
+
method: 'POST',
|
|
249
|
+
headers: {
|
|
250
|
+
'Content-Type': 'application/json',
|
|
251
|
+
Authorization: `Bearer ${apiKey}`,
|
|
252
|
+
},
|
|
253
|
+
body: JSON.stringify(exportedDid),
|
|
254
|
+
});
|
|
255
|
+
const result = await response.json();
|
|
256
|
+
if (response.status != 200) {
|
|
257
|
+
throw new Error(`Failed to create did with ${this.supportedProvider}: ${JSON.stringify(result)}`);
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
status: true,
|
|
261
|
+
did,
|
|
262
|
+
provider: 'dock',
|
|
263
|
+
keys: [],
|
|
264
|
+
services: [],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
async importDidV2(did, exportedDidResult, _password, customer) {
|
|
268
|
+
if (!process.env.PROVIDER_EXPORT_PASSWORD) {
|
|
269
|
+
throw new Error('Provider export requires a password');
|
|
270
|
+
}
|
|
271
|
+
// Step 1: Resolve provider
|
|
272
|
+
const provider = await ProviderService.instance.getProvider(this.supportedProvider, {
|
|
273
|
+
deprecated: false,
|
|
274
|
+
});
|
|
275
|
+
if (!provider) {
|
|
276
|
+
throw new Error(`Provider ${this.supportedProvider} not found or deprecated`);
|
|
277
|
+
}
|
|
278
|
+
const providerConfig = await ProviderService.instance.getProviderConfiguration(customer.customerId, provider.providerId);
|
|
279
|
+
if (!providerConfig) {
|
|
280
|
+
throw new Error(`Provider ${this.supportedProvider} not configured for customer ${customer.customerId}`);
|
|
281
|
+
}
|
|
282
|
+
// Step 2: Send export result to provider
|
|
283
|
+
const apiKey = await ProviderService.instance.getDecryptedApiKey(providerConfig);
|
|
284
|
+
const { keys, ...exportResult } = exportedDidResult;
|
|
285
|
+
const response = await fetch(`${this.defaultApiUrl}/dids/import`, {
|
|
286
|
+
method: 'POST',
|
|
287
|
+
headers: {
|
|
288
|
+
'Content-Type': 'application/json',
|
|
289
|
+
Authorization: `Bearer ${apiKey}`,
|
|
290
|
+
},
|
|
291
|
+
body: JSON.stringify({ data: [exportResult, ...keys] }),
|
|
292
|
+
});
|
|
293
|
+
const result = await response.json();
|
|
294
|
+
if (response.status !== 200) {
|
|
295
|
+
throw new Error(`Failed to import DID with ${this.supportedProvider}: ${JSON.stringify(result)}`);
|
|
296
|
+
}
|
|
297
|
+
// Step 3: Return identifier
|
|
298
|
+
return {
|
|
299
|
+
status: true,
|
|
300
|
+
did,
|
|
301
|
+
provider: this.supportedProvider,
|
|
302
|
+
keys: [], // optionally map exportedDidResult -> keys[]
|
|
303
|
+
services: [],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../../src/services/identity/provid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,EAAE,EAAE,EAAE,6CAA6C;YACvD,QAAQ,EAAE,EAAE;SACZ,CAAC;IACH,CAAC;CACD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { DIDDocument } from 'did-resolver';
|
|
2
|
+
export type DockTrustRegistry = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
logoUrl: string;
|
|
6
|
+
};
|
|
7
|
+
export type DockDidProfile = {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
};
|
|
12
|
+
export type DockListDidsResponse = {
|
|
13
|
+
id: string;
|
|
14
|
+
did: string;
|
|
15
|
+
type: string;
|
|
16
|
+
controller: string;
|
|
17
|
+
profile: DockDidProfile;
|
|
18
|
+
keyId: string;
|
|
19
|
+
jobId: string | null;
|
|
20
|
+
trustRegistries: DockTrustRegistry[];
|
|
21
|
+
}[];
|
|
22
|
+
export type DockCreateDidResponse = {
|
|
23
|
+
id: string;
|
|
24
|
+
data: {
|
|
25
|
+
did: string;
|
|
26
|
+
controller: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type DockIssueCredentialRequestBody = {
|
|
30
|
+
persist?: boolean;
|
|
31
|
+
password?: string;
|
|
32
|
+
template?: string;
|
|
33
|
+
recipientEmail?: string;
|
|
34
|
+
distribute?: boolean;
|
|
35
|
+
revocable?: boolean;
|
|
36
|
+
format: 'jsonld' | 'jwt' | 'sdjwt';
|
|
37
|
+
credential: {
|
|
38
|
+
id?: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
schema?: string;
|
|
42
|
+
context?: string[];
|
|
43
|
+
type?: string[];
|
|
44
|
+
issuer: string;
|
|
45
|
+
issuanceDate?: string;
|
|
46
|
+
expirationDate?: string;
|
|
47
|
+
subject: Record<string, any>;
|
|
48
|
+
status?: string | object;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type DockExportDidResponse = {
|
|
52
|
+
'@context': string[];
|
|
53
|
+
id: string;
|
|
54
|
+
type: string[];
|
|
55
|
+
issuer: string;
|
|
56
|
+
issuanceDate: string;
|
|
57
|
+
credentialSubject: {
|
|
58
|
+
id: string;
|
|
59
|
+
encryptedWalletContents: {
|
|
60
|
+
protected: string;
|
|
61
|
+
recipients: Array<{
|
|
62
|
+
encrypted_key: string;
|
|
63
|
+
header: {
|
|
64
|
+
kid: string;
|
|
65
|
+
alg: string;
|
|
66
|
+
epk: {
|
|
67
|
+
kty: string;
|
|
68
|
+
crv: string;
|
|
69
|
+
x: string;
|
|
70
|
+
};
|
|
71
|
+
apu: string;
|
|
72
|
+
apv: string;
|
|
73
|
+
};
|
|
74
|
+
}>;
|
|
75
|
+
iv: string;
|
|
76
|
+
ciphertext: string;
|
|
77
|
+
tag: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export type DockDecryptedKey = {
|
|
82
|
+
controller: string;
|
|
83
|
+
type: string;
|
|
84
|
+
id: string;
|
|
85
|
+
publicKeyMultibase: string;
|
|
86
|
+
privateKeyMultibase: string;
|
|
87
|
+
privateKeyBase58: string;
|
|
88
|
+
publicKeyBase58: string;
|
|
89
|
+
'@context': string[];
|
|
90
|
+
};
|
|
91
|
+
export type DockDecryptedCredentialContent = {
|
|
92
|
+
'@context': string[];
|
|
93
|
+
id: string;
|
|
94
|
+
type: string[];
|
|
95
|
+
tags: string[];
|
|
96
|
+
correlation: string[];
|
|
97
|
+
created: string;
|
|
98
|
+
didDocument: DIDDocument;
|
|
99
|
+
didDocumentMetadata: {
|
|
100
|
+
'content-type': string;
|
|
101
|
+
};
|
|
102
|
+
didResolutionMetadata: object;
|
|
103
|
+
} | DockDecryptedKey;
|
|
104
|
+
export type DockDecryptedCredential = {
|
|
105
|
+
'@context': string[];
|
|
106
|
+
id: string;
|
|
107
|
+
type: string[];
|
|
108
|
+
status: string;
|
|
109
|
+
contents: DockDecryptedCredentialContent[];
|
|
110
|
+
};
|
|
111
|
+
export type DockListCredentialResponse = {
|
|
112
|
+
id: string;
|
|
113
|
+
issuerKey: string;
|
|
114
|
+
subjectRef: string;
|
|
115
|
+
issuerName: string;
|
|
116
|
+
type: string;
|
|
117
|
+
revocationRegistry: string;
|
|
118
|
+
revoked: boolean;
|
|
119
|
+
index: string;
|
|
120
|
+
createdAt: string;
|
|
121
|
+
expiryDate: string | null;
|
|
122
|
+
expirationDate: string | null;
|
|
123
|
+
issuanceDate: string;
|
|
124
|
+
byteSize: number;
|
|
125
|
+
persist: boolean;
|
|
126
|
+
whitelabel: string | null;
|
|
127
|
+
algorithm: string;
|
|
128
|
+
}[];
|
|
129
|
+
export type DockListCredentialRequestOptions = {
|
|
130
|
+
offset?: number;
|
|
131
|
+
limit?: number;
|
|
132
|
+
filter: {
|
|
133
|
+
id?: string;
|
|
134
|
+
issuerDid?: string;
|
|
135
|
+
type?: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/identity/providers/dock/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;I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,CAAC;IACF,qBAAqB,EAAE,MAAM,CAAC;CAC7B,GACD,gBAAgB,CAAC;AAEpB,MAAM,MAAM,uBAAuB,GAAG;IACrC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,8BAA8B,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CAClB,EAAE,CAAC;AAEJ,MAAM,MAAM,gCAAgC,GAAG;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACP,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/services/identity/providers/dock/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/identity/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/identity/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CredentialPayload, DIDDocument, IDIDManager, IIdentifier, IKey, IKeyManager, IResolver, IVerifyResult, PresentationPayload, TAgent, VerifiableCredential, VerifiablePresentation, W3CVerifiableCredential } from '@veramo/core';
|
|
2
2
|
import { type ResourcePayload, DefaultStatusList2021StatusPurposeType, TransactionResult } from '@cheqd/did-provider-cheqd';
|
|
3
3
|
import { DIDResolutionResult } from 'did-resolver';
|
|
4
|
-
import { CreateAgentRequest, VeramoAgent } from '
|
|
5
|
-
import type { VerificationOptions } from '
|
|
6
|
-
import type { CreateEncryptedBitstringOptions, CreateUnencryptedBitstringOptions, FeePaymentOptions } from '
|
|
7
|
-
import type { CredentialRequest } from '
|
|
8
|
-
import type { CheckStatusListOptions } from '
|
|
9
|
-
import type { StatusOptions } from '
|
|
10
|
-
import type { BroadcastStatusListOptions, CreateUnencryptedStatusListOptions, UpdateUnencryptedStatusListOptions, CreateEncryptedStatusListOptions, UpdateEncryptedStatusListOptions, SearchStatusListResult } from '
|
|
4
|
+
import { CreateAgentRequest, VeramoAgent } from '../../../../types/shared.js';
|
|
5
|
+
import type { VerificationOptions } from '../../../../types/shared.js';
|
|
6
|
+
import type { CreateEncryptedBitstringOptions, CreateUnencryptedBitstringOptions, FeePaymentOptions } from '../../../../types/credential-status.js';
|
|
7
|
+
import type { CredentialRequest } from '../../../../types/credential.js';
|
|
8
|
+
import type { CheckStatusListOptions } from '../../../../types/credential-status.js';
|
|
9
|
+
import type { StatusOptions } from '../../../../types/credential-status.js';
|
|
10
|
+
import type { BroadcastStatusListOptions, CreateUnencryptedStatusListOptions, UpdateUnencryptedStatusListOptions, CreateEncryptedStatusListOptions, UpdateEncryptedStatusListOptions, SearchStatusListResult } from '../../../../types/credential-status.js';
|
|
11
11
|
import type { TPublicKeyEd25519 } from '@cheqd/did-provider-cheqd';
|
|
12
12
|
import { SupportedKeyTypes } from '@veramo/utils';
|
|
13
13
|
export declare class Veramo {
|
|
@@ -23,7 +23,7 @@ export declare class Veramo {
|
|
|
23
23
|
resolveDid(agent: TAgent<IResolver>, did: string): Promise<DIDResolutionResult>;
|
|
24
24
|
resolve(didUrl: string): Promise<Response>;
|
|
25
25
|
getDid(agent: TAgent<IDIDManager>, did: string): Promise<IIdentifier>;
|
|
26
|
-
importDid(agent: TAgent<IDIDManager>, did: string, keys: Pick<IKey, 'privateKeyHex' | 'type'>[], controllerKeyId: string | undefined): Promise<IIdentifier>;
|
|
26
|
+
importDid(agent: TAgent<IDIDManager>, did: string, keys: Pick<IKey, 'privateKeyHex' | 'type'>[], controllerKeyId: string | undefined, provider?: string): Promise<IIdentifier>;
|
|
27
27
|
createResource(agent: VeramoAgent, network: string, payload: ResourcePayload, publicKeyHexs?: TPublicKeyEd25519[]): Promise<boolean>;
|
|
28
28
|
issueCredential(agent: VeramoAgent, credential: CredentialPayload, format: CredentialRequest['format'], statusListOptions: StatusOptions | null): Promise<VerifiableCredential>;
|
|
29
29
|
verifyCredential(agent: VeramoAgent, credential: string | VerifiableCredential, verificationOptions?: VerificationOptions): Promise<IVerifyResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../../src/services/identity/providers/studio/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,iBAAiB,EACjB,WAAW,EAIX,WAAW,EACX,WAAW,EACX,IAAI,EACJ,WAAW,EACX,SAAS,EACT,aAAa,EAEb,mBAAmB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,iBAAiB,CAAC;IAUvB,iBAAiB,CACtB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,EAChE,QAAQ,EAAE,MAAM,EAChB,OAAO,UAAO,EACd,YAAY,SAAK;IAsCZ,kBAAkB,CACvB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,EAChE,QAAQ,EAAE,MAAM,EAChB,OAAO,UAAO,EACd,YAAY,SAAK;IAkCZ,oBAAoB,CACzB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,EAChE,QAAQ,EAAE,MAAM,EAChB,OAAO,UAAO,EACd,YAAY,SAAK;IAkCZ,2BAA2B,CAChC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,kCAAkC;IAiE5C,yBAAyB,CAC9B,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,gCAAgC;IA2H1C,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,sBAAsB;IAW1F,gBAAgB,CACrB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,sCAAsC,GACnD,OAAO,CAAC,sBAAsB,CAAC;CAuElC"}
|
|
@@ -9,10 +9,10 @@ import { Cheqd, getResolver as CheqdDidResolver, DefaultResolverUrl, BitstringSt
|
|
|
9
9
|
import { ResourceModule } from '@cheqd/sdk';
|
|
10
10
|
import { getDidKeyResolver as KeyDidResolver } from '@veramo/did-provider-key';
|
|
11
11
|
import { Resolver } from 'did-resolver';
|
|
12
|
-
import { DefaultDidUrlPattern } from '
|
|
13
|
-
import { BitstringStatusActions, DefaultStatusActions, StatusListType } from '
|
|
14
|
-
import { BitstringStatusListEntry, MINIMAL_DENOM, VC_PROOF_FORMAT, VC_REMOVE_ORIGINAL_FIELDS, } from '
|
|
15
|
-
import { toCoin, toDefaultDkg, toMinimalDenom } from '
|
|
12
|
+
import { DefaultDidUrlPattern } from '../../../../types/shared.js';
|
|
13
|
+
import { BitstringStatusActions, DefaultStatusActions, StatusListType } from '../../../../types/credential-status.js';
|
|
14
|
+
import { BitstringStatusListEntry, MINIMAL_DENOM, VC_PROOF_FORMAT, VC_REMOVE_ORIGINAL_FIELDS, } from '../../../../types/constants.js';
|
|
15
|
+
import { toCoin, toDefaultDkg, toMinimalDenom } from '../../../../helpers/helpers.js';
|
|
16
16
|
import { jwtDecode } from 'jwt-decode';
|
|
17
17
|
import { SupportedKeyTypes } from '@veramo/utils';
|
|
18
18
|
// dynamic import to avoid circular dependency
|
|
@@ -149,7 +149,7 @@ export class Veramo {
|
|
|
149
149
|
async getDid(agent, did) {
|
|
150
150
|
return await agent.didManagerGet({ did });
|
|
151
151
|
}
|
|
152
|
-
async importDid(agent, did, keys, controllerKeyId) {
|
|
152
|
+
async importDid(agent, did, keys, controllerKeyId, provider) {
|
|
153
153
|
const [kms] = await agent.keyManagerGetKeyManagementSystems();
|
|
154
154
|
if (!did.match(DefaultDidUrlPattern)) {
|
|
155
155
|
throw new Error('Invalid DID');
|
|
@@ -163,6 +163,7 @@ export class Veramo {
|
|
|
163
163
|
}),
|
|
164
164
|
did,
|
|
165
165
|
controllerKeyId,
|
|
166
|
+
provider,
|
|
166
167
|
});
|
|
167
168
|
return identifier;
|
|
168
169
|
}
|
|
@@ -821,7 +822,7 @@ export class Veramo {
|
|
|
821
822
|
resourceType = DefaultStatusList2021ResourceTypes[statusPurpose];
|
|
822
823
|
}
|
|
823
824
|
// construct url
|
|
824
|
-
const url = new URL(`${process.env.RESOLVER_URL || DefaultResolverUrl}${did}?resourceName=${statusListName}&resourceType=${resourceType}`);
|
|
825
|
+
const url = new URL(`${process.env.RESOLVER_URL || DefaultResolverUrl}${did}?resourceName=${encodeURIComponent(statusListName)}&resourceType=${resourceType}`);
|
|
825
826
|
try {
|
|
826
827
|
// fetch resource metadata
|
|
827
828
|
const resourceMetadataVersioned = (await (await fetch(url, {
|