|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Configurable pause duration (in seconds)
|
|
|
|
PAUSE_DURATION=2
|
|
|
|
MANUAL_CONTINUE=true
|
|
|
|
|
|
|
|
# Function to test deep link
|
|
|
|
test_link() {
|
|
|
|
echo "----------------------------------------"
|
|
|
|
echo "Testing: $1"
|
|
|
|
echo "Description: $2"
|
|
|
|
echo "----------------------------------------"
|
|
|
|
adb shell am start -W -a android.intent.action.VIEW -d "$1" app.timesafari.app
|
|
|
|
|
|
|
|
if [ "$MANUAL_CONTINUE" = true ]; then
|
|
|
|
read -p "Press Enter to continue to next test..."
|
|
|
|
else
|
|
|
|
sleep $PAUSE_DURATION
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Allow command line override of pause settings
|
|
|
|
while getopts "t:a" opt; do
|
|
|
|
case $opt in
|
|
|
|
t) PAUSE_DURATION=$OPTARG ;;
|
|
|
|
a) MANUAL_CONTINUE=false ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Starting TimeSafari Deep Link Tests"
|
|
|
|
echo "======================================"
|
|
|
|
echo "Pause duration: $PAUSE_DURATION seconds"
|
|
|
|
echo "Manual continue: $MANUAL_CONTINUE"
|
|
|
|
|
|
|
|
# Contact Import Routes
|
|
|
|
echo "\nTesting Contact Import Routes:"
|
|
|
|
|
|
|
|
# 1. Direct Query Parameter Import (URL-encoded JSON)
|
|
|
|
QUERY_CONTACTS='[{
|
|
|
|
"did":"did:ethr:0xf969A5DeE7a5806d1C37f4Ec49A555Ab97911089"
|
|
|
|
},{
|
|
|
|
"did":"did:ethr:0xFEd3b416946b23F3F472799053144B4E34155B5b",
|
|
|
|
"name":"Jordan",
|
|
|
|
"nextPubKeyHashB64":"IBfRZfwdzeKOzqCx8b+WlLpMJHOAT9ZknIDJo7F3rZE=",
|
|
|
|
"publicKeyBase64":"A1eIndfaxgMpVwyD5dYe74DgjuIo5SwPZFCcLdOemjf"
|
|
|
|
}]'
|
|
|
|
ENCODED_CONTACTS=$(echo $QUERY_CONTACTS | jq -c | python3 -c "import urllib.parse; print(urllib.parse.quote(input()))")
|
|
|
|
test_link "timesafari://contact-import?contacts=$ENCODED_CONTACTS" "Bulk import via query parameters"
|
|
|
|
|
|
|
|
# 2. JWT Path Imports
|
|
|
|
# Original JWT with multiple contacts
|
|
|
|
BULK_JWT="eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJpYXQiOjE3NDA3NDA0NTMsImNvbnRhY3RzIjpbeyJkaWQiOiJkaWQ6ZXRocjoweGY5NjlBNURlRTdhNTgwNmQxQzM3ZjRFYzQ5QTU1NUFiOTc5MTEwODkifSx7ImRpZCI6ImRpZDpldGhyOjB4RkVkM2I0MTY5NDZiMjNGM0Y0NzI3OTkwNTMxNDRCNEUzNDE1NUI1YiIsIm5hbWUiOiJKb3JkYW4iLCJuZXh0UHViS2V5SGFzaEI2NCI6IklCZlJaZndkemVLT3pxQ3g4YitXbExwTUpIT0FUOVprbklESm83RjNyWkU9IiwicHVibGljS2V5QmFzZTY0IjoiQTFlSW5kZmF4Z01wVnd5RDVkWWU3NERnanQ5SW81U3dQWkZDY0xkT2VtamYifV0sImlzcyI6ImRpZDpldGhyOjB4RDUzMTE0ODMwRDRhNUQ5MDQxNkI0M0ZjOTlhMjViMGRGOGJiMUJBZCJ9.yKEFounxUGU9-grAMFHA12dif9BKYkftg8F3wAIcFYh0H_k1tevjEYyD1fvAyIxYxK5xR0E8moqMhi78ipJXcg"
|
|
|
|
test_link "timesafari://contact-import/$BULK_JWT" "Multiple contacts via JWT"
|
|
|
|
|
|
|
|
# 3. Contact Page JWT Redirect
|
|
|
|
test_link "timesafari://contacts?contactJwt=$BULK_JWT" "Multiple contacts redirect"
|
|
|
|
|
|
|
|
# Contact Management Routes
|
|
|
|
test_link "timesafari://contact-edit/did:ethr:0xf969A5DeE7a5806d1C37f4Ec49A555Ab97911089" \
|
|
|
|
"Edit first contact"
|
|
|
|
|
|
|
|
# Error Cases
|
|
|
|
echo "\nTesting Contact Import Error Cases:"
|
|
|
|
test_link "timesafari://contact-import/eyJJTlZBTElEIn0" "Invalid JWT format"
|
|
|
|
test_link "timesafari://contact-import?contacts=[{invalid:data}]" "Invalid contact data"
|
|
|
|
|
|
|
|
# Original Routes (preserved from previous version)
|
|
|
|
echo "\nTesting Other Routes:"
|
|
|
|
|
|
|
|
# Test claim routes
|
|
|
|
echo "\nTesting Claim Routes:"
|
|
|
|
test_link "timesafari://claim/01JMAAFZRNSRTQ0EBSD70A8E1H"
|
|
|
|
test_link "timesafari://claim/01JMAAFZRNSRTQ0EBSD70A8E1H?view=details"
|
|
|
|
test_link "timesafari://claim-cert/01JMAAFZRNSRTQ0EBSD70A8E1H"
|
|
|
|
|
|
|
|
echo "\nTesting Additional Claim Routes:"
|
|
|
|
test_link "timesafari://claim/123?view=certificate"
|
|
|
|
test_link "timesafari://claim/123?view=raw"
|
|
|
|
test_link "timesafari://claim-add-raw/123?claimJwtId=jwt123"
|
|
|
|
|
|
|
|
# Test project routes
|
|
|
|
echo "\nTesting Project Routes:"
|
|
|
|
test_link "timesafari://project/https%3A%2F%2Fendorser.ch%2Fentity%2F01JKW0QZX1XVCVZV85VXAMB31R"
|
|
|
|
|
|
|
|
# Test gift routes
|
|
|
|
echo "\nTesting Gift Routes:"
|
|
|
|
test_link "timesafari://confirm-gift/01JMTC8T961KFPP2N8ZB92ER4K"
|
|
|
|
|
|
|
|
# Test offer routes
|
|
|
|
echo "\nTesting Offer Routes:"
|
|
|
|
test_link "timesafari://offer-details/101"
|
|
|
|
|
|
|
|
# Test complex query parameters
|
|
|
|
echo "\nTesting Complex Query Parameters:"
|
|
|
|
test_link "timesafari://contact-import/jwt?contacts=%5B%7B%22name%22%3A%22Test%22%7D%5D"
|
|
|
|
|
|
|
|
# New test cases
|
|
|
|
echo "\nTesting DID Routes:"
|
|
|
|
test_link "timesafari://did/did:example:123"
|
|
|
|
test_link "timesafari://did/did:example:456?view=details"
|
|
|
|
|
|
|
|
echo "\nTesting Additional Contact Routes:"
|
|
|
|
test_link "timesafari://contact-import/jwt?contacts=%5B%7B%22did%22%3A%22did%3Aexample%3A123%22%7D%5D"
|
|
|
|
test_link "timesafari://contact-edit/did:example:123?action=edit"
|
|
|
|
|
|
|
|
echo "\nTesting Error Cases:"
|
|
|
|
test_link "timesafari://invalid-route/123"
|
|
|
|
test_link "timesafari://claim/123?view=invalid"
|
|
|
|
test_link "timesafari://did/invalid-did"
|
|
|
|
|
|
|
|
# Single invite JWT test
|
|
|
|
# Header: {"typ":"JWT","alg":"ES256K"}
|
|
|
|
# Payload: {
|
|
|
|
# "iat": 1740740453,
|
|
|
|
# "contact": {
|
|
|
|
# "did": "did:ethr:0xFEd3b416946b23F3F472799053144B4E34155B5b",
|
|
|
|
# "name": "Jordan",
|
|
|
|
# "nextPubKeyHashB64": "IBfRZfwdzeKOzqCx8b+WlLpMJHOAT9ZknIDJo7F3rZE=",
|
|
|
|
# "publicKeyBase64": "A1eIndfaxgMpVwyD5dYe74DgjuIo5SwPZFCcLdOemjf"
|
|
|
|
# },
|
|
|
|
# "iss": "did:ethr:0xD53114830D4a5D90416B43Fc99a25b0dF8bb1BAd"
|
|
|
|
# }
|
|
|
|
|
|
|
|
SINGLE_INVITE_JWT="eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJpYXQiOjE3NDA3NDA0NTMsImNvbnRhY3QiOnsiZGlkIjoiZGlkOmV0aHI6MHhGRWQzYjQxNjk0NmIyM0YzRjQ3Mjc5OTA1MzE0NEI0RTM0MTU1QjViIiwibmFtZSI6IkpvcmRhbiIsIm5leHRQdWJLZXlIYXNoQjY0IjoiSUJmUlpmd2R6ZUtPenFDeDhiK1dsTHBNSkhPQVQ5WmtuSURKbzdGM3JaRT0iLCJwdWJsaWNLZXlCYXNlNjQiOiJBMWVJbmRmYXhnTXBWd3lENWRZZTc0RGdqdUlvNVN3UFpGQ2NMZEtlbWpmIn0sImlzcyI6ImRpZDpldGhyOjB4RDUzMTE0ODMwRDRhNUQ5MDQxNkI0M0ZjOTlhMjViMGRGOGJiMUJBZCJ9.yKEFounxUGU9-grAMFHA12dif9BKYkftg8F3wAIcFYh0H_k1tevjEYyD1fvAyIxYxK5xR0E8moqMhi78ipJXcg"
|
|
|
|
|
|
|
|
test_link "timesafari://invite-one-accept/$SINGLE_INVITE_JWT" "Single contact invite via JWT"
|
|
|
|
|
|
|
|
echo "\nDeep link testing complete"
|
|
|
|
echo "======================================"
|