@salefronts/cli 1.5.0 → 1.6.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 CHANGED
@@ -21,8 +21,9 @@ sf help
21
21
 
22
22
  ## Publishing
23
23
 
24
- Increase the version inside the package.json
24
+ - Increase the version inside the package.json
25
+ - Generate an access token in npm: check bypass 2FA
25
26
 
26
27
  ```bash
27
- npm publish --access public
28
+ export NPM_TOKEN=<token here> && npm publish --access public
28
29
  ```
package/commands/help.js CHANGED
@@ -8,6 +8,7 @@ function showHelp() {
8
8
  console.log('Usage: sf <command>\n');
9
9
  console.log('Available commands:');
10
10
  console.log(' jwt Generate JWT tokens');
11
+ console.log(' key Generate an uppercase alphanumeric key');
11
12
  console.log(' keypair Generate public/private key pairs');
12
13
  console.log(' passphrase Generate secure passphrases');
13
14
  console.log(' secret Generate a random secret');
@@ -26,4 +27,4 @@ function showHelp() {
26
27
  module.exports = async function () {
27
28
  showHelp();
28
29
  process.exit(0);
29
- }
30
+ }
@@ -0,0 +1,20 @@
1
+ const crypto = require('crypto');
2
+
3
+ const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
4
+ const KEY_LENGTH = 16;
5
+
6
+ module.exports = function () {
7
+ try {
8
+ const bytes = crypto.randomBytes(KEY_LENGTH);
9
+ let key = '';
10
+
11
+ for (const byte of bytes) {
12
+ key += ALPHABET[byte % ALPHABET.length];
13
+ }
14
+
15
+ console.log(key);
16
+ } catch (err) {
17
+ console.error('Error generating key:', err.message);
18
+ process.exit(1);
19
+ }
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salefronts/cli",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "bin": {
5
5
  "sf": "bin/sf"
6
6
  },