software/hoardy-web/./extension/bin/gen-chromium-key.sh

Passively capture, archive, and hoard your web browsing history, including the contents of the pages you visit, for later offline viewing, mirroring, and/or indexing. Your own personal private Wayback Machine that can also archive HTTP POST requests and responses, as well as most other HTTP-level data.

Files

Raw Source

Contents

#!/usr/bin/env bash
# Purpose: generate Chromium key in PEM format and generate a JSON with its public key
# based on https://stackoverflow.com/questions/37317779/making-a-unique-extension-id-and-key-for-chrome-extension

set -e

key=${1:-chromium.key.pem}
output=${2:-manifest-chromium}

if [[ ! -e "$key" ]]; then
    echo "Generating a new Chromium key!"
    openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -out "$key"
fi

{
    echo "{"
    echo -n '"key": "'
    openssl rsa -in "$key" -pubout -outform DER 2>/dev/null | openssl base64 -A
    echo '"'
    echo "}"
} > "$output-key.json"

openssl rsa -in "$key" -pubout -outform DER 2>/dev/null | sha256sum | head -c32 | tr 0-9a-f a-p > "$output-id.txt"