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:
- Node.js
- Java
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,
});
String schemaDID = "did:test:z252afasgJiXARFGw3B8Mc6DrLBC2thMzjgeUZWQvHcyPVBxAYZw";
String identityDID = "did:test:z3v8AuagJiXARFGw3B8Mc6DrLBC2thMzjgeUZWQvHcyPVBxAYZv";
Map<String, Object> atoms = new HashMap<>();
atoms.put("firstName", "Paul");
atoms.put("lastName", "Revere");
atoms.put("birthDate", "1735-01-01");
BindCredentialOptions bindOptions = new BindCredentialOptions();
bindOptions.credential = atoms;
Map<String, Object> attested = keymaster.bindCredential(schemaDID, identityDID, bindOptions);
The next step is to issue the credential to the identity. This will encrypt the verifiable credential to the recevier's DID.
Issue Credential
- Node.js
- Java
const issued = await Keymaster.issueCredential(attested);
String issuedDid = keymaster.issueCredential(attested);
Map<String, Object> issued = keymaster.getCredential(issuedDid);
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.
Example Attestation DID JSON
{
"atomCount": 8,
"attestToName": undefined,
"attestedTo": undefined,
"attester": undefined,
"attesterName": undefined,
"credential": {
"addressType": "",
"apartmentUnit": "",
"city": "New York",
"country": "USA",
"effectiveDate": "",
"postalCode": "12345",
"stateProvince": "NY",
"streetAddress": "123 Main Street"
},
"credentialSubject": {
"id": "did:test:z3v8AuabtdhuGRcGEQcJXFRxBV6apCyNvEDeEsLxLe3NzrnaKHG"
},
"did": "did:test:z3v8Auab5BmWtX7yrnF49hU8x5Jz7276SkDNmqHLsstVa29PHNs",
"issuer": "did:test:z3v8AuabtdhuGRcGEQcJXFRxBV6apCyNvEDeEsLxLe3NzrnaKHG",
"issuerDisplayName": "did:test:z3v8AuabtdhuGRcGEQcJXFRxBV6apCyNvEDeEsLxLe3NzrnaKHG",
"name": "Address",
"publicationDate": undefined,
"publicationResponses": [],
"published": false,
"revealed": false,
"schema": undefined,
"sensitive": false,
"signature": {
"hash": "b73049fc0adedb28463ede3b4baea8ef5911cd746660ca6d3fb5e18d0d12f213",
"signed": "2026-02-13T06:58:20.403Z",
"signer": "did:test:z3v8AuabtdhuGRcGEQcJXFRxBV6apCyNvEDeEsLxLe3NzrnaKHG",
"value": "7e66cc58ef1edeef485a5cfaf9f28683859fb08e03a772a9c14a76eadbdabd546b3237a350003046c5d0274d8f254719fc222e1d2d7de647f45d205001acddb0"
},
"templateDid": "did:test:z3v8AuaVKoFaHL8LQp8eDyLP4sWCmfEmYRavUwe8CjbTUF4BMoS",
"type": [
"VerifiableCredential",
"did:test:z3v8AuaVKoFaHL8LQp8eDyLP4sWCmfEmYRavUwe8CjbTUF4BMoS"
],
"validFrom": "2026-02-13T06:58:20.204Z",
"validUntil": "",
"version": 1
}