@verdocs/js-sdk 6.3.3 → 6.4.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/dist/index.d.mts CHANGED
@@ -433,6 +433,7 @@ interface IWebhook {
433
433
  id: string;
434
434
  organization_id: string;
435
435
  url: string;
436
+ secret_key?: string;
436
437
  active: boolean;
437
438
  events: IWebhookEvents;
438
439
  status: string | null;
@@ -1383,7 +1384,17 @@ interface ISignerTokenResponse {
1383
1384
  * A copy of the recipient record related to the signing session. This is almost always needed when
1384
1385
  * a signing session is being started, so it is included here for convenience.
1385
1386
  */
1386
- recipient: IRecipient;
1387
+ recipient: IRecipient[];
1388
+ /**
1389
+ * Stored signature blocks for the recipient. All entries are returned to support workflows in
1390
+ * which that is required, but for most use-cases, only the first entry should be used.
1391
+ */
1392
+ signatures?: ISignature[];
1393
+ /**
1394
+ * Stored initials blocks for the recipient. All entries are returned to support workflows in
1395
+ * which that is required, but for most use-cases, only the first entry should be used.
1396
+ */
1397
+ initials?: IInitial[];
1387
1398
  }
1388
1399
  interface IInPersonLinkResponse {
1389
1400
  /** A valid Verdocs Web URL that hosts a signing experience. */
@@ -3122,6 +3133,35 @@ declare const getWebhooks: (endpoint: VerdocsEndpoint) => Promise<IWebhook>;
3122
3133
  * @apiSuccess IWebhook . The updated Webhooks config for the caller's organization.
3123
3134
  */
3124
3135
  declare const setWebhooks: (endpoint: VerdocsEndpoint, params: ISetWebhookRequest) => Promise<IWebhook>;
3136
+ /**
3137
+ * Rotate the secret key used to authenticate Webhooks. If a secret key has not yet been set,
3138
+ * it will be created. Until this is done, Webhook calls will not have a signature applied to
3139
+ * their headers. Please note that pending Webhook deliveries will not be affected until the
3140
+ * next Webhook is triggered.
3141
+ *
3142
+ * To authenticate a Webhook call, compute an HMAC-256 hash of the JSON payload `body` field
3143
+ * as follows:
3144
+ *
3145
+ * ```typescript
3146
+ * // NOTE: Hash the `body` field INSIDE the payload. In many frameworks the payload is also called
3147
+ * // `body`, which can be confusing.
3148
+ * const jsonBody = JSON.stringify(req.body.body);
3149
+ * const hash = createHmac('sha256', SECRET_KEY).update(jsonBody).digest('hex');
3150
+ * if (hash !== req.headers['x-webhook-signature']) {
3151
+ * // Handle error here
3152
+ * }
3153
+ *
3154
+ * // It is important to return a 200 status code anyway, to avoid the sender trying to resend
3155
+ * // the same data.
3156
+ * res.status(200).send();
3157
+ * ```
3158
+ *
3159
+ * @group Webhooks
3160
+ * @api PATCH /v2/webhooks Rotate Webhook secret key
3161
+ * @apiDescription Note that Webhooks cannot currently be deleted, but may be easily disabled by setting `active` to `false` and/or setting the `url` to an empty string.
3162
+ * @apiSuccess IWebhook . The updated Webhooks config for the caller's organization, including the secret_key.
3163
+ */
3164
+ declare const rotateWebhookSecret: (endpoint: VerdocsEndpoint) => Promise<IWebhook>;
3125
3165
  declare const canPerformTemplateAction: (profile: IProfile | null | undefined, action: TTemplateAction, template?: ITemplate) => {
3126
3166
  canPerform: boolean;
3127
3167
  message: string;
@@ -3814,4 +3854,4 @@ declare const decodeJWTBody: (token: string) => any;
3814
3854
  * the presence of the `document_id` field, which will only be present for signing sessions.
3815
3855
  */
3816
3856
  declare const decodeAccessTokenBody: (token: string) => TSession;
3817
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
3857
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, rotateWebhookSecret, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
package/dist/index.d.ts CHANGED
@@ -433,6 +433,7 @@ interface IWebhook {
433
433
  id: string;
434
434
  organization_id: string;
435
435
  url: string;
436
+ secret_key?: string;
436
437
  active: boolean;
437
438
  events: IWebhookEvents;
438
439
  status: string | null;
@@ -1383,7 +1384,17 @@ interface ISignerTokenResponse {
1383
1384
  * A copy of the recipient record related to the signing session. This is almost always needed when
1384
1385
  * a signing session is being started, so it is included here for convenience.
1385
1386
  */
1386
- recipient: IRecipient;
1387
+ recipient: IRecipient[];
1388
+ /**
1389
+ * Stored signature blocks for the recipient. All entries are returned to support workflows in
1390
+ * which that is required, but for most use-cases, only the first entry should be used.
1391
+ */
1392
+ signatures?: ISignature[];
1393
+ /**
1394
+ * Stored initials blocks for the recipient. All entries are returned to support workflows in
1395
+ * which that is required, but for most use-cases, only the first entry should be used.
1396
+ */
1397
+ initials?: IInitial[];
1387
1398
  }
1388
1399
  interface IInPersonLinkResponse {
1389
1400
  /** A valid Verdocs Web URL that hosts a signing experience. */
@@ -3122,6 +3133,35 @@ declare const getWebhooks: (endpoint: VerdocsEndpoint) => Promise<IWebhook>;
3122
3133
  * @apiSuccess IWebhook . The updated Webhooks config for the caller's organization.
3123
3134
  */
3124
3135
  declare const setWebhooks: (endpoint: VerdocsEndpoint, params: ISetWebhookRequest) => Promise<IWebhook>;
3136
+ /**
3137
+ * Rotate the secret key used to authenticate Webhooks. If a secret key has not yet been set,
3138
+ * it will be created. Until this is done, Webhook calls will not have a signature applied to
3139
+ * their headers. Please note that pending Webhook deliveries will not be affected until the
3140
+ * next Webhook is triggered.
3141
+ *
3142
+ * To authenticate a Webhook call, compute an HMAC-256 hash of the JSON payload `body` field
3143
+ * as follows:
3144
+ *
3145
+ * ```typescript
3146
+ * // NOTE: Hash the `body` field INSIDE the payload. In many frameworks the payload is also called
3147
+ * // `body`, which can be confusing.
3148
+ * const jsonBody = JSON.stringify(req.body.body);
3149
+ * const hash = createHmac('sha256', SECRET_KEY).update(jsonBody).digest('hex');
3150
+ * if (hash !== req.headers['x-webhook-signature']) {
3151
+ * // Handle error here
3152
+ * }
3153
+ *
3154
+ * // It is important to return a 200 status code anyway, to avoid the sender trying to resend
3155
+ * // the same data.
3156
+ * res.status(200).send();
3157
+ * ```
3158
+ *
3159
+ * @group Webhooks
3160
+ * @api PATCH /v2/webhooks Rotate Webhook secret key
3161
+ * @apiDescription Note that Webhooks cannot currently be deleted, but may be easily disabled by setting `active` to `false` and/or setting the `url` to an empty string.
3162
+ * @apiSuccess IWebhook . The updated Webhooks config for the caller's organization, including the secret_key.
3163
+ */
3164
+ declare const rotateWebhookSecret: (endpoint: VerdocsEndpoint) => Promise<IWebhook>;
3125
3165
  declare const canPerformTemplateAction: (profile: IProfile | null | undefined, action: TTemplateAction, template?: ITemplate) => {
3126
3166
  canPerform: boolean;
3127
3167
  message: string;
@@ -3814,4 +3854,4 @@ declare const decodeJWTBody: (token: string) => any;
3814
3854
  * the presence of the `document_id` field, which will only be present for signing sessions.
3815
3855
  */
3816
3856
  declare const decodeAccessTokenBody: (token: string) => TSession;
3817
- export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
3857
+ export { TRequestStatus, TTemplateSender, TTemplateAction, TRecipientAction, TEnvelopeStatus, TRecipientStatus, TRecipientType, TSortTemplateBy, TAccessKeyType, TApiKeyPermission, TDeprecatedHistoryEvent, THistoryEvent, TEventDetail, TEnvelopeUpdateResult, TFieldType, TWebhookEvent, TTemplateVisibility, TEntitlement, TRecipientAuthMethod, TRecipientAuthStep, TUsageType, FIELD_TYPES, DEFAULT_FIELD_WIDTHS, DEFAULT_FIELD_HEIGHTS, WEBHOOK_EVENTS, ALL_PERMISSIONS, IChannel, IDisabledChannel, INotification, IApiKey, IGroup, IGroupProfile, IOAuth2App, IEntitlement, IOrganization, IOrganizationInvitation, IPendingWebhook, IProfile, IUser, IWebhookEvents, IWebhook, IInPersonAccessKey, IInAppAccessKey, IEmailAccessKey, ISMSAccessKey, TAccessKey, IEnvelope, IEnvelopeDocument, IDropdownOption, IEnvelopeField, IEnvelopeFieldOptions, IEnvelopeFieldSettings, IEnvelopeHistory, IInitial, IKbaPINRequired, IKBAQuestion, IRecipient, IRole, ISignature, ITemplate, ITemplateDocument, ITemplateField, ITextFieldSetting, ITemplateFieldSetting, TOrganizationUsage, TEnvironment, TSessionChangedListener, VerdocsEndpointOptions, VerdocsEndpoint, createEnvelope, getEnvelope, getEnvelopeDocument, downloadEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPreviewLink, cancelEnvelope, getEnvelopeFile, updateEnvelope, updateEnvelopeField, uploadEnvelopeFieldAttachment, deleteEnvelopeFieldAttachment, getEnvelopeDocumentPageDisplayUri, ITimeRange, IListEnvelopesParams, getEnvelopes, getEnvelopesZip, isFieldFilled, isFieldValid, createInitials, IRecipientKbaStepNone, IRecipientKbaStepComplete, IRecipientKbaStepPin, IRecipientKbaStepIdentity, IRecipientKbaStepChallenge, IRecipientKbaStepFailed, TRecipientKbaStep, getKbaStep, submitKbaPin, IKbaIdentity, submitKbaIdentity, IKbaChallengeResponse, submitKbaChallengeResponse, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, startSigningSession, getInPersonLink, verifySigner, delegateRecipient, updateRecipient, remindRecipient, resetRecipient, askQuestion, isEnvelopeOwner, isEnvelopeRecipient, canAccessEnvelope, userIsEnvelopeOwner, userIsEnvelopeRecipient, useCanAccessEnvelope, envelopeIsActive, envelopeIsComplete, userCanCancelEnvelope, userCanFinishEnvelope, recipientHasAction, getRecipientsWithActions, recipientCanAct, userCanAct, userCanSignNow, getNextRecipient, createSignature, IEnvelopesSearchResult, IDocumentSearchOptions, ICreateEnvelopeRecipientFromTemplate, ICreateEnvelopeRecipientDirectly, ISignerTokenResponse, IInPersonLinkResponse, IUpdateRecipientStatus, ICreateEnvelopeReminderRequest, IUpdateRecipientParams, ICreateEnvelopeDocumentFromData, ICreateEnvelopeDocumentFromUri, ICreateEnvelopeDocumentFromFile, ICreateEnvelopeFieldFromTemplate, ICreateEnvelopeFieldDirectly, ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeDirectlyRequest, TCreateEnvelopeRequest, IAuthenticateRecipientViaPasscodeRequest, IAuthenticateRecipientViaEmailRequest, IAuthenticateRecipientViaSMSRequest, IKBAResponse, IAuthenticateRecipientViaKBARequest, TAuthenticateRecipientRequest, DEFAULT_DISCLOSURES, getApiKeys, createApiKey, rotateApiKey, updateApiKey, deleteApiKey, getOrganizationContacts, deleteOrganizationContact, createOrganizationContact, updateOrganizationContact, getGroups, getGroup, createGroup, updateGroup, deleteGroup, addGroupMember, deleteGroupMember, getOrganizationInvitations, createOrganizationInvitation, deleteOrganizationInvitation, updateOrganizationInvitation, resendOrganizationInvitation, getOrganizationInvitation, acceptOrganizationInvitation, declineOrganizationInvitation, getOrganizationMembers, deleteOrganizationMember, updateOrganizationMember, getOrganization, getOrganizationChildren, getOrganizationUsage, createOrganization, updateOrganization, deleteOrganization, updateOrganizationLogo, updateOrganizationThumbnail, getEntitlements, getActiveEntitlements, ICreateApiKeyRequest, IUpdateApiKeyRequest, ICreateInvitationRequest, IAcceptOrganizationInvitationRequest, ISetWebhookRequest, getWebhooks, setWebhooks, rotateWebhookSecret, TTemplatePermissionCreatePublic, TTemplatePermissionCreateOrg, TTemplatePermissionCreatePersonal, TTemplatePermissionDelete, TTemplatePermissionVisibility, TTemplateMemberRead, TTemplateMemberWrite, TTemplateMemberDelete, TTemplateMemberVisibility, TTemplatePermission, TAccountPermissionOwnerAdd, TAccountPermissionOwnerRemove, TAccountPermissionAdminAdd, TAccountPermissionAdminRemove, TAccountPermissionMemberView, TAccountPermissionMemberAdd, TAccountPermissionMemberRemove, TAccountPermission, TOrgPermissionCreate, TOrgPermissionView, TOrgPermissionUpdate, TOrgPermissionDelete, TOrgPermissionTransfer, TOrgPermissionList, TOrgPermission, TEnvelopePermissionCreate, TEnvelopePermissionCancel, TEnvelopePermissionView, TEnvelopePermissionOrg, TEnvelopePermission, TPermission, TRole, RolePermissions, userHasPermissions, ISigningSession, IUserSession, IIdToken, TSessionType, TSession, TActiveSession, canPerformTemplateAction, hasRequiredPermissions, createField, updateField, deleteField, userIsTemplateCreator, userHasSharedTemplate, userCanCreatePersonalTemplate, userCanCreateOrgTemplate, userCanCreatePublicTemplate, userCanReadTemplate, userCanUpdateTemplate, userCanMakeTemplatePrivate, userCanMakeTemplateShared, userCanMakeTemplatePublic, userCanChangeOrgVisibility, userCanDeleteTemplate, userCanSendTemplate, userCanCreateTemplate, userCanBuildTemplate, getFieldsForRole, userCanPreviewTemplate, createTemplateRole, updateTemplateRole, deleteTemplateRole, ITemplateSortBy, TTemplateVisibilityFilter, IGetTemplatesParams, getTemplates, getTemplate, IDocumentFromUri, IDocumentFromData, ITemplateCreateParams, createTemplate, duplicateTemplate, ITemplateCreateFromSharepointParams, createTemplateFromSharepoint, updateTemplate, deleteTemplate, toggleTemplateStar, createTemplateDocument, deleteTemplateDocument, getTemplateDocument, downloadTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentPreviewLink, getTemplateDocumentFile, getTemplateDocumentThumbnail, getTemplateDocumentPageDisplayUri, ITemplateTag, ITag, IStar, ITemplateSearchResult, IValidator, isValidInput, getValidators, isValidEmail, isValidPhone, isValidRoleName, isValidTag, IROPCRequest, IClientCredentialsRequest, IRefreshTokenRequest, TAuthenticationRequest, authenticate, refreshToken, changePassword, resetPassword, resendVerification, verifyEmail, getMyUser, getNotifications, getProfiles, getCurrentProfile, switchProfile, updateProfile, deleteProfile, createProfile, updateProfilePhoto, ICreateProfileRequest, IUpdateProfileRequest, IAuthenticateResponse, IChangePasswordRequest, IChangePasswordResponse, IResetPasswordRequest, IResetPasswordResponse, IVerifyEmailRequest, getRGB, getRGBA, nameToRGBA, getRoleColor, formatShortTimeAgo, collapseEntitlements, getRTop, getRLeft, getRValue, blobToBase64, rescale, sortFields, fileToDataUrl, downloadBlob, Countries, getCountryByCode, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, getPlusOneCountry, isCanada, isAmericanSamoa, isDominicanRepublic, isPuertoRico, getMatchingCountry, integerSequence, formatFullName, formatInitials, fullNameToInitials, capitalize, convertToE164, randomString, AtoB, decodeJWTBody, decodeAccessTokenBody, IFileWithData, ICountry };
package/dist/index.js CHANGED
@@ -3716,6 +3716,37 @@ const getWebhooks = (endpoint) => endpoint.api //
3716
3716
  const setWebhooks = (endpoint, params) => endpoint.api //
3717
3717
  .patch(`/v2/webhooks`, params)
3718
3718
  .then((r) => r.data);
3719
+ /**
3720
+ * Rotate the secret key used to authenticate Webhooks. If a secret key has not yet been set,
3721
+ * it will be created. Until this is done, Webhook calls will not have a signature applied to
3722
+ * their headers. Please note that pending Webhook deliveries will not be affected until the
3723
+ * next Webhook is triggered.
3724
+ *
3725
+ * To authenticate a Webhook call, compute an HMAC-256 hash of the JSON payload `body` field
3726
+ * as follows:
3727
+ *
3728
+ * ```typescript
3729
+ * // NOTE: Hash the `body` field INSIDE the payload. In many frameworks the payload is also called
3730
+ * // `body`, which can be confusing.
3731
+ * const jsonBody = JSON.stringify(req.body.body);
3732
+ * const hash = createHmac('sha256', SECRET_KEY).update(jsonBody).digest('hex');
3733
+ * if (hash !== req.headers['x-webhook-signature']) {
3734
+ * // Handle error here
3735
+ * }
3736
+ *
3737
+ * // It is important to return a 200 status code anyway, to avoid the sender trying to resend
3738
+ * // the same data.
3739
+ * res.status(200).send();
3740
+ * ```
3741
+ *
3742
+ * @group Webhooks
3743
+ * @api PATCH /v2/webhooks Rotate Webhook secret key
3744
+ * @apiDescription Note that Webhooks cannot currently be deleted, but may be easily disabled by setting `active` to `false` and/or setting the `url` to an empty string.
3745
+ * @apiSuccess IWebhook . The updated Webhooks config for the caller's organization, including the secret_key.
3746
+ */
3747
+ const rotateWebhookSecret = (endpoint) => endpoint.api //
3748
+ .put(`/v2/webhooks/rotate-secret`)
3749
+ .then((r) => r.data);
3719
3750
 
3720
3751
  exports.ALL_PERMISSIONS = ALL_PERMISSIONS;
3721
3752
  exports.AtoB = AtoB;
@@ -3863,6 +3894,7 @@ exports.resendVerification = resendVerification;
3863
3894
  exports.resetPassword = resetPassword;
3864
3895
  exports.resetRecipient = resetRecipient;
3865
3896
  exports.rotateApiKey = rotateApiKey;
3897
+ exports.rotateWebhookSecret = rotateWebhookSecret;
3866
3898
  exports.setWebhooks = setWebhooks;
3867
3899
  exports.sortFields = sortFields;
3868
3900
  exports.startSigningSession = startSigningSession;