Claims
Claims store plain data on the blockchain, Usually it is used in conjunction with datum.set and instead of storing data we store data item ID
To be GDPR compliant DON'T store plain data on the blockchain since it will not be deleted
addClaim
Add a claim
NOTE: value of claim should be the storage address. See set() operation on how to store data.
Parameters
- String- Subject to add the claim
- String- Key of the claim
- String- Value of the claim - ie address id of data
Returns
Promise with transaction result
Example
datum.addClaim('0xb57f5f92f8931e044f59d54f7f2a445e5dd274e16599f104a61a8dd4cfa5b0fa', '0xE4d3Df777CaD70A6b0048bc572Fd3f843751529E','ANY VALUE')
getClaim static
Return the value of the claim for given issuer, subject and key
Parameters
- String- issuer that created the claim
- String- subject/wallet address for the claim
- String- key name of the claim
Returns
Promise
Example
Datum.getClaim("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C","0x6e585cc6047a55a793d1E922afE28BaefaBcd73C", "0x656d61696c");
getClaims static
Returns an array of claims object with issuer, subject, key ,value
Parameters
- String- subject address of claims
Returns
Promise array of claims
Example
Datum.getClaims("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C");
Result
[{  issuer: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
    subject: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
    key: 'Age',
    value: '80' } ]
getClaimsByIssuer static
Returns an array of claims object with issuer, subject, key ,value
Parameters
- String- issuer address of claims
Returns
Promise array of claims
Example
Datum.getClaims("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C");
Result
[{  issuer: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
    subject: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
    key: 'Age',
    value: '80' } ]
removeClaim
Removes a claim. Can only be done by issuer or subject of the claim.
NOTE: removing claim WILL NOT remove storage assoicated. See remove() on how to remove storage data.
Parameters
- String- Issuer of the claim
- String- Subject to add the claim
- String- Key of the claim
Returns
Promise with transaction result
Example
datum.removeClaim('0xb57f5f92f8931e044f59d54f7f2a445e5dd274e16599f104a61a8dd4cfa5b0fa', '0xE4d3Df777CaD70A6b0048bc572Fd3f843751529E', 'MY_KEY');
verifyClaim
Returns true if the claim exists and signed by the issuer, false if claim not exists or signed by someone else.
Parameters
- String- issuer of the claim
- String- subject of the claim
- String- key name of the claim
Returns
Promise with true or false
Example
//static
Datum.verifiyClaim("0xc90a556e6381b0c6acdaf1e00e41f101e495762f","0xbddb8404281d830de5e200eb241aec3c97d885bc","0x1230000000000000000000000000000000000000000000000000000000000000")
Result
false
