@sphereon/ssi-sdk.ms-request-api 0.33.1-next.3 → 0.33.1-next.68

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.js CHANGED
@@ -1,27 +1,303 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
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: ["authenticationInfo", "clientIssuanceConfig", "claims"],
29
+ additionalProperties: false
30
+ },
31
+ IMsAuthenticationClientCredentialArgs: {
32
+ type: "object",
33
+ properties: {
34
+ azClientId: {
35
+ type: "string"
36
+ },
37
+ azTenantId: {
38
+ type: "string"
39
+ },
40
+ azClientSecret: {
41
+ type: "string"
42
+ },
43
+ credentialManifestUrl: {
44
+ type: "string"
45
+ },
46
+ authority: {
47
+ type: "string"
48
+ },
49
+ region: {
50
+ type: "string"
51
+ },
52
+ scopes: {
53
+ type: "array",
54
+ items: {
55
+ type: "string"
56
+ }
57
+ },
58
+ skipCache: {
59
+ type: "boolean"
60
+ },
61
+ piiLoggingEnabled: {
62
+ type: "boolean"
63
+ },
64
+ logLevel: {
65
+ $ref: "#/components/schemas/LogLevel"
66
+ }
67
+ },
68
+ required: ["azClientId", "azTenantId", "azClientSecret"],
69
+ additionalProperties: false,
70
+ 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"
71
+ },
72
+ LogLevel: {
73
+ type: "number",
74
+ enum: [0, 1, 2, 3, 4],
75
+ description: "Log message level."
76
+ },
77
+ IClientIssuanceConfig: {
78
+ type: "object",
79
+ properties: {
80
+ authority: {
81
+ type: "string"
82
+ },
83
+ includeQRCode: {
84
+ type: "boolean"
85
+ },
86
+ registration: {
87
+ $ref: "#/components/schemas/Registration"
88
+ },
89
+ callback: {
90
+ $ref: "#/components/schemas/Callback"
91
+ },
92
+ issuance: {
93
+ $ref: "#/components/schemas/IClientIssuance"
94
+ }
95
+ },
96
+ required: ["authority", "includeQRCode", "registration", "callback", "issuance"],
97
+ additionalProperties: false
98
+ },
99
+ Registration: {
100
+ type: "object",
101
+ properties: {
102
+ clientName: {
103
+ type: "string"
104
+ }
105
+ },
106
+ required: ["clientName"],
107
+ additionalProperties: false
108
+ },
109
+ Callback: {
110
+ type: "object",
111
+ properties: {
112
+ url: {
113
+ type: "string"
114
+ },
115
+ state: {
116
+ type: "string"
117
+ },
118
+ headers: {
119
+ $ref: "#/components/schemas/Headers"
120
+ }
121
+ },
122
+ required: ["url", "state", "headers"],
123
+ additionalProperties: false
124
+ },
125
+ Headers: {
126
+ type: "object",
127
+ properties: {
128
+ apiKey: {
129
+ type: "string"
130
+ }
131
+ },
132
+ required: ["apiKey"],
133
+ additionalProperties: false
134
+ },
135
+ IClientIssuance: {
136
+ type: "object",
137
+ properties: {
138
+ type: {
139
+ type: "string"
140
+ },
141
+ manifest: {
142
+ type: "string"
143
+ },
144
+ pin: {
145
+ $ref: "#/components/schemas/Pin"
146
+ }
147
+ },
148
+ required: ["type", "manifest", "pin"],
149
+ additionalProperties: false
150
+ },
151
+ Pin: {
152
+ type: "object",
153
+ properties: {
154
+ value: {
155
+ type: "string"
156
+ },
157
+ length: {
158
+ type: "number"
159
+ }
160
+ },
161
+ required: ["value", "length"],
162
+ additionalProperties: false
163
+ },
164
+ CredentialSubject: {
165
+ type: "object"
166
+ },
167
+ IIssueRequestResponse: {
168
+ type: "object",
169
+ properties: {
170
+ id: {
171
+ type: "string"
172
+ },
173
+ requestId: {
174
+ type: "string"
175
+ },
176
+ url: {
177
+ type: "string"
178
+ },
179
+ expiry: {
180
+ type: "string",
181
+ format: "date-time"
182
+ },
183
+ pin: {
184
+ type: "string"
185
+ }
186
+ },
187
+ required: ["id", "requestId", "url", "expiry", "pin"],
188
+ additionalProperties: false
189
+ }
190
+ },
191
+ methods: {
192
+ issuanceRequestMsVc: {
193
+ description: "",
194
+ arguments: {
195
+ $ref: "#/components/schemas/IClientIssueRequest"
196
+ },
197
+ returnType: {
198
+ $ref: "#/components/schemas/IIssueRequestResponse"
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+ };
205
+ }
206
+ });
207
+
208
+ // src/agent/MsRequestApi.ts
209
+ import { assertEntraCredentialManifestUrlInCorrectRegion, determineMSAuthId, getMSClientCredentialAccessToken, newMSClientCredentialAuthenticator } from "@sphereon/ssi-sdk.ms-authenticator";
210
+
211
+ // src/IssuerUtil.ts
212
+ import { fetch } from "cross-fetch";
213
+ async function fetchIssuanceRequestMs(issuanceInfo, accessToken, msIdentityHostName) {
214
+ const requestEndpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request`;
215
+ const payload = JSON.stringify(issuanceInfo.issuanceConfig);
216
+ const fetchOptions = {
217
+ method: "POST",
218
+ body: payload,
219
+ headers: {
220
+ "Content-Type": "application/json",
221
+ "Content-Length": payload.length.toString(),
222
+ Authorization: `Bearer ${accessToken}`
223
+ }
224
+ };
225
+ const response = await fetch(requestEndpoint, fetchOptions);
226
+ return await response.json();
227
+ }
228
+ __name(fetchIssuanceRequestMs, "fetchIssuanceRequestMs");
229
+ function generatePin(digits) {
230
+ const add = 1;
231
+ let max = 12 - add;
232
+ max = Math.pow(10, digits + add);
233
+ const min = max / 10;
234
+ const number = Math.floor(Math.random() * (max - min + 1)) + min;
235
+ return ("" + number).substring(add);
236
+ }
237
+ __name(generatePin, "generatePin");
238
+
239
+ // src/agent/MsRequestApi.ts
240
+ var MsRequestApi = class {
241
+ static {
242
+ __name(this, "MsRequestApi");
243
+ }
244
+ clients = /* @__PURE__ */ new Map();
245
+ methods = {
246
+ issuanceRequestMsVc: this.issuanceRequestMsVc.bind(this)
247
+ };
248
+ /** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
249
+ async issuanceRequestMsVc(clientIssueRequest, context) {
250
+ const id = determineMSAuthId(clientIssueRequest.authenticationInfo);
251
+ if (!this.clients.has(id)) {
252
+ this.clients.set(id, await newMSClientCredentialAuthenticator(clientIssueRequest.authenticationInfo));
253
+ }
254
+ const clientInfo = this.clients.get(id);
255
+ if (!clientInfo) {
256
+ throw Error(`Could not get client from arguments for id: ${id}`);
257
+ }
258
+ const authResult = await getMSClientCredentialAccessToken(clientIssueRequest.authenticationInfo, {
259
+ confidentialClient: clientInfo.confidentialClient
260
+ });
261
+ const accessToken = authResult.accessToken;
262
+ const msIdentityHostName = await assertEntraCredentialManifestUrlInCorrectRegion(clientIssueRequest.authenticationInfo);
263
+ if (!clientIssueRequest.authenticationInfo.azTenantId) {
264
+ throw new Error("azTenantId is missing.");
7
265
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
266
+ if (clientIssueRequest.clientIssuanceConfig.issuance.pin) {
267
+ clientIssueRequest.clientIssuanceConfig.issuance.pin.value = generatePin(clientIssueRequest.clientIssuanceConfig.issuance.pin.length);
268
+ }
269
+ const issuance = {
270
+ type: clientIssueRequest.clientIssuanceConfig.issuance.type,
271
+ manifest: clientIssueRequest.clientIssuanceConfig.issuance.manifest,
272
+ pin: clientIssueRequest.clientIssuanceConfig.issuance.pin,
273
+ claims: clientIssueRequest.claims
274
+ };
275
+ const issuanceConfig = {
276
+ authority: clientIssueRequest.clientIssuanceConfig.authority,
277
+ includeQRCode: clientIssueRequest.clientIssuanceConfig.includeQRCode,
278
+ registration: clientIssueRequest.clientIssuanceConfig.registration,
279
+ callback: clientIssueRequest.clientIssuanceConfig.callback,
280
+ issuance
281
+ };
282
+ const issueRequest = {
283
+ authenticationInfo: clientIssueRequest.authenticationInfo,
284
+ issuanceConfig
285
+ };
286
+ const resp = await fetchIssuanceRequestMs(issueRequest, accessToken, msIdentityHostName);
287
+ resp.id = issueRequest.issuanceConfig.callback.state;
288
+ if (issueRequest.issuanceConfig.issuance.pin) {
289
+ resp.pin = issueRequest.issuanceConfig.issuance.pin.value;
290
+ }
291
+ return resp;
292
+ }
293
+ };
294
+
295
+ // src/index.ts
296
+ var schema = require_plugin_schema();
297
+ export {
298
+ MsRequestApi,
299
+ fetchIssuanceRequestMs,
300
+ generatePin,
301
+ schema
15
302
  };
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
303
  //# 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\": [\"authenticationInfo\", \"clientIssuanceConfig\", \"claims\"],\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\": [\"azClientId\", \"azTenantId\", \"azClientSecret\"],\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\": [0, 1, 2, 3, 4],\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\": [\"authority\", \"includeQRCode\", \"registration\", \"callback\", \"issuance\"],\n \"additionalProperties\": false\n },\n \"Registration\": {\n \"type\": \"object\",\n \"properties\": {\n \"clientName\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"clientName\"],\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\": [\"url\", \"state\", \"headers\"],\n \"additionalProperties\": false\n },\n \"Headers\": {\n \"type\": \"object\",\n \"properties\": {\n \"apiKey\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"apiKey\"],\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\": [\"type\", \"manifest\", \"pin\"],\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\": [\"value\", \"length\"],\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\": [\"id\", \"requestId\", \"url\", \"expiry\", \"pin\"],\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}\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;AAAA,YACT,qBAAuB;AAAA,cACrB,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,oBAAsB;AAAA,kBACpB,MAAQ;AAAA,gBACV;AAAA,gBACA,sBAAwB;AAAA,kBACtB,MAAQ;AAAA,gBACV;AAAA,gBACA,QAAU;AAAA,kBACR,MAAQ;AAAA,gBACV;AAAA,cACF;AAAA,cACA,UAAY,CAAC,sBAAsB,wBAAwB,QAAQ;AAAA,cACnE,sBAAwB;AAAA,YAC1B;AAAA,YACA,uCAAyC;AAAA,cACvC,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,YAAc;AAAA,kBACZ,MAAQ;AAAA,gBACV;AAAA,gBACA,YAAc;AAAA,kBACZ,MAAQ;AAAA,gBACV;AAAA,gBACA,gBAAkB;AAAA,kBAChB,MAAQ;AAAA,gBACV;AAAA,gBACA,uBAAyB;AAAA,kBACvB,MAAQ;AAAA,gBACV;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,QAAU;AAAA,kBACR,MAAQ;AAAA,gBACV;AAAA,gBACA,QAAU;AAAA,kBACR,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,gBACF;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,gBACV;AAAA,gBACA,mBAAqB;AAAA,kBACnB,MAAQ;AAAA,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Id","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.1-next.3+fd1a6fba",
3
+ "version": "0.33.1-next.68+b6c8b366",
4
4
  "source": "src/index.ts",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
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": "tsc --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.1-next.3+fd1a6fba",
30
+ "@sphereon/ssi-sdk.ms-authenticator": "0.33.1-next.68+b6c8b366",
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.1-next.3+fd1a6fba",
24
- "@sphereon/ssi-sdk.credential-store": "0.33.1-next.3+fd1a6fba",
35
+ "@sphereon/ssi-sdk.agent-config": "0.33.1-next.68+b6c8b366",
36
+ "@sphereon/ssi-sdk.credential-store": "0.33.1-next.68+b6c8b366",
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
- "ts-jest": "^27.1.5",
39
- "typeorm": "^0.3.21",
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
- "nx": {},
69
- "gitHead": "fd1a6fba306a83a73ff7c531db87fa207dbf436d"
77
+ "gitHead": "b6c8b36636fa3777494f55860d6a75f2e5a5611e"
70
78
  }
@@ -15,11 +15,8 @@
15
15
  "$ref": "#/components/schemas/CredentialSubject"
16
16
  }
17
17
  },
18
- "required": [
19
- "authenticationInfo",
20
- "clientIssuanceConfig",
21
- "claims"
22
- ]
18
+ "required": ["authenticationInfo", "clientIssuanceConfig", "claims"],
19
+ "additionalProperties": false
23
20
  },
24
21
  "IMsAuthenticationClientCredentialArgs": {
25
22
  "type": "object",
@@ -58,22 +55,13 @@
58
55
  "$ref": "#/components/schemas/LogLevel"
59
56
  }
60
57
  },
61
- "required": [
62
- "azClientId",
63
- "azTenantId",
64
- "azClientSecret"
65
- ],
58
+ "required": ["azClientId", "azTenantId", "azClientSecret"],
59
+ "additionalProperties": false,
66
60
  "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
61
  },
68
62
  "LogLevel": {
69
63
  "type": "number",
70
- "enum": [
71
- 0,
72
- 1,
73
- 2,
74
- 3,
75
- 4
76
- ],
64
+ "enum": [0, 1, 2, 3, 4],
77
65
  "description": "Log message level."
78
66
  },
79
67
  "IClientIssuanceConfig": {
@@ -95,13 +83,8 @@
95
83
  "$ref": "#/components/schemas/IClientIssuance"
96
84
  }
97
85
  },
98
- "required": [
99
- "authority",
100
- "includeQRCode",
101
- "registration",
102
- "callback",
103
- "issuance"
104
- ]
86
+ "required": ["authority", "includeQRCode", "registration", "callback", "issuance"],
87
+ "additionalProperties": false
105
88
  },
106
89
  "Registration": {
107
90
  "type": "object",
@@ -110,9 +93,8 @@
110
93
  "type": "string"
111
94
  }
112
95
  },
113
- "required": [
114
- "clientName"
115
- ]
96
+ "required": ["clientName"],
97
+ "additionalProperties": false
116
98
  },
117
99
  "Callback": {
118
100
  "type": "object",
@@ -127,11 +109,8 @@
127
109
  "$ref": "#/components/schemas/Headers"
128
110
  }
129
111
  },
130
- "required": [
131
- "url",
132
- "state",
133
- "headers"
134
- ]
112
+ "required": ["url", "state", "headers"],
113
+ "additionalProperties": false
135
114
  },
136
115
  "Headers": {
137
116
  "type": "object",
@@ -140,9 +119,8 @@
140
119
  "type": "string"
141
120
  }
142
121
  },
143
- "required": [
144
- "apiKey"
145
- ]
122
+ "required": ["apiKey"],
123
+ "additionalProperties": false
146
124
  },
147
125
  "IClientIssuance": {
148
126
  "type": "object",
@@ -157,11 +135,8 @@
157
135
  "$ref": "#/components/schemas/Pin"
158
136
  }
159
137
  },
160
- "required": [
161
- "type",
162
- "manifest",
163
- "pin"
164
- ]
138
+ "required": ["type", "manifest", "pin"],
139
+ "additionalProperties": false
165
140
  },
166
141
  "Pin": {
167
142
  "type": "object",
@@ -173,10 +148,8 @@
173
148
  "type": "number"
174
149
  }
175
150
  },
176
- "required": [
177
- "value",
178
- "length"
179
- ]
151
+ "required": ["value", "length"],
152
+ "additionalProperties": false
180
153
  },
181
154
  "CredentialSubject": {
182
155
  "type": "object"
@@ -201,13 +174,8 @@
201
174
  "type": "string"
202
175
  }
203
176
  },
204
- "required": [
205
- "id",
206
- "requestId",
207
- "url",
208
- "expiry",
209
- "pin"
210
- ]
177
+ "required": ["id", "requestId", "url", "expiry", "pin"],
178
+ "additionalProperties": false
211
179
  }
212
180
  },
213
181
  "methods": {
@@ -223,4 +191,4 @@
223
191
  }
224
192
  }
225
193
  }
226
- }
194
+ }
@@ -1,4 +0,0 @@
1
- import { IIssueRequest, IIssueRequestResponse } from './types/IMsRequestApi';
2
- export declare function fetchIssuanceRequestMs(issuanceInfo: IIssueRequest, accessToken: string, msIdentityHostName: string): Promise<IIssueRequestResponse>;
3
- export declare function generatePin(digits: number): string;
4
- //# sourceMappingURL=IssuerUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IssuerUtil.d.ts","sourceRoot":"","sources":["../src/IssuerUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAG5E,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,qBAAqB,CAAC,CAehC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,UAOzC"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.fetchIssuanceRequestMs = fetchIssuanceRequestMs;
13
- exports.generatePin = generatePin;
14
- const cross_fetch_1 = require("cross-fetch");
15
- function fetchIssuanceRequestMs(issuanceInfo, accessToken, msIdentityHostName) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const requestEndpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request`;
18
- const payload = JSON.stringify(issuanceInfo.issuanceConfig);
19
- const fetchOptions = {
20
- method: 'POST',
21
- body: payload,
22
- headers: {
23
- 'Content-Type': 'application/json',
24
- 'Content-Length': payload.length.toString(),
25
- Authorization: `Bearer ${accessToken}`,
26
- },
27
- };
28
- const response = yield (0, cross_fetch_1.fetch)(requestEndpoint, fetchOptions);
29
- return yield response.json();
30
- });
31
- }
32
- function generatePin(digits) {
33
- const add = 1;
34
- let max = 12 - add;
35
- max = Math.pow(10, digits + add);
36
- const min = max / 10; // Math.pow(10, n) basically
37
- const number = Math.floor(Math.random() * (max - min + 1)) + min;
38
- return ('' + number).substring(add);
39
- }
40
- //# sourceMappingURL=IssuerUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IssuerUtil.js","sourceRoot":"","sources":["../src/IssuerUtil.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,wDAmBC;AAED,kCAOC;AA7BD,6CAAmC;AACnC,SAAsB,sBAAsB,CAC1C,YAA2B,EAC3B,WAAmB,EACnB,kBAA0B;;QAE1B,MAAM,eAAe,GAAG,GAAG,kBAAkB,GAAG,YAAY,CAAC,kBAAkB,CAAC,UAAU,gCAAgC,CAAA;QAE1H,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;QAC3D,MAAM,YAAY,GAAG;YACnB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO;YACb,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC3C,aAAa,EAAE,UAAU,WAAW,EAAE;aACvC;SACF,CAAA;QACD,MAAM,QAAQ,GAAG,MAAM,IAAA,mBAAK,EAAC,eAAe,EAAE,YAAY,CAAC,CAAA;QAC3D,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC9B,CAAC;CAAA;AAED,SAAgB,WAAW,CAAC,MAAc;IACxC,MAAM,GAAG,GAAG,CAAC,CAAA;IACb,IAAI,GAAG,GAAG,EAAE,GAAG,GAAG,CAAA;IAClB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAA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