@sphereon/ssi-sdk.ms-request-api 0.33.1-next.2 → 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.cjs +323 -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 +300 -24
- package/dist/index.js.map +1 -1
- package/package.json +25 -17
- package/plugin.schema.json +20 -52
- 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
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IAgentPlugin } from '@veramo/core';
|
|
2
|
-
import { IMsRequestApi } from '../types/IMsRequestApi';
|
|
3
|
-
/**
|
|
4
|
-
* {@inheritDoc IMsRequestApi}
|
|
5
|
-
*/
|
|
6
|
-
export declare class MsRequestApi implements IAgentPlugin {
|
|
7
|
-
private clients;
|
|
8
|
-
readonly methods: IMsRequestApi;
|
|
9
|
-
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
10
|
-
private issuanceRequestMsVc;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=MsRequestApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MsRequestApi.d.ts","sourceRoot":"","sources":["../../src/agent/MsRequestApi.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EAIL,aAAa,EAId,MAAM,wBAAwB,CAAA;AAE/B;;GAEG;AACH,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,OAAO,CAA2F;IAE1G,QAAQ,CAAC,OAAO,EAAE,aAAa,CAE9B;IAED,sDAAsD;YACxC,mBAAmB;CAyDlC"}
|
|
@@ -1,80 +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.MsRequestApi = void 0;
|
|
13
|
-
const ssi_sdk_ms_authenticator_1 = require("@sphereon/ssi-sdk.ms-authenticator");
|
|
14
|
-
const IssuerUtil_1 = require("../IssuerUtil");
|
|
15
|
-
/**
|
|
16
|
-
* {@inheritDoc IMsRequestApi}
|
|
17
|
-
*/
|
|
18
|
-
class MsRequestApi {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.clients = new Map();
|
|
21
|
-
this.methods = {
|
|
22
|
-
issuanceRequestMsVc: this.issuanceRequestMsVc.bind(this),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
26
|
-
issuanceRequestMsVc(clientIssueRequest, context) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const id = (0, ssi_sdk_ms_authenticator_1.determineMSAuthId)(clientIssueRequest.authenticationInfo);
|
|
29
|
-
if (!this.clients.has(id)) {
|
|
30
|
-
this.clients.set(id, yield (0, ssi_sdk_ms_authenticator_1.newMSClientCredentialAuthenticator)(clientIssueRequest.authenticationInfo));
|
|
31
|
-
}
|
|
32
|
-
const clientInfo = this.clients.get(id);
|
|
33
|
-
if (!clientInfo) {
|
|
34
|
-
throw Error(`Could not get client from arguments for id: ${id}`);
|
|
35
|
-
}
|
|
36
|
-
const authResult = yield (0, ssi_sdk_ms_authenticator_1.getMSClientCredentialAccessToken)(clientIssueRequest.authenticationInfo, {
|
|
37
|
-
confidentialClient: clientInfo.confidentialClient,
|
|
38
|
-
});
|
|
39
|
-
const accessToken = authResult.accessToken;
|
|
40
|
-
const msIdentityHostName = yield (0, ssi_sdk_ms_authenticator_1.assertEntraCredentialManifestUrlInCorrectRegion)(clientIssueRequest.authenticationInfo);
|
|
41
|
-
// Config Request and App Config File should be a parameter to this function
|
|
42
|
-
if (!clientIssueRequest.authenticationInfo.azTenantId) {
|
|
43
|
-
throw new Error('azTenantId is missing.');
|
|
44
|
-
}
|
|
45
|
-
// check if pin is required, if found make sure we set a new random pin
|
|
46
|
-
// pincode is only used when the payload contains claim value pairs which results in an IDTokenhint
|
|
47
|
-
if (clientIssueRequest.clientIssuanceConfig.issuance.pin) {
|
|
48
|
-
clientIssueRequest.clientIssuanceConfig.issuance.pin.value = (0, IssuerUtil_1.generatePin)(clientIssueRequest.clientIssuanceConfig.issuance.pin.length);
|
|
49
|
-
}
|
|
50
|
-
const issuance = {
|
|
51
|
-
type: clientIssueRequest.clientIssuanceConfig.issuance.type,
|
|
52
|
-
manifest: clientIssueRequest.clientIssuanceConfig.issuance.manifest,
|
|
53
|
-
pin: clientIssueRequest.clientIssuanceConfig.issuance.pin,
|
|
54
|
-
claims: clientIssueRequest.claims,
|
|
55
|
-
};
|
|
56
|
-
const issuanceConfig = {
|
|
57
|
-
authority: clientIssueRequest.clientIssuanceConfig.authority,
|
|
58
|
-
includeQRCode: clientIssueRequest.clientIssuanceConfig.includeQRCode,
|
|
59
|
-
registration: clientIssueRequest.clientIssuanceConfig.registration,
|
|
60
|
-
callback: clientIssueRequest.clientIssuanceConfig.callback,
|
|
61
|
-
issuance: issuance,
|
|
62
|
-
};
|
|
63
|
-
const issueRequest = {
|
|
64
|
-
authenticationInfo: clientIssueRequest.authenticationInfo,
|
|
65
|
-
issuanceConfig: issuanceConfig,
|
|
66
|
-
};
|
|
67
|
-
const resp = yield (0, IssuerUtil_1.fetchIssuanceRequestMs)(issueRequest, accessToken, msIdentityHostName);
|
|
68
|
-
// 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
|
|
69
|
-
// it has scanned the QR code. If the payload requested the VC Request service to create the QR code that is returned as well
|
|
70
|
-
// the javascript in the UI will use that QR code to display it on the screen to the user.
|
|
71
|
-
resp.id = issueRequest.issuanceConfig.callback.state; // add session id so browser can pull status
|
|
72
|
-
if (issueRequest.issuanceConfig.issuance.pin) {
|
|
73
|
-
resp.pin = issueRequest.issuanceConfig.issuance.pin.value; // add pin code so browser can display it
|
|
74
|
-
}
|
|
75
|
-
return resp;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.MsRequestApi = MsRequestApi;
|
|
80
|
-
//# sourceMappingURL=MsRequestApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MsRequestApi.js","sourceRoot":"","sources":["../../src/agent/MsRequestApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAM2C;AAE3C,8CAAmE;AAWnE;;GAEG;AACH,MAAa,YAAY;IAAzB;QACU,YAAO,GAA6C,IAAI,GAAG,EAAuC,CAAA;QAEjG,YAAO,GAAkB;YAChC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,CAA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ELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA"}
|
package/dist/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.52.1"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { IAgentContext, IPluginMethodMap } from '@veramo/core';
|
|
2
|
-
import { IMsAuthenticationClientCredentialArgs } from '@sphereon/ssi-sdk.ms-authenticator';
|
|
3
|
-
export interface IMsRequestApi extends IPluginMethodMap {
|
|
4
|
-
issuanceRequestMsVc(clientIssueRequest: IClientIssueRequest, context: IRequiredContext): Promise<IIssueRequestResponse>;
|
|
5
|
-
}
|
|
6
|
-
export interface IClientIssueRequest {
|
|
7
|
-
authenticationInfo: IMsAuthenticationClientCredentialArgs;
|
|
8
|
-
clientIssuanceConfig: IClientIssuanceConfig;
|
|
9
|
-
claims: CredentialSubject;
|
|
10
|
-
}
|
|
11
|
-
export interface IClientIssuanceConfig {
|
|
12
|
-
authority: string;
|
|
13
|
-
includeQRCode: boolean;
|
|
14
|
-
registration: Registration;
|
|
15
|
-
callback: Callback;
|
|
16
|
-
issuance: IClientIssuance;
|
|
17
|
-
}
|
|
18
|
-
export interface IClientIssuance {
|
|
19
|
-
type: string;
|
|
20
|
-
manifest: string;
|
|
21
|
-
pin: Pin;
|
|
22
|
-
}
|
|
23
|
-
export interface IIssueRequest {
|
|
24
|
-
authenticationInfo: IMsAuthenticationClientCredentialArgs;
|
|
25
|
-
issuanceConfig: IssuanceConfig;
|
|
26
|
-
}
|
|
27
|
-
export interface IIssueRequestResponse {
|
|
28
|
-
id: string;
|
|
29
|
-
requestId: string;
|
|
30
|
-
url: string;
|
|
31
|
-
expiry: Date;
|
|
32
|
-
pin: string;
|
|
33
|
-
}
|
|
34
|
-
export interface Registration {
|
|
35
|
-
clientName: string;
|
|
36
|
-
}
|
|
37
|
-
export interface Headers {
|
|
38
|
-
apiKey: string;
|
|
39
|
-
}
|
|
40
|
-
export interface Callback {
|
|
41
|
-
url: string;
|
|
42
|
-
state: string;
|
|
43
|
-
headers: Headers;
|
|
44
|
-
}
|
|
45
|
-
export interface Pin {
|
|
46
|
-
value: string;
|
|
47
|
-
length: number;
|
|
48
|
-
}
|
|
49
|
-
export type CredentialSubject = {
|
|
50
|
-
[x: string]: any;
|
|
51
|
-
};
|
|
52
|
-
export interface Issuance {
|
|
53
|
-
type: string;
|
|
54
|
-
manifest: string;
|
|
55
|
-
pin: Pin;
|
|
56
|
-
claims: CredentialSubject;
|
|
57
|
-
}
|
|
58
|
-
export interface IssuanceConfig {
|
|
59
|
-
authority: string;
|
|
60
|
-
includeQRCode: boolean;
|
|
61
|
-
registration: Registration;
|
|
62
|
-
callback: Callback;
|
|
63
|
-
issuance: Issuance;
|
|
64
|
-
}
|
|
65
|
-
export type IRequiredContext = IAgentContext<Record<string, never>>;
|
|
66
|
-
//# sourceMappingURL=IMsRequestApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IMsRequestApi.d.ts","sourceRoot":"","sources":["../../src/types/IMsRequestApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAA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