Create an Attestation
Overview
Attestations are verifiable credentials issued to identities on the SELF network. Parties attest verifiable credentials to other parties to prove claims about them.
Attesting a verifiable credential involves two steps:
- Bind a credential to a specific identity DID.
- Issue the credential to the identity DID.
Ensure that Keymaster is installed, initialized, and started as described in the Keymaster installation documentation before creating an attestation.
Bind Credential
Binding a credential requires the schema DID of the verifiable credential, the DID of the identity to which the credential will be bound, and the data or "atoms" that compose the credential:
const schemaDID =
"did:test:z252afasgJiXARFGw3B8Mc6DrLBC2thMzjgeUZWQvHcyPVBxAYZw";
const identityDID =
"did:test:z3v8AuagJiXARFGw3B8Mc6DrLBC2thMzjgeUZWQvHcyPVBxAYZv";
const atoms = {
firstName: "Paul",
lastName: "Revere",
birthDate: "1735-01-01",
};
const attested = await Keymaster.bindCredential(schemaDID, identityDID, {
credential: atoms,
});
The next step is to issue the credential to the identity. This will encrypt the verifiable credential to the recevier's DID.
Issue Credential
const issued = await Keymaster.issueCredential(attested);
The best practice is to display the issued attestation as a QR code. The user can then scan the QR code with their SELF app to receive the attestation.