Request an Attestation
To obtain credentials, Claimers have to request an attestation for a set of claims from an Attester.
The resulting object is a Credential
, which can be created following the snippet below.
This process does not involve any interaction with the KILT blockchain, but is simply a communication channel where the Claimer and the Attester can communicate.
- Typescript
- Javascript
import * as Kilt from '@kiltprotocol/sdk-js'
export function requestAttestation(
claimer: Kilt.DidDocument,
ctype: Kilt.ICType
): Kilt.ICredential {
// The claimer generates the claim they would like to get attested.
const claim = Kilt.Claim.fromCTypeAndClaimContents(
ctype,
{
name: 'Alice',
age: 29,
id: '123456789987654321'
},
claimer.uri
)
const credential = Kilt.Credential.fromClaim(claim)
return credential
}
# loading code...
note
The structure of the claims must respect the schema defined in the specified CType. Attesters (and Verifiers) will reject claims that fail to verify correctly.