@sphereon/ssi-sdk.ms-request-api 0.33.0 → 0.33.1-feature.jose.vcdm.55
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.cjs +364 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{ssi-sdk.ms-request-api.d.ts → index.d.cts} +86 -103
- package/dist/index.d.ts +82 -5
- package/dist/index.js +341 -24
- package/dist/index.js.map +1 -1
- package/package.json +25 -17
- package/plugin.schema.json +17 -8
- package/dist/IssuerUtil.d.ts +0 -4
- package/dist/IssuerUtil.d.ts.map +0 -1
- package/dist/IssuerUtil.js +0 -40
- package/dist/IssuerUtil.js.map +0 -1
- package/dist/agent/MsRequestApi.d.ts +0 -12
- package/dist/agent/MsRequestApi.d.ts.map +0 -1
- package/dist/agent/MsRequestApi.js +0 -80
- package/dist/agent/MsRequestApi.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/IMsRequestApi.d.ts +0 -66
- package/dist/types/IMsRequestApi.d.ts.map +0 -1
- package/dist/types/IMsRequestApi.js +0 -3
- package/dist/types/IMsRequestApi.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,86 @@
|
|
|
1
|
+
import { IPluginMethodMap, IAgentContext, IAgentPlugin } from '@veramo/core';
|
|
2
|
+
import { IMsAuthenticationClientCredentialArgs } from '@sphereon/ssi-sdk.ms-authenticator';
|
|
3
|
+
|
|
4
|
+
interface IMsRequestApi extends IPluginMethodMap {
|
|
5
|
+
issuanceRequestMsVc(clientIssueRequest: IClientIssueRequest, context: IRequiredContext): Promise<IIssueRequestResponse>;
|
|
6
|
+
}
|
|
7
|
+
interface IClientIssueRequest {
|
|
8
|
+
authenticationInfo: IMsAuthenticationClientCredentialArgs;
|
|
9
|
+
clientIssuanceConfig: IClientIssuanceConfig;
|
|
10
|
+
claims: CredentialSubject;
|
|
11
|
+
}
|
|
12
|
+
interface IClientIssuanceConfig {
|
|
13
|
+
authority: string;
|
|
14
|
+
includeQRCode: boolean;
|
|
15
|
+
registration: Registration;
|
|
16
|
+
callback: Callback;
|
|
17
|
+
issuance: IClientIssuance;
|
|
18
|
+
}
|
|
19
|
+
interface IClientIssuance {
|
|
20
|
+
type: string;
|
|
21
|
+
manifest: string;
|
|
22
|
+
pin: Pin;
|
|
23
|
+
}
|
|
24
|
+
interface IIssueRequest {
|
|
25
|
+
authenticationInfo: IMsAuthenticationClientCredentialArgs;
|
|
26
|
+
issuanceConfig: IssuanceConfig;
|
|
27
|
+
}
|
|
28
|
+
interface IIssueRequestResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
requestId: string;
|
|
31
|
+
url: string;
|
|
32
|
+
expiry: Date;
|
|
33
|
+
pin: string;
|
|
34
|
+
}
|
|
35
|
+
interface Registration {
|
|
36
|
+
clientName: string;
|
|
37
|
+
}
|
|
38
|
+
interface Headers {
|
|
39
|
+
apiKey: string;
|
|
40
|
+
}
|
|
41
|
+
interface Callback {
|
|
42
|
+
url: string;
|
|
43
|
+
state: string;
|
|
44
|
+
headers: Headers;
|
|
45
|
+
}
|
|
46
|
+
interface Pin {
|
|
47
|
+
value: string;
|
|
48
|
+
length: number;
|
|
49
|
+
}
|
|
50
|
+
type CredentialSubject = {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
};
|
|
53
|
+
interface Issuance {
|
|
54
|
+
type: string;
|
|
55
|
+
manifest: string;
|
|
56
|
+
pin: Pin;
|
|
57
|
+
claims: CredentialSubject;
|
|
58
|
+
}
|
|
59
|
+
interface IssuanceConfig {
|
|
60
|
+
authority: string;
|
|
61
|
+
includeQRCode: boolean;
|
|
62
|
+
registration: Registration;
|
|
63
|
+
callback: Callback;
|
|
64
|
+
issuance: Issuance;
|
|
65
|
+
}
|
|
66
|
+
type IRequiredContext = IAgentContext<Record<string, never>>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* {@inheritDoc IMsRequestApi}
|
|
70
|
+
*/
|
|
71
|
+
declare class MsRequestApi implements IAgentPlugin {
|
|
72
|
+
private clients;
|
|
73
|
+
readonly methods: IMsRequestApi;
|
|
74
|
+
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
75
|
+
private issuanceRequestMsVc;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare function fetchIssuanceRequestMs(issuanceInfo: IIssueRequest, accessToken: string, msIdentityHostName: string): Promise<IIssueRequestResponse>;
|
|
79
|
+
declare function generatePin(digits: number): string;
|
|
80
|
+
|
|
1
81
|
/**
|
|
2
82
|
* @public
|
|
3
83
|
*/
|
|
4
84
|
declare const schema: any;
|
|
5
|
-
|
|
6
|
-
export { MsRequestApi
|
|
7
|
-
export * from './types/IMsRequestApi';
|
|
8
|
-
export * from './IssuerUtil';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
85
|
+
|
|
86
|
+
export { type Callback, type CredentialSubject, type Headers, type IClientIssuance, type IClientIssuanceConfig, type IClientIssueRequest, type IIssueRequest, type IIssueRequestResponse, type IMsRequestApi, type IRequiredContext, type Issuance, type IssuanceConfig, MsRequestApi, type Pin, type Registration, fetchIssuanceRequestMs, generatePin, schema };
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,344 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
5
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// plugin.schema.json
|
|
9
|
+
var require_plugin_schema = __commonJS({
|
|
10
|
+
"plugin.schema.json"(exports, module) {
|
|
11
|
+
module.exports = {
|
|
12
|
+
IMsRequestApi: {
|
|
13
|
+
components: {
|
|
14
|
+
schemas: {
|
|
15
|
+
IClientIssueRequest: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
authenticationInfo: {
|
|
19
|
+
$ref: "#/components/schemas/IMsAuthenticationClientCredentialArgs"
|
|
20
|
+
},
|
|
21
|
+
clientIssuanceConfig: {
|
|
22
|
+
$ref: "#/components/schemas/IClientIssuanceConfig"
|
|
23
|
+
},
|
|
24
|
+
claims: {
|
|
25
|
+
$ref: "#/components/schemas/CredentialSubject"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
required: [
|
|
29
|
+
"authenticationInfo",
|
|
30
|
+
"clientIssuanceConfig",
|
|
31
|
+
"claims"
|
|
32
|
+
],
|
|
33
|
+
additionalProperties: false
|
|
34
|
+
},
|
|
35
|
+
IMsAuthenticationClientCredentialArgs: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
azClientId: {
|
|
39
|
+
type: "string"
|
|
40
|
+
},
|
|
41
|
+
azTenantId: {
|
|
42
|
+
type: "string"
|
|
43
|
+
},
|
|
44
|
+
azClientSecret: {
|
|
45
|
+
type: "string"
|
|
46
|
+
},
|
|
47
|
+
credentialManifestUrl: {
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
authority: {
|
|
51
|
+
type: "string"
|
|
52
|
+
},
|
|
53
|
+
region: {
|
|
54
|
+
type: "string"
|
|
55
|
+
},
|
|
56
|
+
scopes: {
|
|
57
|
+
type: "array",
|
|
58
|
+
items: {
|
|
59
|
+
type: "string"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
skipCache: {
|
|
63
|
+
type: "boolean"
|
|
64
|
+
},
|
|
65
|
+
piiLoggingEnabled: {
|
|
66
|
+
type: "boolean"
|
|
67
|
+
},
|
|
68
|
+
logLevel: {
|
|
69
|
+
$ref: "#/components/schemas/LogLevel"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
required: [
|
|
73
|
+
"azClientId",
|
|
74
|
+
"azTenantId",
|
|
75
|
+
"azClientSecret"
|
|
76
|
+
],
|
|
77
|
+
additionalProperties: false,
|
|
78
|
+
description: "azClientId: clientId of the application you're trying to login azClientSecret: secret of the application you're trying to login azTenantId: your MS Azure tenantId credentialManifestUrl: url of your credential manifest. usually in following format: https://beta.eu.did.msidentity.com/v1.0/<tenant_id>/verifiableCredential/contracts/<verifiable_credential_schema> authority: optional. if not provided, we'll use the azClientId to create the Tenanted format if provided should be one of these two formats: - Tenanted: https://login.microsoftonline.com/{tenant}/, where {tenant} is either the GUID representing the tenant ID or a domain name associated with the tenant. - Work and school accounts: https://login.microsoftonline.com/organizations/. region?: if present will use the provided, if not will make a request to determine the region scopes?: scopes that you want to access via this authentication skipCache?: whether to skip cache piiLoggingEnabled?: if not provided defaults to false logLevel?: can be one of these values: Error = 0, Warning = 1, Info = 2, Verbose = 3, Trace = 4 if not provided defaults to LogLevel.Verbose"
|
|
79
|
+
},
|
|
80
|
+
LogLevel: {
|
|
81
|
+
type: "number",
|
|
82
|
+
enum: [
|
|
83
|
+
0,
|
|
84
|
+
1,
|
|
85
|
+
2,
|
|
86
|
+
3,
|
|
87
|
+
4
|
|
88
|
+
],
|
|
89
|
+
description: "Log message level."
|
|
90
|
+
},
|
|
91
|
+
IClientIssuanceConfig: {
|
|
92
|
+
type: "object",
|
|
93
|
+
properties: {
|
|
94
|
+
authority: {
|
|
95
|
+
type: "string"
|
|
96
|
+
},
|
|
97
|
+
includeQRCode: {
|
|
98
|
+
type: "boolean"
|
|
99
|
+
},
|
|
100
|
+
registration: {
|
|
101
|
+
$ref: "#/components/schemas/Registration"
|
|
102
|
+
},
|
|
103
|
+
callback: {
|
|
104
|
+
$ref: "#/components/schemas/Callback"
|
|
105
|
+
},
|
|
106
|
+
issuance: {
|
|
107
|
+
$ref: "#/components/schemas/IClientIssuance"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
required: [
|
|
111
|
+
"authority",
|
|
112
|
+
"includeQRCode",
|
|
113
|
+
"registration",
|
|
114
|
+
"callback",
|
|
115
|
+
"issuance"
|
|
116
|
+
],
|
|
117
|
+
additionalProperties: false
|
|
118
|
+
},
|
|
119
|
+
Registration: {
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
clientName: {
|
|
123
|
+
type: "string"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
required: [
|
|
127
|
+
"clientName"
|
|
128
|
+
],
|
|
129
|
+
additionalProperties: false
|
|
130
|
+
},
|
|
131
|
+
Callback: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: {
|
|
134
|
+
url: {
|
|
135
|
+
type: "string"
|
|
136
|
+
},
|
|
137
|
+
state: {
|
|
138
|
+
type: "string"
|
|
139
|
+
},
|
|
140
|
+
headers: {
|
|
141
|
+
$ref: "#/components/schemas/Headers"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
required: [
|
|
145
|
+
"url",
|
|
146
|
+
"state",
|
|
147
|
+
"headers"
|
|
148
|
+
],
|
|
149
|
+
additionalProperties: false
|
|
150
|
+
},
|
|
151
|
+
Headers: {
|
|
152
|
+
type: "object",
|
|
153
|
+
properties: {
|
|
154
|
+
apiKey: {
|
|
155
|
+
type: "string"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
required: [
|
|
159
|
+
"apiKey"
|
|
160
|
+
],
|
|
161
|
+
additionalProperties: false
|
|
162
|
+
},
|
|
163
|
+
IClientIssuance: {
|
|
164
|
+
type: "object",
|
|
165
|
+
properties: {
|
|
166
|
+
type: {
|
|
167
|
+
type: "string"
|
|
168
|
+
},
|
|
169
|
+
manifest: {
|
|
170
|
+
type: "string"
|
|
171
|
+
},
|
|
172
|
+
pin: {
|
|
173
|
+
$ref: "#/components/schemas/Pin"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
required: [
|
|
177
|
+
"type",
|
|
178
|
+
"manifest",
|
|
179
|
+
"pin"
|
|
180
|
+
],
|
|
181
|
+
additionalProperties: false
|
|
182
|
+
},
|
|
183
|
+
Pin: {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties: {
|
|
186
|
+
value: {
|
|
187
|
+
type: "string"
|
|
188
|
+
},
|
|
189
|
+
length: {
|
|
190
|
+
type: "number"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
required: [
|
|
194
|
+
"value",
|
|
195
|
+
"length"
|
|
196
|
+
],
|
|
197
|
+
additionalProperties: false
|
|
198
|
+
},
|
|
199
|
+
CredentialSubject: {
|
|
200
|
+
type: "object"
|
|
201
|
+
},
|
|
202
|
+
IIssueRequestResponse: {
|
|
203
|
+
type: "object",
|
|
204
|
+
properties: {
|
|
205
|
+
id: {
|
|
206
|
+
type: "string"
|
|
207
|
+
},
|
|
208
|
+
requestId: {
|
|
209
|
+
type: "string"
|
|
210
|
+
},
|
|
211
|
+
url: {
|
|
212
|
+
type: "string"
|
|
213
|
+
},
|
|
214
|
+
expiry: {
|
|
215
|
+
type: "string",
|
|
216
|
+
format: "date-time"
|
|
217
|
+
},
|
|
218
|
+
pin: {
|
|
219
|
+
type: "string"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
required: [
|
|
223
|
+
"id",
|
|
224
|
+
"requestId",
|
|
225
|
+
"url",
|
|
226
|
+
"expiry",
|
|
227
|
+
"pin"
|
|
228
|
+
],
|
|
229
|
+
additionalProperties: false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
methods: {
|
|
233
|
+
issuanceRequestMsVc: {
|
|
234
|
+
description: "",
|
|
235
|
+
arguments: {
|
|
236
|
+
$ref: "#/components/schemas/IClientIssueRequest"
|
|
237
|
+
},
|
|
238
|
+
returnType: {
|
|
239
|
+
$ref: "#/components/schemas/IIssueRequestResponse"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// src/agent/MsRequestApi.ts
|
|
250
|
+
import { assertEntraCredentialManifestUrlInCorrectRegion, determineMSAuthId, getMSClientCredentialAccessToken, newMSClientCredentialAuthenticator } from "@sphereon/ssi-sdk.ms-authenticator";
|
|
251
|
+
|
|
252
|
+
// src/IssuerUtil.ts
|
|
253
|
+
import { fetch } from "cross-fetch";
|
|
254
|
+
async function fetchIssuanceRequestMs(issuanceInfo, accessToken, msIdentityHostName) {
|
|
255
|
+
const requestEndpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request`;
|
|
256
|
+
const payload = JSON.stringify(issuanceInfo.issuanceConfig);
|
|
257
|
+
const fetchOptions = {
|
|
258
|
+
method: "POST",
|
|
259
|
+
body: payload,
|
|
260
|
+
headers: {
|
|
261
|
+
"Content-Type": "application/json",
|
|
262
|
+
"Content-Length": payload.length.toString(),
|
|
263
|
+
Authorization: `Bearer ${accessToken}`
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const response = await fetch(requestEndpoint, fetchOptions);
|
|
267
|
+
return await response.json();
|
|
268
|
+
}
|
|
269
|
+
__name(fetchIssuanceRequestMs, "fetchIssuanceRequestMs");
|
|
270
|
+
function generatePin(digits) {
|
|
271
|
+
const add = 1;
|
|
272
|
+
let max = 12 - add;
|
|
273
|
+
max = Math.pow(10, digits + add);
|
|
274
|
+
const min = max / 10;
|
|
275
|
+
const number = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
276
|
+
return ("" + number).substring(add);
|
|
277
|
+
}
|
|
278
|
+
__name(generatePin, "generatePin");
|
|
279
|
+
|
|
280
|
+
// src/agent/MsRequestApi.ts
|
|
281
|
+
var MsRequestApi = class {
|
|
282
|
+
static {
|
|
283
|
+
__name(this, "MsRequestApi");
|
|
284
|
+
}
|
|
285
|
+
clients = /* @__PURE__ */ new Map();
|
|
286
|
+
methods = {
|
|
287
|
+
issuanceRequestMsVc: this.issuanceRequestMsVc.bind(this)
|
|
288
|
+
};
|
|
289
|
+
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
290
|
+
async issuanceRequestMsVc(clientIssueRequest, context) {
|
|
291
|
+
const id = determineMSAuthId(clientIssueRequest.authenticationInfo);
|
|
292
|
+
if (!this.clients.has(id)) {
|
|
293
|
+
this.clients.set(id, await newMSClientCredentialAuthenticator(clientIssueRequest.authenticationInfo));
|
|
294
|
+
}
|
|
295
|
+
const clientInfo = this.clients.get(id);
|
|
296
|
+
if (!clientInfo) {
|
|
297
|
+
throw Error(`Could not get client from arguments for id: ${id}`);
|
|
298
|
+
}
|
|
299
|
+
const authResult = await getMSClientCredentialAccessToken(clientIssueRequest.authenticationInfo, {
|
|
300
|
+
confidentialClient: clientInfo.confidentialClient
|
|
301
|
+
});
|
|
302
|
+
const accessToken = authResult.accessToken;
|
|
303
|
+
const msIdentityHostName = await assertEntraCredentialManifestUrlInCorrectRegion(clientIssueRequest.authenticationInfo);
|
|
304
|
+
if (!clientIssueRequest.authenticationInfo.azTenantId) {
|
|
305
|
+
throw new Error("azTenantId is missing.");
|
|
7
306
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
307
|
+
if (clientIssueRequest.clientIssuanceConfig.issuance.pin) {
|
|
308
|
+
clientIssueRequest.clientIssuanceConfig.issuance.pin.value = generatePin(clientIssueRequest.clientIssuanceConfig.issuance.pin.length);
|
|
309
|
+
}
|
|
310
|
+
const issuance = {
|
|
311
|
+
type: clientIssueRequest.clientIssuanceConfig.issuance.type,
|
|
312
|
+
manifest: clientIssueRequest.clientIssuanceConfig.issuance.manifest,
|
|
313
|
+
pin: clientIssueRequest.clientIssuanceConfig.issuance.pin,
|
|
314
|
+
claims: clientIssueRequest.claims
|
|
315
|
+
};
|
|
316
|
+
const issuanceConfig = {
|
|
317
|
+
authority: clientIssueRequest.clientIssuanceConfig.authority,
|
|
318
|
+
includeQRCode: clientIssueRequest.clientIssuanceConfig.includeQRCode,
|
|
319
|
+
registration: clientIssueRequest.clientIssuanceConfig.registration,
|
|
320
|
+
callback: clientIssueRequest.clientIssuanceConfig.callback,
|
|
321
|
+
issuance
|
|
322
|
+
};
|
|
323
|
+
const issueRequest = {
|
|
324
|
+
authenticationInfo: clientIssueRequest.authenticationInfo,
|
|
325
|
+
issuanceConfig
|
|
326
|
+
};
|
|
327
|
+
const resp = await fetchIssuanceRequestMs(issueRequest, accessToken, msIdentityHostName);
|
|
328
|
+
resp.id = issueRequest.issuanceConfig.callback.state;
|
|
329
|
+
if (issueRequest.issuanceConfig.issuance.pin) {
|
|
330
|
+
resp.pin = issueRequest.issuanceConfig.issuance.pin.value;
|
|
331
|
+
}
|
|
332
|
+
return resp;
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// src/index.ts
|
|
337
|
+
var schema = require_plugin_schema();
|
|
338
|
+
export {
|
|
339
|
+
MsRequestApi,
|
|
340
|
+
fetchIssuanceRequestMs,
|
|
341
|
+
generatePin,
|
|
342
|
+
schema
|
|
15
343
|
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.MsRequestApi = exports.schema = void 0;
|
|
18
|
-
/**
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
const schema = require('../plugin.schema.json');
|
|
22
|
-
exports.schema = schema;
|
|
23
|
-
var MsRequestApi_1 = require("./agent/MsRequestApi");
|
|
24
|
-
Object.defineProperty(exports, "MsRequestApi", { enumerable: true, get: function () { return MsRequestApi_1.MsRequestApi; } });
|
|
25
|
-
__exportStar(require("./types/IMsRequestApi"), exports);
|
|
26
|
-
__exportStar(require("./IssuerUtil"), exports);
|
|
27
344
|
//# 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;;GAEG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM;AACf,qDAAmD;AAA1C,4GAAA,YAAY,OAAA;AACrB,wDAAqC;AACrC,+CAA4B"}
|
|
1
|
+
{"version":3,"sources":["../plugin.schema.json","../src/agent/MsRequestApi.ts","../src/IssuerUtil.ts","../src/index.ts"],"sourcesContent":["{\n \"IMsRequestApi\": {\n \"components\": {\n \"schemas\": {\n \"IClientIssueRequest\": {\n \"type\": \"object\",\n \"properties\": {\n \"authenticationInfo\": {\n \"$ref\": \"#/components/schemas/IMsAuthenticationClientCredentialArgs\"\n },\n \"clientIssuanceConfig\": {\n \"$ref\": \"#/components/schemas/IClientIssuanceConfig\"\n },\n \"claims\": {\n \"$ref\": \"#/components/schemas/CredentialSubject\"\n }\n },\n \"required\": [\n \"authenticationInfo\",\n \"clientIssuanceConfig\",\n \"claims\"\n ],\n \"additionalProperties\": false\n },\n \"IMsAuthenticationClientCredentialArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"azClientId\": {\n \"type\": \"string\"\n },\n \"azTenantId\": {\n \"type\": \"string\"\n },\n \"azClientSecret\": {\n \"type\": \"string\"\n },\n \"credentialManifestUrl\": {\n \"type\": \"string\"\n },\n \"authority\": {\n \"type\": \"string\"\n },\n \"region\": {\n \"type\": \"string\"\n },\n \"scopes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"skipCache\": {\n \"type\": \"boolean\"\n },\n \"piiLoggingEnabled\": {\n \"type\": \"boolean\"\n },\n \"logLevel\": {\n \"$ref\": \"#/components/schemas/LogLevel\"\n }\n },\n \"required\": [\n \"azClientId\",\n \"azTenantId\",\n \"azClientSecret\"\n ],\n \"additionalProperties\": false,\n \"description\": \"azClientId: clientId of the application you're trying to login azClientSecret: secret of the application you're trying to login azTenantId: your MS Azure tenantId credentialManifestUrl: url of your credential manifest. usually in following format: https://beta.eu.did.msidentity.com/v1.0/<tenant_id>/verifiableCredential/contracts/<verifiable_credential_schema> authority: optional. if not provided, we'll use the azClientId to create the Tenanted format if provided should be one of these two formats: - Tenanted: https://login.microsoftonline.com/{tenant}/, where {tenant} is either the GUID representing the tenant ID or a domain name associated with the tenant. - Work and school accounts: https://login.microsoftonline.com/organizations/. region?: if present will use the provided, if not will make a request to determine the region scopes?: scopes that you want to access via this authentication skipCache?: whether to skip cache piiLoggingEnabled?: if not provided defaults to false logLevel?: can be one of these values: Error = 0, Warning = 1, Info = 2, Verbose = 3, Trace = 4 if not provided defaults to LogLevel.Verbose\"\n },\n \"LogLevel\": {\n \"type\": \"number\",\n \"enum\": [\n 0,\n 1,\n 2,\n 3,\n 4\n ],\n \"description\": \"Log message level.\"\n },\n \"IClientIssuanceConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"authority\": {\n \"type\": \"string\"\n },\n \"includeQRCode\": {\n \"type\": \"boolean\"\n },\n \"registration\": {\n \"$ref\": \"#/components/schemas/Registration\"\n },\n \"callback\": {\n \"$ref\": \"#/components/schemas/Callback\"\n },\n \"issuance\": {\n \"$ref\": \"#/components/schemas/IClientIssuance\"\n }\n },\n \"required\": [\n \"authority\",\n \"includeQRCode\",\n \"registration\",\n \"callback\",\n \"issuance\"\n ],\n \"additionalProperties\": false\n },\n \"Registration\": {\n \"type\": \"object\",\n \"properties\": {\n \"clientName\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"clientName\"\n ],\n \"additionalProperties\": false\n },\n \"Callback\": {\n \"type\": \"object\",\n \"properties\": {\n \"url\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"headers\": {\n \"$ref\": \"#/components/schemas/Headers\"\n }\n },\n \"required\": [\n \"url\",\n \"state\",\n \"headers\"\n ],\n \"additionalProperties\": false\n },\n \"Headers\": {\n \"type\": \"object\",\n \"properties\": {\n \"apiKey\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"apiKey\"\n ],\n \"additionalProperties\": false\n },\n \"IClientIssuance\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\"\n },\n \"manifest\": {\n \"type\": \"string\"\n },\n \"pin\": {\n \"$ref\": \"#/components/schemas/Pin\"\n }\n },\n \"required\": [\n \"type\",\n \"manifest\",\n \"pin\"\n ],\n \"additionalProperties\": false\n },\n \"Pin\": {\n \"type\": \"object\",\n \"properties\": {\n \"value\": {\n \"type\": \"string\"\n },\n \"length\": {\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"value\",\n \"length\"\n ],\n \"additionalProperties\": false\n },\n \"CredentialSubject\": {\n \"type\": \"object\"\n },\n \"IIssueRequestResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"requestId\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"type\": \"string\"\n },\n \"expiry\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"pin\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"requestId\",\n \"url\",\n \"expiry\",\n \"pin\"\n ],\n \"additionalProperties\": false\n }\n },\n \"methods\": {\n \"issuanceRequestMsVc\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IClientIssueRequest\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IIssueRequestResponse\"\n }\n }\n }\n }\n }\n}","import {\n assertEntraCredentialManifestUrlInCorrectRegion,\n IMSClientCredentialAuthInfo,\n determineMSAuthId,\n getMSClientCredentialAccessToken,\n newMSClientCredentialAuthenticator,\n} from '@sphereon/ssi-sdk.ms-authenticator'\nimport { IAgentPlugin } from '@veramo/core'\nimport { fetchIssuanceRequestMs, generatePin } from '../IssuerUtil'\nimport {\n IClientIssueRequest,\n IIssueRequest,\n IIssueRequestResponse,\n IMsRequestApi,\n IRequiredContext,\n Issuance,\n IssuanceConfig,\n} from '../types/IMsRequestApi'\n\n/**\n * {@inheritDoc IMsRequestApi}\n */\nexport class MsRequestApi implements IAgentPlugin {\n private clients: Map<string, IMSClientCredentialAuthInfo> = new Map<string, IMSClientCredentialAuthInfo>()\n\n readonly methods: IMsRequestApi = {\n issuanceRequestMsVc: this.issuanceRequestMsVc.bind(this),\n }\n\n /** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */\n private async issuanceRequestMsVc(clientIssueRequest: IClientIssueRequest, context: IRequiredContext): Promise<IIssueRequestResponse> {\n const id = determineMSAuthId(clientIssueRequest.authenticationInfo)\n if (!this.clients.has(id)) {\n this.clients.set(id, await newMSClientCredentialAuthenticator(clientIssueRequest.authenticationInfo))\n }\n const clientInfo = this.clients.get(id)\n if (!clientInfo) {\n throw Error(`Could not get client from arguments for id: ${id}`)\n }\n const authResult = await getMSClientCredentialAccessToken(clientIssueRequest.authenticationInfo, {\n confidentialClient: clientInfo.confidentialClient,\n })\n const accessToken = authResult.accessToken\n\n const msIdentityHostName = await assertEntraCredentialManifestUrlInCorrectRegion(clientIssueRequest.authenticationInfo)\n\n // Config Request and App Config File should be a parameter to this function\n if (!clientIssueRequest.authenticationInfo.azTenantId) {\n throw new Error('azTenantId is missing.')\n }\n\n // check if pin is required, if found make sure we set a new random pin\n // pincode is only used when the payload contains claim value pairs which results in an IDTokenhint\n if (clientIssueRequest.clientIssuanceConfig.issuance.pin) {\n clientIssueRequest.clientIssuanceConfig.issuance.pin.value = generatePin(clientIssueRequest.clientIssuanceConfig.issuance.pin.length)\n }\n\n const issuance: Issuance = {\n type: clientIssueRequest.clientIssuanceConfig.issuance.type,\n manifest: clientIssueRequest.clientIssuanceConfig.issuance.manifest,\n pin: clientIssueRequest.clientIssuanceConfig.issuance.pin,\n claims: clientIssueRequest.claims,\n }\n\n const issuanceConfig: IssuanceConfig = {\n authority: clientIssueRequest.clientIssuanceConfig.authority,\n includeQRCode: clientIssueRequest.clientIssuanceConfig.includeQRCode,\n registration: clientIssueRequest.clientIssuanceConfig.registration,\n callback: clientIssueRequest.clientIssuanceConfig.callback,\n issuance: issuance,\n }\n const issueRequest: IIssueRequest = {\n authenticationInfo: clientIssueRequest.authenticationInfo,\n issuanceConfig: issuanceConfig,\n }\n\n const resp = await fetchIssuanceRequestMs(issueRequest, accessToken, msIdentityHostName)\n\n // the response from the VC Request API call is returned to the caller (the UI). It contains the URI to the request which Authenticator can download after\n // it has scanned the QR code. If the payload requested the VC Request service to create the QR code that is returned as well\n // the javascript in the UI will use that QR code to display it on the screen to the user.\n resp.id = issueRequest.issuanceConfig.callback.state // add session id so browser can pull status\n if (issueRequest.issuanceConfig.issuance.pin) {\n resp.pin = issueRequest.issuanceConfig.issuance.pin.value // add pin code so browser can display it\n }\n return resp\n }\n}\n","import { IIssueRequest, IIssueRequestResponse } from './types/IMsRequestApi'\n\nimport { fetch } from 'cross-fetch'\nexport async function fetchIssuanceRequestMs(\n issuanceInfo: IIssueRequest,\n accessToken: string,\n msIdentityHostName: string,\n): Promise<IIssueRequestResponse> {\n const requestEndpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request`\n\n const payload = JSON.stringify(issuanceInfo.issuanceConfig)\n const fetchOptions = {\n method: 'POST',\n body: payload,\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': payload.length.toString(),\n Authorization: `Bearer ${accessToken}`,\n },\n }\n const response = await fetch(requestEndpoint, fetchOptions)\n return await response.json()\n}\n\nexport function generatePin(digits: number) {\n const add = 1\n let max = 12 - add\n max = Math.pow(10, digits + add)\n const min = max / 10 // Math.pow(10, n) basically\n const number = Math.floor(Math.random() * (max - min + 1)) + min\n return ('' + number).substring(add)\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { MsRequestApi } from './agent/MsRequestApi'\nexport * from './types/IMsRequestApi'\nexport * from './IssuerUtil'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,eAAiB;AAAA,QACf,YAAc;AAAA,UACZ,SAAW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S,oBAAoBL,WAAWK;IACjC,CAAA;AACA,UAAMC,cAAcH,WAAWG;AAE/B,UAAMC,qBAAqB,MAAMC,gDAAgDhB,mBAAmBI,kBAAkB;AAGtH,QAAI,CAACJ,mBAAmBI,mBAAmBa,YAAY;AACrD,YAAM,IAAIP,MAAM,wBAAA;IAClB;AAIA,QAAIV,mBAAmBkB,qBAAqBC,SAASC,KAAK;AACxDpB,yBAAmBkB,qBAAqBC,SAASC,IAAIC,QAAQC,YAAYtB,mBAAmBkB,qBAAqBC,SAASC,IAAIG,MAAM;IACtI;AAEA,UAAMJ,WAAqB;MACzBK,MAAMxB,mBAAmBkB,qBAAqBC,SAASK;MACvDC,UAAUzB,mBAAmBkB,qBAAqBC,SAASM;MAC3DL,KAAKpB,mBAAmBkB,qBAAqBC,SAASC;MACtDM,QAAQ1B,mBAAmB0B;IAC7B;AAEA,UAAMC,iBAAiC;MACrCC,WAAW5B,mBAAmBkB,qBAAqBU;MACnDC,eAAe7B,mBAAmBkB,qBAAqBW;MACvDC,cAAc9B,mBAAmBkB,qBAAqBY;MACtDC,UAAU/B,mBAAmBkB,qBAAqBa;MAClDZ;IACF;AACA,UAAMa,eAA8B;MAClC5B,oBAAoBJ,mBAAmBI;MACvCuB;IACF;AAEA,UAAMM,OAAO,MAAMC,uBAAuBF,cAAclB,aAAaC,kBAAAA;AAKrEkB,SAAK/B,KAAK8B,aAAaL,eAAeI,SAASI;AAC/C,QAAIH,aAAaL,eAAeR,SAASC,KAAK;AAC5Ca,WAAKb,MAAMY,aAAaL,eAAeR,SAASC,IAAIC;IACtD;AACA,WAAOY;EACT;AACF;;;AEpFA,IAAMG,SAASC;","names":["assertEntraCredentialManifestUrlInCorrectRegion","determineMSAuthId","getMSClientCredentialAccessToken","newMSClientCredentialAuthenticator","fetch","fetchIssuanceRequestMs","issuanceInfo","accessToken","msIdentityHostName","requestEndpoint","authenticationInfo","azTenantId","payload","JSON","stringify","issuanceConfig","fetchOptions","method","body","headers","length","toString","Authorization","response","fetch","json","generatePin","digits","add","max","Math","pow","min","number","floor","random","substring","MsRequestApi","clients","Map","methods","issuanceRequestMsVc","bind","clientIssueRequest","context","id","determineMSAuthId","authenticationInfo","has","set","newMSClientCredentialAuthenticator","clientInfo","get","Error","authResult","getMSClientCredentialAccessToken","confidentialClient","accessToken","msIdentityHostName","assertEntraCredentialManifestUrlInCorrectRegion","azTenantId","clientIssuanceConfig","issuance","pin","value","generatePin","length","type","manifest","claims","issuanceConfig","authority","includeQRCode","registration","callback","issueRequest","resp","fetchIssuanceRequestMs","state","schema","require"]}
|
package/package.json
CHANGED
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.ms-request-api",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.1-feature.jose.vcdm.55+6f02f6f8",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"react-native": "./dist/index.js",
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"veramo": {
|
|
8
21
|
"pluginInterfaces": {
|
|
9
22
|
"IMsRequestApi": "./src/types/IMsRequestApi.ts"
|
|
10
23
|
}
|
|
11
24
|
},
|
|
12
25
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
-
"build:clean": "tsc --build --clean && tsc --build",
|
|
26
|
+
"build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
|
|
15
27
|
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
|
|
16
28
|
},
|
|
17
29
|
"dependencies": {
|
|
18
|
-
"@sphereon/ssi-sdk.ms-authenticator": "0.33.
|
|
30
|
+
"@sphereon/ssi-sdk.ms-authenticator": "0.33.1-feature.jose.vcdm.55+6f02f6f8",
|
|
19
31
|
"@veramo/core": "4.2.0",
|
|
20
32
|
"cross-fetch": "^3.1.8"
|
|
21
33
|
},
|
|
22
34
|
"devDependencies": {
|
|
23
|
-
"@sphereon/ssi-sdk.agent-config": "0.33.
|
|
24
|
-
"@sphereon/ssi-sdk.credential-store": "0.33.
|
|
35
|
+
"@sphereon/ssi-sdk.agent-config": "0.33.1-feature.jose.vcdm.55+6f02f6f8",
|
|
36
|
+
"@sphereon/ssi-sdk.credential-store": "0.33.1-feature.jose.vcdm.55+6f02f6f8",
|
|
25
37
|
"@types/express": "^4.17.21",
|
|
26
38
|
"@types/express-session": "^1.18.0",
|
|
27
|
-
"@types/jest": "^27.5.2",
|
|
28
39
|
"@types/node": "^20.17.1",
|
|
29
40
|
"@types/uuid": "^9.0.8",
|
|
30
41
|
"@veramo/data-store": "4.2.0",
|
|
@@ -32,17 +43,15 @@
|
|
|
32
43
|
"@veramo/remote-server": "4.2.0",
|
|
33
44
|
"express": "^4.19.2",
|
|
34
45
|
"express-session": "^1.18.0",
|
|
35
|
-
"jest": "^27.5.1",
|
|
36
46
|
"prettier": "^2.8.8",
|
|
37
47
|
"sqlite3": "^5.1.7",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"typescript": "5.4.2",
|
|
48
|
+
"typeorm": "0.3.20",
|
|
49
|
+
"typescript": "5.8.3",
|
|
41
50
|
"uuid": "^9.0.1"
|
|
42
51
|
},
|
|
43
52
|
"files": [
|
|
44
|
-
"dist
|
|
45
|
-
"src
|
|
53
|
+
"dist",
|
|
54
|
+
"src",
|
|
46
55
|
"README.md",
|
|
47
56
|
"plugin.schema.json",
|
|
48
57
|
"LICENSE"
|
|
@@ -65,6 +74,5 @@
|
|
|
65
74
|
"API",
|
|
66
75
|
"Issuer"
|
|
67
76
|
],
|
|
68
|
-
"
|
|
69
|
-
"gitHead": "c575bdd6642bda761881f0152e0a70ddc82d7f61"
|
|
77
|
+
"gitHead": "6f02f6f83679198268c6e1ea956be24cc1017234"
|
|
70
78
|
}
|
package/plugin.schema.json
CHANGED
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"authenticationInfo",
|
|
20
20
|
"clientIssuanceConfig",
|
|
21
21
|
"claims"
|
|
22
|
-
]
|
|
22
|
+
],
|
|
23
|
+
"additionalProperties": false
|
|
23
24
|
},
|
|
24
25
|
"IMsAuthenticationClientCredentialArgs": {
|
|
25
26
|
"type": "object",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"azTenantId",
|
|
64
65
|
"azClientSecret"
|
|
65
66
|
],
|
|
67
|
+
"additionalProperties": false,
|
|
66
68
|
"description": "azClientId: clientId of the application you're trying to login azClientSecret: secret of the application you're trying to login azTenantId: your MS Azure tenantId credentialManifestUrl: url of your credential manifest. usually in following format: https://beta.eu.did.msidentity.com/v1.0/<tenant_id>/verifiableCredential/contracts/<verifiable_credential_schema> authority: optional. if not provided, we'll use the azClientId to create the Tenanted format if provided should be one of these two formats: - Tenanted: https://login.microsoftonline.com/{tenant}/, where {tenant} is either the GUID representing the tenant ID or a domain name associated with the tenant. - Work and school accounts: https://login.microsoftonline.com/organizations/. region?: if present will use the provided, if not will make a request to determine the region scopes?: scopes that you want to access via this authentication skipCache?: whether to skip cache piiLoggingEnabled?: if not provided defaults to false logLevel?: can be one of these values: Error = 0, Warning = 1, Info = 2, Verbose = 3, Trace = 4 if not provided defaults to LogLevel.Verbose"
|
|
67
69
|
},
|
|
68
70
|
"LogLevel": {
|
|
@@ -101,7 +103,8 @@
|
|
|
101
103
|
"registration",
|
|
102
104
|
"callback",
|
|
103
105
|
"issuance"
|
|
104
|
-
]
|
|
106
|
+
],
|
|
107
|
+
"additionalProperties": false
|
|
105
108
|
},
|
|
106
109
|
"Registration": {
|
|
107
110
|
"type": "object",
|
|
@@ -112,7 +115,8 @@
|
|
|
112
115
|
},
|
|
113
116
|
"required": [
|
|
114
117
|
"clientName"
|
|
115
|
-
]
|
|
118
|
+
],
|
|
119
|
+
"additionalProperties": false
|
|
116
120
|
},
|
|
117
121
|
"Callback": {
|
|
118
122
|
"type": "object",
|
|
@@ -131,7 +135,8 @@
|
|
|
131
135
|
"url",
|
|
132
136
|
"state",
|
|
133
137
|
"headers"
|
|
134
|
-
]
|
|
138
|
+
],
|
|
139
|
+
"additionalProperties": false
|
|
135
140
|
},
|
|
136
141
|
"Headers": {
|
|
137
142
|
"type": "object",
|
|
@@ -142,7 +147,8 @@
|
|
|
142
147
|
},
|
|
143
148
|
"required": [
|
|
144
149
|
"apiKey"
|
|
145
|
-
]
|
|
150
|
+
],
|
|
151
|
+
"additionalProperties": false
|
|
146
152
|
},
|
|
147
153
|
"IClientIssuance": {
|
|
148
154
|
"type": "object",
|
|
@@ -161,7 +167,8 @@
|
|
|
161
167
|
"type",
|
|
162
168
|
"manifest",
|
|
163
169
|
"pin"
|
|
164
|
-
]
|
|
170
|
+
],
|
|
171
|
+
"additionalProperties": false
|
|
165
172
|
},
|
|
166
173
|
"Pin": {
|
|
167
174
|
"type": "object",
|
|
@@ -176,7 +183,8 @@
|
|
|
176
183
|
"required": [
|
|
177
184
|
"value",
|
|
178
185
|
"length"
|
|
179
|
-
]
|
|
186
|
+
],
|
|
187
|
+
"additionalProperties": false
|
|
180
188
|
},
|
|
181
189
|
"CredentialSubject": {
|
|
182
190
|
"type": "object"
|
|
@@ -207,7 +215,8 @@
|
|
|
207
215
|
"url",
|
|
208
216
|
"expiry",
|
|
209
217
|
"pin"
|
|
210
|
-
]
|
|
218
|
+
],
|
|
219
|
+
"additionalProperties": false
|
|
211
220
|
}
|
|
212
221
|
},
|
|
213
222
|
"methods": {
|