@node-core/utils 6.1.0 → 6.1.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/lib/auth.js +3 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/lib/auth.js
CHANGED
|
@@ -12,7 +12,7 @@ function errorExit(message) {
|
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function check(username, token) {
|
|
15
|
+
function check(username, token, format = /^[A-Za-z0-9_]+$/) {
|
|
16
16
|
if (typeof username !== 'string') {
|
|
17
17
|
errorExit(`username must be a string, received ${typeof username}`);
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ function check(username, token) {
|
|
|
25
25
|
if (typeof token !== 'string') {
|
|
26
26
|
errorExit(`token must be a string, received ${typeof token}`);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (!format.test(token)) {
|
|
29
29
|
errorExit(`token is misformatted: ${token}`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -107,7 +107,7 @@ async function auth(
|
|
|
107
107
|
|
|
108
108
|
get h1() {
|
|
109
109
|
const { h1_username, h1_token } = getMergedConfig();
|
|
110
|
-
check(h1_username, h1_token);
|
|
110
|
+
check(h1_username, h1_token, /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/);
|
|
111
111
|
const h1 = encode(h1_username, h1_token);
|
|
112
112
|
setOwnProperty(result, 'h1', h1);
|
|
113
113
|
return h1;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-core/utils",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@node-core/utils",
|
|
9
|
-
"version": "6.1.
|
|
9
|
+
"version": "6.1.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@inquirer/prompts": "^7.4.1",
|