TokenScript
TokenScript copied to clipboard
make mock site hotel-bogota use Authenticator
trafficstars
This branch: https://github.com/TokenScript/TokenScript/tree/hotel-bogota/examples/sites/hotel-bogota
Pseudo code:
// this will open the iframe to attestation.id if first time
const useTicketProof = Authenticator.generateAuthenticationBlob(selectedTicket);
// getting a challenge
const challenge = fetch(…)…
// sign a challenge contain
const msg = '{challenge: "' + challenge + '", proof: "' + atob(useTicketProof) + '"}'
const signedMsg = web3.eth.account.signMessage(msg)
// send the challenge back to the server
fetch(URL, {method: post, body: signedMsg;}).…
// get server greenlight, fetch privileged content
…
Operational Attributes
There are a few operational attributes, most importantly ownerAddress, however, it is not discovered until webster's code runs generateAthenticationBlob, which is confusing (as webster might not expect this function to change the token object. Therefore alternatively the function can be changed:
Authenticator.assertOwnerAddress(token) // this changes the token object
Which results in two operational attributes:
{
devconID: 6,
ticketID: 8080,
ticketClass: 0,
ownerAddress: 0xd55729e2A0C82b193cdb0d026f576f3ab5Aeac3e;
ownershipProof: ArrayBuffer(…);
}
i.e. instead of returning the blob in a function call like originally planned, store it in the token object as Operational Attribute.