Skip to content

Commit 40ce2a1

Browse files
authored
Merge pull request #1446 from Criptext/custom-domains-aliases
Criptext Plus
2 parents 99956bf + 063d133 commit 40ce2a1

File tree

100 files changed

+6046
-598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+6046
-598
lines changed

electron_app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "criptext",
3-
"version": "0.28.5",
3+
"version": "0.29.0",
44
"author": {
55
"name": "Criptext Inc",
66
"email": "[email protected]",
@@ -150,7 +150,7 @@
150150
"electron-notarize": "^0.1.1"
151151
},
152152
"dependencies": {
153-
"@criptext/api": "^0.15.23",
153+
"@criptext/api": "^0.15.35",
154154
"@criptext/data-transfer-client": "^0.1.1",
155155
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",
156156
"@criptext/electron-push-receiver": "^2.1.3",

electron_app/src/Account.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { APP_DOMAIN } = require('./utils/const');
33
const accountProperties = [
44
'jwt',
55
'name',
6+
'customerType',
67
'signature',
78
'signatureEnabled',
89
'signFooter',
@@ -39,6 +40,9 @@ class Account {
3940
get jwt() {
4041
return this.activeAccount.jwt;
4142
}
43+
get customerType() {
44+
return this.activeAccount.customerType;
45+
}
4246
get privKey() {
4347
return this.activeAccount.privKey;
4448
}

electron_app/src/__integrations__/__snapshots__/Account.integration.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Array [
99
"autoBackupLastSize": null,
1010
"autoBackupNextDate": null,
1111
"autoBackupPath": null,
12+
"customerType": 0,
1213
"deviceId": 1,
1314
"encryptToExternals": false,
1415
"id": 1,
@@ -32,6 +33,7 @@ Array [
3233
"autoBackupLastSize": null,
3334
"autoBackupNextDate": null,
3435
"autoBackupPath": null,
36+
"customerType": 0,
3537
"deviceId": 1,
3638
"encryptToExternals": false,
3739
"id": 2,

electron_app/src/clientManager.js

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ const checkExpiredSession = async (
165165
}
166166
};
167167

168+
const activateAddress = async ({ rowId, active, recipientId }) => {
169+
const client = await createClient({ recipientId });
170+
const res = await client.activateAddress(rowId, active);
171+
return res.status === 200
172+
? res
173+
: await checkExpiredSession(res, activateAddress, { rowId, active });
174+
};
175+
168176
const acknowledgeEvents = async params => {
169177
const { eventIds, recipientId } = params;
170178
const client = await createClient({ recipientId });
@@ -209,6 +217,14 @@ const checkAvailableUsername = async username => {
209217
return await client.checkAvailableUsername(username);
210218
};
211219

220+
const deleteAddress = async ({ addressId, recipientId }) => {
221+
const client = await createClient({ recipientId });
222+
const res = await client.deleteAddress(addressId);
223+
return res.status === 200
224+
? res
225+
: await checkExpiredSession(res, deleteAddress, addressId);
226+
};
227+
212228
const deleteDeviceToken = async params => {
213229
const recipientId = getRecipientId(params);
214230
const client = await createClient({
@@ -221,6 +237,14 @@ const deleteDeviceToken = async params => {
221237
: await checkExpiredSession(res, deleteDeviceToken, params);
222238
};
223239

240+
const deleteDomain = async ({ domain, recipientId }) => {
241+
const client = await createClient({ recipientId });
242+
const res = await client.deleteDomain(domain);
243+
return res.status === 200
244+
? res
245+
: await checkExpiredSession(res, deleteDomain, domain);
246+
};
247+
224248
const deleteMyAccount = async params => {
225249
const { recipientId, password } = params;
226250
const client = await createClient({ recipientId });
@@ -265,6 +289,14 @@ const getDataReady = async recipientId => {
265289
: await checkExpiredSession(res, getDataReady, recipientId);
266290
};
267291

292+
const getDomainMX = async ({ domain, recipientId }) => {
293+
const client = await createClient({ recipientId });
294+
const res = await client.getDomainMX(domain);
295+
return res.status === 200
296+
? res
297+
: await checkExpiredSession(res, getDomainMX, domain);
298+
};
299+
268300
const getKeyBundle = async params => {
269301
const { deviceId, recipientId } = params;
270302
const client = await createClient({ recipientId });
@@ -274,6 +306,13 @@ const getKeyBundle = async params => {
274306
: await checkExpiredSession(res, getKeyBundle, params);
275307
};
276308

309+
const getMaxDevices = async params => {
310+
const { token, recipientId } = params;
311+
const client = await createClient({ recipientId });
312+
const res = await client.getMaxDevices(token);
313+
return res;
314+
};
315+
277316
const getUserSettings = async recipientId => {
278317
const client = await createClient({ recipientId });
279318
const res = await client.getUserSettings();
@@ -282,9 +321,16 @@ const getUserSettings = async recipientId => {
282321
: await checkExpiredSession(res, getUserSettings, recipientId);
283322
};
284323

324+
const isDomainAvailable = async ({ domain, recipientId }) => {
325+
const request = { domain: { name: domain } };
326+
const client = await createClient({ recipientId });
327+
return await client.isDomainAvailable(request);
328+
};
329+
285330
const parseUserSettings = settings => {
286-
const { devices, general } = settings;
331+
const { devices, general, addresses } = settings;
287332
const {
333+
customerType,
288334
recoveryEmail,
289335
recoveryEmailConfirmed,
290336
replyTo,
@@ -293,6 +339,8 @@ const parseUserSettings = settings => {
293339
} = general;
294340
return {
295341
devices,
342+
addresses,
343+
customerType,
296344
twoFactorAuth: !!twoFactorAuth,
297345
recoveryEmail,
298346
recoveryEmailConfirmed: !!recoveryEmailConfirmed,
@@ -463,6 +511,14 @@ const postUser = async params => {
463511
return await client.postUser(params);
464512
};
465513

514+
const registerDomain = async ({ domain, recipientId }) => {
515+
const client = await createClient({ recipientId });
516+
const res = await client.registerDomain(domain);
517+
return res.status === 200
518+
? res
519+
: await checkExpiredSession(res, registerDomain, domain);
520+
};
521+
466522
const removeAvatar = async recipientId => {
467523
const client = await createClient({ recipientId });
468524
return await client.deleteAvatar();
@@ -505,6 +561,14 @@ const resetPassword = async params => {
505561
: await checkExpiredSession(res, resetPassword, params);
506562
};
507563

564+
const setAddress = async params => {
565+
const client = await createClient({ recipientId: params.recipientId });
566+
const res = await client.setAddress(params.username, params.domain);
567+
return res.status === 200
568+
? res
569+
: await checkExpiredSession(res, setAddress, params);
570+
};
571+
508572
const sendRecoveryCode = async ({ newDeviceData, jwt }) => {
509573
const recipientId = getRecipientId(newDeviceData);
510574
const client = await createClient({ recipientId, optionalToken: jwt });
@@ -659,6 +723,14 @@ const unsendEmail = async params => {
659723
: await checkExpiredSession(res, unsendEmail, params);
660724
};
661725

726+
const validateDomainMX = async ({ domain, recipientId }) => {
727+
const client = await createClient({ recipientId });
728+
const res = await client.validateDomainMX(domain);
729+
return res.status === 200
730+
? res
731+
: await checkExpiredSession(res, validateDomainMX, domain);
732+
};
733+
662734
const validateRecoveryCode = async ({ newDeviceData, jwt }) => {
663735
const recipientId = getRecipientId(newDeviceData);
664736
const client = await createClient({ recipientId, optionalToken: jwt });
@@ -667,22 +739,28 @@ const validateRecoveryCode = async ({ newDeviceData, jwt }) => {
667739
};
668740

669741
module.exports = {
742+
activateAddress,
670743
acknowledgeEvents,
671744
canLogin,
672745
changePassword,
673746
changeRecoveryEmail,
674747
checkAvailableUsername,
675748
checkExpiredSession,
749+
deleteAddress,
676750
deleteDeviceToken,
751+
deleteDomain,
677752
deleteMyAccount,
678753
findDevices,
679754
findKeyBundles,
680755
generateEvent,
681756
getDataReady,
757+
getDomainMX,
682758
getKeyBundle,
759+
getMaxDevices,
683760
getUserSettings,
684761
insertPreKeys,
685762
isCriptextDomain,
763+
isDomainAvailable,
686764
linkAccept,
687765
linkAuth,
688766
linkBegin,
@@ -698,11 +776,13 @@ module.exports = {
698776
postPeerEvent,
699777
pushPeerEvents,
700778
postUser,
779+
registerDomain,
701780
removeAvatar,
702781
removeDevice,
703782
reportPhishing,
704783
resendConfirmationEmail,
705784
resetPassword,
785+
setAddress,
706786
sendRecoveryCode,
707787
setReadTracking,
708788
setReplyTo,
@@ -718,5 +798,6 @@ module.exports = {
718798
updatePushToken,
719799
uploadAvatar,
720800
unsendEmail,
801+
validateDomainMX,
721802
validateRecoveryCode
722803
};

0 commit comments

Comments
 (0)