@sphereon/ssi-sdk.ms-authenticator 0.11.1-unstable.151 → 0.11.1-unstable.152
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/authenticators/MsAuthenticator.d.ts +22 -0
- package/dist/authenticators/MsAuthenticator.d.ts.map +1 -0
- package/dist/authenticators/MsAuthenticator.js +122 -0
- package/dist/authenticators/MsAuthenticator.js.map +1 -0
- package/dist/authenticators/index.d.ts +2 -0
- package/dist/authenticators/index.d.ts.map +1 -0
- package/dist/authenticators/index.js +18 -0
- package/dist/authenticators/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/types/IMsAuthenticator.d.ts +56 -0
- package/dist/types/IMsAuthenticator.d.ts.map +1 -0
- package/dist/types/IMsAuthenticator.js +3 -0
- package/dist/types/IMsAuthenticator.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IMsAuthenticationClientCredentialArgs, IMsAuthenticationUsernamePasswordArgs } from '../index';
|
|
2
|
+
export declare const MS_IDENTITY_HOST_NAME_NONE_EU = "https://beta.did.msidentity.com/v1.0/";
|
|
3
|
+
export declare const MS_IDENTITY_HOST_NAME_EU = "https://beta.eu.did.msidentity.com/v1.0/";
|
|
4
|
+
export declare function checkMsIdentityHostname(authenticationArgs: IMsAuthenticationClientCredentialArgs): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* necessary fields are:
|
|
7
|
+
* azClientId: clientId of the application you're trying to login
|
|
8
|
+
* azClientSecret: secret of the application you're trying to login
|
|
9
|
+
* azTenantId: your MS Azure tenantId
|
|
10
|
+
* credentialManifest: address of your credential manifest. usually in following format:
|
|
11
|
+
* https://beta.eu.did.msidentity.com/v1.0/<tenant_id>/verifiableCredential/contracts/<verifiable_credential_schema>
|
|
12
|
+
* @param authenticationArgs
|
|
13
|
+
* @constructor
|
|
14
|
+
*/
|
|
15
|
+
export declare function ClientCredentialAuthenticator(authenticationArgs: IMsAuthenticationClientCredentialArgs): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Logs in with provided authenticationArgs and returns access token
|
|
18
|
+
* @param authenticationArgs
|
|
19
|
+
* @constructor
|
|
20
|
+
*/
|
|
21
|
+
export declare function UsernamePasswordAuthenticator(authenticationArgs: IMsAuthenticationUsernamePasswordArgs): Promise<string>;
|
|
22
|
+
//# sourceMappingURL=MsAuthenticator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsAuthenticator.d.ts","sourceRoot":"","sources":["../../src/authenticators/MsAuthenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qCAAqC,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAA;AASvG,eAAO,MAAM,6BAA6B,0CAA0C,CAAA;AACpF,eAAO,MAAM,wBAAwB,6CAA6C,CAAA;AAmBlF,wBAAsB,uBAAuB,CAAC,kBAAkB,EAAE,qCAAqC,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxH;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,kBAAkB,EAAE,qCAAqC,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC9H;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CAAC,kBAAkB,EAAE,qCAAqC,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB9H"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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.UsernamePasswordAuthenticator = exports.ClientCredentialAuthenticator = exports.checkMsIdentityHostname = exports.MS_IDENTITY_HOST_NAME_EU = exports.MS_IDENTITY_HOST_NAME_NONE_EU = void 0;
|
|
13
|
+
const msal_node_1 = require("@azure/msal-node");
|
|
14
|
+
const cross_fetch_1 = require("cross-fetch");
|
|
15
|
+
const EU = 'EU';
|
|
16
|
+
const HTTP_METHOD_GET = 'GET';
|
|
17
|
+
// Event though there are many regions, MS has only 2 identity host names (EU and NONE_EU)
|
|
18
|
+
// https://docs.microsoft.com/en-us/azure/active-directory/verifiable-credentials/whats-new#are-there-any-changes-to-the-way-that-we-use-the-request-api-as-a-result-of-this-move
|
|
19
|
+
exports.MS_IDENTITY_HOST_NAME_NONE_EU = 'https://beta.did.msidentity.com/v1.0/';
|
|
20
|
+
exports.MS_IDENTITY_HOST_NAME_EU = 'https://beta.eu.did.msidentity.com/v1.0/';
|
|
21
|
+
const MS_LOGIN_PREFIX = 'https://login.microsoftonline.com/';
|
|
22
|
+
const MS_LOGIN_OPENID_CONFIG_POSTFIX = '/v2.0/.well-known/openid-configuration';
|
|
23
|
+
const MS_CLIENT_CREDENTIAL_DEFAULT_SCOPE = '3db474b9-6a0c-4840-96ac-1fceb342124f/.default';
|
|
24
|
+
const ERROR_CREDENTIAL_MANIFEST_REGION = `Error in config file. CredentialManifest URL configured for wrong tenant region. Should start with:`;
|
|
25
|
+
const ERROR_ACQUIRE_ACCESS_TOKEN_FOR_CLIENT = 'Could not acquire verifiableCredentials to access your Azure Key Vault:\n';
|
|
26
|
+
const ERROR_FAILED_AUTHENTICATION = 'failed to authenticate: ';
|
|
27
|
+
function getClientRegion(azTenantId) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
let region = EU;
|
|
30
|
+
yield (0, cross_fetch_1.fetch)(MS_LOGIN_PREFIX + azTenantId + MS_LOGIN_OPENID_CONFIG_POSTFIX, { method: HTTP_METHOD_GET })
|
|
31
|
+
.then((res) => res.json())
|
|
32
|
+
.then((resp) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
region = resp.tenant_region_scope;
|
|
34
|
+
}));
|
|
35
|
+
return region;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function checkMsIdentityHostname(authenticationArgs) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const region = authenticationArgs.region ? authenticationArgs.region : yield getClientRegion(authenticationArgs.azTenantId);
|
|
41
|
+
const msIdentityHostName = region === EU ? exports.MS_IDENTITY_HOST_NAME_EU : exports.MS_IDENTITY_HOST_NAME_NONE_EU;
|
|
42
|
+
// Check that the Credential Manifest URL is in the same tenant Region and throw an error if it's not
|
|
43
|
+
if (!authenticationArgs.credentialManifestUrl.startsWith(msIdentityHostName)) {
|
|
44
|
+
throw new Error(ERROR_CREDENTIAL_MANIFEST_REGION + msIdentityHostName + `. value: ${authenticationArgs.credentialManifestUrl}`);
|
|
45
|
+
}
|
|
46
|
+
return msIdentityHostName;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.checkMsIdentityHostname = checkMsIdentityHostname;
|
|
50
|
+
/**
|
|
51
|
+
* necessary fields are:
|
|
52
|
+
* azClientId: clientId of the application you're trying to login
|
|
53
|
+
* azClientSecret: secret of the application you're trying to login
|
|
54
|
+
* azTenantId: your MS Azure tenantId
|
|
55
|
+
* credentialManifest: address of your credential manifest. usually in following format:
|
|
56
|
+
* https://beta.eu.did.msidentity.com/v1.0/<tenant_id>/verifiableCredential/contracts/<verifiable_credential_schema>
|
|
57
|
+
* @param authenticationArgs
|
|
58
|
+
* @constructor
|
|
59
|
+
*/
|
|
60
|
+
function ClientCredentialAuthenticator(authenticationArgs) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const msalConfig = {
|
|
63
|
+
auth: {
|
|
64
|
+
clientId: authenticationArgs.azClientId,
|
|
65
|
+
authority: authenticationArgs.authority ? authenticationArgs.authority : MS_LOGIN_PREFIX + authenticationArgs.azTenantId,
|
|
66
|
+
clientSecret: authenticationArgs.azClientSecret,
|
|
67
|
+
},
|
|
68
|
+
system: {
|
|
69
|
+
loggerOptions: {
|
|
70
|
+
piiLoggingEnabled: authenticationArgs.piiLoggingEnabled ? authenticationArgs.piiLoggingEnabled : false,
|
|
71
|
+
logLevel: authenticationArgs.logLevel ? authenticationArgs.logLevel : msal_node_1.LogLevel.Verbose,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
const cca = new msal_node_1.ConfidentialClientApplication(msalConfig);
|
|
76
|
+
const msalClientCredentialRequest = {
|
|
77
|
+
scopes: authenticationArgs.scopes ? authenticationArgs.scopes : [MS_CLIENT_CREDENTIAL_DEFAULT_SCOPE],
|
|
78
|
+
skipCache: authenticationArgs.skipCache ? authenticationArgs.skipCache : false,
|
|
79
|
+
};
|
|
80
|
+
checkMsIdentityHostname(authenticationArgs);
|
|
81
|
+
// get the Access Token
|
|
82
|
+
try {
|
|
83
|
+
const result = yield cca.acquireTokenByClientCredential(msalClientCredentialRequest);
|
|
84
|
+
if (result && result.accessToken) {
|
|
85
|
+
return result.accessToken;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
throw {
|
|
90
|
+
error: ERROR_ACQUIRE_ACCESS_TOKEN_FOR_CLIENT + err,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return '';
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.ClientCredentialAuthenticator = ClientCredentialAuthenticator;
|
|
97
|
+
/**
|
|
98
|
+
* Logs in with provided authenticationArgs and returns access token
|
|
99
|
+
* @param authenticationArgs
|
|
100
|
+
* @constructor
|
|
101
|
+
*/
|
|
102
|
+
function UsernamePasswordAuthenticator(authenticationArgs) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
const msalConfig = {
|
|
105
|
+
auth: {
|
|
106
|
+
clientId: authenticationArgs.azClientId,
|
|
107
|
+
authority: authenticationArgs.authority ? authenticationArgs.authority : MS_LOGIN_PREFIX + authenticationArgs.azTenantId,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
const pca = new msal_node_1.PublicClientApplication(msalConfig);
|
|
111
|
+
return yield pca
|
|
112
|
+
.acquireTokenByUsernamePassword(authenticationArgs)
|
|
113
|
+
.then((response) => {
|
|
114
|
+
return response;
|
|
115
|
+
})
|
|
116
|
+
.catch((error) => {
|
|
117
|
+
throw new Error(ERROR_FAILED_AUTHENTICATION + error);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
exports.UsernamePasswordAuthenticator = UsernamePasswordAuthenticator;
|
|
122
|
+
//# sourceMappingURL=MsAuthenticator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsAuthenticator.js","sourceRoot":"","sources":["../../src/authenticators/MsAuthenticator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA4H;AAE5H,6CAAmC;AAEnC,MAAM,EAAE,GAAG,IAAI,CAAA;AAEf,MAAM,eAAe,GAAG,KAAK,CAAA;AAE7B,0FAA0F;AAC1F,iLAAiL;AACpK,QAAA,6BAA6B,GAAG,uCAAuC,CAAA;AACvE,QAAA,wBAAwB,GAAG,0CAA0C,CAAA;AAClF,MAAM,eAAe,GAAG,oCAAoC,CAAA;AAC5D,MAAM,8BAA8B,GAAG,wCAAwC,CAAA;AAC/E,MAAM,kCAAkC,GAAG,+CAA+C,C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AM,UAAU,GAAG;YACjB,IAAI,EAAE;gBACJ,QAAQ,EAAE,kBAAkB,CAAC,UAAU;gBACvC,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,GAAG,kBAAkB,CAAC,UAAU;aACzH;SACF,CAAA;QACD,MAAM,GAAG,GAAG,IAAI,mCAAuB,CAAC,UAAU,CAAC,CAAA;QACnD,OAAO,MAAM,GAAG;aACb,8BAA8B,CAAC,kBAA6C,CAAC;aAC7E,IAAI,CAAC,CAAC,QAAa,EAAE,EAAE;YACtB,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;IACN,CAAC;CAAA;AAhBD,sEAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authenticators/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./MsAuthenticator"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authenticators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
__exportStar(require("./authenticators"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC;AAChC,0CAAuB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IAgentContext } from '@veramo/core';
|
|
2
|
+
import { LogLevel } from '@azure/msal-node';
|
|
3
|
+
/**
|
|
4
|
+
* azClientId: clientId of the application you're trying to login
|
|
5
|
+
* azClientSecret: secret of the application you're trying to login
|
|
6
|
+
* azTenantId: your MS Azure tenantId
|
|
7
|
+
* credentialManifestUrl: url of your credential manifest. usually in following format:
|
|
8
|
+
* https://beta.eu.did.msidentity.com/v1.0/<tenant_id>/verifiableCredential/contracts/<verifiable_credential_schema>
|
|
9
|
+
* authority: optional. if not provided, we'll use the azClientId to create the Tenanted format if provided should be one of these two formats:
|
|
10
|
+
* - Tenanted: https://login.microsoftonline.com/{tenant}/, where {tenant} is either the GUID representing the tenant ID or a domain name associated with the tenant.
|
|
11
|
+
* - Work and school accounts: https://login.microsoftonline.com/organizations/.
|
|
12
|
+
* region?: if present will use the provided, if not will make a request to determine the region
|
|
13
|
+
* scopes?: scopes that you want to access via this authentication
|
|
14
|
+
* skipCache?: whether to skip cache
|
|
15
|
+
* piiLoggingEnabled?: if not provided defaults to false
|
|
16
|
+
* logLevel?: can be one of these values:
|
|
17
|
+
* Error = 0,
|
|
18
|
+
* Warning = 1,
|
|
19
|
+
* Info = 2,
|
|
20
|
+
* Verbose = 3,
|
|
21
|
+
* Trace = 4
|
|
22
|
+
* if not provided defaults to LogLevel.Verbose
|
|
23
|
+
*/
|
|
24
|
+
export interface IMsAuthenticationClientCredentialArgs {
|
|
25
|
+
azClientId: string;
|
|
26
|
+
azTenantId: string;
|
|
27
|
+
azClientSecret: string;
|
|
28
|
+
credentialManifestUrl: string;
|
|
29
|
+
authority?: string;
|
|
30
|
+
region?: string;
|
|
31
|
+
scopes?: string[];
|
|
32
|
+
skipCache?: boolean;
|
|
33
|
+
piiLoggingEnabled?: boolean;
|
|
34
|
+
logLevel?: LogLevel;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* azClientId: clientId of the application you're trying to login
|
|
38
|
+
* azTenantId: your MS Azure tenantId
|
|
39
|
+
* username: username of the user
|
|
40
|
+
* password: password of the user
|
|
41
|
+
* scopes: scopes that you want to access via this authentication
|
|
42
|
+
* authority: optional. if not provided, we'll use the azClientId to create the Tenanted format if provided should be one of these two formats:
|
|
43
|
+
* - Tenanted: https://login.microsoftonline.com/{tenant}/, where {tenant} is either the GUID representing the tenant ID or a domain name associated with the tenant.
|
|
44
|
+
* - Work and school accounts: https://login.microsoftonline.com/organizations/.
|
|
45
|
+
*/
|
|
46
|
+
export interface IMsAuthenticationUsernamePasswordArgs {
|
|
47
|
+
azClientId: string;
|
|
48
|
+
azTenantId: string;
|
|
49
|
+
password: string;
|
|
50
|
+
scopes: string[];
|
|
51
|
+
username: string;
|
|
52
|
+
authority?: string;
|
|
53
|
+
}
|
|
54
|
+
export type IRequiredContext = IAgentContext<Record<string, never>>;
|
|
55
|
+
export type IMsAuthenticationResponse = String;
|
|
56
|
+
//# sourceMappingURL=IMsAuthenticator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMsAuthenticator.d.ts","sourceRoot":"","sources":["../../src/types/IMsAuthenticator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,qCAAqC;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,qCAAqC;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AACnE,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMsAuthenticator.js","sourceRoot":"","sources":["../../src/types/IMsAuthenticator.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./IMsAuthenticator"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.ms-authenticator",
|
|
3
|
-
"version": "0.11.1-unstable.
|
|
3
|
+
"version": "0.11.1-unstable.152+e1924a1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"SSI",
|
|
43
43
|
"Veramo"
|
|
44
44
|
],
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e1924a1e5c4b336718ed0e6ddd5dbe8fcc767507"
|
|
46
46
|
}
|