n8n-nodes-duo 1.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wetomate
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # n8n-nodes-duo
2
+
3
+ > A Wetomate n8n community node for the Duo Security multi-factor authentication API.
4
+ > This package provides authentication, pre-authentication, status checks, and availability checks directly within n8n workflows.
5
+
6
+ ## Prerequisites
7
+
8
+ - n8n version 1.x or higher
9
+ - Node.js v14+
10
+ - Duo Security account with:
11
+ - Integration Key
12
+ - Secret Key
13
+ - API Hostname (e.g., `api-xxxxxxxx.duosecurity.com`)
14
+
15
+ ## Installation
16
+
17
+ Install the community package from your n8n instance's **Settings > Community Nodes** page using:
18
+
19
+ ```text
20
+ n8n-nodes-duo
21
+ ```
22
+
23
+ ## Credential setup
24
+
25
+ Create a new Duo credential in n8n with these fields:
26
+
27
+ - **Integration Key**
28
+ - **Secret Key**
29
+ - **API Hostname**
30
+
31
+ Use this credential in all Duo node endpoints.
32
+ See the [Duo Auth API documentation](https://duo.com/docs/authapi) for integration setup and endpoint details.
33
+
34
+ ## Supported endpoints
35
+
36
+ | Endpoint | Description |
37
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------- |
38
+ | `/auth/v2/auth` | Starts second-factor authentication with a push notification, passcode, phone call, or SMS passcode delivery. |
39
+ | `/auth/v2/auth_status` | Waits for the next status update from an asynchronous authentication transaction. |
40
+ | `/auth/v2/ping` | Checks whether the Duo Auth API is available without requiring a signed request. |
41
+ | `/auth/v2/preauth` | Checks whether a user may authenticate and returns the authentication factors available to that user. |
42
+
43
+ Each operation accepts input parameters and returns JSON output.
44
+
45
+ ## Development and testing
46
+
47
+ When the repository Docker development environment starts, it imports the inactive [`Duo Authentication Flow`](./examples/workflows/check-api-health.json) and [`Duo Human-in-the-Loop Approval`](./examples/workflows/duo-human-in-the-loop-approval.json) sample workflows. The authentication example demonstrates availability checking, user pre-authentication, an asynchronous push request, and transaction status polling. The approval example adds an event webhook, contextual `pushinfo`, a synchronous push approval, an allow/deny gate, and an action HTTP request; its brainstorming board is documented in [`duo-human-in-the-loop-approval.md`](./examples/workflows/duo-human-in-the-loop-approval.md). Both workflows intentionally omit credentials. Create or select a Duo credential and use test users and endpoints before running them; the push and approved action steps have real effects.
48
+
49
+ From the repository root, install the locked dependencies and run the Duo package checks with:
50
+
51
+ ```bash
52
+ npm ci
53
+ npm run build --workspace n8n-nodes-duo
54
+ npm run lint --workspace n8n-nodes-duo
55
+ npm test --workspace n8n-nodes-duo
56
+ ```
57
+
58
+ ## Linting
59
+
60
+ Linting helps ensure code quality, consistency, and prevents common errors.
61
+ This project uses **ESLint** (and optionally **Prettier** for formatting) to maintain a consistent code style.
62
+
63
+ ### Run the linter
64
+
65
+ ```bash
66
+ npm run lint
67
+ ```
68
+
69
+ ### Run Prettier
70
+
71
+ ```bash
72
+ npm run format
73
+ ```
74
+
75
+ ## Contributing
76
+
77
+ Issues and pull requests are welcome! Please ensure code follows linting and testing standards before submitting.
78
+
79
+ ## License
80
+
81
+ [MIT](./LICENSE.md)
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // credentials/DuoSecurityApi.credentials.ts
31
+ var DuoSecurityApi_credentials_exports = {};
32
+ __export(DuoSecurityApi_credentials_exports, {
33
+ DuoSecurityApi: () => DuoSecurityApi,
34
+ signV5: () => signV5
35
+ });
36
+ module.exports = __toCommonJS(DuoSecurityApi_credentials_exports);
37
+ var crypto = __toESM(require("crypto"));
38
+ function canonParams(params) {
39
+ return Object.keys(params).sort().flatMap((k) => {
40
+ const value = params[k];
41
+ const keq = encodeURIComponent(k) + "=";
42
+ return Array.isArray(value) ? value.map((v) => keq + encodeURIComponent(v)) : [keq + encodeURIComponent(value)];
43
+ }).join("&").replace(/[!'()*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
44
+ }
45
+ function hashString(to_hash) {
46
+ return crypto.createHash("sha512").update(to_hash).digest("hex");
47
+ }
48
+ function canonicalizeV5(method, host, path, params, date, body) {
49
+ return [
50
+ date,
51
+ method.toUpperCase(),
52
+ host.toLowerCase(),
53
+ path,
54
+ canonParams(params),
55
+ hashString(body),
56
+ hashString("")
57
+ ].join("\n");
58
+ }
59
+ function signV5(ikey, skey, method, host, path, params, date, body) {
60
+ const canon = canonicalizeV5(method, host, path, params, date, body);
61
+ const sig = crypto.createHmac("sha512", skey).update(canon).digest("hex");
62
+ const auth = Buffer.from([ikey, sig].join(":")).toString("base64");
63
+ return "Basic " + auth;
64
+ }
65
+ var DuoSecurityApi = class {
66
+ constructor() {
67
+ this.name = "duoSecurityApi";
68
+ this.displayName = "Duo Security API";
69
+ this.documentationUrl = "https://duo.com";
70
+ this.icon = {
71
+ light: "file:../nodes/DuoSecurity/duo.svg",
72
+ dark: "file:../nodes/DuoSecurity/duo-dark.svg"
73
+ };
74
+ this.properties = [
75
+ {
76
+ displayName: "Integration Key",
77
+ name: "ikey",
78
+ type: "string",
79
+ default: "",
80
+ placeholder: "Ex: DIXXXXXXXXXX"
81
+ },
82
+ // eslint-disable-next-line @n8n/community-nodes/credential-unnecessary-password
83
+ {
84
+ displayName: "Secret Key",
85
+ name: "skey",
86
+ type: "string",
87
+ default: "",
88
+ typeOptions: {
89
+ password: true
90
+ }
91
+ },
92
+ {
93
+ displayName: "API Host",
94
+ name: "hostname",
95
+ type: "string",
96
+ description: "hostname address must be without https or http",
97
+ placeholder: "Ex: api-XXXXXXXX.duosecurity.com",
98
+ default: ""
99
+ }
100
+ ];
101
+ this.test = {
102
+ request: {
103
+ url: "/auth/v2/check",
104
+ method: "GET"
105
+ }
106
+ };
107
+ }
108
+ async authenticate(credentials, requestOptions) {
109
+ const ikey = credentials.ikey;
110
+ const skey = credentials.skey;
111
+ const hostname = credentials.hostname;
112
+ if (requestOptions.url !== "/auth/v2/ping") {
113
+ const date = (/* @__PURE__ */ new Date()).toUTCString();
114
+ const bodyString = requestOptions.body !== void 0 ? requestOptions.body : "";
115
+ const auth = signV5(
116
+ ikey,
117
+ skey,
118
+ requestOptions.method,
119
+ hostname,
120
+ requestOptions.url,
121
+ requestOptions.qs,
122
+ date,
123
+ bodyString
124
+ );
125
+ requestOptions.headers = {
126
+ ...requestOptions.headers,
127
+ Date: date,
128
+ Authorization: auth
129
+ };
130
+ }
131
+ requestOptions.baseURL = "https://" + hostname;
132
+ return requestOptions;
133
+ }
134
+ };
135
+ // Annotate the CommonJS export names for ESM import in node:
136
+ 0 && (module.exports = {
137
+ DuoSecurityApi,
138
+ signV5
139
+ });
140
+ //# sourceMappingURL=DuoSecurityApi.credentials.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../credentials/DuoSecurityApi.credentials.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,aAAwB;AAiBxB,SAAS,YAAY,QAA2C;AAC/D,SAAO,OAAO,KAAK,MAAM,EACvB,KAAK,EACL,QAAQ,CAAC,MAAM;AACf,UAAM,QAAQ,OAAO,CAAC;AACtB,UAAM,MAAM,mBAAmB,CAAC,IAAI;AACpC,WAAO,MAAM,QAAQ,KAAK,IACvB,MAAM,IAAI,CAAC,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAC5C,CAAC,MAAM,mBAAmB,KAAK,CAAC;AAAA,EACpC,CAAC,EACA,KAAK,GAAG,EACR,QAAQ,YAAY,CAAC,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