caa 8.0.2 → 9.0.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/README.md +1 -1
- package/index.js +8 -8
- package/package.json +9 -15
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# caa
|
|
2
|
-
[](https://www.npmjs.org/package/caa) [](https://www.npmjs.org/package/caa)
|
|
2
|
+
[](https://www.npmjs.org/package/caa) [](https://www.npmjs.org/package/caa) [](https://packagephobia.com/result?p=caa)
|
|
3
3
|
|
|
4
4
|
> [rfc6844](https://tools.ietf.org/html/rfc6844)-conform CAA record lookup and validation
|
|
5
5
|
|
package/index.js
CHANGED
|
@@ -51,7 +51,7 @@ const resolve = async ({name, query, servers, port, recursions, retries, tries,
|
|
|
51
51
|
|
|
52
52
|
// parse DNS answers to {type: [{name, data}]}
|
|
53
53
|
const records = {};
|
|
54
|
-
if (res
|
|
54
|
+
if (res?.answers?.length) {
|
|
55
55
|
for (const {name, type, data} of res.answers || {}) {
|
|
56
56
|
if (!name || !type || !data) continue;
|
|
57
57
|
if (!records[type]) records[type] = [];
|
|
@@ -60,22 +60,22 @@ const resolve = async ({name, query, servers, port, recursions, retries, tries,
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// If CAA(X) is not empty, R(X) = CAA (X)
|
|
63
|
-
if (records.CAA
|
|
63
|
+
if (records.CAA?.length) {
|
|
64
64
|
const caas = records.CAA.filter(record => record.name === name).map(record => record.data);
|
|
65
65
|
if (caas.length) return caas;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
let alias;
|
|
69
|
-
if (records.CNAME
|
|
69
|
+
if (records.CNAME?.length) {
|
|
70
70
|
const dest = records.CNAME.find(record => record.name === name);
|
|
71
71
|
alias = dest.data;
|
|
72
|
-
} else if (records.DNAME
|
|
72
|
+
} else if (records.DNAME?.length) {
|
|
73
73
|
const dest = records.DNAME.find(record => record.name === name);
|
|
74
74
|
alias = name.replace(dest.name, dest.data);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// If A(X) is not null, and CAA(A(X)) is not empty, then R(X) = CAA(A(X)), otherwise
|
|
78
|
-
if (alias && records.CAA
|
|
78
|
+
if (alias && records.CAA?.length) {
|
|
79
79
|
return records.CAA.filter(record => record.name === alias && record.data).map(record => record.data);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -94,7 +94,7 @@ export async function caa(name, opts = {}) {
|
|
|
94
94
|
|
|
95
95
|
if (!opts.servers) {
|
|
96
96
|
const systemServers = getServers();
|
|
97
|
-
opts.servers =
|
|
97
|
+
opts.servers = systemServers?.length ? systemServers : defaults.servers;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
opts = {...defaults, ...opts};
|
|
@@ -127,10 +127,10 @@ export async function caaMatches(name, ca, opts = {}) {
|
|
|
127
127
|
if (!caas.length) return true;
|
|
128
128
|
|
|
129
129
|
const issueNames = caas
|
|
130
|
-
.filter(caa => caa
|
|
130
|
+
.filter(caa => caa?.tag === "issue")
|
|
131
131
|
.map(name => normalizeName(name.value.split(";")[0].trim()));
|
|
132
132
|
const issueWildNames = caas
|
|
133
|
-
.filter(caa => caa
|
|
133
|
+
.filter(caa => caa?.tag === "issuewild")
|
|
134
134
|
.map(name => normalizeName(name.value.split(";")[0].trim()));
|
|
135
135
|
|
|
136
136
|
const names = isWildcard(name) ? (issueWildNames.length ? issueWildNames : issueNames) : issueNames;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "rfc6844-conform CAA record lookup and validation",
|
|
5
5
|
"author": "silverwind <me@silverwind.io>",
|
|
6
6
|
"repository": "silverwind/caa",
|
|
@@ -8,27 +8,21 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": "./index.js",
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
11
|
+
"node": ">=18"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"index.js"
|
|
15
15
|
],
|
|
16
|
-
"keywords": [
|
|
17
|
-
"caa",
|
|
18
|
-
"dns",
|
|
19
|
-
"letsencrypt",
|
|
20
|
-
"certificate authority"
|
|
21
|
-
],
|
|
22
16
|
"dependencies": {
|
|
23
17
|
"dns-socket": "^4.2.2",
|
|
24
|
-
"tlds": "^1.
|
|
18
|
+
"tlds": "^1.251.0"
|
|
25
19
|
},
|
|
26
20
|
"devDependencies": {
|
|
27
|
-
"eslint": "8.
|
|
28
|
-
"eslint-config-silverwind": "
|
|
29
|
-
"updates": "15.
|
|
30
|
-
"versions": "12.0.
|
|
31
|
-
"vitest": "
|
|
32
|
-
"vitest-config-silverwind": "
|
|
21
|
+
"eslint": "8.57.0",
|
|
22
|
+
"eslint-config-silverwind": "82.0.4",
|
|
23
|
+
"updates": "15.3.1",
|
|
24
|
+
"versions": "12.0.1",
|
|
25
|
+
"vitest": "1.3.1",
|
|
26
|
+
"vitest-config-silverwind": "5.1.5"
|
|
33
27
|
}
|
|
34
28
|
}
|