three-blocks-login 0.0.1 → 0.0.2
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/bin/login.js +11 -6
- package/package.json +1 -1
package/bin/login.js
CHANGED
|
@@ -37,8 +37,19 @@ const BROKER_URL =
|
|
|
37
37
|
const LICENSE =
|
|
38
38
|
args.license || process.env.THREE_BLOCKS_SECRET_KEY || process.env.THREE_BLOCKS_LICENSE_KEY;
|
|
39
39
|
|
|
40
|
+
if (!LICENSE || String(LICENSE).trim() === "") {
|
|
41
|
+
fail(
|
|
42
|
+
"Missing license key. Provide --license <key> or set THREE_BLOCKS_SECRET_KEY/THREE_BLOCKS_LICENSE_KEY (env or .env)."
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
// Sanitize + validate license early to avoid header ByteString errors
|
|
41
47
|
const LICENSE_CLEAN = sanitizeLicense(LICENSE);
|
|
48
|
+
if (!LICENSE_CLEAN) {
|
|
49
|
+
fail(
|
|
50
|
+
"Missing license key. Provide --license <key> or set THREE_BLOCKS_SECRET_KEY/THREE_BLOCKS_LICENSE_KEY (env or .env)."
|
|
51
|
+
);
|
|
52
|
+
}
|
|
42
53
|
const invalidIdx = findFirstNonByteChar(LICENSE_CLEAN);
|
|
43
54
|
if (invalidIdx !== -1) {
|
|
44
55
|
if (VERBOSE) log.warn(`[debug] license contains non-ASCII/byte char at index ${invalidIdx}`);
|
|
@@ -58,12 +69,6 @@ const log = {
|
|
|
58
69
|
error:(msg) => { console.error(`${red("✖")} ${msg}`); }
|
|
59
70
|
};
|
|
60
71
|
|
|
61
|
-
if (!LICENSE) {
|
|
62
|
-
fail(
|
|
63
|
-
"Missing license key. Provide --license <key> or set THREE_BLOCKS_SECRET_KEY/THREE_BLOCKS_LICENSE_KEY (env or .env)."
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
72
|
(async () => {
|
|
68
73
|
try {
|
|
69
74
|
const tokenData = await fetchToken(BROKER_URL, LICENSE_CLEAN);
|