fix: WIP: Update test scripts for DID verification and claim generation
- Add check-did.sh to verify DID registration using admin JWT auth - Fix JWT signing in generate-test-claim.sh to match uport-credentials format - Clean up DID extraction in run-deeplink-tests.sh - Add proper error handling and response parsing The changes improve test script reliability by: 1. Using consistent JWT signing across scripts 2. Adding ability to verify DID registration status 3. Simplifying DID info extraction 4. Adding better error messages and debug output
This commit is contained in:
@@ -40,37 +40,14 @@ if [ -f .generated/test-env.sh ] && [ "$GENERATE_ONLY" = false ]; then
|
||||
else
|
||||
# Function to extract DID info from did_generator.sh output
|
||||
extract_did_info() {
|
||||
local output
|
||||
# Read all input into output variable
|
||||
output=$(cat)
|
||||
|
||||
# Debug the input
|
||||
echo "Parsing output:" >&2
|
||||
echo "$output" >&2
|
||||
|
||||
# Extract values using more robust patterns
|
||||
local output="$1"
|
||||
local did=$(echo "$output" | grep "^DID: " | cut -d' ' -f2-)
|
||||
local private_key=$(echo "$output" | grep "^Private Key: " | cut -d' ' -f3-)
|
||||
|
||||
# Debug the extracted values
|
||||
echo "Found DID: $did" >&2
|
||||
echo "Found Key: $private_key" >&2
|
||||
|
||||
# Output JSON only if both values were found
|
||||
if [ -n "$did" ] && [ -n "$private_key" ]; then
|
||||
printf '%s\n' "{\"did\":\"$did\",\"privateKey\":\"$private_key\"}"
|
||||
else
|
||||
echo "Error: Could not extract DID info from output" >&2
|
||||
return 1
|
||||
fi
|
||||
printf '%s\n' "{\"did\":\"$did\",\"privateKey\":\"$private_key\"}"
|
||||
}
|
||||
|
||||
echo "Generating first contact DID..."
|
||||
CONTACT1_INFO=$(./test-scripts/did_generator.sh | tee /dev/stderr | extract_did_info)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to generate first contact DID"
|
||||
exit 1
|
||||
fi
|
||||
CONTACT1_INFO=$(./test-scripts/did_generator.sh 2>&1 | tee /dev/stderr | extract_did_info)
|
||||
CONTACT1_DID=$(echo "$CONTACT1_INFO" | jq -r .did)
|
||||
CONTACT1_KEY=$(echo "$CONTACT1_INFO" | jq -r .privateKey)
|
||||
echo "Extracted DID: $CONTACT1_DID"
|
||||
|
||||
Reference in New Issue
Block a user