Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ node_modules/
.DS_Store
desktop.ini
.directory

# Jetbrains .idea/ folder
.idea/
67 changes: 67 additions & 0 deletions keychain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Funtoo:Keychain
homepage: https://www.funtoo.org/Funtoo:Keychain
tagline: |
Keychain helps you to manage SSH and GPG keys in a convenient and secure manner.
---

To update or switch versions, run `webi keychain@stable` (or `@v2`, `@beta`,
etc).

### Files

These are the files / directories that are created and/or modified with this
install:

```text
~/.config/envman/PATH.env
~/.local/bin/keychain
~/.local/opt/keychain-v*.*.*/
```

## Cheat Sheet

> `keychain` helps you to manage SSH and GPG keys in a convenient and secure
> manner. It acts as a frontend to ssh-agent and ssh-add, but allows you to
> easily have one long-running ssh-agent process per system, rather than the
> norm of one ssh-agent per login session.

### Quick start

The following assumes that you have an RSA key pair named `id_rsa`

Add the following to your `~/.bash_profile`

```sh
eval `keychain --eval id_rsa`
```

### Multiple keys

The following assumes that you have an RSA key pair named `id_rsa` and a GPG key
with ID `1A2B3C4D5E6F7890`

Add the following to your `~/.bash_profile`

```sh
eval `keychain --eval id_rsa 1A2B3C4D5E6F7890`
```

### Finding your gpg key id

```sh
gpg --list-secret-keys --keyid-format=long
```

will output something like

```
/home/your-user/.gnupg/pubring.kbx
---------------------------------
sec ed25519/1A2B3C4D5E6F7890 2025-06-10 [SC]
ABCDEF0123456789ABCDEF011A2B3C4D5E6F7890
uid [ultimate] John Doe <[email protected]>
ssb cv25519/9876543210ABCDEF 2025-06-10 [E]
```

In this example your GPG key id would be `1A2B3C4D5E6F7890`
60 changes: 60 additions & 0 deletions keychain/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

# shellcheck disable=SC2034
# "'pkg_cmd_name' appears unused. Verify it or export it."

__init_keychain() {
set -e
set -u

####################
# Install keychain #
####################

# Every package should define these 6 variables
pkg_cmd_name="keychain"

pkg_dst_cmd="$HOME/.local/bin/keychain"
pkg_dst="$pkg_dst_cmd"

pkg_src_cmd="$HOME/.local/opt/keychain-v$WEBI_VERSION/bin/keychain"
pkg_src_dir="$HOME/.local/opt/keychain-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"

# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/keychain-v0.99.9/bin
mkdir -p "$(dirname "${pkg_src_cmd}")"

# mv ./keychain ~/.local/opt/keychain-v0.99.9/bin/keychain
mv ./keychain "${pkg_src_cmd}"
}

# pkg_get_current_version is recommended, but not required
pkg_get_current_version() {
# 'keychain --version' has output in this format:
# <empty-line>
# * keychain 2.8.5 ~ http://www.funtoo.org
#
# Copyright 2002-2006 Gentoo Foundation;
# Copyright 2007 Aron Griffis;
# Copyright 2009-2017 Funtoo Solutions, Inc;
# lockfile() Copyright 2009 Parallels, Inc.
#
# Keychain is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# and is redirected to stderr
# This trims it down to just the version number:
# 2.8.5
keychain --version 2>&1 |
head -n 2 |
tr -d '\n' |
sed 's/^[[:space:]]*//;s/[[:space:]]*$//' |
cut -d' ' -f3
}

}

__init_keychain
39 changes: 39 additions & 0 deletions keychain/releases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

var github = require('../_common/github.js');
var owner = 'funtoo';
var repo = 'keychain';

let Releases = module.exports;

Releases.latest = async function () {
let all = await github(null, owner, repo);

// Set each release package to posix_2017 since they are shell scripts
// that can run on any POSIX-compliant system
for (let pkg of all.releases) {
pkg.os = 'posix_2017';
pkg.arch = 'ANYARCH'; // Since it's a shell script, it works on any architecture
pkg.libc = 'none'; // No libc dependency since it's a shell script
pkg.ext = ''; // No extension since it's a plain shell script
}

return all;
};

Releases.sample = async function () {
let normalize = require('../_webi/normalize.js');
let all = await Releases.latest();
all = normalize(all);
// just select the first 5 for demonstration
all.releases = all.releases.slice(0, 5);
return all;
};

if (module === require.main) {
(async function () {
let samples = await Releases.sample();

console.info(JSON.stringify(samples, null, 2));
})();
}
3 changes: 3 additions & 0 deletions test/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ __rmrf_local() {
iterm2-utils \
jq \
k9s \
keychain \
keypairs \
kind \
koji \
Expand Down Expand Up @@ -139,6 +140,7 @@ __rmrf_local() {
iterm2-utils \
jq \
k9s \
keychain \
keypairs \
kind \
koji \
Expand Down Expand Up @@ -238,6 +240,7 @@ __test() {
iterm2-utils \
jq \
k9s \
keychain \
keypairs \
kind \
koji \
Expand Down