vaulter-cli 0.1.1 → 0.1.3
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 +1 -8
- package/package.json +1 -1
- package/postinstall.js +15 -1
- package/src/commands/help.js +1 -0
- package/src/commands/sign-out.js +12 -0
- package/src/index.js +6 -0
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ vaulter remove my-openai-key
|
|
|
36
36
|
| Command | Description |
|
|
37
37
|
| --- | --- |
|
|
38
38
|
| `vaulter sign-in` | Authenticate with Vaulter via browser |
|
|
39
|
+
| `vaulter sign-out` | Sign out and clear saved credentials |
|
|
39
40
|
| `vaulter ls` | List all API keys in your vault |
|
|
40
41
|
| `vaulter add <name>` | Add a new API key to your vault |
|
|
41
42
|
| `vaulter remove <name-or-id>` | Remove an API key from your vault |
|
|
@@ -46,14 +47,6 @@ vaulter remove my-openai-key
|
|
|
46
47
|
|
|
47
48
|
Vaulter uses browser-based device auth. Running `vaulter sign-in` opens your browser where you log in, and the CLI receives a token automatically. Credentials are stored locally at `~/.vaulter/credentials.json` with restricted file permissions.
|
|
48
49
|
|
|
49
|
-
## Configuration
|
|
50
|
-
|
|
51
|
-
By default the CLI connects to `https://vaulter-nine.vercel.app`. You can override this with the `VAULTER_API_URL` environment variable:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
export VAULTER_API_URL=http://localhost:3000
|
|
55
|
-
```
|
|
56
|
-
|
|
57
50
|
## License
|
|
58
51
|
|
|
59
52
|
MIT
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -5,11 +5,25 @@ const purple3 = '\x1b[38;2;102;0;204m';
|
|
|
5
5
|
const purple4 = '\x1b[38;2;94;0;255m';
|
|
6
6
|
const reset = '\x1b[0m';
|
|
7
7
|
|
|
8
|
+
const dim = '\x1b[2m';
|
|
9
|
+
const bold = '\x1b[1m';
|
|
10
|
+
const white = '\x1b[37m';
|
|
11
|
+
|
|
8
12
|
console.log('');
|
|
9
13
|
console.log(purple + ' ╦ ╦╔═╗╦ ╦╦ ╔╦╗╔═╗╦═╗' + reset);
|
|
10
14
|
console.log(purple2 + ' ╚╗╔╝╠═╣║ ║║ ║ ║╣ ╠╦╝' + reset);
|
|
11
15
|
console.log(purple3 + ' ╚╝ ╩ ╩╚═╝╩═╝╩ ╚═╝╩╚═' + reset);
|
|
12
16
|
console.log(purple4 + ' Your keys. Your vault.' + reset);
|
|
13
17
|
console.log('');
|
|
14
|
-
console.log('
|
|
18
|
+
console.log(purple + ' COMMANDS' + reset);
|
|
19
|
+
console.log('');
|
|
20
|
+
console.log(' ' + bold + white + 'vaulter sign-in ' + reset + dim + 'Authenticate with Vaulter via browser' + reset);
|
|
21
|
+
console.log(' ' + bold + white + 'vaulter sign-out ' + reset + dim + 'Sign out and clear saved credentials' + reset);
|
|
22
|
+
console.log(' ' + bold + white + 'vaulter ls ' + reset + dim + 'List all API keys in your vault' + reset);
|
|
23
|
+
console.log(' ' + bold + white + 'vaulter add <name> ' + reset + dim + 'Add a new API key to your vault' + reset);
|
|
24
|
+
console.log(' ' + bold + white + 'vaulter remove <name-or-id>' + reset + dim + ' Remove an API key from your vault' + reset);
|
|
25
|
+
console.log(' ' + bold + white + 'vaulter web-app ' + reset + dim + 'Open the Vaulter web app in your browser' + reset);
|
|
26
|
+
console.log(' ' + bold + white + 'vaulter help ' + reset + dim + 'Show all available commands' + reset);
|
|
27
|
+
console.log('');
|
|
28
|
+
console.log(' Run ' + bold + 'vaulter sign-in' + reset + ' to get started.');
|
|
15
29
|
console.log('');
|
package/src/commands/help.js
CHANGED
|
@@ -17,6 +17,7 @@ export async function showHelp() {
|
|
|
17
17
|
|
|
18
18
|
const commands = [
|
|
19
19
|
{ name: 'sign-in', desc: 'Authenticate with Vaulter via browser' },
|
|
20
|
+
{ name: 'sign-out', desc: 'Sign out and clear saved credentials' },
|
|
20
21
|
{ name: 'ls', desc: 'List all API keys in your vault' },
|
|
21
22
|
{ name: 'add <name>', desc: 'Add a new API key to your vault' },
|
|
22
23
|
{ name: 'remove <name-or-id>', desc: 'Remove an API key from your vault' },
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { clearToken, isAuthenticated } from '../lib/auth.js';
|
|
2
|
+
import { success, warn } from '../lib/ui.js';
|
|
3
|
+
|
|
4
|
+
export function signOut() {
|
|
5
|
+
if (!isAuthenticated()) {
|
|
6
|
+
warn('You are not signed in.');
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
clearToken();
|
|
11
|
+
success('Signed out of Vaulter.');
|
|
12
|
+
}
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { signIn } from './commands/sign-in.js';
|
|
5
|
+
import { signOut } from './commands/sign-out.js';
|
|
5
6
|
import { listKeys } from './commands/ls.js';
|
|
6
7
|
import { addKey } from './commands/add.js';
|
|
7
8
|
import { removeKey } from './commands/remove.js';
|
|
@@ -26,6 +27,11 @@ program
|
|
|
26
27
|
.description('Authenticate with Vaulter via browser')
|
|
27
28
|
.action(signIn);
|
|
28
29
|
|
|
30
|
+
program
|
|
31
|
+
.command('sign-out')
|
|
32
|
+
.description('Sign out and clear saved credentials')
|
|
33
|
+
.action(signOut);
|
|
34
|
+
|
|
29
35
|
program
|
|
30
36
|
.command('ls')
|
|
31
37
|
.description('List all API keys in your vault')
|