Skip to content

Instantly share code, notes, and snippets.

@msalahz
Last active February 17, 2023 14:42
Show Gist options
  • Save msalahz/cc5d3aa250237c011eafb3bc40967e66 to your computer and use it in GitHub Desktop.
Save msalahz/cc5d3aa250237c011eafb3bc40967e66 to your computer and use it in GitHub Desktop.
ULS Membership Identification
export default {
'@context': [
'https://www.w3.org/2018/credentials/v1',
'https://schema.org/docs/jsonldcontext.json'
],
type: [
'VerifiableCredential',
],
issuer: {
id: ''
},
issuanceDate: '',
credentialSubject: {
type: 'ProofOfMembership',
id: '',
// memberId
identifier: '',
// barAdmissionDate
datePosted: '',
// firstName
givenName:'',
// surname
familyName:''
}
}
export interface Holder {
id: string;
memberId: string; // map to memberID column on ULS's member table
photoUrl: string; // map to photo column on ULS's member table
title: string;
firstName: string;
surname: string;
otherNames: string[];
sex: 'Male' | 'Female';
email: string;
phone: string; // map to contacts column on ULS's member table
barAdmissionDate: Date; // map to bardate column on ULS's member table
interest?: string;
expectations?: string;
committees?: string;
signers: Signers[];
contactInfo?: ContactInfo[];
metadata?: OptionalMetadata;
}
//We will rely on that these exist in the Diwala system and provide feedback of they dont.
interface Signers {
type: 'phone' | 'email';
value: string;
}
export interface ContactInfo {
type: string;
value: string;
}
export interface OptionalMetadata {
createdBy: string;
createdAt: string;
updatedBy: string;
updatedAt: string;
profileID: string;
membershipID: string;
dateOfBirth: string;
countryOfBirth: string;
}
const model = {
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Holder",
"definitions": {
"Holder": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"memberId": {
"type": "string"
},
"photoUrl": {
"type": "string"
},
"title": {
"type": "string"
},
"firstName": {
"type": "string"
},
"surname": {
"type": "string"
},
"otherNames": {
"type": "array",
"items": {
"type": "string"
}
},
"sex": {
"type": "string",
"enum": [
"male",
"female"
]
},
"email": {
"type": "string"
},
"phone": {
"type": "string"
},
"interest": {
"type": "string"
},
"expectations": {
"type": "string"
},
"committees": {
"type": "string"
},
"barAdmissionDate": {
"type": "string",
"format": "date-time"
},
"signers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"phone",
"email"
]
},
"value": {
"type": "string"
}
},
"required": [
"type",
"value"
],
"additionalProperties": false
}
},
"contactInfo": {
"type": "array",
"items": {
"$ref": "#/definitions/ContactInfo"
}
},
"metadata": {
"$ref": "#/definitions/OptionalMetadata"
}
},
"required": [
"id",
"memberId",
"photoUrl",
"title",
"firstName",
"surname",
"otherNames",
"sex",
"email",
"phone",
"barAdmissionDate",
"signers",
],
"additionalProperties": false
},
"ContactInfo": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"type",
"value"
],
"additionalProperties": false
},
"OptionalMetadata": {
"type": "object",
"properties": {
"createdBy": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"updatedBy": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"profileID": {
"type": "string"
},
"membershipID": {
"type": "string"
},
"dateOfBirth": {
"type": "string"
},
"countryOfBirth": {
"type": "string"
}
},
"required": [
"createdBy",
"createdAt",
"updatedBy",
"updatedAt",
"profileID",
"membershipID",
"dateOfBirth",
"countryOfBirth"
],
"additionalProperties": false
}
}
}
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schema.org/docs/jsonldcontext.json"
],
"type": [
"VerifiableCredential"
],
"issuer": {
"id": "did:key:z6MkkgfrEB9gSvpJui6yLmqHhcuuLjto9QXKCSa4WtHai4KR"
},
"issuanceDate": "2023-02-08T22:57:47Z",
"credentialSubject": {
"type": "ProofOfMembership",
"id": "did:key:z6MkoatuG6vy6NNgvcxoiGs3X6U5MhRCkQ6c4zFL6u7gXzyU",
"identifier": "ULS/6668/2023",
"datePosted": "2020-11-27T00:00:00",
"givenName": "John Paul",
"familyName": "Ojilong"
},
"id": "urn:uuid:dfbdb2b5-a5a0-4944-bdd7-48cc9637169a",
"proof": {
"type": "Ed25519Signature2018",
"created": "2023-02-08T20:57:48Z",
"verificationMethod": "did:key:z6MkkgfrEB9gSvpJui6yLmqHhcuuLjto9QXKCSa4WtHai4KR#z6MkkgfrEB9gSvpJui6yLmqHhcuuLjto9QXKCSa4WtHai4KR",
"proofPurpose": "assertionMethod",
"jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..I_-NP56w9iKqZKL_uzvdMH6YVfp41SekZ9j8mp905o9_kqerW_jhk_4ehC7VHoJFAOZr-uqOKYBT2r691mi8BQ"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment