Links
Comment on page

Schemas

Schemas are blueprints for credentials. Credentials based on schema definitions can be claimed through Vault+ or other third-party services.

Data Objects & Type Annotations

TypeScript

export type Schema = {
name: string;
creator: string;
public: boolean;
creationDate: number; // UnixTimestamp
expirationDate?: number; // UnixTimestamp
mandatoryFields: AttributeFields;
issuerClaims: Claims;
subjectClaims: Claims;
credentialClaims: Claims;
metadata: string;
nonce: number;
};

Rust

struct VerifiableCredentialSchema {
name: &str,
creator: &str, // (DID)
creationDate: DateType,
expirationDate: Option<DateType>,
public: bool,
mandatoryFields: [{
name: &str,
attributeType: DataType
}],
issuerClaims : [{
property: &str,
value: &str
}],
subjectClaims: [{
property: &str,
value: &str,
schemaId: &str
}, ...],
credentialClaims: [
{
property: &str,
value: &str,
issuanceRequirement: [
{ name: &str, issuanceType: DataType},
...]
}, ...],
metadata: &str,
nonce: Hex
}

Schema Store Mapping

SchemaStore: Mapping(signature=>VerifiableCredentialSchema)
typeof(signature) -> Hex

Field Descriptors

name: Name of the Schema.
creator: DID of the creator of this schema.
creationDate: The date of creation of this schema.
expirationDate: The date of expiration of this schema, if any.
public: If the issued credential will be public or not.
mandatoryFields: List of mandatory fields the issued credential must have and their types.
issuerClaims: List of claims that the issuer of the credential must satisfy (issuer prerequisites).
subjectClaims: List of claims that the subject of the credential must satisfy (subject prerequisites).
credentialClaims: List of claims about the subject which the credential asserts (claims of the credential itself).
metadata: All the (stringified JSON) metadata required for the creation or claiming of a credential based on the schema.
nonce: A nonce is required during the creation of the cryptographic signature.
signature: Signature of the schema.
DataType: Int, String, Hex, Float, DateType, Base64

Example

"VerifiableCredentialSchema": {
"name": "PassportIssuedVC",
"creator": "did:seneca:0xc2cfba930a0598165bede4ab188c4b5ed6626d1cfe8bad9a79c00042ea32ce5a",
"creationDate": 1678302376,
"expirationDate": null,
"public": false,
"mandatoryFields": [
{"name": "issuer", "attributeType": "String"},
{"name": "subject", "attributeType": "Object"},
{"name": "signature", "attributeType": "String"},
{"name": "issuanceDate", "attributeType": "Date"},
{"name": "expirationDate", "attributeType": "Date"}
],
"issuerClaims" : [{
"property": "memberOf",
"value": "Authenticate.com",
}],
"subjectClaims": [{
"property": "citizenOf",
"value": "Valid_Country_ID_Authenticate.com",
"schemaId": “0x9c6eaa3a405992a1661ed2d90195dadca05cd15240f433580478d5c97cffc72bd94e37e34b9895962ad6ed18123d9f2f91b0dde3aa118c507ad1a4cb026d2481”
}],
"credentialClaims": [{
"property": "National_ID_authenticatedBy",
"value": "Authenticate.com",
"issuanceRequirement" : [
{"name": "first_name", "issuanceType": "String"},
{"name": "last_name", "issuanceType": "String"},
{"name": "age", "issuanceType": "Int"},
{"name": "nationality_document", "issuanceType": "Base64"}
]
}],
"nonce": 0x32e11a23c77,
"metadata": "{name:National Id,badge:https://mantis-public-assets.s3.amazonaws.com/MilitaryLogo.jpg,description:check if its a valid Id,requirements:[{inputType:text,question:What is your First Name?,required:true,name:first_name,dataType:Text,label:First name},{inputType:text,question:What is your Last Name?,required:true,name:last_name,dataType:Text,label:Last name},{inputType:date,question:When where you born?,required:true,name:dob,dataType:DateType,label:Date of Birth},{inputType:text,question:What is your email?,required:true,name:email,dataType:Text,label:Email},{inputType:image,exts:[],question:Upload the image of your Passport,required:true,name:idFront,dataType:Base64,label:Image of the Passport},{inputType:select,question:Which Country is your Id from?,required:true,options:[{value:0,label:U.S.A.},{value:1,label:Canada},{value:2,label:Americas}],name:country,dataType:Int,label:Country}],verifier:{name:Authenticate.com,verificationMethod:passport,description:check if its a valid Id}}"
}
​
"signature":"0x28a854d54903e056f89581c691c1f7d2ff39f8f896c9e9c22475e60902cc2b3547199e0e91fa32902028f2ca2355e8cdd16cfe19ba5e8b658c94aa80f3b81a00"
​
​