@@ -41,8 +41,9 @@ func main() { //nolint: funlen,gocyclo,cyclop
4141 WHISPER_AGENT_ADDR = WHISPER_AGENT_ADDR_DEFAULT
4242 }
4343
44- privateKey := flags .String ("p" , WHISPER_DEFAULT_KEY , "Private key path to decrypt data.\n " +
45- "You can use env var WHISPER_DEFAULT_KEY to set the default key path.\n " +
44+ privateKey := flags .String ("p" , WHISPER_DEFAULT_KEY_PATH , "Private key path to decrypt data.\n " +
45+ "Use env var WHISPER_DEFAULT_KEY to set the default key data.\n " +
46+ "Use env var WHISPER_DEFAULT_KEY_PATH to set the default key path.\n " +
4647 "If it's empty a key in ~/.ssh will be auto selected.\n " +
4748 "If it requires a passphrase, env var WHISPER_PASSPHRASE will be used or a password cli prompt will show up.\n " +
4849 "The file path should always use / as the separator, even on Windows." )
@@ -192,6 +193,15 @@ func getPrivate(decrypt bool, sign bool, location string, meta *whisper.Meta) *w
192193 return nil
193194 }
194195
196+ if location == "" && WHISPER_DEFAULT_KEY != "" {
197+ private := whisper.PrivateKey {
198+ Data : []byte (WHISPER_DEFAULT_KEY ),
199+ Passphrase : WHISPER_PASSPHRASE ,
200+ }
201+
202+ return ensurePassphrase (private , location )
203+ }
204+
195205 if location == "" && decrypt {
196206 location = findPrivateKey (meta )
197207 }
@@ -245,7 +255,7 @@ func findPrivateKey(meta *whisper.Meta) string {
245255 return p
246256 }
247257
248- return WHISPER_DEFAULT_KEY
258+ return WHISPER_DEFAULT_KEY_PATH
249259}
250260
251261func getPublicKeys (paths []string ) []whisper.PublicKey {
0 commit comments