A VC contains a "Proof", which is essentially a claim that has been signed by the attester using the AssertionMethod.
VerifiableCredential is an extension of RawCredential with the following 7 new structures in addition to the basic RawCredential:
context:indicates the base context of Credential, the default value is: 'https://www.w3.org/2018/credentials/v1';version:indicates the version of the Credential, the current version is 1;issuanceDate:the time when the Credential was issued, represented as a timestamp;expirationDate(optional):the time when the Credential is expired, represented as a timestamp;issuer:the DID URL of the Issuer(Attester), prefixed with did::zk::;digest:Digesthash, which is a unique identifier for a Credential. To find more details about how to calculate Digest, please check the section -- 'Digest Calculation';proof:After the Issuer checks and agrees to issue the Credential, the attester needs to sign for this Credential. To find more details about how to make a signature, please check the section -- 'Issuer Signature';Generating a Verifiable Credential requires a 2-step process:
VerifiableCredentialBuilder needs to be generated;VerifiableCredentialBuilder with its DID as parameter to generate a VerifiableCredential with Attester's signature (including attester's Proof)export class VerifiableCredentialBuilder {
public '@context'?: string[];
public version?: VerifiableCredentialVersion;
public issuanceDate?: number;
public expirationDate?: number | null;
public raw: Raw;
public digestHashType?: HashType;
...
}
export interface VerifiableCredential extends RawCredential {
'@context': string[];
version: VerifiableCredentialVersion;
issuanceDate: number;
expirationDate?: number;
issuer: DidUrl;
digest: HexString;
proof: Proof[];
}
A Verifiable Credential contains the following methods for building VCs from claims and managing VCs. For more details, please refer to our SDK Guideline.
buildsetContext