-
Notifications
You must be signed in to change notification settings - Fork 4
/
README
114 lines (78 loc) · 3.25 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
NAME
Config::Identity - Load (and optionally decrypt via GnuPG) user/pass
identity information
VERSION
version 0.0017
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;
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;
print "login: $identity{login} token: $identity{token}\n";
DESCRIPTION
Config::Identity is a tool for loadiing (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
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>
AUTHOR
Robert Krimen <[email protected]>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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.