@memberjunction/esignature-docusign 5.40.0 → 5.40.2

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.
Files changed (2) hide show
  1. package/README.md +125 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,125 @@
1
+ [← Back to eSignature Overview](../../README.md) · [Core Primitive](../../Base/README.md)
2
+
3
+ # @memberjunction/esignature-docusign
4
+
5
+ The **DocuSign** driver for the MemberJunction eSignature subsystem. It implements the [`BaseSignatureProvider`](../../Base/README.md#the-provider-contract-basesignatureprovider) contract against the DocuSign eSignature REST API, using JWT-grant OAuth for server-to-server authentication.
6
+
7
+ This is the **reference provider** — it implements the full feature set, including templates, embedded signing, and DocuSign Connect webhooks.
8
+
9
+ ```bash
10
+ npm install @memberjunction/esignature-docusign
11
+ ```
12
+
13
+ > You don't call this package directly. You configure a DocuSign **Signature Account** and use the [`SignatureEngine`](../../Base/README.md#the-engines) (or the [no-code Actions](../../Base/README.md#using-the-actions-no-code)). The engine resolves and drives this provider for you.
14
+
15
+ ---
16
+
17
+ ## At a glance
18
+
19
+ | | |
20
+ |---|---|
21
+ | **Driver key** | `DocuSign` |
22
+ | **Registration** | `@RegisterClass(BaseSignatureProvider, 'DocuSign')` |
23
+ | **Authentication** | JWT-grant OAuth 2.0 (service-account impersonation) |
24
+ | **API** | DocuSign eSignature REST API `v2.1` |
25
+ | **Webhooks** | DocuSign Connect, HMAC-verified |
26
+
27
+ ### Supported operations
28
+
29
+ | Operation | Supported |
30
+ |---|:---:|
31
+ | Create envelope | ✅ |
32
+ | Get status | ✅ |
33
+ | Download signed | ✅ |
34
+ | Void | ✅ |
35
+ | Apply template | ✅ |
36
+ | Embedded signing URL | ✅ |
37
+ | Parse webhook event | ✅ |
38
+ | Verify webhook signature | ✅ |
39
+
40
+ ---
41
+
42
+ ## How authentication works
43
+
44
+ DocuSign uses **JWT grant** — the driver signs a JWT with your RSA private key and exchanges it for a short-lived access token, with no interactive login. Tokens are obtained on demand and refreshed automatically.
45
+
46
+ ```mermaid
47
+ sequenceDiagram
48
+ participant Drv as DocuSign Driver
49
+ participant OAuth as DocuSign OAuth Server
50
+ participant API as DocuSign REST API
51
+
52
+ Drv->>Drv: Sign JWT with privateKey<br/>(iss=integrationKey, sub=userId, aud=oauthBase)
53
+ Drv->>OAuth: POST /oauth/token (JWT grant)
54
+ OAuth-->>Drv: Access token
55
+ Drv->>API: Authorized request (envelopes, status, …)
56
+ API-->>Drv: Response
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Configuration
62
+
63
+ These values live in the account's **Credential** (encrypted via the [Credential Engine](../../../Credentials)) — never in code or environment variables. Non-secret defaults (`oauthBase`, `restBase`) may also be set on the **Signature Provider** record.
64
+
65
+ | Key | Required | Default | Description |
66
+ |---|:---:|---|---|
67
+ | `integrationKey` | ✅ | — | DocuSign OAuth app integration key (the JWT `iss`). |
68
+ | `userId` | ✅ | — | DocuSign user ID to impersonate (the JWT `sub`). |
69
+ | `accountId` | ✅ | — | DocuSign account ID that owns the envelopes. |
70
+ | `privateKey` | ✅ | — | RSA private key (PEM) used to sign the JWT. |
71
+ | `oauthBase` | — | `account-d.docusign.com` | OAuth host. Use `account.docusign.com` for production. |
72
+ | `restBase` | — | `https://demo.docusign.net/restapi` | REST API base. Use your production base for live envelopes. |
73
+ | `connectHmacKey` | — | — | HMAC secret for verifying DocuSign Connect webhooks. **Set this in production.** |
74
+
75
+ > The defaults point at the **DocuSign demo** environment, so you can test immediately. Override `oauthBase` and `restBase` for production.
76
+
77
+ ### One-time setup
78
+
79
+ 1. In the DocuSign Admin console, create an **integration key** with JWT grant and upload an RSA keypair.
80
+ 2. Grant the app **consent** for the impersonated user (one-time admin consent URL).
81
+ 3. In MemberJunction:
82
+ - The **DocuSign** Signature Provider row is already seeded.
83
+ - Create a **Credential** holding `integrationKey`, `userId`, `accountId`, and `privateKey`.
84
+ - Create a **Signature Account** pointing at that credential.
85
+ 4. (Production) Configure a **Connect** webhook in DocuSign pointing at `POST {your-server}/esignature/webhook/DocuSign`, and store its HMAC secret as `connectHmacKey`.
86
+
87
+ ---
88
+
89
+ ## Status mapping
90
+
91
+ DocuSign's native envelope statuses map onto MemberJunction's [normalized lifecycle](../../Base/README.md#status):
92
+
93
+ | DocuSign status | MJ `EnvelopeStatus` |
94
+ |---|---|
95
+ | `created` | `Draft` |
96
+ | `sent` | `Sent` |
97
+ | `delivered` | `Delivered` |
98
+ | `signed` | `Signed` |
99
+ | `completed` | `Completed` |
100
+ | `declined` | `Declined` |
101
+ | `voided` | `Voided` |
102
+
103
+ ---
104
+
105
+ ## Webhooks (DocuSign Connect)
106
+
107
+ DocuSign Connect pushes envelope events to `POST /esignature/webhook/DocuSign`. The driver verifies the `x-docusign-signature-1` header as an HMAC over the **raw request body** using your `connectHmacKey`. If the key is configured and the signature doesn't match, the event is logged and the envelope status is left unchanged — see the [webhook flow](../../Base/README.md#inbound-webhooks).
108
+
109
+ ---
110
+
111
+ ## Testing
112
+
113
+ ```bash
114
+ cd packages/eSignature/Providers/DocuSign && npm run test
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Related
120
+
121
+ | | |
122
+ |---|---|
123
+ | [eSignature overview](../../README.md) | The whole subsystem. |
124
+ | [Core primitive](../../Base/README.md) | The contract, engine, and data model this driver plugs into. |
125
+ | [PandaDoc driver](../PandaDoc/README.md) · [Dropbox Sign driver](../DropboxSign/README.md) | Sibling providers. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/esignature-docusign",
3
- "version": "5.40.0",
3
+ "version": "5.40.2",
4
4
  "description": "DocuSign driver for the MemberJunction eSignature primitive. Registers a BaseSignatureProvider implementation via @RegisterClass(BaseSignatureProvider, 'DocuSign') using the DocuSign REST API and JWT-grant OAuth.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,8 +17,8 @@
17
17
  },
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@memberjunction/esignature": "5.40.0",
21
- "@memberjunction/global": "5.40.0",
20
+ "@memberjunction/esignature": "5.40.2",
21
+ "@memberjunction/global": "5.40.2",
22
22
  "jsonwebtoken": "^9.0.0"
23
23
  },
24
24
  "devDependencies": {