caa 9.2.0 → 10.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/README.md +1 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +3 -7
- package/package.json +1 -3
package/README.md
CHANGED
|
@@ -11,9 +11,8 @@ import {caa, caaMatches} from "caa";
|
|
|
11
11
|
await caa("example.com");
|
|
12
12
|
// => [{flags: 0, tag: 'issue', value: 'letsencrypt.org', issuerCritical: false}]
|
|
13
13
|
|
|
14
|
-
await
|
|
14
|
+
await caaMatches("example.com", "letsencrypt.org");
|
|
15
15
|
// => true
|
|
16
|
-
|
|
17
16
|
```
|
|
18
17
|
|
|
19
18
|
## API
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ type CaaOpts = {
|
|
|
6
6
|
servers?: string[];
|
|
7
7
|
dnsSocket?: any;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type CaaRecord = {
|
|
10
|
+
flags: number;
|
|
11
|
+
tag: string;
|
|
12
|
+
value: string;
|
|
13
|
+
issuerCritical: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function caa(name: string, opts?: CaaOpts): Promise<CaaRecord[]>;
|
|
16
|
+
export declare function caaMatches(name: string, ca: string, opts?: CaaOpts): Promise<boolean>;
|
|
11
17
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,9 @@ const tldSet = new Set(tlds);
|
|
|
15
15
|
const isTLD = (name) => tldSet.has(name);
|
|
16
16
|
const isWildcard = (name) => /\*/.test(name);
|
|
17
17
|
const parent = (name) => name.split(".").splice(1).join(".");
|
|
18
|
-
|
|
18
|
+
function selectServer(servers, retries, tries) {
|
|
19
|
+
return servers[(tries - retries) % servers.length];
|
|
20
|
+
}
|
|
19
21
|
function normalizeName(name = "") {
|
|
20
22
|
name = name.toLowerCase();
|
|
21
23
|
return name.endsWith(".") && name.length > 1 ? name.substring(0, name.length - 1) : name;
|
|
@@ -79,8 +81,6 @@ const resolve = async ({ name, query, servers, port, recursions, retries, tries,
|
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
async function caa(name, opts = {}) {
|
|
82
|
-
if (typeof name !== "string")
|
|
83
|
-
throw new Error(`Expected a string for 'name', got ${name}`);
|
|
84
84
|
name = normalizeName(name);
|
|
85
85
|
if (!opts.servers) {
|
|
86
86
|
const systemServers = getServers();
|
|
@@ -104,10 +104,6 @@ async function caa(name, opts = {}) {
|
|
|
104
104
|
return caa2 || [];
|
|
105
105
|
}
|
|
106
106
|
async function caaMatches(name, ca, opts = {}) {
|
|
107
|
-
if (typeof name !== "string")
|
|
108
|
-
throw new Error(`Expected a string for 'name', got ${name}`);
|
|
109
|
-
if (typeof ca !== "string")
|
|
110
|
-
throw new Error(`Expected a string for 'ca', got ${ca}`);
|
|
111
107
|
name = normalizeName(name);
|
|
112
108
|
ca = normalizeName(ca);
|
|
113
109
|
const caas = await caa(name, opts);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "caa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "rfc6844-conform CAA record lookup and validation",
|
|
5
5
|
"author": "silverwind <me@silverwind.io>",
|
|
6
6
|
"repository": "silverwind/caa",
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
"tlds": "^1.252.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/eslint-parser": "7.24.5",
|
|
25
|
-
"@babel/plugin-syntax-import-assertions": "7.24.1",
|
|
26
24
|
"@types/node": "20.12.12",
|
|
27
25
|
"eslint": "8.57.0",
|
|
28
26
|
"eslint-config-silverwind": "85.1.3",
|