#!/bin/bash


# start challenge in read only mode
NONCE=$(curl -s 'http://challenger.taler.test:1180/setup/1'   -X 'POST'   -H 'Accept: application/json'   -H 'Accept-Language: en-US,en;q=0.9,es;q=0.8'   -H 'Authorization: Bearer secret-token:chal-secret'  -d '{"ADDRESS_LINES":"addr 123","CONTACT_NAME":"sebas","read_only":true}' | jq .nonce -r)

# login
curl -s 'http://challenger.taler.test:1180/authorize/'$NONCE'?response_type=code&client_id=1&redirect_uri=http%3A%2F%2Fexchange.taler.test%3A1180%2Fkyc-proof%2FemailChallenger&state=yep' \
     -X 'POST'

# try to change the addres
curl 'http://challenger.taler.test:1180/challenge/'$NONCE \
	-H 'Content-Type: application/json' \
	-d '{"ADDRESS_LINES":"addr 123","CONTACT_NAME":"sebas","read_only":true}'

