-
Notifications
You must be signed in to change notification settings - Fork 0
Working with claims
A claim represent an statement/fact about an entity, that can be either an identity, asset type of asset/account.
The claim is stated by a party (e.g the owner of an identity), and additional trust can be attached by having other parties (e.g. verification authorities) endorsing it. See [Working with endorsements] for information on how endorsements work.
The helper method createIdentityClaims creates claims for an identity.
import { ICreateClaimsRequest, IKeyPairData, PlatformClient, PlatformUtils } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const platformUtils = new PlatformUtils();
const identityId: string = "<existing identityId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
const claims: string[] = "array of claims";
const request: ICreateClaimsRequest = {
claims: platformUtils.createClaimsHashArray(claims),
requestId: uuidv4(),
subjectId: identityId,
};
platformClient.createIdentityClaims(request, claims, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method getIdentityClaims retrieves all claims of an identity.
import { IKeyPairData, PlatformClient } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const identityId: string = "<existing identityId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
platformClient.getIdentityClaims(identityId, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method getIdentityClaim retrieves a single claim of an identity.
import { IKeyPairData, PlatformClient } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const identityId: string = "<existing identityId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
const claimHash: string = "<sha256 hash of the claim>";
platformClient.getIdentityClaim(identityId, claimHash, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method createAssetTypeClaims creates claims for an asset type.
import { ICreateClaimsRequest, IKeyPairData, PlatformClient, PlatformUtils } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const platformUtils = new PlatformUtils();
const assetTypeId: string = "<existing assetTypeId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
const claims: string[] = "array of claims";
const request: ICreateClaimsRequest = {
claims: platformUtils.createClaimsHashArray(claims),
requestId: uuidv4(),
subjectId: assetTypeId,
};
platformClient.createAssetTypeClaims(request, claims, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method getAssetTypeClaims retrieves all claims of an asset type.
import { IKeyPairData, PlatformClient } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const assetTypeId: string = "<existing assetTypeId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
platformClient.getAssetTypeClaims(assetTypeId, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method getAssetTypeClaim retrieves a single claim of an asset type.
import { IKeyPairData, PlatformClient } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const assetTypeId: string = "<existing assetTypeId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
const claimHash: string = "<sha256 hash of the claim>";
platformClient.getAssetTypeClaim(assetTypeId, claimHash, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method createAssetClaims creates claims for an asset/account.
import { ICreateClaimsRequest, IKeyPairData, PlatformClient, PlatformUtils } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const platformUtils = new PlatformUtils();
const assetId: string = "<existing assetId or accountId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
const claims: string[] = "array of claims";
const request: ICreateClaimsRequest = {
claims: platformUtils.createClaimsHashArray(claims),
requestId: uuidv4(),
subjectId: assetId,
};
platformClient.createAssetClaims(request, claims, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method getAssetClaims retrieves all claims of an asset/account.
import { IKeyPairData, PlatformClient } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const assetId: string = "<existing assetId or accountId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
platformClient.getAssetClaims(assetId, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});
The helper method getAssetClaim retrieves a single claim of an asset/account.
import { IKeyPairData, PlatformClient } from "../iov42/core-sdk";
const rpcUrl = "https://api.sandbox.iov42.dev"; //Url of the iov42 API server
const platformClient = new PlatformClient(rpcUrl);
const assetId: string = "<existing assetId or accountId>";
const keyPair: IKeyPairData = "<previously generated key pair>";
const claimHash: string = "<sha256 hash of the claim>";
platformClient.getAssetClaim(assetId, claimHash, keyPair);
.then( (response) => {
// Check response
})
.catch( (error) => {
console.error(error);
});