diff --git a/emacs/init.org b/emacs/init.org index 8c5b588..e219225 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -2773,3 +2773,30 @@ The aws-mfa command: (general-def kubernetes-overview-mode-map "m" #'aws-mfa)) #+END_SRC +** 1Password +#+BEGIN_SRC emacs-lisp + (defvar op-token nil + "The 1Password session token") + + (defun 1pass-signin () + (interactive) + (let* ((signin-address "team-lolatravel.1password.com") + (signin-email "jeremydormitzer@lola.com") + (secret-key (password-store-get "1pass-lola-secret-key")) + (master-password (password-store-get "team-lolatravel.1password.com")) + (proc (start-process "op-signin" "*op-signin*" + "op" "signin" signin-address signin-email secret-key "--output=raw"))) + (set-process-sentinel + proc + (make-process-sentinel + (lambda () + (setq op-token + (with-current-buffer "*op-signin*" + (goto-char (- (point-max) 1)) + (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) + (message (format "Signed in to 1Password with session token %s" op-token)) + (kill-buffer "*op-signin*")) + (lambda () + (message "1Password signin failed, check *op-signin* buffer for details")))) + (process-send-string proc (concat master-password "\n")))) +#+END_SRC