<commit_before>#!/usr/bin/env bash
set -e

KEY_FILE="vault_passphrase.pgp"
NEW_KEY_FILE=".vault_newpassphrase.pgp"

VAULT_FILES=( group_vars/all/vault.yml )
RECIPIENTS=(
    0x54BA90995CCBD6D6B0E68D27CDAB3CCDA649FFDA! # lrvick's 4k encryption key
    0x954A3772D62EF90E4B31FBC6C91A9911192C187A  # daurnimator
    0x47BF2F123A4F98EF279DC3DFC60D4B85F1BAB95A  # ryan
    0x700E88FC14B533111AD7A40F1D7C08C6CC263D74  # kellerfuchs
    0xF2B7999666D83093F8D4212926CDD32189AA2885  # dpflug
    0xA68847F70315340C5117B31778FC3358C2E3276E  # dgrove
)

if [ $# -eq 0 ]; then
    exec gpg --batch --decrypt "${KEY_FILE}" 2>/dev/null

elif [ $# -eq 1 ] && [ "$1" = "rekey" ]; then
    # Get 256b out of /dev/random, hex encoded
    NEW_KEY=$(od -vAn -N32 -tx -w /dev/random)

    # Save the new key
    gpg -e $(printf "%s" "${RECIPIENTS[@]/#/ -r }") -o "${NEW_KEY_FILE}" <<< "${NEW_KEY}"

    # Re-encrypt the files
    ansible-vault rekey --new-vault-password-file ./.vault_newpassphrase.sh "${VAULT_FILES[@]}"
<commit_msg>vault_passphrase.sh: List missing vault files<commit_after>#!/usr/bin/env bash
set -e

KEY_FILE="vault_passphrase.pgp"
NEW_KEY_FILE=".vault_newpassphrase.pgp"

VAULT_FILES=(
    group_vars/all/vault.yml
    group_vars/irc
)
RECIPIENTS=(
    0x54BA90995CCBD6D6B0E68D27CDAB3CCDA649FFDA! # lrvick's 4k encryption key
    0x954A3772D62EF90E4B31FBC6C91A9911192C187A  # daurnimator
    0x47BF2F123A4F98EF279DC3DFC60D4B85F1BAB95A  # ryan
    0x700E88FC14B533111AD7A40F1D7C08C6CC263D74  # kellerfuchs
    0xF2B7999666D83093F8D4212926CDD32189AA2885  # dpflug
    0xA<KEY>  # dgrove
)

if [ $# -eq 0 ]; then
    exec gpg --batch --decrypt "${KEY_FILE}" 2>/dev/null

elif [ $# -eq 1 ] && [ "$1" = "rekey" ]; then
    # Get 256b out of /dev/random, hex encoded
    NEW_KEY=$(od -vAn -N32 -tx -w /dev/random)

    # Save the new key
    gpg -e $(printf "%s" "${RECIPIENTS[@]/#/ -r }") -o "${NEW_KEY_FILE}" <<< "${NEW_KEY}"

    # Re-encrypt the files
    ansible-vault rekey --new-vault-password-file ./.vault_newpassphrase.sh "${VAULT_FILES[@]}"

{'fraction_non_alphanumeric': 0.13629702002931118, 'fraction_numerical': 0.14997557401074743, 'mean_word_length': 3.876190476190476, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7016469', 'n_tokens_mistral': 1098, 'n_tokens_neox': 923, 'n_words': 153}