@zimbra/api-client 73.0.0 → 74.0.0

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/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zimbra/api-client",
3
- "version": "73.0.0",
3
+ "version": "74.0.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zimbra/api-client",
3
3
  "amdName": "zmApiJsClient",
4
- "version": "73.0.0",
4
+ "version": "74.0.0",
5
5
  "description": "Zimbra JS API Client and GraphQL client for making requests against the Zimbra SOAP API.",
6
6
  "main": "dist/zm-api-js-client.js",
7
7
  "source": "index.ts",
@@ -44,6 +44,7 @@ import {
44
44
  SearchResponse,
45
45
  SendMessageInfo,
46
46
  ShareNotification,
47
+ SmimeCertInfoResponse,
47
48
  Tag,
48
49
  ZimletConfigEntity
49
50
  } from '../normalize/entities';
@@ -82,6 +83,7 @@ import {
82
83
  ModifyIdentityInput,
83
84
  PreferencesInput,
84
85
  RevokeRightsInput,
86
+ SaveSMimeCertInputUpload,
85
87
  SearchFolderInput,
86
88
  SendMessageInput,
87
89
  ShareNotificationInput,
@@ -118,6 +120,7 @@ import {
118
120
  ChangePasswordOptions,
119
121
  CreateFolderOptions,
120
122
  CreateSearchFolderOptions,
123
+ DiscoverRightOptions,
121
124
  ExternalAccountDeleteInput,
122
125
  ExternalAccountModifyInput,
123
126
  FreeBusyOptions,
@@ -155,10 +158,8 @@ function normalizeMessage(
155
158
  message: { [key: string]: any },
156
159
  { origin, jwtToken, isDesktop }: { isDesktop?: string; jwtToken?: string; origin?: string }
157
160
  ) {
158
- const normalizedMessage = normalize(MessageInfo)(message);
159
- normalizedMessage.attributes =
160
- normalizedMessage.attributes &&
161
- mapValuesDeep(normalizedMessage.attributes, coerceStringToBoolean);
161
+ let normalizedMessage = normalize(MessageInfo)(message);
162
+ normalizedMessage = normalizedMessage && mapValuesDeep(normalizedMessage, coerceStringToBoolean);
162
163
 
163
164
  return normalizeEmailAddresses(
164
165
  normalizeMimeParts(normalizedMessage, { origin, jwtToken, isDesktop })
@@ -589,7 +590,7 @@ export class ZimbraBatchClient {
589
590
  public createContact = (data: CreateContactInput) =>
590
591
  this.jsonRequest({
591
592
  name: 'CreateContact',
592
- body: createContactBody(data),
593
+ body: createContactBody(data, this.localStoreClient !== undefined),
593
594
  singleRequest: true
594
595
  }).then(res => normalize(Contact)(normalizeOtherAttr(res.cn)[0]));
595
596
 
@@ -753,19 +754,12 @@ export class ZimbraBatchClient {
753
754
  singleRequest: true
754
755
  }).then(Boolean);
755
756
 
756
- public discoverRights = () =>
757
+ public discoverRights = ({ right }: DiscoverRightOptions) =>
757
758
  this.jsonRequest({
758
759
  name: 'DiscoverRights',
759
760
  namespace: Namespace.Account,
760
761
  body: {
761
- right: [
762
- {
763
- _content: 'sendAs'
764
- },
765
- {
766
- _content: 'sendOnBehalfOf'
767
- }
768
- ]
762
+ right
769
763
  }
770
764
  }).then(res => normalize(DiscoverRightsResponse)(res));
771
765
 
@@ -1156,7 +1150,7 @@ export class ZimbraBatchClient {
1156
1150
  needExp: 1,
1157
1151
  neuter: 0,
1158
1152
  // max body length (look for mp.truncated=1)
1159
- max: max || 250000,
1153
+ ...(max && { max: max }),
1160
1154
  raw: raw ? 1 : 0,
1161
1155
  ...(ridZ && { ridZ: ridZ }),
1162
1156
  ...(part && { part: part })
@@ -1233,6 +1227,12 @@ export class ZimbraBatchClient {
1233
1227
  namespace: Namespace.Account
1234
1228
  }).then(res => mapValuesDeep(res, coerceStringToBoolean));
1235
1229
 
1230
+ public getSMimeCertInfo = () =>
1231
+ this.jsonRequest({
1232
+ name: 'GetSmimeCertificateInfo',
1233
+ namespace: Namespace.Account
1234
+ }).then(certificate => normalize(SmimeCertInfoResponse)(certificate || {}));
1235
+
1236
1236
  public getSMimePublicCerts = (options: GetSMimePublicCertsOptions) =>
1237
1237
  this.jsonRequest({
1238
1238
  name: 'GetSMIMEPublicCerts',
@@ -1374,7 +1374,7 @@ export class ZimbraBatchClient {
1374
1374
  public modifyContact = (data: ModifyContactInput) =>
1375
1375
  this.jsonRequest({
1376
1376
  name: 'ModifyContact',
1377
- body: createContactBody(data),
1377
+ body: createContactBody(data, this.localStoreClient !== undefined),
1378
1378
  singleRequest: true
1379
1379
  }).then(res => normalize(Contact)(normalizeOtherAttr(res.cn)[0]));
1380
1380
 
@@ -1645,6 +1645,16 @@ export class ZimbraBatchClient {
1645
1645
  message: messages && messages.map(this.normalizeMessage)
1646
1646
  }));
1647
1647
 
1648
+ public saveSMimeCert = (upload: SaveSMimeCertInputUpload, password: string) =>
1649
+ this.jsonRequest({
1650
+ name: 'SaveSmimeCertificate',
1651
+ body: {
1652
+ upload,
1653
+ password
1654
+ },
1655
+ namespace: Namespace.Account
1656
+ }).then(certificate => normalize(SmimeCertInfoResponse)(certificate || {}));
1657
+
1648
1658
  public search = (options: SearchOptions) =>
1649
1659
  this.jsonRequest({
1650
1660
  name: 'Search',
@@ -1674,7 +1684,12 @@ export class ZimbraBatchClient {
1674
1684
  name: 'SearchGal',
1675
1685
  body: options,
1676
1686
  namespace: Namespace.Account
1677
- }).then(normalize(SearchResponse));
1687
+ }).then(res => {
1688
+ if (res.cn) {
1689
+ res.cn = normalizeOtherAttr(res.cn);
1690
+ }
1691
+ return normalize(SearchResponse)(res);
1692
+ });
1678
1693
 
1679
1694
  public sendDeliveryReport = (messageId: string) =>
1680
1695
  this.jsonRequest({
@@ -1694,10 +1709,19 @@ export class ZimbraBatchClient {
1694
1709
  singleRequest: true
1695
1710
  }).then(res => normalize(CalendarItemHitInfo)(res));
1696
1711
 
1697
- public sendMessage = (message: SendMessageInput, accountName: string) =>
1712
+ public sendMessage = (
1713
+ message: SendMessageInput,
1714
+ accountName: string,
1715
+ sign: Boolean,
1716
+ encrypt: Boolean
1717
+ ) =>
1698
1718
  this.jsonRequest({
1699
- name: 'SendMsg',
1700
- body: denormalize(SendMessageInfo)({ message }),
1719
+ name: !(sign || encrypt) ? 'SendMsg' : 'SendSecureMsg',
1720
+ body: {
1721
+ ...denormalize(SendMessageInfo)({ message }),
1722
+ ...(sign && { sign: true }),
1723
+ ...(encrypt && { encrypt: true })
1724
+ },
1701
1725
  singleRequest: true,
1702
1726
  accountName: accountName
1703
1727
  }).then(normalize(SendMessageInfo));
@@ -365,3 +365,10 @@ export interface NoOpOptions {
365
365
  limitToOneBlocked: number;
366
366
  wait: number;
367
367
  }
368
+
369
+ export interface DiscoverRightInput {
370
+ _content: string;
371
+ }
372
+ export interface DiscoverRightOptions {
373
+ right: Array<DiscoverRightInput>;
374
+ }
@@ -13,9 +13,7 @@ const MimePart = new Entity({
13
13
  cl: 'contentLocation',
14
14
  ct: 'contentType',
15
15
  s: 'size',
16
- part: 'part',
17
- mid: 'messageId',
18
- content: 'content'
16
+ mid: 'messageId'
19
17
  });
20
18
 
21
19
  const CalendarItemAlarmTriggerRelative = new Entity({
@@ -201,6 +199,43 @@ MimePart.addMapping({
201
199
  attach: ['attachments', AttachmentsInfo]
202
200
  });
203
201
 
202
+ const SmimeCertsSubjectRfc822Name = new Entity({
203
+ _content: 'content'
204
+ });
205
+
206
+ const SmimeCertsSubjectAltName = new Entity({
207
+ rfc822Name: ['rfc822Name', SmimeCertsSubjectRfc822Name]
208
+ });
209
+
210
+ const commonSmimeCertsFields = {
211
+ c: 'country',
212
+ cn: 'commonName',
213
+ o: 'organizationName',
214
+ st: 'state'
215
+ };
216
+
217
+ const SmimeCertsIssuedBy = new Entity({
218
+ ...commonSmimeCertsFields,
219
+ l: 'locality'
220
+ });
221
+
222
+ const SmimeCertsIssuedTo = new Entity({
223
+ ...commonSmimeCertsFields,
224
+ ou: 'organizationUnit'
225
+ });
226
+
227
+ const SmimeCert = new Entity({
228
+ issuedBy: ['issuedBy', SmimeCertsIssuedBy],
229
+ issuedTo: ['issuedTo', SmimeCertsIssuedTo],
230
+ pubCertId: 'publicCertificateId',
231
+ pvtKeyId: 'privateKeyId',
232
+ subjectAltName: ['subjectAltName', SmimeCertsSubjectAltName]
233
+ });
234
+
235
+ export const SmimeCertInfoResponse = new Entity({
236
+ certificate: ['certificates', SmimeCert]
237
+ });
238
+
204
239
  const commonMailItemFields = {
205
240
  ...commonMessageFields,
206
241
  e: ['emailAddresses', MailItemEmailAddress],
@@ -210,7 +245,8 @@ const commonMailItemFields = {
210
245
  su: 'subject',
211
246
  origid: 'origId',
212
247
  attach: ['attachments', AttachmentsInfo],
213
- rt: 'replyType'
248
+ rt: 'replyType',
249
+ certificate: ['certificate', SmimeCert]
214
250
  };
215
251
 
216
252
  const SendMessageFields = new Entity({
@@ -446,7 +482,8 @@ const contactFields = {
446
482
  sf: 'sortField',
447
483
  t: 'tags',
448
484
  tn: 'tagNames',
449
- _attrs: ['attributes', ContactAttributes]
485
+ _attrs: ['attributes', ContactAttributes],
486
+ certificate: ['certificate', SmimeCert]
450
487
  };
451
488
 
452
489
  const contactListMembers = new Entity({
@@ -19,12 +19,14 @@ export interface BaseRequestOptions {
19
19
  authToken?: string;
20
20
  credentials?: RequestCredentials;
21
21
  csrfToken?: string | null;
22
+ encrypt?: Boolean;
22
23
  fetchOptions?: any;
23
24
  headers?: any;
24
25
  jwtToken?: string | null;
25
26
  origin?: string;
26
27
  sessionId?: SessionId;
27
28
  sessionSeq?: SessionSeq;
29
+ sign?: Boolean;
28
30
  singleRequest?: boolean;
29
31
  soapPathname?: string;
30
32
  userAgent?: UserAgent;
@@ -817,6 +817,7 @@ export enum ConnectionType {
817
817
  export type Contact = {
818
818
  __typename?: 'Contact';
819
819
  attributes?: Maybe<ContactAttributes>;
820
+ certificate?: Maybe<Array<Maybe<SmimeCert>>>;
820
821
  date?: Maybe<Scalars['Float']>;
821
822
  fileAsStr?: Maybe<Scalars['String']>;
822
823
  folderId?: Maybe<Scalars['ID']>;
@@ -1234,6 +1235,10 @@ export type Device = {
1234
1235
  ua?: Maybe<Scalars['String']>;
1235
1236
  };
1236
1237
 
1238
+ export type DiscoverRightInput = {
1239
+ _content?: Maybe<Scalars['String']>;
1240
+ };
1241
+
1237
1242
  export type DiscoverRights = {
1238
1243
  __typename?: 'DiscoverRights';
1239
1244
  targets?: Maybe<Array<Maybe<Targets>>>;
@@ -2222,9 +2227,11 @@ export type MessageInfo = MailItem & {
2222
2227
  autoSendTime?: Maybe<Scalars['Float']>;
2223
2228
  bcc?: Maybe<Array<Maybe<EmailAddress>>>;
2224
2229
  cc?: Maybe<Array<Maybe<EmailAddress>>>;
2230
+ certificate?: Maybe<Array<Maybe<SmimeCert>>>;
2225
2231
  changeDate?: Maybe<Scalars['Float']>;
2226
2232
  conversationId?: Maybe<Scalars['ID']>;
2227
2233
  date?: Maybe<Scalars['Float']>;
2234
+ decryptionErrorCode?: Maybe<Scalars['String']>;
2228
2235
  emailAddresses?: Maybe<Array<Maybe<EmailAddress>>>;
2229
2236
  excerpt?: Maybe<Scalars['String']>;
2230
2237
  flags?: Maybe<Scalars['String']>;
@@ -2234,6 +2241,8 @@ export type MessageInfo = MailItem & {
2234
2241
  id?: Maybe<Scalars['ID']>;
2235
2242
  inlineAttachments?: Maybe<Array<Maybe<MimePart>>>;
2236
2243
  invitations?: Maybe<Array<Maybe<InviteInfo>>>;
2244
+ isEncrypted?: Maybe<Scalars['Boolean']>;
2245
+ isSigned?: Maybe<Scalars['Boolean']>;
2237
2246
  local?: Maybe<Scalars['Boolean']>;
2238
2247
  mimeParts?: Maybe<Array<Maybe<MimePart>>>;
2239
2248
  modifiedSequence?: Maybe<Scalars['Float']>;
@@ -2287,6 +2296,7 @@ export type MimePart = {
2287
2296
  mimeParts?: Maybe<Array<Maybe<MimePart>>>;
2288
2297
  part?: Maybe<Scalars['ID']>;
2289
2298
  size?: Maybe<Scalars['Float']>;
2299
+ truncated?: Maybe<Scalars['Boolean']>;
2290
2300
  url?: Maybe<Scalars['String']>;
2291
2301
  };
2292
2302
 
@@ -2303,6 +2313,7 @@ export type MimePartInput = {
2303
2313
  mimeParts?: Maybe<Array<Maybe<MimePartInput>>>;
2304
2314
  part?: Maybe<Scalars['ID']>;
2305
2315
  size?: Maybe<Scalars['Float']>;
2316
+ truncated?: Maybe<Scalars['Boolean']>;
2306
2317
  url?: Maybe<Scalars['String']>;
2307
2318
  };
2308
2319
 
@@ -2449,6 +2460,7 @@ export type Mutation = {
2449
2460
  revokeTrustedDevice?: Maybe<Scalars['Boolean']>;
2450
2461
  saveDocument?: Maybe<SaveDocumentResponse>;
2451
2462
  saveDraft?: Maybe<SaveDraftResponse>;
2463
+ saveSMimeCert?: Maybe<SmimeCertInfoResponse>;
2452
2464
  sendDeliveryReport?: Maybe<Scalars['Boolean']>;
2453
2465
  sendInviteReply?: Maybe<InviteReplyResponse>;
2454
2466
  sendMessage?: Maybe<SendMessageResponse>;
@@ -2909,6 +2921,12 @@ export type MutationSaveDraftArgs = {
2909
2921
  };
2910
2922
 
2911
2923
 
2924
+ export type MutationSaveSMimeCertArgs = {
2925
+ password?: Maybe<Scalars['String']>;
2926
+ upload: SaveSMimeCertInputUpload;
2927
+ };
2928
+
2929
+
2912
2930
  export type MutationSendDeliveryReportArgs = {
2913
2931
  messageId: Scalars['ID'];
2914
2932
  };
@@ -2921,7 +2939,9 @@ export type MutationSendInviteReplyArgs = {
2921
2939
 
2922
2940
  export type MutationSendMessageArgs = {
2923
2941
  accountName?: Maybe<Scalars['String']>;
2942
+ encrypt?: Maybe<Scalars['Boolean']>;
2924
2943
  message: SendMessageInput;
2944
+ sign?: Maybe<Scalars['Boolean']>;
2925
2945
  };
2926
2946
 
2927
2947
 
@@ -3283,6 +3303,7 @@ export type Query = {
3283
3303
  getPreferences?: Maybe<Preferences>;
3284
3304
  getReminders?: Maybe<RemindersResponse>;
3285
3305
  getRights?: Maybe<RightsResponse>;
3306
+ getSMimeCertInfo?: Maybe<SmimeCertInfoResponse>;
3286
3307
  getSMimePublicCerts?: Maybe<SMimePublicCertsResponse>;
3287
3308
  getScratchCodes?: Maybe<ScratchCodes>;
3288
3309
  getSearchFolder?: Maybe<Folder>;
@@ -3326,6 +3347,11 @@ export type QueryClientInfoArgs = {
3326
3347
  };
3327
3348
 
3328
3349
 
3350
+ export type QueryDiscoverRightsArgs = {
3351
+ right: Array<DiscoverRightInput>;
3352
+ };
3353
+
3354
+
3329
3355
  export type QueryDownloadAttachmentArgs = {
3330
3356
  id: Scalars['ID'];
3331
3357
  part: Scalars['ID'];
@@ -3468,6 +3494,11 @@ export type QueryGetRightsArgs = {
3468
3494
  };
3469
3495
 
3470
3496
 
3497
+ export type QueryGetSMimeCertInfoArgs = {
3498
+ certId?: Maybe<Scalars['String']>;
3499
+ };
3500
+
3501
+
3471
3502
  export type QueryGetSMimePublicCertsArgs = {
3472
3503
  contactAddr: Scalars['String'];
3473
3504
  store: Scalars['String'];
@@ -3766,6 +3797,10 @@ export type SaveMessageDataInput = {
3766
3797
  meta: Scalars['String'];
3767
3798
  };
3768
3799
 
3800
+ export type SaveSMimeCertInputUpload = {
3801
+ id?: Maybe<Scalars['String']>;
3802
+ };
3803
+
3769
3804
  export type ScratchCode = {
3770
3805
  __typename?: 'ScratchCode';
3771
3806
  scratchCode?: Maybe<Array<Maybe<ScratchCodeType>>>;
@@ -3984,6 +4019,67 @@ export type Skin = {
3984
4019
  _content?: Maybe<Scalars['String']>;
3985
4020
  };
3986
4021
 
4022
+ export type SmimeCert = {
4023
+ __typename?: 'SmimeCert';
4024
+ default?: Maybe<Scalars['Boolean']>;
4025
+ emailAddress?: Maybe<Scalars['String']>;
4026
+ errorCode?: Maybe<Scalars['String']>;
4027
+ issuedBy?: Maybe<SmimeCertIssuedBy>;
4028
+ issuedTo?: Maybe<SmimeCertIssuedTo>;
4029
+ privateKeyId?: Maybe<Scalars['String']>;
4030
+ publicCertificateId?: Maybe<Scalars['String']>;
4031
+ signature?: Maybe<SmimeCertSignature>;
4032
+ subjectAltName?: Maybe<SmimeCertSubjectAltName>;
4033
+ validity?: Maybe<SmimeCertValidity>;
4034
+ };
4035
+
4036
+ export type SmimeCertInfoResponse = {
4037
+ __typename?: 'SmimeCertInfoResponse';
4038
+ certificates?: Maybe<Array<Maybe<SmimeCert>>>;
4039
+ };
4040
+
4041
+ export type SmimeCertIssuedBy = {
4042
+ __typename?: 'SmimeCertIssuedBy';
4043
+ commonName?: Maybe<Scalars['String']>;
4044
+ country?: Maybe<Scalars['String']>;
4045
+ emailAddress?: Maybe<Scalars['String']>;
4046
+ locality?: Maybe<Scalars['String']>;
4047
+ organizationName?: Maybe<Scalars['String']>;
4048
+ state?: Maybe<Scalars['String']>;
4049
+ };
4050
+
4051
+ export type SmimeCertIssuedTo = {
4052
+ __typename?: 'SmimeCertIssuedTo';
4053
+ commonName?: Maybe<Scalars['String']>;
4054
+ country?: Maybe<Scalars['String']>;
4055
+ emailAddress?: Maybe<Scalars['String']>;
4056
+ organizationName?: Maybe<Scalars['String']>;
4057
+ organizationUnit?: Maybe<Scalars['String']>;
4058
+ state?: Maybe<Scalars['String']>;
4059
+ };
4060
+
4061
+ export type SmimeCertSignature = {
4062
+ __typename?: 'SmimeCertSignature';
4063
+ algorithm?: Maybe<Scalars['String']>;
4064
+ serialNo?: Maybe<Scalars['String']>;
4065
+ };
4066
+
4067
+ export type SmimeCertSubjectAltName = {
4068
+ __typename?: 'SmimeCertSubjectAltName';
4069
+ rfc822Name?: Maybe<Array<Maybe<SmimeCertSubjectRfc822Name>>>;
4070
+ };
4071
+
4072
+ export type SmimeCertSubjectRfc822Name = {
4073
+ __typename?: 'SmimeCertSubjectRfc822Name';
4074
+ content?: Maybe<Scalars['String']>;
4075
+ };
4076
+
4077
+ export type SmimeCertValidity = {
4078
+ __typename?: 'SmimeCertValidity';
4079
+ endDate?: Maybe<Scalars['Float']>;
4080
+ startDate?: Maybe<Scalars['Float']>;
4081
+ };
4082
+
3987
4083
  export type SnoozeInput = {
3988
4084
  id: Scalars['ID'];
3989
4085
  until: Scalars['Float'];
@@ -513,6 +513,8 @@ type MessageInfo implements MailItem {
513
513
  modifiedSequence: Float # ms
514
514
  invitations: [InviteInfo] # inv
515
515
  sortField: String # sf, Sort field used for cursor-based pagination
516
+ decryptionErrorCode: String
517
+ certificate: [SmimeCert]
516
518
  mimeParts: [MimePart]
517
519
  to: [EmailAddress]
518
520
  from: [EmailAddress]
@@ -527,6 +529,8 @@ type MessageInfo implements MailItem {
527
529
  share: [ShareNotification] # shr
528
530
  replyType: String #rt
529
531
  attributes: MessageAttributes
532
+ isEncrypted: Boolean
533
+ isSigned: Boolean
530
534
  autoSendTime: Float
531
535
  local: Boolean
532
536
  part: String
@@ -1640,6 +1644,7 @@ type Contact {
1640
1644
  tagNames: String # tn
1641
1645
  attributes: ContactAttributes
1642
1646
  members: [ContactListMember]
1647
+ certificate: [SmimeCert]
1643
1648
  }
1644
1649
 
1645
1650
  type OtherContactAttribute {
@@ -1976,6 +1981,7 @@ type MimePart {
1976
1981
  url: String
1977
1982
  messageId: ID
1978
1983
  base64: String
1984
+ truncated: Boolean
1979
1985
  }
1980
1986
 
1981
1987
  type ActionData {
@@ -2002,7 +2008,8 @@ input MimePartInput {
2002
2008
  url: String
2003
2009
  messageId: ID
2004
2010
  attachments: [AttachmentInput]
2005
- base64: String
2011
+ base64: String,
2012
+ truncated: Boolean
2006
2013
  }
2007
2014
 
2008
2015
  input ExistingAttachmentInput {
@@ -2112,6 +2119,10 @@ input SendMessageInput {
2112
2119
  inlineAttachments: [MimePartInput] #attach
2113
2120
  }
2114
2121
 
2122
+ input SaveSMimeCertInputUpload {
2123
+ id: String
2124
+ }
2125
+
2115
2126
  input CalendarItemInviteInput {
2116
2127
  components: [CalendarItemInviteComponentInput]!
2117
2128
  }
@@ -2988,6 +2999,59 @@ type SMimePublicCertsResponse {
2988
2999
  certs: [SMimePublicCerts]
2989
3000
  }
2990
3001
 
3002
+ type SmimeCertIssuedBy {
3003
+ country: String
3004
+ commonName: String
3005
+ emailAddress: String
3006
+ locality: String
3007
+ organizationName: String
3008
+ state: String
3009
+ }
3010
+
3011
+ type SmimeCertIssuedTo {
3012
+ country: String
3013
+ commonName: String
3014
+ emailAddress: String
3015
+ organizationName: String
3016
+ organizationUnit: String
3017
+ state: String
3018
+ }
3019
+
3020
+ type SmimeCertSignature {
3021
+ algorithm: String
3022
+ serialNo: String
3023
+ }
3024
+
3025
+ type SmimeCertSubjectRfc822Name {
3026
+ content: String
3027
+ }
3028
+
3029
+ type SmimeCertSubjectAltName {
3030
+ rfc822Name: [SmimeCertSubjectRfc822Name]
3031
+ }
3032
+
3033
+ type SmimeCertValidity {
3034
+ endDate: Float
3035
+ startDate: Float
3036
+ }
3037
+
3038
+ type SmimeCert {
3039
+ default: Boolean
3040
+ emailAddress: String
3041
+ issuedBy: SmimeCertIssuedBy
3042
+ issuedTo: SmimeCertIssuedTo
3043
+ publicCertificateId: String
3044
+ privateKeyId: String
3045
+ signature: SmimeCertSignature
3046
+ subjectAltName: SmimeCertSubjectAltName
3047
+ validity: SmimeCertValidity
3048
+ errorCode: String
3049
+ }
3050
+
3051
+ type SmimeCertInfoResponse {
3052
+ certificates: [SmimeCert]
3053
+ }
3054
+
2991
3055
  type SMimeMessage {
2992
3056
  id: ID
2993
3057
  content: String
@@ -3095,6 +3159,10 @@ input SearchConditionsInput {
3095
3159
  conds: ConditionsInput
3096
3160
  }
3097
3161
 
3162
+ input DiscoverRightInput {
3163
+ _content: String
3164
+ }
3165
+
3098
3166
  # Zimbra GraphQL Queries
3099
3167
  # - [[SOAP API Reference]](https://files.zimbra.com/docs/soap_api/8.7.11/api-reference/index.html)
3100
3168
  # - [[SOAP Documentation]](https://github.com/Zimbra/zm-mailbox/blob/develop/store/docs/soap.txt)
@@ -3118,7 +3186,7 @@ type Query {
3118
3186
  downloadMessage(id: ID!, isSecure: Boolean, isLocal: Boolean): SMimeMessage
3119
3187
  downloadAttachment(id: ID!, part: ID!): Attachment
3120
3188
  downloadDocument(id: ID!, url: String!): Attachment
3121
- discoverRights: DiscoverRights
3189
+ discoverRights(right: [DiscoverRightInput!]!): DiscoverRights
3122
3190
  freeBusy(names: [String!]!, start: Float, end: Float): [FreeBusy]
3123
3191
  getContact(
3124
3192
  id: ID
@@ -3205,6 +3273,7 @@ type Query {
3205
3273
  contactAddr: String!
3206
3274
  store: String!
3207
3275
  ): SMimePublicCertsResponse
3276
+ getSMimeCertInfo(certId: String): SmimeCertInfoResponse
3208
3277
  getScratchCodes(username: String!): ScratchCodes
3209
3278
  getSearchFolder: Folder
3210
3279
  getTrustedDevices: GetTrustedDevicesResponse
@@ -3443,7 +3512,10 @@ type Mutation {
3443
3512
  sendMessage(
3444
3513
  message: SendMessageInput!
3445
3514
  accountName: String
3515
+ sign: Boolean
3516
+ encrypt: Boolean
3446
3517
  ): SendMessageResponse
3518
+ saveSMimeCert(upload: SaveSMimeCertInputUpload!, password: String): SmimeCertInfoResponse
3447
3519
  sendDeliveryReport(messageId: ID!): Boolean
3448
3520
  sendInviteReply(inviteReply: InviteReplyInput!): InviteReplyResponse
3449
3521
  sendShareNotification(shareNotification: ShareNotificationInput!): Boolean
@@ -30,6 +30,7 @@ import {
30
30
  PreferencesInput,
31
31
  PropertiesInput,
32
32
  RevokeRightsInput,
33
+ SaveSMimeCertInputUpload,
33
34
  SearchFolderInput,
34
35
  SendMessageInput,
35
36
  ShareNotificationInput,
@@ -54,6 +55,7 @@ import {
54
55
  ClientInfoInput,
55
56
  CreateFolderOptions,
56
57
  CreateSearchFolderOptions,
58
+ DiscoverRightOptions,
57
59
  ExternalAccountDeleteInput,
58
60
  ExternalAccountModifyInput,
59
61
  FreeBusyOptions,
@@ -103,7 +105,7 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
103
105
  autoComplete: (_, variables) => client.autoComplete(variables as AutoCompleteOptions),
104
106
  autoCompleteGAL: (_, variables) =>
105
107
  client.autoCompleteGAL(variables as AutoCompleteGALOptions),
106
- discoverRights: client.discoverRights,
108
+ discoverRights: (_, variables) => client.discoverRights(variables as DiscoverRightOptions),
107
109
  downloadAttachment: (_, variables) => client.downloadAttachment(variables),
108
110
  downloadDocument: (_, variables) => client.downloadDocument(variables),
109
111
  downloadMessage: (_, variables, context = {}) => {
@@ -169,6 +171,7 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
169
171
  getSearchFolder: client.getSearchFolder,
170
172
  getSMimePublicCerts: (_, variables) =>
171
173
  client.getSMimePublicCerts(variables as GetSMimePublicCertsOptions),
174
+ getSMimeCertInfo: client.getSMimeCertInfo,
172
175
  getTrustedDevices: client.getTrustedDevices,
173
176
  getDeviceStatus: client.getDeviceStatus,
174
177
  getWorkingHours: (_, variables) => client.getWorkingHours(variables as WorkingHoursOptions),
@@ -368,11 +371,15 @@ export function createZimbraSchema(options: ZimbraSchemaOptions): {
368
371
  message as SendMessageInput,
369
372
  accountName as string
370
373
  ),
371
- sendMessage: (_, { message, accountName }, context = {}) =>
374
+ sendMessage: (_, { message, accountName, sign = false, encrypt = false }, context = {}) =>
372
375
  (context.local ? localStoreClient : client).sendMessage(
373
376
  message as SendMessageInput,
374
- accountName as string
377
+ accountName as string,
378
+ sign as Boolean,
379
+ encrypt as Boolean
375
380
  ),
381
+ saveSMimeCert: (_, { upload, password }) =>
382
+ client.saveSMimeCert(upload as SaveSMimeCertInputUpload, password as string),
376
383
  sendDeliveryReport: (_, { messageId }) => client.sendDeliveryReport(messageId),
377
384
  uploadMessage: (_, { value }) => client.uploadMessage(value),
378
385
  createTask: (_, { task }) => client.createTask(task as CalendarItemInput),
@@ -99,7 +99,7 @@ const ignoreAttributes = [
99
99
  'vcardXProps',
100
100
  'imagepart'
101
101
  ];
102
- export function createContactBody(data: any) {
102
+ export function createContactBody(data: any, isDesktop: Boolean) {
103
103
  const { attributes, ...rest } = data;
104
104
  const contactAttrs = <Object[]>[];
105
105
 
@@ -107,7 +107,7 @@ export function createContactBody(data: any) {
107
107
  key !== 'other'
108
108
  ? contactAttrs.push({
109
109
  name: key,
110
- [key === 'image' ? 'aid' : 'content']: val
110
+ [key === 'image' || (!isDesktop && key === 'userCertificate') ? 'aid' : 'content']: val
111
111
  })
112
112
  : forEach(val, otherValue =>
113
113
  contactAttrs.push({