Browse Source

bitwarden: add bitwarden-lock

Sean Farley 7 years ago
parent
commit
79faf463bd
1 changed files with 7 additions and 1 deletions
  1. 7 1
      bitwarden.el

+ 7 - 1
bitwarden.el

@@ -159,13 +159,19 @@ since that could be set yet could be expired or incorrect."
     (error "Bitwarden: already logged in"))
   (bitwarden--raw-unlock (concat "login " bitwarden-user)))
 
+(defun bitwarden-lock ()
+  "Lock the bw vault.  Does not ask for confirmation."
+  (interactive)
+  (when (bitwarden-unlocked-p)
+    (setenv "BW_SESSION" nil)))
+
 ;;;###autoload
 (defun bitwarden-logout ()
   "Log out bw.  Does not ask for confirmation."
   (interactive)
   (when (bitwarden-logged-in-p)
     (bitwarden-runcmd "logout")
-    (setenv "BW_SESSION" nil)))
+    (bitwarden-lock)))
 
 (provide 'bitwarden)