iosignal-cli 1.7.0 → 2.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/bin/io-keygen.js CHANGED
@@ -1,45 +1,47 @@
1
- #!/usr/bin/env node
2
-
3
- import { RAND } from 'iosignal'
4
-
5
- // base64 from random n-byte
6
- function rand_b64(srcByteSize) {
7
- return RAND(srcByteSize).toString('base64')
8
- }
9
-
10
- // accept 1 ~ 12
11
- function rand_number_string(len) {
12
- if (len > 12) throw new RangeError("Member: rand_number range is over.")
13
-
14
- let bigNumberBuffer, n, nString;
15
- const cropFrom = 1;
16
- do {
17
- bigNumberBuffer = RAND(8);
18
- n = bigNumberBuffer.readBigUInt64LE(0);
19
- nString = n.toString()
20
- // console.log('>', n )
21
- } while ((n < 2 ** 44) || nString[cropFrom] == '0') // 44-> 14digit.
22
-
23
- nString = nString.substring(cropFrom, len + cropFrom)
24
- return nString
25
- }
26
-
27
-
28
- let key20 = rand_b64(15)
29
- let did4 = rand_b64(3)
30
- let did8 = rand_b64(6)
31
- let randNumber4 = rand_number_string(4)
32
- let randNumber8 = rand_number_string(8)
33
- // console.log('rand number 8chars', rand_number_string(8) )
34
- // console.log('random 15bytes as base64 20chars: ', key )
35
- // console.log('random 3bytes as base64 4chars: ', did )
36
-
37
- console.log('\n random values')
38
- console.log('+------------------------------------+')
39
- console.log('| ID:', did4, ' KEY:', key20)
40
- console.log('+------------------------------------+')
41
- console.log('| ID_KEY: ', did4 + '.' + key20)
42
- console.log('+------------------------------------+')
43
- console.log('| numbers: ', randNumber4, randNumber8)
44
- console.log('+------------------------------------+')
45
- console.log('')
1
+ #!/usr/bin/env node
2
+ import { Boho } from 'iosignal'
3
+
4
+ // base64 from random n-byte
5
+ function rand_b64(srcByteSize) {
6
+ return Boho.RAND(srcByteSize).toString('base64')
7
+ }
8
+
9
+ // accept 1 ~ 12
10
+ function rand_number_string(len) {
11
+ if (len > 12) throw new RangeError("Member: rand_number range is over.")
12
+
13
+ let bigNumberBuffer, n, nString;
14
+ const cropFrom = 1;
15
+ do {
16
+ bigNumberBuffer = Boho.RAND(8);
17
+ n = bigNumberBuffer.readBigUInt64LE(0);
18
+ nString = n.toString()
19
+ // console.log('>', n )
20
+ } while ((n < 2 ** 44) || nString[cropFrom] == '0') // 44-> 14digit.
21
+
22
+ nString = nString.substring(cropFrom, len + cropFrom)
23
+ return nString
24
+ }
25
+
26
+
27
+ let key20 = rand_b64(15)
28
+ let key40 = rand_b64(30)
29
+ let did4 = rand_b64(3)
30
+ let did8 = rand_b64(6)
31
+ let randNumber4 = rand_number_string(4)
32
+ let randNumber8 = rand_number_string(8)
33
+ // console.log('rand number 8chars', rand_number_string(8) )
34
+ // console.log('random 15bytes as base64 20chars: ', key )
35
+ // console.log('random 3bytes as base64 4chars: ', did )
36
+
37
+ console.log('\n random values')
38
+ console.log('+----------------------------------------------------+')
39
+ console.log('| ID:', did4, ' KEY L20:', key20)
40
+ console.log('+----------------------------------------------------+')
41
+ console.log('| ID_KEY: ', did4 + '.' + key20)
42
+ console.log('+----------------------------------------------------+')
43
+ console.log('| numbers: ', randNumber4, randNumber8)
44
+ console.log('+----------------------------------------------------+')
45
+ console.log('| b64_L40: ', key40)
46
+ console.log('+----------------------------------------------------+')
47
+ console.log('')
package/bin/io-server.js CHANGED
@@ -1,104 +1,104 @@
1
- #!/usr/bin/env node
2
-
3
- import { createClient } from 'redis';
4
- import { program } from 'commander'
5
- import { version } from './getVersion.js'
6
- import { serverInfo } from './serverInfo.js';
7
- import {
8
- Server, serverOption, Auth_File, Auth_Env, Auth_Redis,
9
- api_reply, api_sudo, RedisAPI
10
- } from 'iosignal'
11
-
12
-
13
-
14
- program
15
- .version(version)
16
- .usage('[options] (--listen <port> )')
17
- .option('-l, --listen <port>', 'listen on port (start WebSocket Server)')
18
- .option('-L, --listen-congport <port>', 'listen on cong port (start CongSocket Server)')
19
- .option('-d, --auth-file <path>', 'auth data file path')
20
- .option('-e, --auth-param <id.key.level>', 'auth data from argument: id.key.level,id2.key2.level2')
21
- .option('-E, --auth-env', 'auth data from shell env BOHO_AUTH')
22
- .option('-r, --auth-redis', 'connect to redis. if exist use env REDIS_HOST, REDIS_PORT or localhost:6379')
23
- .option('-t, --timeout <milliseconds>', 'ping period & timeout')
24
- .option('-m, --metric <type>', 'show metric <number> 1:traffic, 2:echo')
25
- .option('-s, --show-message <none|message>', 'show receive message. ')
26
- .option('-f, --file-logger', 'write log files.')
27
- .option('-a, --api-list [list...]', 'one or multiple api names: -a api_1 api_2 ')
28
- .option('-o, --show-options', 'show server init options.')
29
- .parse(process.argv)
30
-
31
- const options = program.opts()
32
-
33
- if (options.fileLogger) {
34
- serverOption.fileLogger.connection.use = true;
35
- serverOption.fileLogger.auth.use = true;
36
- serverOption.fileLogger.attack.use = true;
37
- }
38
-
39
- if (options.listen) {
40
- serverOption.port = parseInt(options.listen)
41
- }
42
-
43
- if (options.listenCongport) {
44
- serverOption.congPort = parseInt(options.listenCongport)
45
- }
46
-
47
- if (options.showMessage) {
48
- serverOption.showMessage = options.showMessage
49
- }
50
-
51
- if (options.metric) {
52
- serverOption.showMetric = options.metric
53
- }
54
-
55
- if (options.timeout) {
56
- serverOption.timeout = options.timeout
57
- }
58
-
59
-
60
- let authManager;
61
- let redisClient;
62
-
63
- if (options.authFile) {
64
- console.log("auth data origin: auth_file")
65
- let authFilePath = options.authFile;
66
- authManager = new Auth_File(authFilePath)
67
- } else if (options.authParam) {
68
- authManager = new Auth_Env(options.authParam)
69
- } else if (options.authEnv) {
70
- authManager = new Auth_Env()
71
- } else if (options.authRedis) {
72
- console.log("auth data origin: redis")
73
- // console.log('####### default redis server url: redis://localhost:6379 ' )
74
- redisClient = createClient();
75
- redisClient.on('error', (err) => console.log('Redis Client Error', err));
76
- redisClient.connect();
77
- authManager = new Auth_Redis(redisClient)
78
- } else {
79
- // console.log("No authentication support.")
80
-
81
- }
82
-
83
-
84
- const server = new Server(serverOption, authManager)
85
-
86
- if (options.apiList && options.apiList.length > 0) {
87
- let apiList = options.apiList
88
- console.log('api list', apiList)
89
- if (apiList.includes('reply')) server.api('reply', api_reply)
90
- if (apiList.includes('sudo')) server.api('sudo', api_sudo)
91
- if (apiList.includes('redis')) server.api('redis', new RedisAPI(redisClient))
92
-
93
- }
94
-
95
- if (options.showOptions) {
96
- console.log('ServerOptions:', serverOption)
97
- console.log('server api list', server.apiNames)
98
- }
99
-
100
- console.log( serverInfo( serverOption.port , serverOption.congPort ))
101
-
102
- if( !serverOption.port && !serverOption.congPort ){
103
- process.exit()
1
+ #!/usr/bin/env node
2
+
3
+ import { createClient } from 'redis';
4
+ import { program } from 'commander'
5
+ import { version } from './getVersion.js'
6
+ import { serverInfo } from './serverInfo.js';
7
+ import {
8
+ Server, serverOption, Auth_File, Auth_Env, Auth_Redis,
9
+ api_reply, api_sudo, RedisAPI
10
+ } from 'iosignal'
11
+
12
+
13
+
14
+ program
15
+ .version(version)
16
+ .usage('[options] (--listen <port> )')
17
+ .option('-l, --listen <port>', 'listen on port (start WebSocket Server)')
18
+ .option('-L, --listen-congport <port>', 'listen on cong port (start CongSocket Server)')
19
+ .option('-d, --auth-file <path>', 'auth data file path')
20
+ .option('-e, --auth-param <id.key.level>', 'auth data from argument: id.key.level,id2.key2.level2')
21
+ .option('-E, --auth-env', 'auth data from shell env BOHO_AUTH')
22
+ .option('-r, --auth-redis', 'connect to redis. if exist use env REDIS_HOST, REDIS_PORT or localhost:6379')
23
+ .option('-t, --timeout <milliseconds>', 'ping period & timeout')
24
+ .option('-m, --metric <type>', 'show metric <number> 1:traffic, 2:echo')
25
+ .option('-s, --show-message <none|message>', 'show receive message. ')
26
+ .option('-f, --file-logger', 'write log files.')
27
+ .option('-a, --api-list [list...]', 'one or multiple api names: -a api_1 api_2 ')
28
+ .option('-o, --show-options', 'show server init options.')
29
+ .parse(process.argv)
30
+
31
+ const options = program.opts()
32
+
33
+ if (options.fileLogger) {
34
+ serverOption.fileLogger.connection.use = true;
35
+ serverOption.fileLogger.auth.use = true;
36
+ serverOption.fileLogger.attack.use = true;
37
+ }
38
+
39
+ if (options.listen) {
40
+ serverOption.port = parseInt(options.listen)
41
+ }
42
+
43
+ if (options.listenCongport) {
44
+ serverOption.congPort = parseInt(options.listenCongport)
45
+ }
46
+
47
+ if (options.showMessage) {
48
+ serverOption.showMessage = options.showMessage
49
+ }
50
+
51
+ if (options.metric) {
52
+ serverOption.showMetric = options.metric
53
+ }
54
+
55
+ if (options.timeout) {
56
+ serverOption.timeout = options.timeout
57
+ }
58
+
59
+
60
+ let authManager;
61
+ let redisClient;
62
+
63
+ if (options.authFile) {
64
+ console.log("auth data origin: auth_file")
65
+ let authFilePath = options.authFile;
66
+ authManager = new Auth_File(authFilePath)
67
+ } else if (options.authParam) {
68
+ authManager = new Auth_Env(options.authParam)
69
+ } else if (options.authEnv) {
70
+ authManager = new Auth_Env()
71
+ } else if (options.authRedis) {
72
+ console.log("auth data origin: redis")
73
+ // console.log('####### default redis server url: redis://localhost:6379 ' )
74
+ redisClient = createClient();
75
+ redisClient.on('error', (err) => console.log('Redis Client Error', err));
76
+ redisClient.connect();
77
+ authManager = new Auth_Redis(redisClient)
78
+ } else {
79
+ // console.log("No authentication support.")
80
+
81
+ }
82
+
83
+
84
+ const server = new Server(serverOption, authManager)
85
+
86
+ if (options.apiList && options.apiList.length > 0) {
87
+ let apiList = options.apiList
88
+ console.log('api list', apiList)
89
+ if (apiList.includes('reply')) server.api('reply', api_reply)
90
+ if (apiList.includes('sudo')) server.api('sudo', api_sudo)
91
+ if (apiList.includes('redis')) server.api('redis', new RedisAPI(redisClient))
92
+
93
+ }
94
+
95
+ if (options.showOptions) {
96
+ console.log('ServerOptions:', serverOption)
97
+ console.log('server api list', server.apiNames)
98
+ }
99
+
100
+ console.log(serverInfo(serverOption.port, serverOption.congPort))
101
+
102
+ if (!serverOption.port && !serverOption.congPort) {
103
+ process.exit()
104
104
  }
package/bin/ioip.js CHANGED
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env node
2
-
3
- import { getNetworkAddress } from './serverInfo.js'
4
- let ip = getNetworkAddress()
5
- console.log( ip )
6
-
1
+ #!/usr/bin/env node
2
+
3
+ import { getNetworkAddress } from './serverInfo.js'
4
+ let ip = getNetworkAddress()
5
+ console.log( ip )
6
+
package/bin/serverInfo.js CHANGED
@@ -1,68 +1,68 @@
1
- import { networkInterfaces as getNetworkInterfaces } from 'node:os';
2
- const networkInterfaces = getNetworkInterfaces();
3
- import chalk from 'chalk';
4
- import boxen from 'boxen';
5
-
6
-
7
- export function getNetworkAddress (){
8
- for (const interfaceDetails of Object.values(networkInterfaces)) {
9
- if (!interfaceDetails) continue;
10
-
11
- for (const details of interfaceDetails) {
12
- const { address, family, internal } = details;
13
-
14
- if (family === 'IPv4' && !internal) return address;
15
- }
16
- }
17
- };
18
-
19
-
20
- export function serverInfo ( wsPort, congPort ){
21
- // console.log('wsPort', wsPort, 'congPort', congPort)
22
- let ip = getNetworkAddress();
23
- let message
24
-
25
- if( wsPort || congPort ){
26
- message = chalk.green('Serving');
27
- }else{
28
- message = chalk.green('please use -l and -L option to select port number.');
29
- message += chalk.yellow('\n\n $ io-server -l 7777');
30
- message += chalk.green(' // iosignal over websocket.');
31
- message += chalk.yellow('\n\n $ io-server -L 8888');
32
- message += chalk.green(' // iosignal over congsocket.');
33
- message += chalk.yellow('\n\n $ io-server -l 7777 -L 8888');
34
- message += chalk.green(' // suppport both.');
35
- message += chalk.yellow('\n\n $ io-server -h');
36
- message += chalk.green(' // display help');
37
- }
38
-
39
- const prefix = '- '
40
- const space = ' '
41
-
42
- if(wsPort){
43
- message += `\n\n`;
44
- message += chalk.green('IOSignal Over WebSocket');
45
- message += chalk.yellow('\n\n Web Browser & Node.js');
46
- message += `\n ${chalk.bold(`${prefix}Local:`)}${space}ws://localhost:${wsPort}`;
47
- message += `\n ${chalk.bold('- Network:')} ws://${ip}:${wsPort}`;
48
- }else{
49
-
50
- }
51
-
52
- if(congPort){
53
- message += `\n\n`;
54
- message += chalk.green('IOSignal Over CongSocket');
55
- message += chalk.yellow('\n\n Node.js');
56
-
57
- message += `\n ${chalk.bold(`${prefix}Local:`)}${space}cong://localhost:${congPort}`;
58
- message += `\n ${chalk.bold('- Network:')} cong://${ip}:${congPort}`;
59
-
60
- message += chalk.yellow('\n\n Arduino');
61
- message += `\n ${chalk.bold(`${prefix}host:`)} ${ip}`;
62
- message += `\n ${chalk.bold('- port:')} ${congPort }`;
63
-
64
- }
65
-
66
- return boxen(message, { padding: 1, borderColor: 'green', margin: 1, })
67
-
1
+ import { networkInterfaces as getNetworkInterfaces } from 'node:os';
2
+ const networkInterfaces = getNetworkInterfaces();
3
+ import chalk from 'chalk';
4
+ import boxen from 'boxen';
5
+
6
+
7
+ export function getNetworkAddress (){
8
+ for (const interfaceDetails of Object.values(networkInterfaces)) {
9
+ if (!interfaceDetails) continue;
10
+
11
+ for (const details of interfaceDetails) {
12
+ const { address, family, internal } = details;
13
+
14
+ if (family === 'IPv4' && !internal) return address;
15
+ }
16
+ }
17
+ };
18
+
19
+
20
+ export function serverInfo ( wsPort, congPort ){
21
+ // console.log('wsPort', wsPort, 'congPort', congPort)
22
+ let ip = getNetworkAddress();
23
+ let message
24
+
25
+ if( wsPort || congPort ){
26
+ message = chalk.green('Serving');
27
+ }else{
28
+ message = chalk.green('please use -l and -L option to select port number.');
29
+ message += chalk.yellow('\n\n $ io-server -l 7777');
30
+ message += chalk.green(' // iosignal over websocket.');
31
+ message += chalk.yellow('\n\n $ io-server -L 8888');
32
+ message += chalk.green(' // iosignal over congsocket.');
33
+ message += chalk.yellow('\n\n $ io-server -l 7777 -L 8888');
34
+ message += chalk.green(' // suppport both.');
35
+ message += chalk.yellow('\n\n $ io-server -h');
36
+ message += chalk.green(' // display help');
37
+ }
38
+
39
+ const prefix = '- '
40
+ const space = ' '
41
+
42
+ if(wsPort){
43
+ message += `\n\n`;
44
+ message += chalk.green('IOSignal Over WebSocket');
45
+ message += chalk.yellow('\n\n Web Browser & Node.js');
46
+ message += `\n ${chalk.bold(`${prefix}Local:`)}${space}ws://localhost:${wsPort}`;
47
+ message += `\n ${chalk.bold('- Network:')} ws://${ip}:${wsPort}`;
48
+ }else{
49
+
50
+ }
51
+
52
+ if(congPort){
53
+ message += `\n\n`;
54
+ message += chalk.green('IOSignal Over CongSocket');
55
+ message += chalk.yellow('\n\n Node.js');
56
+
57
+ message += `\n ${chalk.bold(`${prefix}Local:`)}${space}cong://localhost:${congPort}`;
58
+ message += `\n ${chalk.bold('- Network:')} cong://${ip}:${congPort}`;
59
+
60
+ message += chalk.yellow('\n\n Arduino');
61
+ message += `\n ${chalk.bold(`${prefix}host:`)} ${ip}`;
62
+ message += `\n ${chalk.bold('- port:')} ${congPort }`;
63
+
64
+ }
65
+
66
+ return boxen(message, { padding: 1, borderColor: 'green', margin: 1, })
67
+
68
68
  }
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "name": "iosignal-cli",
3
- "version": "1.7.0",
4
- "description": "IOSignal server and client CLI program.",
5
- "type": "module",
6
- "bin": {
7
- "io-server": "./bin/io-server.js",
8
- "io-client": "./bin/io-client.js",
9
- "ios": "./bin/io-server.js",
10
- "io": "./bin/io-client.js",
11
- "ioip": "./bin/ioip.js",
12
- "io-keygen": "./bin/io-keygen.js"
13
- },
14
- "author": {
15
- "name": "Lee Dongeun",
16
- "email": "sixgen@gmail.com"
17
- },
18
- "license": "MIT",
19
- "dependencies": {
20
- "boxen": "^7.1.1",
21
- "chalk": "^5.3.0",
22
- "commander": "^12.1.0",
23
- "iosignal": "^1.7.0",
24
- "meta-buffer-pack": "^1.4.0",
25
- "redis": "^4.6.12"
26
- },
27
- "repository": {
28
- "type": "git",
29
- "url": "git://github.com/remocons/iosignal-cli.git"
30
- },
31
- "homepage": "https://iosignal.net",
32
- "keywords": [
33
- "websocket",
34
- "pubsub",
35
- "arduino",
36
- "iot",
37
- "auth",
38
- "signal",
39
- "CLI",
40
- "remocon"
41
- ]
42
- }
1
+ {
2
+ "name": "iosignal-cli",
3
+ "version": "2.0.0",
4
+ "description": "IOSignal server and client CLI program.",
5
+ "type": "module",
6
+ "bin": {
7
+ "io-server": "./bin/io-server.js",
8
+ "io-client": "./bin/io-client.js",
9
+ "ios": "./bin/io-server.js",
10
+ "io": "./bin/io-client.js",
11
+ "ioip": "./bin/ioip.js",
12
+ "io-keygen": "./bin/io-keygen.js"
13
+ },
14
+ "author": {
15
+ "name": "Lee Taeo",
16
+ "email": "taeo.mocha@gmail.com"
17
+ },
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "boxen": "^8.0.1",
21
+ "chalk": "^5.3.0",
22
+ "commander": "^12.1.0",
23
+ "iosignal": "^2.0.0",
24
+ "meta-buffer-pack": "^2.0.2",
25
+ "redis": "^4.7.0"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git://github.com/remocons/iosignal-cli.git"
30
+ },
31
+ "homepage": "https://iosignal.net",
32
+ "keywords": [
33
+ "websocket",
34
+ "pubsub",
35
+ "arduino",
36
+ "iot",
37
+ "auth",
38
+ "signal",
39
+ "CLI",
40
+ "remocon"
41
+ ]
42
+ }
@@ -1,32 +1,32 @@
1
- import { Auth_Redis } from 'iosignal'
2
- import { createClient } from 'redis';
3
-
4
- let redisClient = createClient();
5
- redisClient.on('error', (err) => console.log('Redis Client Error', err));
6
- redisClient.connect();
7
-
8
- let auth = new Auth_Redis( redisClient)
9
-
10
- //addUSer(did,dkey,cid,level)
11
- if( process.argv.length != 5 ){
12
- console.log('=> $ node addAdmin.js id key cid')
13
- process.exit()
14
- }
15
-
16
- let did = process.argv[2]
17
- let dkey = process.argv[3]
18
- let cid = process.argv[4]
19
-
20
- let addResult = await auth.addAuth( did, dkey, cid ,255)
21
- let getResult = await auth.getAuth( did )
22
- let saveResult = await auth.save();
23
-
24
- console.log('add',addResult )
25
- console.log('get',getResult)
26
- console.log('data.key',getResult.key)
27
- console.log('save result', saveResult)
28
-
29
- process.exit()
30
-
31
-
32
-
1
+ import { Auth_Redis } from 'iosignal'
2
+ import { createClient } from 'redis';
3
+
4
+ let redisClient = createClient();
5
+ redisClient.on('error', (err) => console.log('Redis Client Error', err));
6
+ redisClient.connect();
7
+
8
+ let auth = new Auth_Redis( redisClient)
9
+
10
+ //addUSer(did,dkey,cid,level)
11
+ if( process.argv.length != 5 ){
12
+ console.log('=> $ node addAdmin.js id key cid')
13
+ process.exit()
14
+ }
15
+
16
+ let did = process.argv[2]
17
+ let dkey = process.argv[3]
18
+ let cid = process.argv[4]
19
+
20
+ let addResult = await auth.addAuth( did, dkey, cid ,255)
21
+ let getResult = await auth.getAuth( did )
22
+ let saveResult = await auth.save();
23
+
24
+ console.log('add',addResult )
25
+ console.log('get',getResult)
26
+ console.log('data.key',getResult.key)
27
+ console.log('save result', saveResult)
28
+
29
+ process.exit()
30
+
31
+
32
+
@@ -1,29 +1,29 @@
1
- import { Auth_Redis } from 'iosignal'
2
- import { createClient } from 'redis';
3
-
4
- let redisClient = createClient();
5
- redisClient.on('error', (err) => console.log('Redis Client Error', err));
6
- redisClient.connect();
7
-
8
- let auth = new Auth_Redis( redisClient)
9
-
10
- // node filename base_id level number
11
- // node uno 1 10
12
- //addUSer(did,dey,cid,level)
13
- let baseId = process.argv[2] ? process.argv[2] : 'uno'
14
- let level = process.argv[3] ? process.argv[3] : 1;
15
- let n = process.argv[4] ? process.argv[4] : 10;
16
-
17
- console.log( baseId, n )
18
- for(let i=0; i< n ;i++){
19
- let id = baseId + i;
20
- let addResult = await auth.addAuth( id, id, id ,level)
21
- console.log('add',addResult )
22
- }
23
-
24
- await auth.save();
25
-
26
- process.exit()
27
-
28
-
29
-
1
+ import { Auth_Redis } from 'iosignal'
2
+ import { createClient } from 'redis';
3
+
4
+ let redisClient = createClient();
5
+ redisClient.on('error', (err) => console.log('Redis Client Error', err));
6
+ redisClient.connect();
7
+
8
+ let auth = new Auth_Redis( redisClient)
9
+
10
+ // node filename base_id level number
11
+ // node uno 1 10
12
+ //addUSer(did,dey,cid,level)
13
+ let baseId = process.argv[2] ? process.argv[2] : 'uno'
14
+ let level = process.argv[3] ? process.argv[3] : 1;
15
+ let n = process.argv[4] ? process.argv[4] : 10;
16
+
17
+ console.log( baseId, n )
18
+ for(let i=0; i< n ;i++){
19
+ let id = baseId + i;
20
+ let addResult = await auth.addAuth( id, id, id ,level)
21
+ console.log('add',addResult )
22
+ }
23
+
24
+ await auth.save();
25
+
26
+ process.exit()
27
+
28
+
29
+