.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Config::Identity 3pm" .TH Config::Identity 3pm "2020-12-17" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Config::Identity \- Load (and optionally decrypt via GnuPG) user/pass identity information .SH "VERSION" .IX Header "VERSION" version 0.0019 .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\s-1PAUSE:\s0 .PP .Vb 1 \& use Config::Identity::PAUSE; \& \& # 1. Find either $HOME/.pause\-identity or $HOME/.pause \& # 2. Decrypt the found file (if necessary), read, and parse it \& # 3. Throw an exception unless %identity has \*(Aquser\*(Aq and \*(Aqpassword\*(Aq defined \& \& my %identity = Config::Identity::PAUSE\->load_check; \& print "user: $identity{user} password: $identity{password}\en"; .Ve .PP GitHub \s-1API:\s0 .PP .Vb 1 \& use Config::Identity::GitHub; \& \& # 1. Find either $HOME/.github\-identity or $HOME/.github \& # 2. Decrypt the found file (if necessary) read, and parse it \& # 3. Throw an exception unless %identity has \*(Aqlogin\*(Aq and \*(Aqtoken\*(Aq defined \& \& my %identity = Config::Identity::PAUSE\->load_check; \& print "login: $identity{login} token: $identity{token}\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Config::Identity is a tool for loading (and optionally decrypting via GnuPG) user/pass identity information .PP For GitHub \s-1API\s0 access, an identity is a \f(CW\*(C`login\*(C'\fR/\f(CW\*(C`token\*(C'\fR pair .PP For \s-1PAUSE\s0 access, an identity is a \f(CW\*(C`user\*(C'\fR/\f(CW\*(C`password\*(C'\fR pair .SH "USAGE" .IX Header "USAGE" .ie n .SS "%identity = Config::Identity\->load_best( )" .el .SS "\f(CW%identity\fP = Config::Identity\->load_best( )" .IX Subsection "%identity = Config::Identity->load_best( )" First attempt to load an identity from \f(CW$HOME\fR/.\-identity .PP If that file does not exist, then attempt to load an identity from \f(CW$HOME\fR/. .PP The file may be optionally GnuPG encrypted .PP \&\f(CW%identity\fR will be populated like so: .PP .Vb 1 \& .Ve .PP For example: .PP .Vb 2 \& username alice \& password hunter2 .Ve .PP If an identity file can't be found or read, the method croaks. .ie n .SS "%identity = Config::Identity\->load_check( , )" .el .SS "\f(CW%identity\fP = Config::Identity\->load_check( , )" .IX Subsection "%identity = Config::Identity->load_check( , )" Works like \f(CW\*(C`load_best\*(C'\fR but also checks for required keys. The \f(CW\*(C`checker\*(C'\fR argument must be an array reference of \fBrequired\fR keys or a code reference that takes a hashref of key/value pairs from the identity file and returns a list of \fBmissing\fR keys. For convenience, the hashref will also be placed in \f(CW$_\fR. .PP If any keys are found missing, the method croaks. .ie n .SH "Using a custom ""gpg"" or passing custom arguments" .el .SH "Using a custom \f(CWgpg\fP or passing custom arguments" .IX Header "Using a custom gpg or passing custom arguments" You can specify a custom \f(CW\*(C`gpg\*(C'\fR executable by setting the \s-1CI_GPG\s0 environment variable .PP .Vb 1 \& export CI_GPG="$HOME/bin/gpg" .Ve .PP You can pass custom arguments by setting the \s-1CI_GPG_ARGUMENTS\s0 environment variable .PP .Vb 1 \& export CI_GPG_ARGUMENTS="\-\-no\-secmem\-warning" .Ve .SH "Encrypting your identity information with GnuPG" .IX Header "Encrypting your identity information with GnuPG" If you've never used GnuPG before, first initialize it: .PP .Vb 2 \& # Follow the prompts to create a new key for yourself \& gpg \-\-gen\-key .Ve .PP To encrypt your GitHub identity with GnuPG using the above key: .PP .Vb 3 \& # Follow the prompts, using the above key as the "recipient" \& # Use ^D once you\*(Aqve finished typing out your authentication information \& gpg \-ea > $HOME/.github .Ve .SH "Caching your GnuPG secret key via gpg-agent" .IX Header "Caching your GnuPG secret key via gpg-agent" Put the following in your .*rc .PP .Vb 12 \& if which gpg\-agent 1>/dev/null \& then \& if test \-f $HOME/.gpg\-agent\-info && \e \& kill \-0 \`cut \-d: \-f 2 $HOME/.gpg\-agent\-info\` 2>/dev/null \& then \& . "${HOME}/.gpg\-agent\-info" \& export GPG_AGENT_INFO \& else \& eval \`gpg\-agent \-\-daemon \-\-write\-env\-file "${HOME}/.gpg\-agent\-info"\` \& fi \& else \& fi .Ve .SH "PAUSE identity format" .IX Header "PAUSE identity format" .Vb 2 \& user \& password .Ve .PP \&\f(CW\*(C`username\*(C'\fR can also be used as alias for \f(CW\*(C`user\*(C'\fR .SH "GitHub identity format" .IX Header "GitHub identity format" .Vb 2 \& login \& token .Ve .SH "SUPPORT" .IX Header "SUPPORT" .SS "Bugs / Feature Requests" .IX Subsection "Bugs / Feature Requests" Please report any bugs or feature requests through the issue tracker at . You will be notified automatically of any progress on your issue. .SS "Source Code" .IX Subsection "Source Code" This is open source software. The code repository is available for public review and contribution under the terms of the license. .PP .PP .Vb 1 \& git clone https://github.com/dagolden/Config\-Identity.git .Ve .SH "AUTHOR" .IX Header "AUTHOR" Robert Krimen .SH "CONTRIBUTOR" .IX Header "CONTRIBUTOR" David Golden .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2010 by Robert Krimen. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.