Claims
addClaim
addClaim('0xb57f5f92f8931e044f59d54f7f2a445e5dd274e16599f104a61a8dd4cfa5b0fa', 'MY_KEY','0xadf488B39BFaa4254ffd4DECCF770661C1E8');
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 claimString
- Key of the claimString
- Value of the claim - ie address id of data
Returns
Promise with transaction result
Example
addClaim('0xb57f5f92f8931e044f59d54f7f2a445e5dd274e16599f104a61a8dd4cfa5b0fa', '0xE4d3Df777CaD70A6b0048bc572Fd3f843751529E','ANY VALUE')
static
getClaim //static
Datum.getClaim("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C","0x6e585cc6047a55a793d1E922afE28BaefaBcd73C", "0x656d61696c");
Return the value of the claim for given issuer, subject and key
Parameters
String
- issuer that created the claimString
- subject/wallet address for the claimString
- key name of the claim
Returns
Promise
Example
getClaim("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C","0x6e585cc6047a55a793d1E922afE28BaefaBcd73C", "0x656d61696c");
static
getClaims //static
Datum.getClaims("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C");
Returns an array of claims object with issuer, subject, key ,value
Parameters
String
- subject address of claims
Returns
Promise array of claims
Example
getClaims("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C");
Result
[{ issuer: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
subject: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
key: 'Age',
value: '80' } ]
static
getClaimsByIssuer //static
Datum.getClaimsByIssuer("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C");
Returns an array of claims object with issuer, subject, key ,value
Parameters
String
- issuer address of claims
Returns
Promise array of claims
Example
getClaims("0x6e585cc6047a55a793d1E922afE28BaefaBcd73C");
Result
[{ issuer: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
subject: '0x5aB36c692D5bCD2713239307F96212110a298f3E',
key: 'Age',
value: '80' } ]
removeClaim
removeClaim('0xb57f5f92f8931e044f59d54f7f2a445e5dd274e16599f104a61a8dd4cfa5b0fa', '0xE4d3Df777CaD70A6b0048bc572Fd3f843751529E', 'MY_KEY');
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 claimString
- Subject to add the claimString
- Key of the claim
Returns
Promise with transaction result
Example
removeClaim('0xb57f5f92f8931e044f59d54f7f2a445e5dd274e16599f104a61a8dd4cfa5b0fa', '0xE4d3Df777CaD70A6b0048bc572Fd3f843751529E')
verifyClaim
//static
Datum.verifiyClaim("0xc90a556e6381b0c6acdaf1e00e41f101e495762f","0xbddb8404281d830de5e200eb241aec3c97d885bc","0x1230000000000000000000000000000000000000000000000000000000000000")
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 claimString
- subject of the claimString
- key name of the claim
Returns
Promise with true or false
Example
Datum.verifiyClaim("0xc90a556e6381b0c6acdaf1e00e41f101e495762f","0xbddb8404281d830de5e200eb241aec3c97d885bc","0x1230000000000000000000000000000000000000000000000000000000000000")
Result false