tydids-jquery-consent
v1.0.5
Published
JQuery extension for TyDIDs Self-Sovereign Identity & Consent Management
Downloads
4
Readme
tydids-jquery-consent
jQuery extension for TyDIDs Self-Sovereign Identity and Consent Management
A jQuery extension that simplifies the process of adding GDPR compliance to existing webforms. It allows web developers to easily integrate GDPR compliance into their existing forms using decentralized and self-sovereign identities. This extension solves the problem of allowing data providers (web users) to revoke consent given at a later time.
Uses TyDIDs-Core. Backend/Middleware: TyDIDs-SSI-Consent-Router
Try on JSFiddle
Features
- Easy to Use: tydids-jquery-consent provides a simple and intuitive API for adding GDPR compliance to your webforms.
- Transparent Implementation: The extension generates a Self-Sovereign Identity (SSI) for each user who checks the GDPR compliance box. This SSI allows the user to revoke consent at any time.
- No Third-Party Dependencies: tydids-jquery-consent is designed to be a standalone solution. It does not rely on any third-party frameworks or service providers.
- Backend Compatibility: The value of the GDPR compliance checkbox is changed to the Identity of the SSI. This allows the consent to be easily validated on the backend.
Installation
<script src="https://energychain.github.io/tydids-jquery-consent/dist/tydids-jquery-consent.js"/>
Usage
Getting Consent
$('#consentCheck').tydisConsent(); // #consentCheck is ID of checkbox field for GDPR Constent
This will add the necessary functionality to the checkbox. When the user checks the box, an SSI will be generated and downloaded. The value of the checkbox will be changed to the Identity of the SSI.
Checking revocation
CLI
npx tydids-core isgranted <identity>
Node JS
const provider = new ethers.providers.JsonRpcProvider(env._RPC_URL);
const bn = (await provider.getBlockNumber()).toString() * 1;
let sc = new ethers.Contract(env._revokeContract, env._revokeAbi, provider);
let rcp = await sc.revocations(identity);
let ts = rcp.toString() * 1;
console.log("isGranted("+identity+")@Consensus:"+bn);
if(ts > 0) {
console.log("Revoked at "+new Date(ts*1000).toISOString());
process.exit(1);
} else {
sc = new ethers.Contract(env._publishContract, env._publishAbi, provider);
rcp = await sc.publishs(identity);
ts = rcp.toString() * 1;
console.log("Granted at "+new Date(ts*1000).toISOString());
process.exit(0);
}
For details check TyDIDs-Core
Rest API
https://api.corrently.io/v2.0/tydids/status?identity=<identity>
Configuration
Basic Usage
<input class="form-check-input" type="checkbox" id="consentCheck" name="consentCheck" required="">
Additional Attributes
<input class="form-check-input" type="checkbox" id="consentCheck" name="consentCheck" required=""
signature="signature"
payload="payload"
identity="identity"
submit="submit" >
signature
, payload
and identity
might be the id of a hidden input field which will be filled after consent.
submit
is the id of a button which will be "disabled" during consent creation.