@small-tech/auto-encrypt 2.1.0 → 2.3.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 +10 -8
- package/index.js +37 -34
- package/lib/Account.js +6 -4
- package/lib/AcmeRequest.js +32 -29
- package/lib/Authorisation.js +9 -7
- package/lib/Certificate.js +26 -24
- package/lib/Configuration.js +11 -16
- package/lib/Directory.js +26 -24
- package/lib/HttpServer.js +7 -5
- package/lib/Identity.js +8 -6
- package/lib/LetsEncryptServer.js +4 -2
- package/lib/Nonce.js +6 -4
- package/lib/Order.js +17 -15
- package/lib/acme-requests/AuthorisationRequest.js +5 -3
- package/lib/acme-requests/CertificateRequest.js +5 -3
- package/lib/acme-requests/CheckOrderStatusRequest.js +5 -3
- package/lib/acme-requests/FinaliseOrderRequest.js +5 -3
- package/lib/acme-requests/NewAccountRequest.js +4 -2
- package/lib/acme-requests/NewOrderRequest.js +5 -3
- package/lib/acme-requests/ReadyForChallengeValidationRequest.js +5 -3
- package/lib/acmeCsr.js +3 -3
- package/lib/identities/AccountIdentity.js +5 -3
- package/lib/identities/CertificateIdentity.js +5 -3
- package/lib/staging/fakelerootx1.pem +30 -27
- package/lib/staging/monkeyPatchTls.js +6 -6
- package/lib/test-helpers/index.js +39 -31
- package/lib/util/Pluralise.js +3 -1
- package/lib/util/Throws.js +7 -3
- package/lib/util/async-foreach.js +3 -1
- package/lib/util/log.js +3 -1
- package/lib/util/waitFor.js +3 -1
- package/lib/x.509/rfc5280.js +171 -84
- package/package.json +20 -21
- package/typedefs/lib/AcmeRequest.js +1 -1
- package/CHANGELOG +0 -99
package/lib/util/Throws.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
//
|
|
12
12
|
////////////////////////////////////////////////////////////////////////////////
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const fs = require('fs-extra')
|
|
15
15
|
|
|
16
16
|
class SymbolicError extends Error {
|
|
17
17
|
symbol = null
|
|
@@ -21,7 +21,7 @@ class SymbolicError extends Error {
|
|
|
21
21
|
// at the end of the error message, in parentheses.
|
|
22
22
|
const hinted = (str, hint) => hint ? `${str} (${hint}).` : `${str}.`
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
class Throws {
|
|
25
25
|
// Define common global errors. These are mixed into a local ERRORS object
|
|
26
26
|
// if it exists on the object the mixin() method is called with a reference to.
|
|
27
27
|
static ERRORS = {
|
|
@@ -75,6 +75,7 @@ export default class Throws {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
ifMissing (parameterName) {
|
|
78
|
+
|
|
78
79
|
// Attempt to automatically get the argument name even if parameterName was not
|
|
79
80
|
// manually specified in the code.
|
|
80
81
|
//
|
|
@@ -86,7 +87,7 @@ export default class Throws {
|
|
|
86
87
|
const stack = new Error().stack;
|
|
87
88
|
Error.prepareStackTrace = copy;
|
|
88
89
|
|
|
89
|
-
const fileName = stack[1].getFileName()
|
|
90
|
+
const fileName = stack[1].getFileName();
|
|
90
91
|
const lineNumber = stack[1].getLineNumber() - 1;
|
|
91
92
|
const columnNumber = stack[1].getColumnNumber() - 1;
|
|
92
93
|
const line = fs.readFileSync(fileName, "utf8").split("\n")[lineNumber];
|
|
@@ -96,6 +97,7 @@ export default class Throws {
|
|
|
96
97
|
if (groups !== null) {
|
|
97
98
|
argumentName = groups[2]
|
|
98
99
|
}
|
|
100
|
+
|
|
99
101
|
this.error(Symbol.for('UndefinedOrNullError'), parameterName || argumentName || '<unknown>')
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -115,3 +117,5 @@ export default class Throws {
|
|
|
115
117
|
throw this.createError(symbol, ...args)
|
|
116
118
|
}
|
|
117
119
|
}
|
|
120
|
+
|
|
121
|
+
module.exports = Throws
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
//
|
|
21
21
|
////////////////////////////////////////////////////////////////////////////////
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
async function asyncForEach(array, callback) {
|
|
24
24
|
for (let index = 0; index < array.length; index++) {
|
|
25
25
|
await callback(array[index], index, array);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
module.exports = asyncForEach
|
package/lib/util/log.js
CHANGED
package/lib/util/waitFor.js
CHANGED