Comment on page
Credentials
Credentials are discrete packages of data that can be held, proven, or verified by a user through their blockchain account. To fully understand the process you can review the credential data flow.
export type Subject = {
id: string;
claim: Claims;
};
export type Credential = {
context: "https://www.w3.org/2018/credentials/v1";
schema: string;
issuer: string;
issuanceDate: number; // UnixTimestamp
expirationDate?: number; // UnixTimestamp
subject: Subject;
credentialHolder: string;
nonce: number;
};
The Claims data types are commonly used throughout multiple functions within the SDK.
export type Field = {
name: string;
insuanceType: string;
};
export type Fields = Field[];
export type ClaimType = "IssuerClaim" | "SubjectClaim" | "CredentialClaim";
export type Claim = {
property: string;
value: string;
claimType: ClaimType;
schemaid?: string;
issuanceRequirement?: Fields;
};
export type Claims = Claim[];
struct VerifiableCredential {
context: &str,
schema: &str,
issuer: &str, // DID
issuanceDate: Option<DateType>,
expirationDate: Option<DateType>,
subject: {
id: &str, // DID
claims: [{
property: &str,
value: &str,
}]
},
credentialHolder: &str, // DID
nonce: Hex
}
SchemaStore: Mapping(signature => VerifiableCredential)
typeof(signature) -> Hex
context:
URI of the W3C context object of this credential (contains version and credential specification).schema:
The schema this credential is based on.issuer:
DID of the issuer of this credential.issuanceDate:
The date of issuance of this credential, if any.expirationDate:
The date of expiration of this credential, if any.credentialHolder:
DID of the holder of this credential (can be the subject DID itself).subject:
DID of the subject of the credential and a list of claims asserted by the credential.nonce:
A nonce is required during the creation of the cryptographic signature.signature
: Signature of the credential."VerifiableCredential": {
"context": "https://www.w3.org/2018/credentials/v1",
"schema": "0xff39f8f896c9e9c22475e60902cc2b3547199e0e91fa32902028f2ca2355e8cdd16cfe19ba5e8b658c94aa80f3b81a0028a854d54903e056f89581c691c1f7d2",
"issuer": "did:seneca:0xc2cfba930a0598165bede4ab188c4b5ed6626d1cfe8bad9a79c00042ea32ce5a",
"issuanceDate": 1678302376,
"expirationDate": 1681303298,
"subject": {
"id": "did:seneca:0xb188c4b5ed6626d1cfe8bad9a79c00042ea32ce5ac2cfba930a0598165bede4a"
"claims": [{
"property": "National_ID_authenticatedBy",
"value": “Authenticate.com”
}],
},
"credentialHolder": "did:seneca:0xb188c4b5ed6626d1cfe8bad9a79c00042ea32ce5ac2cfba930a0598165bede4a",
"nonce": "0x32e11a23c77"
}
“signature”: "903e056f89581c691c1f7d2ff39f8f896c9e9c22475e60902cc2b3547199e0e91fa32902028f2ca2355e8cdd16cfe19ba5e8b658c94aa80f3b81a00"
Last modified 8mo ago