Function: auth-source-epa-extract-gpg-token

auth-source-epa-extract-gpg-token is a byte-compiled function defined in auth-source.el.gz.

Signature

(auth-source-epa-extract-gpg-token SECRET FILE)

Documentation

Pass either the decoded SECRET or the gpg:BASE64DATA version.

FILE is the file from which we obtained this token.

Source Code

;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
(defun auth-source-epa-extract-gpg-token (secret file)
  "Pass either the decoded SECRET or the gpg:BASE64DATA version.
FILE is the file from which we obtained this token."
  (when (string-match "^gpg:\\(.+\\)" secret)
    (setq secret (base64-decode-string (match-string 1 secret))))
  (let ((context (epg-make-context 'OpenPGP)))
    (epg-context-set-passphrase-callback
     context
     (cons #'auth-source-token-passphrase-callback-function
           file))
    (epg-decrypt-string context secret)))