Skip to content

Instantly share code, notes, and snippets.

@lenkan
Created April 16, 2025 15:32
Show Gist options
  • Save lenkan/44022e4a0bc0f8fe600f373256920789 to your computer and use it in GitHub Desktop.
Save lenkan/44022e4a0bc0f8fe600f373256920789 to your computer and use it in GitHub Desktop.
#!/bin/bash
install_keri() {
if [[ ! -d .venv ]]; then
python3.12 -m venv .venv
fi
source .venv/bin/activate
pip install keri==1.2.4
mkdir -p scripts/keri/cf/main
wget -O- https://raw.githubusercontent.com/WebOfTrust/keripy/refs/heads/main/scripts/keri/cf/main/wan.json > scripts/keri/cf/main/wan.json
wget -O- https://raw.githubusercontent.com/WebOfTrust/keripy/refs/heads/main/scripts/keri/cf/main/wes.json > scripts/keri/cf/main/wes.json
wget -O- https://raw.githubusercontent.com/WebOfTrust/keripy/refs/heads/main/scripts/keri/cf/main/wil.json > scripts/keri/cf/main/wil.json
wget -O- https://raw.githubusercontent.com/WebOfTrust/keripy/refs/heads/main/scripts/keri/cf/main/wit.json > scripts/keri/cf/main/wit.json
wget -O- https://raw.githubusercontent.com/WebOfTrust/keripy/refs/heads/main/scripts/keri/cf/main/wub.json > scripts/keri/cf/main/wub.json
wget -O- https://raw.githubusercontent.com/WebOfTrust/keripy/refs/heads/main/scripts/keri/cf/main/wyz.json > scripts/keri/cf/main/wyz.json
}
kill_witness() {
kill $witness_pid
}
start_witnesses() {
kli witness demo &
witness_pid=$!
trap kill_witness EXIT
while true; do
status=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5642/oobi)
if [[ $status -eq 200 ]]; then
break
fi
echo "Waiting for witness to start"
sleep 5
done
echo "Witness started"
}
trap kill_witness EXIT
install_keri
start_witnesses
name="test_$(hexdump -vn4 -e'4/4 "%08x" 1 "\n"' /dev/urandom | xargs)"
kli init --name "$name" --nopasscode
kli oobi resolve --name "$name" --oobi http://localhost:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller
kli oobi resolve --name "$name" --oobi http://localhost:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller
kli oobi resolve --name "$name" --oobi http://localhost:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller
kli incept --name "$name" --alias "$name" \
--isith 1 \
--icount 1 \
--nsith 1 \
--ncount 1 \
--transferable \
--wits BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha \
--wits BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM \
--wits BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX \
--toad 2
echo "##"
echo "## STATUS BEFORE ROTATE"
echo "##"
kli status --name "$name" --alias "$name"
kli rotate --name "$name" --alias "$name"
echo "##"
echo "## STATUS AFTER ROTATE"
echo "##"
kli status --name "$name" --alias "$name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment