Skip to content

Commit b26ca71

Browse files
committed
[cli] Fix interactive secrets code
1 parent 02aa311 commit b26ca71

File tree

5 files changed

+37
-17
lines changed

5 files changed

+37
-17
lines changed

cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ A more secure way is to let the CLI prompt you for the passphrase when needed.
106106
antij wallet create --ask-passphrase
107107
```
108108

109-
If you set the `ANTI_INTERACTIVE_PASSWORD` environment variable to any value, the CLI will prompt you for the passphrase every time it needs it.
109+
If you set the `ANTI_INTERACTIVE_SECRETS` environment variable to any value, the CLI will prompt you for the passphrase every time it needs it.
110110

111111
```bash
112-
export ANTI_INTERACTIVE_PASSWORD=1
112+
export ANTI_INTERACTIVE_SECRETS=1
113113
```
114114

115115
You can review this wallet info anytime with

cli/docs/requester-role.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ Before proceding be careful to set the necessary signing assets in your environm
116116
As with the wallet passphrase you can set the password in the environment variable
117117
118118
```bash
119-
read -s -p "Enter password to decrypt the SSH private key: " ANTI_INTERACTIVE_PASSWORD
120-
export ANTI_INTERACTIVE_PASSWORD
119+
read -s -p "Enter password to decrypt the SSH private key: " ANTI_INTERACTIVE_SECRETS
120+
export ANTI_INTERACTIVE_SECRETS
121121
```
122122
123123
Or better paste it from a password manager each time you need it using the 'ask-password' option
124124
125-
Or set the `ANTI_INTERACTIVE_PASSWORD` environment variable to any value.
125+
Or set the `ANTI_INTERACTIVE_SECRETS` environment variable to any value.
126126
127127
> The file at ANTI_SSH_FILE path has to be the encrypted ssh private key matching the user registration [see above](#registering-a-user-public-key).
128128

cli/src/Core/Types/Mnemonics/Options.hs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import OptEnvConf
3232
, setting
3333
, short
3434
, str
35+
, switch
3536
, withConfig
3637
)
3738
import System.Console.Haskeline
@@ -57,13 +58,18 @@ walletPassphraseCommon =
5758
mapIO id
5859
$ setting
5960
[ help "Prompt for the passphrase for the encrypted mnemonics"
60-
, env "ANTI_INTERACTIVE_PASSWORD"
61+
, env "ANTI_INTERACTIVE_SECRETS"
6162
, metavar "NONE"
62-
, long "ask-passphrase"
63-
, option
6463
, reader
6564
$ str @String $> queryConsole "Enter passphrase for encrypted mnemonics"
6665
]
66+
<|> setting
67+
[ help "Prompt for the passphrase for the encrypted mnemonics"
68+
, metavar "NONE"
69+
, long "ask-wallet-passphrase"
70+
, switch
71+
$ queryConsole "Enter passphrase for encrypted mnemonics"
72+
]
6773
<|> setting
6874
[ env "ANTI_WALLET_PASSPHRASE"
6975
, metavar "PASSPHRASE"

cli/src/Options.hs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import OptEnvConf
4747
, runParser
4848
, setting
4949
, str
50+
, switch
5051
, (<|>)
5152
)
5253
import Oracle.Options (oracleCommandParser)
@@ -64,15 +65,22 @@ githubAuthOption =
6465
$ mapIO id
6566
$ setting
6667
[ help "Prompt for the passphrase for the encrypted mnemonics"
67-
, env "ANTI_INTERACTIVE_PASSWORD"
68+
, env "ANTI_INTERACTIVE_SECRETS"
6869
, metavar "NONE"
69-
, long "ask-passphrase"
70-
, option
7170
, reader
72-
$ str @String
71+
( str @String
7372
$> ( T.encodeUtf8
74-
<$> queryConsole "Enter your GitHub personal access token: "
73+
<$> queryConsole "Enter your GitHub personal access token"
7574
)
75+
)
76+
]
77+
<|> setting
78+
[ help "Prompt for the passphrase for the encrypted mnemonics"
79+
, metavar "NONE"
80+
, long "ask-github-pat"
81+
, switch
82+
$ T.encodeUtf8
83+
<$> queryConsole "Enter your GitHub personal access token"
7684
]
7785
<|> setting
7886
[ env "ANTI_GITHUB_PAT"

cli/src/User/Requester/Options.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ import OptEnvConf
3434
, long
3535
, mapIO
3636
, metavar
37-
, option
3837
, reader
3938
, setting
4039
, str
40+
, switch
4141
, (<|>)
4242
)
4343
import Oracle.Validate.Requests.RegisterRole
@@ -160,16 +160,22 @@ keyPasswordOption =
160160
mapIO id
161161
$ setting
162162
[ help "Prompt for the password to decrypt the SSH private key"
163-
, env "ANTI_INTERACTIVE_PASSWORD"
163+
, env "ANTI_INTERACTIVE_SECRETS"
164164
, metavar "NONE"
165-
, long "ask-password"
166-
, option
167165
, reader
168166
$ str @String
169167
$> ( T.unpack
170168
<$> queryConsole "Enter password for SSH private key"
171169
)
172170
]
171+
<|> setting
172+
[ help "Prompt for the password to decrypt the SSH private key"
173+
, metavar "NONE"
174+
, long "ask-ssh-password"
175+
, switch
176+
$ T.unpack
177+
<$> queryConsole "Enter password for SSH private key"
178+
]
173179
<|> setting
174180
[ env "ANTI_SSH_PASSWORD"
175181
, help "Password to the decrypt the SSH private key"

0 commit comments

Comments
 (0)