@wireapp/core 42.11.0 → 42.12.1
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/lib/Account.d.ts +6 -2
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +32 -12
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts +125 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.js +157 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.d.ts +17 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.js +20 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.d.ts +2 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.js +35 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts +306 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.js +117 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/index.d.ts +2 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/index.js +35 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +43 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +25 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +17 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +85 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +24 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +263 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +12 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +46 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.d.ts +12 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.js +32 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts +15 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.js +49 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.d.ts +14 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.js +33 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.d.ts +12 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.js +63 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.d.ts +20 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.js +20 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/index.d.ts +2 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/index.js +35 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts +28 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.js +34 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.d.ts +28 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.js +56 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts +28 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.js +120 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts +136 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.js +49 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/index.d.ts +4 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/index.js +37 -0
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +21 -6
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +81 -11
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +27 -10
- package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts +4 -0
- package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/types.d.ts +1 -0
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/lib/util/LocalStorageStore/index.d.ts +7 -0
- package/lib/util/LocalStorageStore/index.d.ts.map +1 -0
- package/lib/util/LocalStorageStore/index.js +38 -0
- package/lib/util/TaskScheduler/TaskScheduler.store.d.ts +1 -1
- package/lib/util/TaskScheduler/TaskScheduler.store.d.ts.map +1 -1
- package/lib/util/TaskScheduler/TaskScheduler.store.js +3 -13
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/package.json +5 -4
package/lib/Account.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { AssetService, ConversationService } from './conversation/';
|
|
|
12
12
|
import { GiphyService } from './giphy/';
|
|
13
13
|
import { LinkPreviewService } from './linkPreview';
|
|
14
14
|
import { MLSService } from './messagingProtocols/mls';
|
|
15
|
+
import { AcmeChallenge, E2EIServiceExternal } from './messagingProtocols/mls/E2EIdentityService';
|
|
15
16
|
import { MLSCallbacks, CryptoProtocolConfig } from './messagingProtocols/mls/types';
|
|
16
17
|
import { NewClient, ProteusService } from './messagingProtocols/proteus';
|
|
17
18
|
import { HandledEventPayload, NotificationService, NotificationSource } from './notification/';
|
|
@@ -67,12 +68,14 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
67
68
|
private readonly apiClient;
|
|
68
69
|
private readonly logger;
|
|
69
70
|
private readonly createStore;
|
|
70
|
-
private storeEngine?;
|
|
71
|
-
private db?;
|
|
72
71
|
private readonly nbPrekeys;
|
|
73
72
|
private readonly cryptoProtocolConfig?;
|
|
73
|
+
private readonly isMlsEnabled;
|
|
74
|
+
private storeEngine?;
|
|
75
|
+
private db?;
|
|
74
76
|
service?: {
|
|
75
77
|
mls?: MLSService;
|
|
78
|
+
e2eIdentity?: E2EIServiceExternal;
|
|
76
79
|
proteus: ProteusService;
|
|
77
80
|
account: AccountService;
|
|
78
81
|
asset: AssetService;
|
|
@@ -108,6 +111,7 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
108
111
|
*/
|
|
109
112
|
useAPIVersion(min: number, max: number, allowDev?: boolean): Promise<BackendFeatures>;
|
|
110
113
|
private persistCookie;
|
|
114
|
+
enrollE2EI(displayName: string, handle: string, discoveryUrl: string, oAuthIdToken?: string): Promise<AcmeChallenge | boolean>;
|
|
111
115
|
get clientId(): string;
|
|
112
116
|
get userId(): string;
|
|
113
117
|
/**
|
package/lib/Account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACnG,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAOxD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,E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AE,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;QAE7E;;WAEG;QACH,4BAA4B,CAAC,EAAE,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;QAEtF;;WAEG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;QAE5D;;;;;;WAMG;QACH,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;CAqBzB"}
|
package/lib/Account.js
CHANGED
|
@@ -48,6 +48,7 @@ const messageSender_1 = require("./conversation/message/messageSender");
|
|
|
48
48
|
const giphy_1 = require("./giphy/");
|
|
49
49
|
const linkPreview_1 = require("./linkPreview");
|
|
50
50
|
const mls_1 = require("./messagingProtocols/mls");
|
|
51
|
+
const E2EIdentityService_1 = require("./messagingProtocols/mls/E2EIdentityService");
|
|
51
52
|
const proteus_1 = require("./messagingProtocols/proteus");
|
|
52
53
|
const CryptoClient_1 = require("./messagingProtocols/proteus/ProteusService/CryptoClient");
|
|
53
54
|
const cryptoMigrationStateStore_1 = require("./messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore");
|
|
@@ -86,12 +87,13 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
86
87
|
* @param apiClient The apiClient instance to use in the core (will create a new new one if undefined)
|
|
87
88
|
* @param accountOptions
|
|
88
89
|
*/
|
|
89
|
-
constructor(apiClient = new api_client_1.APIClient(), { createStore = () => undefined, nbPrekeys =
|
|
90
|
+
constructor(apiClient = new api_client_1.APIClient(), { createStore = () => undefined, nbPrekeys = 100, cryptoProtocolConfig } = {}) {
|
|
90
91
|
super();
|
|
91
92
|
this.apiClient = apiClient;
|
|
92
93
|
this.backendFeatures = this.apiClient.backendFeatures;
|
|
93
94
|
this.cryptoProtocolConfig = cryptoProtocolConfig;
|
|
94
95
|
this.nbPrekeys = nbPrekeys;
|
|
96
|
+
this.isMlsEnabled = () => { var _a; return this.backendFeatures.supportsMLS && !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls); };
|
|
95
97
|
this.createStore = createStore;
|
|
96
98
|
this.recurringTaskScheduler = new RecurringTaskScheduler_1.RecurringTaskScheduler({
|
|
97
99
|
get: async (key) => {
|
|
@@ -144,6 +146,22 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
144
146
|
const entity = { expiration: cookie.expiration, zuid: cookie.zuid };
|
|
145
147
|
return storeEngine.updateOrCreate(auth_1.AUTH_TABLE_NAME, auth_1.AUTH_COOKIE_KEY, entity);
|
|
146
148
|
}
|
|
149
|
+
async enrollE2EI(displayName, handle, discoveryUrl, oAuthIdToken) {
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
const context = this.apiClient.context;
|
|
152
|
+
const domain = (_a = context === null || context === void 0 ? void 0 : context.domain) !== null && _a !== void 0 ? _a : '';
|
|
153
|
+
if (!this.isMlsEnabled() || !((_b = this.service) === null || _b === void 0 ? void 0 : _b.mls) || !((_c = this.service) === null || _c === void 0 ? void 0 : _c.e2eIdentity)) {
|
|
154
|
+
this.logger.info('MLS not initialized, unable to enroll E2EI');
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
const user = {
|
|
158
|
+
displayName,
|
|
159
|
+
handle,
|
|
160
|
+
domain,
|
|
161
|
+
id: this.userId,
|
|
162
|
+
};
|
|
163
|
+
return this.service.mls.enrollE2EI(discoveryUrl, this.service.e2eIdentity, user, this.clientId, this.nbPrekeys, oAuthIdToken);
|
|
164
|
+
}
|
|
147
165
|
get clientId() {
|
|
148
166
|
return this.apiClient.validatedClientId;
|
|
149
167
|
}
|
|
@@ -223,22 +241,22 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
223
241
|
await this.service.mls.initClient({ id: userId, domain }, validClient);
|
|
224
242
|
}
|
|
225
243
|
// initialize schedulers for pending mls proposals once client is initialized
|
|
226
|
-
await this.service.mls.
|
|
244
|
+
await this.service.mls.initialisePendingProposalsTasks();
|
|
227
245
|
// initialize scheduler for syncing key packages with backend
|
|
228
|
-
this.service.mls.schedulePeriodicKeyPackagesBackendSync(validClient.id);
|
|
246
|
+
await this.service.mls.schedulePeriodicKeyPackagesBackendSync(validClient.id);
|
|
229
247
|
// leave stale conference subconversations (e.g after a crash)
|
|
230
248
|
await this.service.mls.leaveStaleConferenceSubconversations();
|
|
231
249
|
}
|
|
232
250
|
return validClient;
|
|
233
251
|
}
|
|
234
|
-
async buildCryptoClient(context, storeEngine
|
|
252
|
+
async buildCryptoClient(context, storeEngine) {
|
|
235
253
|
var _a, _b, _c;
|
|
236
254
|
/* There are 3 cases where we want to instantiate CoreCrypto:
|
|
237
255
|
* 1. MLS is enabled
|
|
238
256
|
* 2. The user has enabled CoreCrypto in the config
|
|
239
257
|
* 3. The user has already used CoreCrypto in the past (cannot rollback to using cryptobox)
|
|
240
258
|
*/
|
|
241
|
-
const clientType =
|
|
259
|
+
const clientType = this.isMlsEnabled() ||
|
|
242
260
|
!!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.useCoreCrypto) ||
|
|
243
261
|
cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.isReady(storeEngine.storeName)
|
|
244
262
|
? CryptoClient_1.CryptoClientType.CORE_CRYPTO
|
|
@@ -267,17 +285,18 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
267
285
|
(_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.mls) === null || _b === void 0 ? void 0 : _b.configureMLSCallbacks(mlsCallbacks);
|
|
268
286
|
}
|
|
269
287
|
async initServices(context) {
|
|
270
|
-
var _a
|
|
271
|
-
const enableMLS = this.backendFeatures.supportsMLS && !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls);
|
|
288
|
+
var _a;
|
|
272
289
|
this.storeEngine = await this.initEngine(context);
|
|
273
290
|
this.db = await (0, CoreDB_1.openDB)(this.generateCoreDbName(context));
|
|
274
291
|
const accountService = new account_1.AccountService(this.apiClient);
|
|
275
292
|
const assetService = new conversation_1.AssetService(this.apiClient);
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
293
|
+
const [clientType, cryptoClient] = await this.buildCryptoClient(context, this.storeEngine);
|
|
294
|
+
let mlsService;
|
|
295
|
+
let e2eIdentityService;
|
|
296
|
+
if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && this.isMlsEnabled()) {
|
|
297
|
+
e2eIdentityService = await E2EIdentityService_1.E2EIServiceExternal.getInstance(cryptoClient.getNativeClient());
|
|
298
|
+
mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, Object.assign({}, (_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls));
|
|
299
|
+
}
|
|
281
300
|
const proteusService = new proteus_1.ProteusService(this.apiClient, cryptoClient, {
|
|
282
301
|
onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
|
|
283
302
|
nbPrekeys: this.nbPrekeys,
|
|
@@ -293,6 +312,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
293
312
|
const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
|
|
294
313
|
const userService = new user_1.UserService(this.apiClient);
|
|
295
314
|
this.service = {
|
|
315
|
+
e2eIdentity: e2eIdentityService,
|
|
296
316
|
mls: mlsService,
|
|
297
317
|
proteus: proteusService,
|
|
298
318
|
account: accountService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src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AC9B,cAAc,EAAE,WAAW,EAC3B,QAAQ,EAAE,OAAO,EACjB,gBAAgB,GAAE,MAAM,GAAG,IAAiB,GAC3C,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,2BAA2B,GAAG,MAAM,GACrD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IAEH;;;OAGG;IACU,qBAAqB,CAChC,gBAAgB,EAAE,eAAe,EACjC,UAAU,EAAE,WAAW,EACvB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,6BAA6B,CAAC;YAmC3B,cAAc;IA2C5B;;;;;;OAMG;IACU,yBAAyB,CAAC,EACrC,cAAc,EACd,OAAO,EACP,cAAc,GACf,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EAEpB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAInD,OAAO,EAEL,cAAc,EAEd,6BAA6B,EAC7B,oBAAoB,EACpB,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,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EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAoBhD,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAmBpE;;;OAGG;IACU,qBAAqB,CAAC,OAAO,EAAE,MAAM;IAIlD;;;;OAIG;IACU,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAI5C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,YAAY;IAYb,gCAAgC;IAa7C;;;;;OAKG;YACW,+BAA+B;IA6B7C;;;OAGG;IACG,sBAAsB,CAAC,MAAM,EAAE,WAAW;IAIhD;;;;;;;OAOG;IACH,SAAgB,4BAA4B,YACjC,MAAM,YACL;QAAC,IAAI,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,eAChC,WAAW,4BAEvB,QAAQ,eAAe,CAAC,CAoDzB;IAEF;;;;;;;;OAQG;IACU,uBAAuB,CAAC,EACnC,OAAO,EACP,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,WAAW,CAAC;QACxB,cAAc,EAAE,WAAW,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BH,wBAAwB;YAoBxB,uCAAuC;YAYvC,4BAA4B;YAI5B,wBAAwB;IAIzB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAYnF"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { GetDirectoryReturnValue, GetInitialNonceReturnValue } from './AcmeService.types';
|
|
2
|
+
import { AcmeChallenge, AcmeDirectory } from '../../E2EIService.types';
|
|
3
|
+
export declare class AcmeService {
|
|
4
|
+
private discoveryUrl;
|
|
5
|
+
private logger;
|
|
6
|
+
private readonly axiosInstance;
|
|
7
|
+
private readonly url;
|
|
8
|
+
constructor(discoveryUrl: string);
|
|
9
|
+
private extractNonce;
|
|
10
|
+
private extractLocation;
|
|
11
|
+
private postJoseRequest;
|
|
12
|
+
getDirectory(): GetDirectoryReturnValue;
|
|
13
|
+
getInitialNonce(url: AcmeDirectory['newNonce']): GetInitialNonceReturnValue;
|
|
14
|
+
createNewAccount(url: AcmeDirectory['newAccount'], payload: Uint8Array): Promise<{
|
|
15
|
+
data: {
|
|
16
|
+
status: string;
|
|
17
|
+
orders: string;
|
|
18
|
+
contact: string[];
|
|
19
|
+
};
|
|
20
|
+
nonce: string;
|
|
21
|
+
location?: string | undefined;
|
|
22
|
+
} | undefined>;
|
|
23
|
+
createNewOrder(url: AcmeDirectory['newOrder'], payload: Uint8Array): Promise<{
|
|
24
|
+
data: {
|
|
25
|
+
status: string;
|
|
26
|
+
expires: string;
|
|
27
|
+
authorizations: string[];
|
|
28
|
+
notBefore: string;
|
|
29
|
+
notAfter: string;
|
|
30
|
+
identifiers: {
|
|
31
|
+
type: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}[];
|
|
34
|
+
finalize: string;
|
|
35
|
+
};
|
|
36
|
+
nonce: string;
|
|
37
|
+
location?: string | undefined;
|
|
38
|
+
} | undefined>;
|
|
39
|
+
getAuthorization(url: string, payload: Uint8Array): Promise<{
|
|
40
|
+
data: {
|
|
41
|
+
status: string;
|
|
42
|
+
expires: string;
|
|
43
|
+
identifier: {
|
|
44
|
+
type: string;
|
|
45
|
+
value: string;
|
|
46
|
+
};
|
|
47
|
+
challenges: {
|
|
48
|
+
type: string;
|
|
49
|
+
url: string;
|
|
50
|
+
target: string;
|
|
51
|
+
status: string;
|
|
52
|
+
token: string;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
nonce: string;
|
|
56
|
+
location?: string | undefined;
|
|
57
|
+
} | undefined>;
|
|
58
|
+
validateDpopChallenge(url: AcmeChallenge['url'], payload: Uint8Array): Promise<{
|
|
59
|
+
data: {
|
|
60
|
+
type: string;
|
|
61
|
+
url: string;
|
|
62
|
+
status: string;
|
|
63
|
+
token: string;
|
|
64
|
+
};
|
|
65
|
+
nonce: string;
|
|
66
|
+
location?: string | undefined;
|
|
67
|
+
} | undefined>;
|
|
68
|
+
validateOidcChallenge(url: AcmeChallenge['url'], payload: Uint8Array): Promise<{
|
|
69
|
+
data: {
|
|
70
|
+
type: string;
|
|
71
|
+
url: string;
|
|
72
|
+
target: string;
|
|
73
|
+
status: string;
|
|
74
|
+
token: string;
|
|
75
|
+
validated?: string | undefined;
|
|
76
|
+
error?: {
|
|
77
|
+
type: string;
|
|
78
|
+
detail: string;
|
|
79
|
+
} | undefined;
|
|
80
|
+
};
|
|
81
|
+
nonce: string;
|
|
82
|
+
location?: string | undefined;
|
|
83
|
+
} | undefined>;
|
|
84
|
+
checkStatusOfOrder(url: string, payload: Uint8Array): Promise<{
|
|
85
|
+
data: {
|
|
86
|
+
id: string;
|
|
87
|
+
status: string;
|
|
88
|
+
expires: string;
|
|
89
|
+
authorizations: string[];
|
|
90
|
+
notBefore: string;
|
|
91
|
+
notAfter: string;
|
|
92
|
+
identifiers: {
|
|
93
|
+
type: string;
|
|
94
|
+
value: string;
|
|
95
|
+
}[];
|
|
96
|
+
finalize: string;
|
|
97
|
+
};
|
|
98
|
+
nonce: string;
|
|
99
|
+
location?: string | undefined;
|
|
100
|
+
} | undefined>;
|
|
101
|
+
finalizeOrder(url: string, payload: Uint8Array): Promise<{
|
|
102
|
+
data: {
|
|
103
|
+
id: string;
|
|
104
|
+
certificate: string;
|
|
105
|
+
status: string;
|
|
106
|
+
expires: string;
|
|
107
|
+
authorizations: string[];
|
|
108
|
+
notBefore: string;
|
|
109
|
+
notAfter: string;
|
|
110
|
+
identifiers: {
|
|
111
|
+
type: string;
|
|
112
|
+
value: string;
|
|
113
|
+
}[];
|
|
114
|
+
finalize: string;
|
|
115
|
+
};
|
|
116
|
+
nonce: string;
|
|
117
|
+
location?: string | undefined;
|
|
118
|
+
} | undefined>;
|
|
119
|
+
getCertificate(url: string, payload: Uint8Array): Promise<{
|
|
120
|
+
data: string;
|
|
121
|
+
nonce: string;
|
|
122
|
+
location?: string | undefined;
|
|
123
|
+
} | undefined>;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=AcmeService.d.ts.map
|
package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcmeService.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAG3B,MAAM,qBAAqB,CAAC;AAyB7B,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,yBAAyB,CAAC;AAErE,qBAAa,WAAW;IAOV,OAAO,CAAC,YAAY;IANhC,OAAO,CAAC,MAAM,CAAwC;IACtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;IAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAElB;gBAEkB,YAAY,EAAE,MAAM;IAIxC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,eAAe;YAIT,eAAe;IAgChB,YAAY,IAAI,uBAAuB;IAWvC,eAAe,CAAC,GAAG,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,0BAA0B;IAW3E,gBAAgB,CAAC,GAAG,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,UAAU;;;;;;;;;IAStE,cAAc,CAAC,GAAG,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,UAAU;;;;;;;;;;;;;;;;IAUlE,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;;;;;;;;;;;;;;;;;;;IASjD,qBAAqB,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,UAAU;;;;;;;;;;IASpE,qBAAqB,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,UAAU;;;;;;;;;;;;;;;;IASpE,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;;;;;;;;;;;;;;;;;IASnD,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;;;;;;;;;;;;;;;;;;IAS9C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;;;;;CAQ7D"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.AcmeService = void 0;
|
|
25
|
+
const axios_1 = __importDefault(require("axios"));
|
|
26
|
+
const logdown_1 = __importDefault(require("logdown"));
|
|
27
|
+
const schema_1 = require("./schema");
|
|
28
|
+
class AcmeService {
|
|
29
|
+
constructor(discoveryUrl) {
|
|
30
|
+
this.discoveryUrl = discoveryUrl;
|
|
31
|
+
this.logger = (0, logdown_1.default)('@wireapp/core/AcmeService');
|
|
32
|
+
this.axiosInstance = axios_1.default.create();
|
|
33
|
+
this.url = {
|
|
34
|
+
DIRECTORY: '/directory',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// ############ Internal Functions ############
|
|
38
|
+
extractNonce(headers) {
|
|
39
|
+
return schema_1.ResponseHeaderNonceSchema.parse(headers)['replay-nonce'];
|
|
40
|
+
}
|
|
41
|
+
extractLocation(headers) {
|
|
42
|
+
return schema_1.ResponseHeaderLocationSchema.parse(headers).location;
|
|
43
|
+
}
|
|
44
|
+
async postJoseRequest({ payload, schema, url, errorMessage, shouldGetLocation = false, }) {
|
|
45
|
+
try {
|
|
46
|
+
const { data, headers } = await this.axiosInstance.post(url, payload, {
|
|
47
|
+
headers: {
|
|
48
|
+
'Content-Type': 'application/jose+json',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
let location = undefined;
|
|
52
|
+
const nonce = this.extractNonce(headers);
|
|
53
|
+
if (shouldGetLocation) {
|
|
54
|
+
location = this.extractLocation(headers);
|
|
55
|
+
}
|
|
56
|
+
const accountData = schema.parse(data);
|
|
57
|
+
return {
|
|
58
|
+
data: accountData,
|
|
59
|
+
nonce,
|
|
60
|
+
location,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
this.logger.error(errorMessage, e);
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// ############ Public Functions ############
|
|
69
|
+
async getDirectory() {
|
|
70
|
+
try {
|
|
71
|
+
const { data } = await this.axiosInstance.get(`${this.discoveryUrl}${this.url.DIRECTORY}`);
|
|
72
|
+
const directory = schema_1.DirectoryResponseSchema.parse(data);
|
|
73
|
+
return new TextEncoder().encode(JSON.stringify(directory));
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
this.logger.error('Error while receiving Directory', e);
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async getInitialNonce(url) {
|
|
81
|
+
try {
|
|
82
|
+
const { headers } = await this.axiosInstance.head(url);
|
|
83
|
+
const nonce = this.extractNonce(headers);
|
|
84
|
+
return nonce;
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
this.logger.error('Error while receiving intial Nonce', e);
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async createNewAccount(url, payload) {
|
|
92
|
+
return this.postJoseRequest({
|
|
93
|
+
errorMessage: 'Error while creating new Account',
|
|
94
|
+
payload,
|
|
95
|
+
schema: schema_1.NewAccountResponseSchema,
|
|
96
|
+
url,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async createNewOrder(url, payload) {
|
|
100
|
+
return this.postJoseRequest({
|
|
101
|
+
errorMessage: 'Error while creating new Order',
|
|
102
|
+
payload,
|
|
103
|
+
schema: schema_1.NewOrderResponseSchema,
|
|
104
|
+
url,
|
|
105
|
+
shouldGetLocation: true,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async getAuthorization(url, payload) {
|
|
109
|
+
return this.postJoseRequest({
|
|
110
|
+
errorMessage: 'Error while receiving Authorization',
|
|
111
|
+
payload,
|
|
112
|
+
schema: schema_1.AuthorizationResponseSchema,
|
|
113
|
+
url,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async validateDpopChallenge(url, payload) {
|
|
117
|
+
return this.postJoseRequest({
|
|
118
|
+
errorMessage: 'Error while validating DPOP challenge',
|
|
119
|
+
payload,
|
|
120
|
+
schema: schema_1.DpopChallengeResponseSchema,
|
|
121
|
+
url,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async validateOidcChallenge(url, payload) {
|
|
125
|
+
return this.postJoseRequest({
|
|
126
|
+
errorMessage: 'Error while validating OIDC challenge',
|
|
127
|
+
payload,
|
|
128
|
+
schema: schema_1.OidcChallengeResponseSchema,
|
|
129
|
+
url,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async checkStatusOfOrder(url, payload) {
|
|
133
|
+
return this.postJoseRequest({
|
|
134
|
+
errorMessage: 'Error while checking status of Order',
|
|
135
|
+
payload,
|
|
136
|
+
schema: schema_1.CheckStatusOfOrderResponseSchema,
|
|
137
|
+
url,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async finalizeOrder(url, payload) {
|
|
141
|
+
return this.postJoseRequest({
|
|
142
|
+
errorMessage: 'Error while finalizing Order',
|
|
143
|
+
payload,
|
|
144
|
+
schema: schema_1.FinalizeOrderResponseSchema,
|
|
145
|
+
url,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async getCertificate(url, payload) {
|
|
149
|
+
return this.postJoseRequest({
|
|
150
|
+
errorMessage: 'Error while receiving Certificate',
|
|
151
|
+
payload,
|
|
152
|
+
schema: schema_1.GetCertificateResponseSchema,
|
|
153
|
+
url,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.AcmeService = AcmeService;
|
package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ZodSchema } from 'zod';
|
|
2
|
+
import { Nonce } from '../../E2EIService.types';
|
|
3
|
+
export type GetDirectoryReturnValue = Promise<Uint8Array | undefined>;
|
|
4
|
+
export type GetInitialNonceReturnValue = Promise<string | undefined>;
|
|
5
|
+
export interface PostJoseRequestParams<T> {
|
|
6
|
+
url: string;
|
|
7
|
+
payload: Uint8Array;
|
|
8
|
+
schema: ZodSchema<T>;
|
|
9
|
+
errorMessage: string;
|
|
10
|
+
shouldGetLocation?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type PostJoseRequestReturnValue<T> = Promise<{
|
|
13
|
+
data: T;
|
|
14
|
+
nonce: Nonce;
|
|
15
|
+
location?: string;
|
|
16
|
+
} | undefined>;
|
|
17
|
+
//# sourceMappingURL=AcmeService.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcmeService.types.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,KAAK,CAAC;AAE9B,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAE9C,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;AAEtE,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AACD,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI,OAAO,CAC/C;IACE,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACD,SAAS,CACZ,CAAC"}
|
package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.types.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/index.ts"],"names":[],"mappings":"AAmBA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./AcmeService"), exports);
|