@sphereon/ssi-sdk.ms-request-api 0.11.1-unstable.151 → 0.11.1-unstable.153
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/IssuerUtil.d.ts +4 -0
- package/dist/IssuerUtil.d.ts.map +1 -0
- package/dist/IssuerUtil.js +40 -0
- package/dist/IssuerUtil.js.map +1 -0
- package/dist/agent/MsRequestApi.d.ts +11 -0
- package/dist/agent/MsRequestApi.d.ts.map +1 -0
- package/dist/agent/MsRequestApi.js +68 -0
- package/dist/agent/MsRequestApi.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/ssi-sdk.ms-request-api.d.ts +102 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/IMsRequestApi.d.ts +66 -0
- package/dist/types/IMsRequestApi.d.ts.map +1 -0
- package/dist/types/IMsRequestApi.js +3 -0
- package/dist/types/IMsRequestApi.js.map +1 -0
- package/package.json +4 -4
- package/plugin.schema.json +53 -11
|
@@ -0,0 +1,4 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.generatePin = exports.fetchIssuanceRequestMs = void 0;
|
|
13
|
+
const cross_fetch_1 = require("cross-fetch");
|
|
14
|
+
function fetchIssuanceRequestMs(issuanceInfo, accessToken, msIdentityHostName) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var client_api_request_endpoint = `${msIdentityHostName}${issuanceInfo.authenticationInfo.azTenantId}/verifiablecredentials/request`;
|
|
17
|
+
var payload = JSON.stringify(issuanceInfo.issuanceConfig);
|
|
18
|
+
const fetchOptions = {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: payload,
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'Content-Length': payload.length.toString(),
|
|
24
|
+
Authorization: `Bearer ${accessToken}`,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const response = yield (0, cross_fetch_1.fetch)(client_api_request_endpoint, fetchOptions);
|
|
28
|
+
return yield response.json();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.fetchIssuanceRequestMs = fetchIssuanceRequestMs;
|
|
32
|
+
function generatePin(digits) {
|
|
33
|
+
var add = 1, max = 12 - add;
|
|
34
|
+
max = Math.pow(10, digits + add);
|
|
35
|
+
var min = max / 10; // Math.pow(10, n) basically
|
|
36
|
+
var number = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
37
|
+
return ('' + number).substring(add);
|
|
38
|
+
}
|
|
39
|
+
exports.generatePin = generatePin;
|
|
40
|
+
//# sourceMappingURL=IssuerUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IssuerUtil.js","sourceRoot":"","sources":["../src/IssuerUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6CAAmC;AACnC,SAAsB,sBAAsB,CAC1C,YAA2B,EAC3B,WAAmB,EACnB,kBAA0B;;QAE1B,IAAI,2BAA2B,GAAG,GAAG,kBAAkB,GAAG,YAAY,CAAC,kBAAkB,CAAC,UAAU,gCAAgC,CAAA;QAEpI,IAAI,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;QACzD,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,2BAA2B,EAAE,YAAY,CAAC,CAAA;QACvE,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC9B,CAAC;CAAA;AAnBD,wDAmBC;AAED,SAAgB,WAAW,CAAC,MAAc;IACxC,IAAI,GAAG,GAAG,CAAC,EACT,GAAG,GAAG,EAAE,GAAG,GAAG,CAAA;IAChB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC,CAAA;IAChC,IAAI,GAAG,GAAG,GAAG,GAAG,EAAE,CAAA,CAAC,4BAA4B;IAC/C,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;IAC9D,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;AACrC,CAAC;AAPD,kCAOC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
readonly methods: IMsRequestApi;
|
|
8
|
+
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
9
|
+
private issuanceRequestMsVc;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=MsRequestApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsRequestApi.d.ts","sourceRoot":"","sources":["../../src/agent/MsRequestApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAIL,aAAa,EAId,MAAM,wBAAwB,CAAA;AAG/B;;GAEG;AACH,qBAAa,YAAa,YAAW,YAAY;IAC/C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAE9B;IAED,sDAAsD;YACxC,mBAAmB;CA8ClC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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.methods = {
|
|
21
|
+
issuanceRequestMsVc: this.issuanceRequestMsVc.bind(this),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
25
|
+
issuanceRequestMsVc(clientIssueRequest, context) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var accessToken = yield (0, ssi_sdk_ms_authenticator_1.ClientCredentialAuthenticator)(clientIssueRequest.authenticationInfo);
|
|
28
|
+
var msIdentityHostName = yield (0, ssi_sdk_ms_authenticator_1.checkMsIdentityHostname)(clientIssueRequest.authenticationInfo);
|
|
29
|
+
// Config Request and App Config File should be a parameter to this function
|
|
30
|
+
if (!clientIssueRequest.authenticationInfo.azTenantId) {
|
|
31
|
+
throw new Error('azTenantId is missing.');
|
|
32
|
+
}
|
|
33
|
+
// check if pin is required, if found make sure we set a new random pin
|
|
34
|
+
// pincode is only used when the payload contains claim value pairs which results in an IDTokenhint
|
|
35
|
+
if (clientIssueRequest.clientIssuanceConfig.issuance.pin) {
|
|
36
|
+
clientIssueRequest.clientIssuanceConfig.issuance.pin.value = (0, IssuerUtil_1.generatePin)(clientIssueRequest.clientIssuanceConfig.issuance.pin.length);
|
|
37
|
+
}
|
|
38
|
+
var issuance = {
|
|
39
|
+
type: clientIssueRequest.clientIssuanceConfig.issuance.type,
|
|
40
|
+
manifest: clientIssueRequest.clientIssuanceConfig.issuance.manifest,
|
|
41
|
+
pin: clientIssueRequest.clientIssuanceConfig.issuance.pin,
|
|
42
|
+
claims: clientIssueRequest.claims,
|
|
43
|
+
};
|
|
44
|
+
var issuanceConfig = {
|
|
45
|
+
authority: clientIssueRequest.clientIssuanceConfig.authority,
|
|
46
|
+
includeQRCode: clientIssueRequest.clientIssuanceConfig.includeQRCode,
|
|
47
|
+
registration: clientIssueRequest.clientIssuanceConfig.registration,
|
|
48
|
+
callback: clientIssueRequest.clientIssuanceConfig.callback,
|
|
49
|
+
issuance: issuance,
|
|
50
|
+
};
|
|
51
|
+
var issueRequest = {
|
|
52
|
+
authenticationInfo: clientIssueRequest.authenticationInfo,
|
|
53
|
+
issuanceConfig: issuanceConfig,
|
|
54
|
+
};
|
|
55
|
+
var resp = yield (0, IssuerUtil_1.fetchIssuanceRequestMs)(issueRequest, accessToken, msIdentityHostName);
|
|
56
|
+
// 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
|
|
57
|
+
// it has scanned the QR code. If the payload requested the VC Request service to create the QR code that is returned as well
|
|
58
|
+
// the javascript in the UI will use that QR code to display it on the screen to the user.
|
|
59
|
+
resp.id = issueRequest.issuanceConfig.callback.state; // add session id so browser can pull status
|
|
60
|
+
if (issueRequest.issuanceConfig.issuance.pin) {
|
|
61
|
+
resp.pin = issueRequest.issuanceConfig.issuance.pin.value; // add pin code so browser can display it
|
|
62
|
+
}
|
|
63
|
+
return resp;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.MsRequestApi = MsRequestApi;
|
|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27 @@
|
|
|
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]; } };
|
|
7
|
+
}
|
|
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);
|
|
15
|
+
};
|
|
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
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { IAgentContext } from '@veramo/core';
|
|
2
|
+
import { IAgentPlugin } from '@veramo/core';
|
|
3
|
+
import { IMsAuthenticationClientCredentialArgs } from '@sphereon/ssi-sdk.ms-authenticator';
|
|
4
|
+
import { IPluginMethodMap } from '@veramo/core';
|
|
5
|
+
|
|
6
|
+
export declare interface Callback {
|
|
7
|
+
url: string;
|
|
8
|
+
state: string;
|
|
9
|
+
headers: Headers_2;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare type CredentialSubject = {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export declare function fetchIssuanceRequestMs(issuanceInfo: IIssueRequest, accessToken: string, msIdentityHostName: string): Promise<IIssueRequestResponse>;
|
|
17
|
+
|
|
18
|
+
export declare function generatePin(digits: number): string;
|
|
19
|
+
|
|
20
|
+
declare interface Headers_2 {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
}
|
|
23
|
+
export { Headers_2 as Headers }
|
|
24
|
+
|
|
25
|
+
export declare interface IClientIssuance {
|
|
26
|
+
type: string;
|
|
27
|
+
manifest: string;
|
|
28
|
+
pin: Pin;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare interface IClientIssuanceConfig {
|
|
32
|
+
authority: string;
|
|
33
|
+
includeQRCode: boolean;
|
|
34
|
+
registration: Registration;
|
|
35
|
+
callback: Callback;
|
|
36
|
+
issuance: IClientIssuance;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare interface IClientIssueRequest {
|
|
40
|
+
authenticationInfo: IMsAuthenticationClientCredentialArgs;
|
|
41
|
+
clientIssuanceConfig: IClientIssuanceConfig;
|
|
42
|
+
claims: CredentialSubject;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare interface IIssueRequest {
|
|
46
|
+
authenticationInfo: IMsAuthenticationClientCredentialArgs;
|
|
47
|
+
issuanceConfig: IssuanceConfig;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare interface IIssueRequestResponse {
|
|
51
|
+
id: string;
|
|
52
|
+
requestId: string;
|
|
53
|
+
url: string;
|
|
54
|
+
expiry: Date;
|
|
55
|
+
pin: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export declare interface IMsRequestApi extends IPluginMethodMap {
|
|
59
|
+
issuanceRequestMsVc(clientIssueRequest: IClientIssueRequest, context: IRequiredContext): Promise<IIssueRequestResponse>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare type IRequiredContext = IAgentContext<Record<string, never>>;
|
|
63
|
+
|
|
64
|
+
export declare interface Issuance {
|
|
65
|
+
type: string;
|
|
66
|
+
manifest: string;
|
|
67
|
+
pin: Pin;
|
|
68
|
+
claims: CredentialSubject;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export declare interface IssuanceConfig {
|
|
72
|
+
authority: string;
|
|
73
|
+
includeQRCode: boolean;
|
|
74
|
+
registration: Registration;
|
|
75
|
+
callback: Callback;
|
|
76
|
+
issuance: Issuance;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* {@inheritDoc IMsRequestApi}
|
|
81
|
+
*/
|
|
82
|
+
export declare class MsRequestApi implements IAgentPlugin {
|
|
83
|
+
readonly methods: IMsRequestApi;
|
|
84
|
+
/** {@inheritDoc IMsRequestApi.issuanceRequestMsVc} */
|
|
85
|
+
private issuanceRequestMsVc;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export declare interface Pin {
|
|
89
|
+
value: string;
|
|
90
|
+
length: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export declare interface Registration {
|
|
94
|
+
clientName: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
export declare const schema: any;
|
|
101
|
+
|
|
102
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
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.33.8"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMsRequestApi.d.ts","sourceRoot":"","sources":["../../src/types/IMsRequestApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAA;AAE1F,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,mBAAmB,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;CACxH;AAED,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,qCAAqC,CAAA;IACzD,oBAAoB,EAAE,qBAAqB,CAAA;IAC3C,MAAM,EAAE,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B,aAAa,EAAE,OAAO,CAAA;IACtB,YAAY,EAAE,YAAY,CAAA;IAC1B,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMsRequestApi.js","sourceRoot":"","sources":["../../src/types/IMsRequestApi.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.ms-request-api",
|
|
3
|
-
"version": "0.11.1-unstable.
|
|
3
|
+
"version": "0.11.1-unstable.153+f894c85",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@sphereon/ssi-sdk.ms-authenticator": "0.11.1-unstable.
|
|
18
|
+
"@sphereon/ssi-sdk.ms-authenticator": "0.11.1-unstable.153+f894c85",
|
|
19
19
|
"@veramo/remote-client": "4.2.0",
|
|
20
20
|
"@veramo/remote-server": "4.2.0",
|
|
21
21
|
"cross-fetch": "^3.1.5",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"typeorm": "^0.3.12"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@sphereon/ssi-sdk.agent-config": "0.11.1-unstable.
|
|
27
|
+
"@sphereon/ssi-sdk.agent-config": "0.11.1-unstable.153+f894c85",
|
|
28
28
|
"@types/express": "^4.17.17",
|
|
29
29
|
"@types/express-session": "^1.17.4",
|
|
30
30
|
"@types/jest": "^27.5.2",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"API",
|
|
66
66
|
"Issuer"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f894c85f93117c52171cb76c2ee2f806dfee473b"
|
|
69
69
|
}
|
package/plugin.schema.json
CHANGED
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
"$ref": "#/components/schemas/CredentialSubject"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"required": [
|
|
18
|
+
"required": [
|
|
19
|
+
"authenticationInfo",
|
|
20
|
+
"clientIssuanceConfig",
|
|
21
|
+
"claims"
|
|
22
|
+
]
|
|
19
23
|
},
|
|
20
24
|
"IMsAuthenticationClientCredentialArgs": {
|
|
21
25
|
"type": "object",
|
|
@@ -54,12 +58,23 @@
|
|
|
54
58
|
"$ref": "#/components/schemas/LogLevel"
|
|
55
59
|
}
|
|
56
60
|
},
|
|
57
|
-
"required": [
|
|
61
|
+
"required": [
|
|
62
|
+
"azClientId",
|
|
63
|
+
"azTenantId",
|
|
64
|
+
"azClientSecret",
|
|
65
|
+
"credentialManifestUrl"
|
|
66
|
+
],
|
|
58
67
|
"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"
|
|
59
68
|
},
|
|
60
69
|
"LogLevel": {
|
|
61
70
|
"type": "number",
|
|
62
|
-
"enum": [
|
|
71
|
+
"enum": [
|
|
72
|
+
0,
|
|
73
|
+
1,
|
|
74
|
+
2,
|
|
75
|
+
3,
|
|
76
|
+
4
|
|
77
|
+
],
|
|
63
78
|
"description": "Log message level."
|
|
64
79
|
},
|
|
65
80
|
"IClientIssuanceConfig": {
|
|
@@ -81,7 +96,13 @@
|
|
|
81
96
|
"$ref": "#/components/schemas/IClientIssuance"
|
|
82
97
|
}
|
|
83
98
|
},
|
|
84
|
-
"required": [
|
|
99
|
+
"required": [
|
|
100
|
+
"authority",
|
|
101
|
+
"includeQRCode",
|
|
102
|
+
"registration",
|
|
103
|
+
"callback",
|
|
104
|
+
"issuance"
|
|
105
|
+
]
|
|
85
106
|
},
|
|
86
107
|
"Registration": {
|
|
87
108
|
"type": "object",
|
|
@@ -90,7 +111,9 @@
|
|
|
90
111
|
"type": "string"
|
|
91
112
|
}
|
|
92
113
|
},
|
|
93
|
-
"required": [
|
|
114
|
+
"required": [
|
|
115
|
+
"clientName"
|
|
116
|
+
]
|
|
94
117
|
},
|
|
95
118
|
"Callback": {
|
|
96
119
|
"type": "object",
|
|
@@ -105,7 +128,11 @@
|
|
|
105
128
|
"$ref": "#/components/schemas/Headers"
|
|
106
129
|
}
|
|
107
130
|
},
|
|
108
|
-
"required": [
|
|
131
|
+
"required": [
|
|
132
|
+
"url",
|
|
133
|
+
"state",
|
|
134
|
+
"headers"
|
|
135
|
+
]
|
|
109
136
|
},
|
|
110
137
|
"Headers": {
|
|
111
138
|
"type": "object",
|
|
@@ -114,7 +141,9 @@
|
|
|
114
141
|
"type": "string"
|
|
115
142
|
}
|
|
116
143
|
},
|
|
117
|
-
"required": [
|
|
144
|
+
"required": [
|
|
145
|
+
"apiKey"
|
|
146
|
+
]
|
|
118
147
|
},
|
|
119
148
|
"IClientIssuance": {
|
|
120
149
|
"type": "object",
|
|
@@ -129,7 +158,11 @@
|
|
|
129
158
|
"$ref": "#/components/schemas/Pin"
|
|
130
159
|
}
|
|
131
160
|
},
|
|
132
|
-
"required": [
|
|
161
|
+
"required": [
|
|
162
|
+
"type",
|
|
163
|
+
"manifest",
|
|
164
|
+
"pin"
|
|
165
|
+
]
|
|
133
166
|
},
|
|
134
167
|
"Pin": {
|
|
135
168
|
"type": "object",
|
|
@@ -141,7 +174,10 @@
|
|
|
141
174
|
"type": "number"
|
|
142
175
|
}
|
|
143
176
|
},
|
|
144
|
-
"required": [
|
|
177
|
+
"required": [
|
|
178
|
+
"value",
|
|
179
|
+
"length"
|
|
180
|
+
]
|
|
145
181
|
},
|
|
146
182
|
"CredentialSubject": {
|
|
147
183
|
"type": "object"
|
|
@@ -166,7 +202,13 @@
|
|
|
166
202
|
"type": "string"
|
|
167
203
|
}
|
|
168
204
|
},
|
|
169
|
-
"required": [
|
|
205
|
+
"required": [
|
|
206
|
+
"id",
|
|
207
|
+
"requestId",
|
|
208
|
+
"url",
|
|
209
|
+
"expiry",
|
|
210
|
+
"pin"
|
|
211
|
+
]
|
|
170
212
|
}
|
|
171
213
|
},
|
|
172
214
|
"methods": {
|
|
@@ -182,4 +224,4 @@
|
|
|
182
224
|
}
|
|
183
225
|
}
|
|
184
226
|
}
|
|
185
|
-
}
|
|
227
|
+
}
|