From ea23654da4aec6426720ff2100b8f8b9cee18b60 Mon Sep 17 00:00:00 2001 From: James Sangalli Date: Wed, 27 Nov 2019 17:21:11 +1100 Subject: [PATCH] WIP add basic edcon draft TokenScript --- examples/edcon/Makefile | 38 +++++++++ examples/edcon/shared.css | 46 +++++++++++ examples/edcon/unicon.en.shtml | 145 +++++++++++++++++++++++++++++++++ examples/edcon/unicon.xml | 137 +++++++++++++++++++++++++++++++ 4 files changed, 366 insertions(+) create mode 100644 examples/edcon/Makefile create mode 100644 examples/edcon/shared.css create mode 100644 examples/edcon/unicon.en.shtml create mode 100644 examples/edcon/unicon.xml diff --git a/examples/edcon/Makefile b/examples/edcon/Makefile new file mode 100644 index 00000000..cce5a256 --- /dev/null +++ b/examples/edcon/Makefile @@ -0,0 +1,38 @@ +XMLSECTOOL=xmlsectool +KEYSTORE= +KEY=1 +KEYPASSWORD= +SIGNATURE_ALGORITHM=rsa-sha256 + +help: + # Needs a target, example: $$ make EntryToken.canonicalized.xml + # + # Let's say you have a TokenScript "EntryToken.xml" + #- to validate and canonicalize, add 'canonicalized' in the filename + @echo $$ make EntryToken.canonicalized.xml + # - to sign, use tsml as file extension: + @echo $$ make EntryToken.tsml + +%.canonicalized.xml : %.xml + # xmlsectool canonicalises automatically when needed, but leaving an xml:base attribute which creates trouble later. + # xmlstarlet does it neatly + # XML Canonicalization + xmlstarlet c14n $^ > $@ + # xmlsectool validates too, albeit adding xml:base with breaks schema. Example: + # JVMOPTS=-Djavax.xml.accessExternalDTD=all /opt/xmlsectool-2.0.0/xmlsectool.sh --validateSchema --xsd --schemaDirectory ../../schema --inFile $^ + # XML Validation + # if INVALID, run validation again with xmllint to get meaningful error + # then delete the canonicalized file + -xmlstarlet val --xsd http://tokenscript.org/2019/10/tokenscript/tokenscript.xsd $@ || (mv $@ $@.INVALID; xmllint --noout --schema http://tokenscript.org/2019/10/tokenscript/tokenscript.xsd $@.INVALID) + +%.tsml: %.canonicalized.xml +ifeq (,$(KEYSTORE)) + @echo ---------------- Keystore missing. Try this ---------------- + @echo $$ make KEYSTORE=shong.wang.p12 KEYPASSWORD=shong.wang $@ + @echo replace it with your .p12 file and your password + rm $^ +else + $(XMLSECTOOL) --sign --keyInfoKeyName 'Shong Wang' --digest SHA-256 --signatureAlgorithm http://www.w3.org/2001/04/xmldsig-more#$(SIGNATURE_ALGORITHM) --inFile $^ --outFile $@ --keystore $(KEYSTORE) --keystoreType PKCS12 --key $(KEY) --keyPassword $(KEYPASSWORD) --signaturePosition LAST + # removing the canonicalized created for validation + rm $^ +endif diff --git a/examples/edcon/shared.css b/examples/edcon/shared.css new file mode 100644 index 00000000..bdd0f91a --- /dev/null +++ b/examples/edcon/shared.css @@ -0,0 +1,46 @@ +.tbml-count { + font-family: "SourceSansPro"; + font-weight: bolder; + font-size: 21px; + color: rgb(117, 185, 67); +} +.tbml-category { + font-family: "SourceSansPro"; + font-weight: lighter; + font-size: 21px; + color: rgb(67, 67, 67); +} +.tbml-venue { + font-family: "SourceSansPro"; + font-weight: lighter; + font-size: 16px; + color: rgb(67, 67, 67); +} +.tbml-date { + font-family: "SourceSansPro"; + font-weight: bold; + font-size: 14px; + color: rgb(112, 112, 112); + margin-left: 7px; + margin-right: 7px; +} +.tbml-time { + font-family: "SourceSansPro"; + font-weight: lighter; + font-size: 16px; + color: rgb(112, 112, 112); +} +html { +} +body { + padding: 0px; + margin: 0px; +} +div { + margin: 0px; + padding: 0px; +} +.data-icon { + height:16px; + vertical-align: middle +} \ No newline at end of file diff --git a/examples/edcon/unicon.en.shtml b/examples/edcon/unicon.en.shtml new file mode 100644 index 00000000..15023e4e --- /dev/null +++ b/examples/edcon/unicon.en.shtml @@ -0,0 +1,145 @@ + + +
diff --git a/examples/edcon/unicon.xml b/examples/edcon/unicon.xml new file mode 100644 index 00000000..6ac90dd4 --- /dev/null +++ b/examples/edcon/unicon.xml @@ -0,0 +1,137 @@ + + + + ]> + + + + Ticket + Tickets + + + + + 0xF6b8DD8Ba9996bEaE6Ad0eE3481F1E9cF080A9eB + + + + + + + + + + + + + &unicon.en; + + + &unicon.en; + + + + + + + + + Time + + + + + + + + + + + City + + + + + + Vienna + + + + + + + + + Venue + + + + + + Blockchain Plaza, Vienna + + + + + + + + + Cat + 等级 + Cat + + + + + + A + + + B + + + C + + + D + + + E + + + + + + + + + + + + + + + + + + Redeemed + + + + + + + + + + + +