#!/usr/bin/env bash
set -euxo pipefail

NODE_FINGERPRINTS=(
  "C0D6248439F1D5604AAFFB4021D900FFDB233756" # Antoine du Hamel
  "DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7" # Juan José Arboleda
  "CC68F5A3106FF448322E48ED27F5E38D5B0A215F" # Marco Ippolito
  "8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600" # Michaël Zasso
  "890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4" # Rafael Gonzaga
  "C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C" # Richard Lau
  "108F52B48DB57BB0CC439B2997B01419BD92F80A" # Ruy Adorno
  "A363A499291CBBC940DD62E41F10027AF002F8B0" # Ulises Gascón
)

rm -rf src/assets/gpg
mkdir -p src/assets/gpg
for fingerprint in "${NODE_FINGERPRINTS[@]}"; do
  curl -fLSs "https://keys.openpgp.org/vks/v1/by-fingerprint/$fingerprint" >> "src/assets/gpg/node.asc"
done
curl -fLSs "https://swift.org/keys/automatic-signing-key-4.asc" >> src/assets/gpg/swift.asc
curl -fLSs "https://swift.org/keys/release-key-swift-5.x.asc" >> src/assets/gpg/swift.asc
curl -fLSs "https://swift.org/keys/release-key-swift-6.x.asc" >> src/assets/gpg/swift.asc
