aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Schwieren <tristan.schwieren@tum.de>2022-01-07 11:47:09 +0100
committerTristan Schwieren <tristan.schwieren@tum.de>2022-01-07 11:47:09 +0100
commitaf2cac12594d107338e1a0cb688a370228b0a999 (patch)
tree930809fea46558094fc3b778e794ca80b8c9ce44
parent3607c9858ced4fe9050f6f4ebdd668efa6c3e02e (diff)
downloadgnunet-af2cac12594d107338e1a0cb688a370228b0a999.tar.gz
gnunet-af2cac12594d107338e1a0cb688a370228b0a999.zip
-w3cvc test
-rwxr-xr-x[-rw-r--r--]src/reclaim/test_reclaim_vc.sh43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/reclaim/test_reclaim_vc.sh b/src/reclaim/test_reclaim_vc.sh
index 50343fed0..3cb23d62f 100644..100755
--- a/src/reclaim/test_reclaim_vc.sh
+++ b/src/reclaim/test_reclaim_vc.sh
@@ -1,22 +1,35 @@
1#!/bin/bash 1#!/bin/bash
2ego1="ego1_$(tr -dc a-z </dev/urandom | head -c 8 ; echo '')"
3ego2="ego2_$(tr -dc a-z </dev/urandom | head -c 8 ; echo '')"
4test_vc='{"@context":["https://www.w3.org/2018/credentials/v1"],"type":["VerifiableCredential"],"issuer":"did:reclaim:1234","issuanceDate":"2018-02-24T05:28:04Z","expirationDate":"2025-02-24T00:00:00Z","credentialSubject":{"id":"did:example:abcdef1234567","name":"Tristan"},"proof":{"type":"RsaSignature2018","created":"2017-06-18T21:19:10Z","proofPurpose":"assertionMethod","verificationMethod":"did:reclaim:1234#key-1","proof":"abc"}}'
2 5
3gnunet-identity -C testego1 6gnunet-identity -C $ego1
4gnunet-identity -C testego2 7gnunet-identity -C $ego2
5test_vc='{"@context":["https://www.w3.org/2018/credentials/v1"],"type":["VerifiableCredential"],"issuer":"did:reclaim:1234","issuanceDate":"2018-02-24T05:28:04Z","expirationDate":"2025-02-24T00:00:00Z","credentialSubject":{"id":"did:example:abcdef1234567","name":"JaneDoe"},"proof":{"type":"RsaSignature2018","created":"2017-06-18T21:19:10Z","proofPurpose":"assertionMethod","verificationMethod":"did:reclaim:1234#key-1","proof":"abc"}}'
6testego2_id=$(gnunet-identity -d | grep testego2 | sed 's/.*- \(.*\) -.*/\1/')
7# echo $testego2_id
8 8
9gnunet-reclaim -e testego1 -N cred1 -u VC -V $test_vc 9ego1_id=$(gnunet-identity -d | grep $ego1 | sed 's/.*- \(.*\) -.*/\1/')
10cred1_id=$(gnunet-reclaim -e testego1 -A | grep cred1 | sed 's/.*ID: \(.*\)/\1/') 10ego2_id=$(gnunet-identity -d | grep $ego2 | sed 's/.*- \(.*\) -.*/\1/')
11# gnunet-identity -d
12echo "$ego1: $ego1_id"
13echo "$ego2: $ego2_id"
11 14
12gnunet-reclaim -e testego1 --add cred1 --value name --credential-id=$cred1_id 15gnunet-reclaim -e $ego1 -N cred1 -u VC -V $test_vc
13# att1_id=$(gnunet-reclaim -e testego1 -D | sed 's/.*ID: \(.*\)/\1/') 16cred1_id=$(gnunet-reclaim -e $ego1 -A | grep cred1 | sed 's/.*ID: \(.*\)/\1/')
14# echo $att1_id 17# gnunet-reclaim -e $ego1 -A
18echo "crd1_id: $cred1_id"
15 19
16gnunet-reclaim -e testego1 -D 20gnunet-reclaim -e $ego1 --add=cred1 --value=name --credential-id=$cred1_id
21att1_id=$(gnunet-reclaim -e $ego1 -D | sed 's/.*ID: \(.*\)/\1/')
22# gnunet-reclaim -e $ego1 -D
23echo "att1_id: $att1_id"
24
25gnunet-reclaim -e $ego1 -i cred1 -r $ego2_id
26ticket_id=$(gnunet-reclaim -e $ego1 -T | sed 's/.*ID: \(.*\) | Audience: .*/\1/')
27# gnunet-reclaim -e $ego1 -T
28echo "ticket_id: $ticket_id"
17 29
18gnunet-reclaim -e testego1 --issue cred1 -r $testego2_id 30curl --header "Content-Type: application/json" --data \
19gnunet-reclaim -e testego1 -T 31 "{\"issuer\": \"$ego1_id\", \"audience\": \"$ego2_id\", \"rnd\": \"$ticket_id\"}" \
32 localhost:7776/reclaim/consume
20 33
21gnunet-identity -D testego1 34# gnunet-identity -D $ego1
22gnunet-identity -D testego2 35# gnunet-identity -D $ego2