caa 7.0.0 → 8.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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/index.js +6 -8
  3. package/package.json +9 -18
package/README.md CHANGED
@@ -9,12 +9,12 @@
9
9
  npm i caa
10
10
  ```
11
11
  ```js
12
- import caa from 'caa';
12
+ import {caa, caaMatches} from "caa";
13
13
 
14
- await caa('subdomain.example.com');
14
+ await caa("subdomain.example.com");
15
15
  // => [{flags: 0, tag: 'issue', value: 'letsencrypt.org', issuerCritical: false}]
16
16
 
17
- await caa.matches('subdomain.example.com', 'letsencrypt.org');
17
+ await caa.matches("subdomain.example.com", "letsencrypt.org");
18
18
  // => true
19
19
 
20
20
  ```
@@ -24,7 +24,7 @@ await caa.matches('subdomain.example.com', 'letsencrypt.org');
24
24
 
25
25
  Retrieve the CAA records which apply to `name`. Returns a [`CAA` object](https://github.com/mafintosh/dns-packet/#caa).
26
26
 
27
- ### `caa.matches(name, ca, [options])`
27
+ ### `caaMatches(name, ca, [options])`
28
28
 
29
29
  Test if the CAA record for `name` matches for certificate authority `ca`.
30
30
 
package/index.js CHANGED
@@ -1,9 +1,7 @@
1
- "use strict";
2
-
3
- import {getServers} from "dns";
1
+ import {getServers} from "node:dns";
2
+ import {promisify} from "node:util";
4
3
  import dnsSocket from "dns-socket";
5
4
  import tlds from "tlds";
6
- import {promisify} from "util";
7
5
 
8
6
  const defaults = {
9
7
  ignoreTLDs: false,
@@ -90,7 +88,7 @@ const resolve = async ({name, query, servers, port, recursions, retries, tries,
90
88
  }
91
89
  };
92
90
 
93
- export default async function caa(name, opts = {}) {
91
+ export async function caa(name, opts = {}) {
94
92
  if (typeof name !== "string") throw new Error(`Expected a string for 'name', got ${name}`);
95
93
  name = normalizeName(name);
96
94
 
@@ -99,7 +97,7 @@ export default async function caa(name, opts = {}) {
99
97
  opts.servers = (systemServers && systemServers.length) ? systemServers : defaults.servers;
100
98
  }
101
99
 
102
- opts = Object.assign({}, defaults, opts);
100
+ opts = {...defaults, ...opts};
103
101
 
104
102
  const socket = opts.dnsSocket || dnsSocket();
105
103
  const query = promisify(socket.query.bind(socket));
@@ -118,7 +116,7 @@ export default async function caa(name, opts = {}) {
118
116
  return caa || [];
119
117
  }
120
118
 
121
- caa.matches = async (name, ca, opts = {}) => {
119
+ export async function caaMatches(name, ca, opts = {}) {
122
120
  if (typeof name !== "string") throw new Error(`Expected a string for 'name', got ${name}`);
123
121
  if (typeof ca !== "string") throw new Error(`Expected a string for 'ca', got ${ca}`);
124
122
 
@@ -139,4 +137,4 @@ caa.matches = async (name, ca, opts = {}) => {
139
137
 
140
138
  if (names.includes(";")) return false;
141
139
  return !names.length || names.includes(ca);
142
- };
140
+ }
package/package.json CHANGED
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "name": "caa",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "rfc6844-conform CAA record lookup and validation",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/caa",
7
7
  "license": "BSD-2-Clause",
8
8
  "type": "module",
9
9
  "exports": "./index.js",
10
- "scripts": {
11
- "test": "make test"
12
- },
13
10
  "engines": {
14
- "node": ">=12"
11
+ "node": ">=14"
15
12
  },
16
13
  "files": [
17
14
  "index.js"
@@ -23,20 +20,14 @@
23
20
  "certificate authority"
24
21
  ],
25
22
  "dependencies": {
26
- "dns-socket": "^4.2.1",
27
- "tlds": "^1.220.0"
23
+ "dns-socket": "^4.2.2",
24
+ "tlds": "^1.236.0"
28
25
  },
29
26
  "devDependencies": {
30
- "@babel/core": "7.13.16",
31
- "eslint": "7.24.0",
32
- "eslint-config-silverwind": "32.3.3",
33
- "jest": "27.0.0-next.8",
34
- "updates": "12.0.2",
35
- "versions": "8.4.7"
36
- },
37
- "jest": {
38
- "verbose": false,
39
- "testTimeout": 10000,
40
- "transform": {}
27
+ "eslint": "8.34.0",
28
+ "eslint-config-silverwind": "65.1.0",
29
+ "updates": "13.2.8",
30
+ "versions": "10.4.1",
31
+ "vitest": "0.28.4"
41
32
  }
42
33
  }