๐Ÿ“ฒReceive the Verifier data with a webhook in your backend

If you want to receive the data in your backend, create a webhook and copy the URL of the webhook in the page (โ€œWebhook URL of your applicationโ€).

  • POST request with header Content-Type : application/json and in option an API KEY authentication โ€˜keyโ€™ : <your_key>)โ€™

  • Event types : โ€˜VERIFICATIONโ€™ or โ€˜VERIFICATION _DATAโ€™

Example :

{"event": "VERIFICATION", "id": "1234", "presented": "2022-11-15T14:59:43Z", "vc_type": ["Over13"], "verification": true}
  • event : string โ€˜VERIFICATIONโ€™ or โ€˜VERIFICATION_DATAโ€™

  • id : string : The id passed through the call or the user blockchain address

  • presented : string : date of the user connexion

  • vc_type : ov13, over18, loyalty cards, etc

  • verification : Signature check

Event โ€œVERIFICATION_DATAโ€ : in that case the webhook receives the full verifiable presentations signed by the wallet with the verifiable credentials signed by the issuer.

Below an example of a webhook code in python :

from flask import Flask, jsonify, request

app = Flask(__name__)
app.config.update(SECRET_KEY = "abcdefgh") # Flask key
verifier_secret = 'c8f90f24-5506-11ed-b15e-0a1628958560' # take the client_secret from the platform https://talao.co

@app.route('/webhook', methods=['POST'])
def dapp_webhook() :
    if request.headers.get('key') != verifier_secret :
        return jsonify('Forbidden'), 403
    data = request.get_json()
    if data['event'] == 'VERIFICATION' :  # this is an event to catch a digest of the credential
        print(data)
        return jsonify('ok')

if __name__ == '__main__': #  use Gunicordn for production
    IP = "127.0.0.1"
    app.run( host = IP, port=4000, debug =True)

Last updated