1 import { build } from '@jackfranklin/test-data-bot';
3 import { CALENDAR_DISPLAY, CALENDAR_FLAGS, CALENDAR_TYPE } from '@proton/shared/lib/calendar/constants';
4 import { MEMBER_PERMISSIONS } from '@proton/shared/lib/calendar/permissions';
5 import { ADDRESS_TYPE } from '@proton/shared/lib/constants';
6 import type { Address, AddressKey } from '@proton/shared/lib/interfaces';
12 } from '@proton/shared/lib/interfaces/calendar';
13 import { CALENDAR_SUBSCRIPTION_STATUS } from '@proton/shared/lib/interfaces/calendar';
14 import type { Message } from '@proton/shared/lib/interfaces/mail/Message';
16 export const messageBuilder = build<Pick<Message, 'ID' | 'ParsedHeaders'>>('Message', {
18 ID: 'FbqL-2iaaLZnVB8oF3PI5hUQW6nbggQ_tg7n0xZlhAw59jy7WXaZbMh51ESNQY16Tq0OKxHu4PvKlux2sXAU8w==',
20 To: 'stest1@proton.black',
21 From: 'ProtonCalendar <noreply@proton.black>',
22 Date: 'Thu, 25 Nov 2021 16:16:15 +0000',
23 Subject: 'Reminder: event starting at 6:00 PM (GMT+1) on Thursday, November 25',
24 'X-Auto-Response-Suppress': 'OOF',
26 'Auto-Submitted': 'auto-generated',
28 '<jWX4uC1V6Nib4EHf19aHN3bC7K5HRChaFBzBZSOrCkE7Dlx0LX0tQqw89Stl45PZXvpJ5hH_BUcpB_Ms3UUIeQ==@calendar.proton.me>',
29 'X-Pm-Calendar-Eventid':
30 'jWX4uC1V6Nib4EHf19aHN3bC7K5HRChaFBzBZSOrCkE7Dlx0LX0tQqw89Stl45PZXvpJ5hH_BUcpB_Ms3UUIeQ==',
31 'X-Pm-Calendar-Calendarid':
32 '8DqHHGgVZgEb9KJ0En3mhktAcUBNlAEfGdp5-KnBy2WedZq2Th_gBhphVfcSITxDpz914-LvghzmLf5dhOB5HQ==',
33 'X-Pm-Calendar-Occurrence': '1637859600',
34 'X-Pm-Calendar-Sequence': '0',
35 'X-Pm-Calendar-Eventuid': 'Ei1MAms3nRIcvGqJ3S7o-UUCkL7i@proton.me',
36 'X-Pm-Calendar-Eventisrecurring': '0',
37 'Message-Id': '<026FBWBHHV3J86BEWD000VNHR0@protonmail.com>',
38 'X-Pm-Origin': 'internal',
39 'X-Pm-Content-Encryption': 'end-to-end',
40 'X-Pm-Spamscore': '0',
41 Received: 'from mailmx.proton.black by mailmx.proton.black; Thu, 25 Nov 2021 16:16:36 +0000',
42 'X-Original-To': 'stest1@proton.black',
43 'Return-Path': '<noreply@proton.black>',
44 'Delivered-To': 'stest1@proton.black',
45 'Mime-Version': '1.0',
46 'Content-Type': 'text/html',
47 'X-Attached': 'protoncalendar.png',
52 const testEmail = 'stest1@proton.black';
53 const testAdddressId = 'Lw5suur9q0eTrcp-ufF41Ar7WNj5FQQFz_iKVcCD8khv0eVLJ8MPyx9oiI1XfZJ3JVuTmpG2dgOIY2zCCrIVIw==';
54 const testCalendarId = '8DqHHGgVZgEb9KJ0En3mhktAcUBNlAEfGdp5-KnBy2WedZq2Th_gBhphVfcSITxDpz914-LvghzmLf5dhOB5HQ==';
56 export const calendarUserSettingsBuilder = build<CalendarUserSettings>('CalendarUserSettings', {
61 AutoDetectPrimaryTimezone: 1,
62 PrimaryTimezone: 'Europe/Zurich',
63 DisplaySecondaryTimezone: 0,
64 SecondaryTimezone: null,
66 DefaultCalendarID: '8DqHHGgVZgEb9KJ0En3mhktAcUBNlAEfGdp5-KnBy2WedZq2Th_gBhphVfcSITxDpz914-LvghzmLf5dhOB5HQ==',
71 export const calendarBuilder = build<VisualCalendar>('Calendar', {
77 Flags: CALENDAR_FLAGS.ACTIVE,
82 Owner: { Email: testEmail },
86 ID: 'otkpEZzG--8dMXvwyLXLQWB72hhBhNGzINjH14rUDfywvOyeN01cDxDrS3Koifxf6asA7Xcwtldm0r_MCmWiAQ==',
89 AddressID: testAdddressId,
90 Flags: CALENDAR_FLAGS.ACTIVE,
93 CalendarID: testCalendarId,
105 ID: 'otkpEZzG--8dMXvwyLXLQWB72hhBhNGzINjH14rUDfywvOyeN01cDxDrS3Koifxf6asA7Xcwtldm0r_MCmWiAQ==',
108 AddressID: testAdddressId,
109 Flags: CALENDAR_FLAGS.RESET_NEEDED,
112 CalendarID: testCalendarId,
124 ID: 'otkpEZzG--8dMXvwyLXLQWB72hhBhNGzINjH14rUDfywvOyeN01cDxDrS3Koifxf6asA7Xcwtldm0r_MCmWiAQ==',
127 AddressID: testAdddressId,
128 Flags: CALENDAR_FLAGS.UPDATE_PASSPHRASE,
131 CalendarID: testCalendarId,
142 export const addressKeyBuilder = build<AddressKey>('AddressKey', {
144 ID: 'oAwF7m8z5CksIPpX9fzAGp6hvyy0zPV0XnDWkdq-OcPyBmVygc7cyK-JFgr_HVkOc4B48BM-RSNILvPDZyfOGA==',
147 Fingerprint: 'dbae8b8bb94db1b8cce9d7d2d683831eeedb3e32',
148 Fingerprints: ['1be0b1b19ca7cc803eba2234725c5400df3b966b', 'dbae8b8bb94db1b8cce9d7d2d683831eeedb3e32'],
150 '-----BEGIN PGP PUBLIC KEY BLOCK-----\\nVersion: ProtonMail\\n\\nxjMEYZYvQxYJKwYBBAHaRw8BAQdA7QXbKv40LALRWxAhKs5qdXCugnfV+ltz\\ndRMIzvLza/XNKXN0ZXN0MUBwcm90b24uYmxhY2sgPHN0ZXN0MUBwcm90b24u\\nYmxhY2s+wo8EEBYKACAFAmGWL0MGCwkHCAMCBBUICgIEFgIBAAIZAQIbAwIe\\nAQAhCRDWg4Me7ts+MhYhBNuui4u5TbG4zOnX0taDgx7u2z4yPJYA/ihS6mAn\\ndgU9SWuT2eQdpHzjS2aFM++3ORBqbmlUMJ2TAP9BK/ShGaU1xQT7oW4r1IwJ\\nwh6GPVoI9l/dDluwAsgbDM44BGGWL0MSCisGAQQBl1UBBQEBB0BHSIm4e1GL\\ndcT1fSo1xyPDskA8DQ3xzgECfLiGB0G/ZwMBCAfCeAQYFggACQUCYZYvQwIb\\nDAAhCRDWg4Me7ts+MhYhBNuui4u5TbG4zOnX0taDgx7u2z4yvkEBAMUxhmbz\\n/iKUMCB1dZWWYgXxXubgRXVE6KUB14tbQS+IAP98S0YWeQgOXG5tRzOgxpZL\\n9hyxyxotRbZCxiMfLIJeBw==\\n=LacE\\n-----END PGP PUBLIC KEY BLOCK-----\\n',
152 '-----BEGIN PGP PRIVATE KEY BLOCK-----\\nVersion: ProtonMail\\n\\nxYYEYZYvQxYJKwYBBAHaRw8BAQdA7QXbKv40LALRWxAhKs5qdXCugnfV+ltz\\ndRMIzvLza/X+CQMI91KskzNcMxhgYjWul/wQozuyfoGySCt3I81VyUgQn2qd\\nwRtolOfoecu6KeOm+62vHBxwUDqeU0RQ3d40gEdf/iqQqSB8PCLSRoU8i4zP\\nhM0pc3Rlc3QxQHByb3Rvbi5ibGFjayA8c3Rlc3QxQHByb3Rvbi5ibGFjaz7C\\njwQQFgoAIAUCYZYvQwYLCQcIAwIEFQgKAgQWAgEAAhkBAhsDAh4BACEJENaD\\ngx7u2z4yFiEE266Li7lNsbjM6dfS1oODHu7bPjI8lgD+KFLqYCd2BT1Ja5PZ\\n5B2kfONLZoUz77c5EGpuaVQwnZMA/0Er9KEZpTXFBPuhbivUjAnCHoY9Wgj2\\nX90OW7ACyBsMx4sEYZYvQxIKKwYBBAGXVQEFAQEHQEdIibh7UYt1xPV9KjXH\\nI8OyQDwNDfHOAQJ8uIYHQb9nAwEIB/4JAwgS0zzsR9GuWWApVtJXYfWFaVy+\\nWv8RtclDDWvYCXm7U6t9Z4X74cYVJdCxxieoOqOs9xiZuWbGUVaj10z2o5WP\\nqp5tfpPMwxgBNNbX7CASwngEGBYIAAkFAmGWL0MCGwwAIQkQ1oODHu7bPjIW\\nIQTbrouLuU2xuMzp19LWg4Me7ts+Mr5BAQDFMYZm8/4ilDAgdXWVlmIF8V7m\\n4EV1ROilAdeLW0EviAD/fEtGFnkIDlxubUczoMaWS/YcscsaLUW2QsYjHyyC\\nXgc=\\n=wxep\\n-----END PGP PRIVATE KEY BLOCK-----\\n',
154 '-----BEGIN PGP SIGNATURE-----\\nVersion: ProtonMail\\n\\nwnUEARYKAAYFAmGWL38AIQkQmMokddP43uoWIQSeQbXypkkMBCLPiL+YyiR1\\n0/je6t0xAPsE4JQeK2gIug3FLP/FGERdmwcscuZNgaoCpUqQupp5eAD/QtOs\\nBF243mQGEbji7T8cq/E5AP7a/nNa4uWvNPAI/gk=\\n=Icvl\\n-----END PGP SIGNATURE-----\\n',
155 Token: '-----BEGIN PGP MESSAGE-----\\nVersion: ProtonMail\\n\\nwV4Dq7i1ziRJQLUSAQdAe+uk39M57AL4pw8jNszfIQ9iOIrYD0qROCVBsttu\\naR8wZ2NmkCujcl4ruaPEDp4cOEE/CAh1aU49zsXVkG/mv5+fd+Y7RWUqoNjI\\n/Y+mUyhM0ngBHu51pNAOaOVphTTZXlCkJmhM2wdggQaIbR6yR4KcFyvycgHj\\nFqdgJKhEwocDW9AtLxcbcPWYXQucB5Gfa4omMS966uKigF5EfeDimK+sQ7mF\\nL3/XKOvRy7axwptQDdGN1/MeloLEQIUdeo+n8FF5IOCZ+7N/YMg=\\n=0UNR\\n-----END PGP MESSAGE-----\\n',
156 RecoverySecret: null,
157 RecoverySecretSignature: null,
160 AddressForwardingID: null,
164 export const addressBuilder = build<Address>('Address', {
168 DomainID: 'l8vWAXHBQmv0u7OVtPbcqMa4iwQaBqowINSQjPrxAr-Da8fVPKUkUcqAq30_BCxj1X0nW70HQRmAa-rIvzmKUA==',
169 DisplayName: testEmail,
176 Data: '[{"Primary":1,"Flags":3,"Fingerprint":"dbae8b8bb94db1b8cce9d7d2d683831eeedb3e32","SHA256Fingerprints":["41964058156a2d90c1f0e65a38f5752fb2921b9666ea3b17f781787b6ef55f8f","d82271d5deec94e65862ca759f3c24a263512f00bf67864cac71c8b14f0dc744"]}]',
178 '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwnUEARYKAAYFAmGWL38AIQkQ1oODHu7bPjIWIQTbrouLuU2xuMzp19LWg4Me\r\n7ts+MmKdAQDGpH8FevWQE32waPgqx+1EqjGmEdywZdZkilUEwb0VswEAgdrS\r\noustAwFTu4E5PubZz7H7tN0SqM9p5GiKSYJSCQg=\r\n=gK8A\r\n-----END PGP SIGNATURE-----\r\n',
186 Type: ADDRESS_TYPE.TYPE_ORIGINAL,
188 ConfirmationState: 1,
191 postBuild: (address) => {
192 address.Keys = [addressKeyBuilder()];
198 export const calendarEventBuilder = build<CalendarEvent>('Event', {
200 IsProtonProtonInvite: 0,
201 IsPersonalSingleEdit: false,
202 // LastEditTime: 1637857503,
203 // LastEditTime: 1637857503,
204 Author: 'stest1@proton.black',
207 'wV4Dg2X1eF86wkcSAQdADLyc34k1EjC67CQo4M2OuhmX+YwNKQhbk6bz2ow31kgw2oiUfClVOBP5sYPcIJ+aD1B9JrTrDP5gY/BUiXKMPpEbaZpp+5DKBKIpdLheM5cJ',
211 Data: 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:Ei1MAms3nRIcvGqJ3S7o-UUCkL7i@proton.me\r\nDTSTAMP:20211125T162445Z\r\nDTSTART;TZID=Europe/Zurich:20211125T180000\r\nDTEND;TZID=Europe/Zurich:20211125T193000\r\nORGANIZER;CN=stest1@proton.black:mailto:stest1@proton.black\r\nSEQUENCE:0\r\nEND:VEVENT\r\nEND:VCALENDAR',
213 '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwnUEARYKAAYFAmGfuN0AIQkQ1oODHu7bPjIWIQTbrouLuU2xuMzp19LWg4Me\r\n7ts+MpTvAP41Z15ymzb+mGakFzAMui23FzRSF0gNHEqRgPGYDNTsXQD9Hrh+\r\nNC4mIQG3mhgx5gKzDSR7yRv7shr9TPVZUe/GuAA=\r\n=yrvm\r\n-----END PGP SIGNATURE-----\r\n',
214 Author: 'stest1@proton.black',
218 Data: '0sBOAVp6l7BAqo8QhcuhlZIrWPYtPYWub5bFf+FTQc6sqz0EtozOUpO4+Ki/3S5YID5xhCkj/TyjA3CP+1TIs5giO2yvRD6GZ/TLPa9XXKmVWBYA+Y+otvAbT0sOudh7T3e2jdhQFcdUHYWoskF5nltoX54AdZuqijT/CBlmfwkIlu9Nv8S/ovW3Wna9BqhYE+XFV9F4ILEz+WicixqbUtsQR8IO1y0wwD9LC7fy07Nd96ym5XB7lEc5d1NfhXiB+dJQ1TXSHcMbgHkt4upOESFGHpXzOKjKDYji75IqzTWErcAgvCHz8aRrYSmaQ2Iz0PtOh83zfNoWwRzj0+OpFLF1EOywrloQdrqmAQ1V2sYo',
220 '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwnUEARYKAAYFAmGfuN0AIQkQ1oODHu7bPjIWIQTbrouLuU2xuMzp19LWg4Me\r\n7ts+Mt7nAQCGtqatUfwfDhYOCFVu3DEYtEtJBsPG1kSGibzBit3++wD/Vgz8\r\n+Oh4n5pCt1lKVXArEWcGP5LESUAfvtoV4zdevgA=\r\n=4wfE\r\n-----END PGP SIGNATURE-----\r\n',
221 Author: 'stest1@proton.black',
224 CalendarKeyPacket: null,
225 AddressKeyPacket: null,
231 Data: 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:Ei1MAms3nRIcvGqJ3S7o-UUCkL7i@proton.me\r\nDTSTAMP:20211125T162445Z\r\nSTATUS:CONFIRMED\r\nEND:VEVENT\r\nEND:VCALENDAR',
233 '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwnUEARYKAAYFAmGfuN0AIQkQ1oODHu7bPjIWIQTbrouLuU2xuMzp19LWg4Me\r\n7ts+Mi8UAQC4VMeBVVzERqdjviLIQHoqQFrRK569/uqokDCBXuZmYwEA6oNl\r\nX3laSh9+ZYhjWZ+KMydEBDQzsuT9+l7bDqJi4AA=\r\n=4H4p\r\n-----END PGP SIGNATURE-----\r\n',
234 Author: 'stest1@proton.black',
237 ID: 'jWX4uC1V6Nib4EHf19aHN3bC7K5HRChaFBzBZSOrCkE7Dlx0LX0tQqw89Stl45PZXvpJ5hH_BUcpB_Ms3UUIeQ==',
238 CalendarID: '8DqHHGgVZgEb9KJ0En3mhktAcUBNlAEfGdp5-KnBy2WedZq2Th_gBhphVfcSITxDpz914-LvghzmLf5dhOB5HQ==',
240 '3YnKxnpRu1eDKP2_WkwZF54MlQSYHvl1FZKFgeiHrjaa4ff60s0yTYlXBMaUUApx1wxaRStoe-c-07JmOp8giBLZe_byc8u_dCWjQGf1zxw=',
241 StartTime: 1637859600,
242 StartTimezone: 'Europe/Zurich',
244 EndTimezone: 'Europe/Zurich',
246 UID: 'Ei1MAms3nRIcvGqJ3S7o-UUCkL7i@proton.me',
250 CreateTime: 1637855813,
251 ModifyTime: 1637857503,
257 Data: '0sEYAYJHqp1jBcWK88Dyn7KmmqYv87UfmOj0bFafht64OeqBKwHWbhNbjo8lRWg5st3hDXEiamCe2d2BfoNhU/EF9UEEb+8jfsvbNAgtYgZYwR29jK2viqw1VY6lZPBVERhXl8enicmMfEOUkOwwZjyOSEHeLMJd9paeba5VoHHRD2d4HApQnWx40FG1E91jbJXm/oCZRaObmb7UC8lXET4J2n/+Gk9NQz5azEWZ8AImVkLmrOKtOeWRVYaV+YFoVMn5hEAhYMSJ8rSjU3cOTk0ve9ALr0hWTnUhbs5yAvnvmWI270y3ipXbO56BGD/oKNogErgPEcCwY97Z1+zKKXEvNCK49Bvo3ltm+cszJAfUJNisdGZTkWT/Jl2BfvXm/bYFs+9p+WTFIGwMNk3K6YV5/65qz7VCElx940nsLfpyPBUT/GONRuYFdxyjpyKxNk65QH4dMfjBK2+y9F6mJ7Cn4iRVGLWBMMMC+yKdJA5fGaFAmoJprtWRjA8hwnjneBsZ98ZZqVClOw/8o2HOjdBjgf/0XmUnxGRc1eIkpo3tWiKdNzXGW7d3C7W4Rs/ludBb2BFnzzoMbY4saPJ2GobKXR1fSRvdtlX3dGgDHcsy5YQ2jroFD9lsIw==',
259 '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwnUEARYKAAYFAmGfuN0AIQkQ1oODHu7bPjIWIQTbrouLuU2xuMzp19LWg4Me\r\n7ts+MrCDAP9WYG5b/GBu0mxUuOUViDU3YadrEBpi8Zu+jO9wlMTvbwD/W/68\r\n4Tod7E68Q9DIHInPb8bBJXDizBeo6Lbp8dVXfgM=\r\n=frBC\r\n-----END PGP SIGNATURE-----\r\n',
260 Author: 'stest1@proton.black',
265 ID: 'Proye_ciptkeikxsRdv3sVlYdqVXqRAJOfIjn_Bcug_9PaEDxga9-gHHa0Bkds25K3GBt50C4gJNsNexeirkrg==',
266 Token: '3c5c89a60b8e36ff0b4b1399152b0551c73e373f',
271 ID: '_rJk4ub7qapyIkWd-d3EwIbJ7svqscEuq_HfWM_E6oBHEQAIKFFpx-89fW27J8waIU39_hcJQ34yM4p9GlYChQ==',
272 Token: '5578255a302f0938e7f5628487a06ed0fd0f5c8c',
284 Data: 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:Ei1MAms3nRIcvGqJ3S7o-UUCkL7i@proton.me\r\nDTSTAMP:20211125T162445Z\r\nSTATUS:CANCELLED\r\nEND:VEVENT\r\nEND:VCALENDAR',
286 '-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwnUEARYKAAYFAmGfuN0AIQkQ1oODHu7bPjIWIQTbrouLuU2xuMzp19LWg4Me\r\n7ts+Mi8UAQC4VMeBVVzERqdjviLIQHoqQFrRK569/uqokDCBXuZmYwEA6oNl\r\nX3laSh9+ZYhjWZ+KMydEBDQzsuT9+l7bDqJi4AA=\r\n=4H4p\r\n-----END PGP SIGNATURE-----\r\n',
287 Author: 'stest1@proton.black',
295 export const veventBuilder = build<VcalVeventComponent>('vevent', {
299 value: 'Ei1MAms3nRIcvGqJ3S7o-UUCkL7i@proton.me',
323 tzid: 'Europe/Zurich',
337 tzid: 'Europe/Zurich',
341 value: 'mailto:stest1@proton.black',
343 cn: 'stest1@proton.black',
350 value: 'Test description',
356 value: 'Test location',
363 value: 'mailto:visionary@proton.black',
365 cn: 'visionary@proton.black',
366 role: 'REQ-PARTICIPANT',
368 'x-pm-token': '3c5c89a60b8e36ff0b4b1399152b0551c73e373f',
369 partstat: 'NEEDS-ACTION',
373 value: 'mailto:calendar@proton.black',
375 cn: 'calendar@proton.black',
376 role: 'REQ-PARTICIPANT',
378 'x-pm-token': '5578255a302f0938e7f5628487a06ed0fd0f5c8c',
379 partstat: 'NEEDS-ACTION',
386 export const userBuilder = build('User', {
388 ID: 'XTMQTRBEv-QushjfD5ST-YBFsGCWD-XwuRWoyqgWvPVQj5KcKQRy207GIwLK-DvBrRL-PAiIpp4XKoznVXq-HA==',
389 Subscribed: 0, // 5 is visionary
394 MaxSpace: 21474836480,
404 ID: 'G069KcZLuBEqitlJvsNsldLWx4kR4HAMwkjLp8w7-VcjWpI0pKExAm0QwalWsoUGKoHrOp5lQSqDYi8nYzKZZA==',
407 RecoverySecret: null,
408 RecoverySecretSignature: null,
410 '-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: ProtonMail\n\nxYYEYZYvQxYJKwYBBAHaRw8BAQdAOAQ0qa66bef6/Q1ENhnWb30cdu9cQoeE\n2Jz4W0pg+ZH+CQMIaWXFbP4Z79Jgqd49X0YbF48Qb8Lz02/tTi2uhyssMmUx\n+SiMf57ROgKif7MVHtSDDhggzPVzvIiO6bZFNBKzPSsxAnfwyBrEdakBZ2jf\n5807bm90X2Zvcl9lbWFpbF91c2VAZG9tYWluLnRsZCA8bm90X2Zvcl9lbWFp\nbF91c2VAZG9tYWluLnRsZD7CjwQQFgoAIAUCYZYvQwYLCQcIAwIEFQgKAgQW\nAgEAAhkBAhsDAh4BACEJEJjKJHXT+N7qFiEEnkG18qZJDAQiz4i/mMokddP4\n3urgQgD+LI33CnxtImG5itTEdXHAS3E+oQkTv0eRv0GKvUTff1wA/isu2UKO\n0oagG/4ZaydLEKnh65sC03KSKy/WDnEpPEAMx4sEYZYvQxIKKwYBBAGXVQEF\nAQEHQGdDIKW1oEv2p4wvBEfkibOD1Ey03uecLDFWZ2Nb5g4zAwEIB/4JAwg2\nupFO+VHAx2CGNlWxM7g+KRr0zb1bFDZnGdVNE/AxJvzZUOuRA5rjGJxM6vac\nFOpH6fL4zNm+BJsu54OiVvxNfVAjyPSmrCk5JbDOGif4wngEGBYIAAkFAmGW\nL0MCGwwAIQkQmMokddP43uoWIQSeQbXypkkMBCLPiL+YyiR10/je6tSoAQDx\ndRTZmvcbkKe6k+F+EOa/Tmp/lARzEYMmWpnQcmI9cQD6AhgeFjDh+r+XY+q1\nZ2fGhDHqYiLQd0s+LmRzq8Tnfwo=\n=y2fV\n-----END PGP PRIVATE KEY BLOCK-----\n',
411 Fingerprint: '9e41b5f2a6490c0422cf88bf98ca2475d3f8deea',
416 Email: 'stest1@proton.black',
417 DisplayName: 'Bad Boy',
421 interface GenerateSimpleCalendarCustomParams {
424 calendarEmail?: string;
426 permissions?: number;
427 type?: CALENDAR_TYPE;
428 flags?: CALENDAR_FLAGS;
429 display?: CALENDAR_DISPLAY;
433 export const generateSimpleCalendar = (
438 calendarEmail = 'calendarEmail',
439 ownerEmail = 'calendarEmail',
440 permissions = MEMBER_PERMISSIONS.OWNS,
441 type = CALENDAR_TYPE.PERSONAL,
442 flags = CALENDAR_FLAGS.ACTIVE,
443 display = CALENDAR_DISPLAY.VISIBLE,
445 }: GenerateSimpleCalendarCustomParams
446 ): VisualCalendar => ({
449 Description: `description-${i}`,
452 Email: calendarEmail,
455 Permissions: permissions,
457 Owner: { Email: ownerEmail },
461 Email: calendarEmail,
462 Permissions: permissions,
463 AddressID: `address-id-${i}`,
467 CalendarID: `id-${i}`,
469 Description: `description-${i}`,
475 export const generateTestAddress = (compelled?: Partial<Address>): Address => {
477 ID: 'fHR97Meg0sNme5k8IFa2umNtk5FjTUA7FbImbZj7RIO3U5hMmGk8_NF6a7qgSZ2QviSQmEg7Qib9xfLEdjCdXA==',
478 DomainID: 'l8vWAXHBQmv0u7OVtPbcqMa4iwQaBqowINSQjPrxAr-Da8fVPKUkUcqAq30_BCxj1X0nW70HQRmAa-rIvzmKUA==',
479 Email: 'unlimited@proton.test',
483 DisplayName: 'unlimited',
485 ExpectedMinEpochID: 1,
486 Data: '[{"Primary":1,"Flags":3,"Fingerprint":"c2b4f440b000d4f326a65d70a827bb8b6fa093d9","SHA256Fingerprints":["efaba78a9004f1c01cce6b45f4ccfe1e37651c9067d188b665d8d29186c693b2","439fa8debeff000609b2cf8e316f3637a3fb7479da144b10bb95fe24f64f926d"]}]',
487 Signature: '-----BEGIN PGP SIGNATURE-----...',
496 Signature: '-----BEGIN PGP SIGNATURE-----...',
497 Type: ADDRESS_TYPE.TYPE_ORIGINAL,
499 ConfirmationState: 1,
505 export const generateSharedCalendar = (i: number, params: GenerateSimpleCalendarCustomParams) => {
506 const calendar = generateSimpleCalendar(i, params);
508 if (params.calendarEmail && params.ownerEmail && params.calendarEmail === params.ownerEmail) {
509 throw new Error('Owner matches calendar email, not a shared calendar!');
512 if (calendar.Email === calendar.Owner.Email) {
513 calendar.Owner.Email = calendar.Owner.Email === 'calendarEmail' ? 'ownerEmail' : `${calendar.Email}-owner`;
519 interface GenerateSubscribedCalendarCustomParams extends GenerateSimpleCalendarCustomParams {
520 status?: CALENDAR_SUBSCRIPTION_STATUS;
524 export const generateSubscribedCalendar = (
526 { status = CALENDAR_SUBSCRIPTION_STATUS.OK, url = '#', ...rest }: GenerateSubscribedCalendarCustomParams
528 const simpleCalendar = generateSimpleCalendar(i, rest);
529 const SubscriptionParameters = {
530 CalendarID: simpleCalendar.ID,
532 LastUpdateTime: Math.floor(+Date.now() / 1000),
539 Type: CALENDAR_TYPE.SUBSCRIPTION,
540 SubscriptionParameters,
544 export const generateHolidaysCalendar = (i: number, params: GenerateSimpleCalendarCustomParams) => {
545 const simpleCalendar = generateSimpleCalendar(i, params);
549 Type: CALENDAR_TYPE.HOLIDAYS,
553 export const generateOwnedPersonalCalendars = (n: number, customParams?: GenerateSimpleCalendarCustomParams[]) => {
560 .map((val, i) => generateSimpleCalendar(i, customParams?.[i] || {}));
563 export const generateSharedCalendars = (n: number, customParams?: GenerateSimpleCalendarCustomParams[]) => {
570 .map((val, i) => generateSharedCalendar(i, customParams?.[i] || {}));
573 export const generateSubscribedCalendars = (n: number, customParams?: GenerateSubscribedCalendarCustomParams[]) => {
580 .map((val, i) => generateSubscribedCalendar(i, customParams?.[i] || {}));
583 export const generateHolidaysCalendars = (n: number, customParams?: GenerateSimpleCalendarCustomParams[]) => {
590 .map((val, i) => generateHolidaysCalendar(i, customParams?.[i] || {}));