packaging/license-issuer/keygen.sh

27fc65bcc5b40b4a4fbfc8b9e2b2adfac44e71da
orgstar/packaging/license-issuer/keygen.sh

14 lines · 851 bytes · executable

 1#!/bin/sh
 2# Makes the license signing key pair once: stores the private key as the Worker's
 3# LICENSE_PRIVATE_KEY secret and writes the public key into Sources/OrgApp/LicenseKey.swift.
 4# The private key is never written to disk; keep a copy in a password manager when prompted.
 5# Usage: packaging/license-issuer/keygen.sh
 6set -eu
 7cd "$(dirname "$0")"
 8pem="$(openssl genpkey -algorithm ed25519)"
 9public="$(printf '%s\n' "$pem" | openssl pkey -pubout -outform DER | tail -c 32 | base64)"
10printf '%s\n' "$pem" | npx wrangler secret put LICENSE_PRIVATE_KEY
11sed -i '' "s|public static let publicKey = .*|public static let publicKey = \"$public\"|" ../../Sources/OrgApp/LicenseKey.swift
12echo "Public key $public written to Sources/OrgApp/LicenseKey.swift; commit it."
13echo "Back up the private key now (it is not saved anywhere else):"
14printf '%s\n' "$pem"
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form