diff --git a/bitwarden.el b/bitwarden.el index 6668407..0e3bbfa 100644 --- a/bitwarden.el +++ b/bitwarden.el @@ -182,7 +182,7 @@ This macro is largely copied from Tecosaur’s screenshot.el" "-s" "login-sso" "Log in with Single-Sign On" 'boolean "0.1.0" nil - (not bitwarden-sso)) + (not bitwarden--login-sso)) (bitwarden--define-infix "-e" "login-passwordenv" "Environment variable storing your password" @@ -228,13 +228,13 @@ Return nil otherwise." (defun bitwarden--get-username () "Get username. -If the `bitwarden--username' variable is empty, retrieve it from -the authinfo source." - (if (bitwarden--empty-or-nil bitwarden--username) +If the `bitwarden--login-username' variable is empty, retrieve it +from the authinfo source." + (if (bitwarden--empty-or-nil bitwarden--login-username) (plist-get (car (auth-source-search :max 1 - :host bitwarden--server)) + :host bitwarden--config-server)) :user) - bitwarden--username)) + bitwarden--login-username)) (defun bitwarden--get-password () "Get password or password source. @@ -244,16 +244,16 @@ designated by the variable `bitwarden--login-passwordenv', by the file designated by the variable `bitwarden--login-passwordfile', or from the authinfo source." (cond - ((! (bitwarden--empty-or-nil bitwarden--passwordenv)) - `("--passwordenv" ,bitwarden--passwordenv)) - ((! (bitwarden--set-passwordfile bitwarden--passwordfile)) - `("--passwordfile" ,bitwarden--passwordfile)) (bitwarden--login-password (read-passwd "Bitwarden Password: ")) + ((not (bitwarden--empty-or-nil bitwarden--login-passwordenv)) + `("--passwordenv" ,bitwarden--login-passwordenv)) + ((not (bitwarden--empty-or-nil bitwarden--login-passwordfile)) + `("--passwordfile" ,bitwarden--login-passwordfile)) (t (funcall (plist-get (car (auth-source-search :max 1 - :host bitwarden--server)) + :host bitwarden--config-server)) :secret))))) @@ -275,13 +275,13 @@ This function is meant to be called by a transient.") (bitwarden--def-action "set-server" "Set the Bitwarden server." - 'bitwarden--server - (bitwarden--run-cli "config" "server" bitwarden--server)) + 'bitwarden--login-server + (bitwarden--run-cli "config" "server" bitwarden--config-server)) (bitwarden--def-action "get-server" "Get the URL of the on-premises hosted installation." - 'bitwarden--server + 'bitwarden--config-server (bitwarden--run-cli "config" "server")) ;; Login @@ -290,7 +290,7 @@ This function is meant to be called by a transient.") "login" "Log in Bitwarden." 'bitwarden--login - (if bitwarden--sso + (if bitwarden--login-sso (bitwarden--run-cli "login" "--raw" "--sso") (bitwarden--run-cli "login" "--raw" (format "\"%s\"" (bitwarden--get-username)) @@ -344,11 +344,11 @@ This function is meant to be called by a transient.") (defun bitwarden-lock () "Lock the vault and destroy active session keys." (progn - (setq bitwarden--session nil - bitwarden--password nil - bitwarden--passwordenv nil - bitwarden--passwordfile nil - bitwarden--code nil) + (setq bitwarden--session nil + bitwarden--login-password nil + bitwarden--login-passwordenv nil + bitwarden--login-passwordfile nil + bitwarden--login-code nil) (bitwarden--run-cli "lock")))