Config::Identity(3pm)

๐Ÿ“ฆ
version 0.0019 ยท 2 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– Config::Identity โ€” the manual page, bestie edition ๐Ÿ’–

okay so this is Config::Identity(3pm), a User Contributed Perl Documentation page, and it's genuinely one of the most useful little modules ever. sit down, grab a boba, we're learning how to load (and optionally decrypt via GnuPG) your user/pass identity info. ๐Ÿซถ


โœจ NAME โœจ

Config::Identity โ€” Load (and optionally decrypt via GnuPG) user/pass identity information

๐ŸŒธ VERSION ๐ŸŒธ

version 0.0019

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

PAUSE:

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 'user' and 'password' defined

my %identity = Config::Identity::PAUSE->load_check;
print "user: $identity{user} password: $identity{password}\n";

GitHub API:

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 'login' and 'token' defined

my %identity = Config::Identity::PAUSE->load_check;
print "login: $identity{login} token: $identity{token}\n";

(and yes, bestie, that second block really does say Config::Identity::PAUSE โ€” the original page says it, so I'm saying it. no editing, no notes. ๐Ÿ’…)

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Config::Identity is a tool for loading (and optionally decrypting via GnuPG) user/pass identity information.

For GitHub API access, an identity is a "login"/"token" pair. ๐Ÿ”‘

For PAUSE access, an identity is a "user"/"password" pair. ๐Ÿ”


โญ USAGE โญ

๐Ÿ’ซ %identity = Config::Identity->load_best( <stub> )

First attempt to load an identity from $HOME/.<stub>-identity

If that file does not exist, then attempt to load an identity from $HOME/.<stub>

The file may be optionally GnuPG encrypted.

%identity will be populated like so:

<key> <value>

For example:

username alice
password hunter2
If an identity file can't be found or read, the method croaks. ๐Ÿ’€ Like, it will not be chill about it.

๐Ÿ’ซ %identity = Config::Identity->load_check( <stub>, <checker> )

Works like "load_best" but also checks for required keys. The "checker" argument must be an array reference of required keys or a code reference that takes a hashref of key/value pairs from the identity file and returns a list of missing keys. For convenience, the hashref will also be placed in $_.

If any keys are found missing, the method croaks. ๐Ÿ˜ญ

๐Ÿ”ฎ Using a custom "gpg" or passing custom arguments

You can specify a custom "gpg" executable by setting the CI_GPG environment variable

export CI_GPG="$HOME/bin/gpg"

You can pass custom arguments by setting the CI_GPG_ARGUMENTS environment variable

export CI_GPG_ARGUMENTS="--no-secmem-warning"

๐Ÿ” Encrypting your identity information with GnuPG

If you've never used GnuPG before, first initialize it:

# Follow the prompts to create a new key for yourself
gpg --gen-key

To encrypt your GitHub identity with GnuPG using the above key:

# Follow the prompts, using the above key as the "recipient"
# Use ^D once you've finished typing out your authentication information
gpg -ea > $HOME/.github

๐Ÿงš Caching your GnuPG secret key via gpg-agent

Put the following in your .*rc

if which gpg-agent 1>/dev/null
then
    if test -f $HOME/.gpg-agent-info && \
        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

๐ŸŒˆ PAUSE identity format

user <user>
password <password>

"username" can also be used as alias for "user"

๐ŸŒˆ GitHub identity format

login <login>
token <token>

๐Ÿซถ SUPPORT ๐Ÿซถ

๐Ÿ’Œ Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at <http://rt.cpan.org/Public/Dist/Display.html?Name=Config-Identity>. You will be notified automatically of any progress on your issue. (bestie they will literally keep you in the loop, slay ๐ŸŽ€)

๐Ÿ’Œ Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

<https://github.com/dagolden/Config-Identity>

git clone https://github.com/dagolden/Config-Identity.git

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Robert Krimen <robertkrimen@gmail.com>

๐Ÿ‘‘ CONTRIBUTOR ๐Ÿ‘‘

David Golden <dagolden@cpan.org>

This software is copyright (c) 2010 by Robert Krimen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page, bestie!! ๐Ÿ’– this one shipped as perl v5.36.0 on 2022-12-08 โ€” go forth and keep your tokens safe, mwah ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from