Use Cases FAQ
Real-world applications and implementation examples for KryptoOS.
Financial Services
How do I implement KYC verification?
typescript
// 1. Issuer (Bank) verifies customer identity
const kycCredential = await client.vc.issue({
type: ['VerifiableCredential', 'KYCCredential'],
credentialSubject: {
id: customerDid,
kycLevel: 'advanced',
jurisdiction: 'EU',
amlCheck: 'passed',
sanctionsCheck: 'clear',
pepCheck: 'negative',
verificationDate: new Date().toISOString()
},
expirationDate: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString()
});
// 2. Customer presents KYC credential to another service
const presentation = await client.vc.createPresentation({
credentials: [kycCredential],
holder: customerDid,
verifier: 'did:emp:exchange-01'
});
// 3. Service verifies KYC without contacting original bank
const result = await client.verifier.verifyVP(presentation);
if (result.valid && result.credentials[0].credentialSubject.kycLevel === 'advanced') {
// Grant access to advanced trading features
}How do I implement AML compliance?
typescript
const amlCredential = await client.vc.issue({
type: ['VerifiableCredential', 'AMLCredential'],
credentialSubject: {
id: userDid,
riskScore: 'low',
sourceOfFunds: 'verified',
transactionMonitoring: 'active',
lastReview: new Date().toISOString()
},
compliance: {
standard: 'MiCA',
auditTrail: true
}
});Education
How do I issue digital diplomas?
typescript
const diploma = await client.vc.issue({
type: ['VerifiableCredential', 'UniversityDegree'],
issuer: 'did:emp:university-01',
credentialSubject: {
id: studentDid,
degree: 'Bachelor of Science',
field: 'Computer Science',
graduationDate: '2024-06-15',
gpa: '3.8',
honors: 'Summa Cum Laude',
institution: 'Tech University',
accreditation: 'ABET'
},
expirationDate: null // Diplomas don't expire
});How do employers verify diplomas?
typescript
// 1. Request diploma from candidate
const presentation = await requestCredential({
type: 'UniversityDegree',
requiredFields: ['degree', 'field', 'graduationDate']
});
// 2. Verify presentation
const result = await client.verifier.verifyVP(presentation);
if (result.valid) {
const diploma = result.credentials[0];
console.log('Verified degree:', diploma.credentialSubject.degree);
console.log('From:', diploma.issuer);
console.log('GPA:', diploma.credentialSubject.gpa);
}Healthcare
How do I issue vaccination records?
typescript
const vaccinationRecord = await client.vc.issue({
type: ['VerifiableCredential', 'VaccinationCredential'],
issuer: 'did:emp:hospital-01',
credentialSubject: {
id: patientDid,
vaccine: 'COVID-19 mRNA',
manufacturer: 'Pfizer-BioNTech',
lotNumber: 'EK9231',
doses: 2,
lastDoseDate: '2024-01-15',
nextDoseDate: null,
administeredBy: 'did:emp:doctor-456',
location: 'City Hospital'
}
});How do I verify vaccination status with privacy?
typescript
// Use zero-knowledge proof to prove vaccination without revealing details
const zkProof = await zkp.prove({
circuit: 'vaccination-status',
privateInputs: {
vaccinationRecord: vaccinationCredential,
doses: 2,
lastDoseDate: '2024-01-15'
},
publicInputs: {
requiredDoses: 2,
validityPeriod: 180 // days
}
});
// Verifier only learns: "This person is fully vaccinated"
const verified = await zkp.verify(zkProof);Government & Public Services
How do I implement digital driver's licenses?
typescript
const driverLicense = await client.vc.issue({
type: ['VerifiableCredential', 'DriverLicense'],
issuer: 'did:emp:dmv-california',
credentialSubject: {
id: citizenDid,
licenseNumber: 'DL-123456',
fullName: 'John Doe',
dateOfBirth: '1990-01-15',
address: '123 Main St, City, State',
licenseClass: 'C',
restrictions: 'None',
issueDate: '2020-01-15',
expirationDate: '2028-01-15'
}
});How do I verify age without revealing birthdate?
typescript
// Create age verification proof
const ageProof = await zkp.prove({
circuit: 'age-verification',
privateInputs: {
birthDate: '1990-01-15'
},
publicInputs: {
minimumAge: 21,
currentDate: '2024-01-15'
}
});
// Verifier only learns: "This person is 21+"
const isOver21 = await zkp.verify(ageProof);Employment
How do I issue employment credentials?
typescript
const employmentCredential = await client.vc.issue({
type: ['VerifiableCredential', 'EmploymentCredential'],
issuer: 'did:emp:company-01',
credentialSubject: {
id: employeeDid,
employer: 'Tech Corp',
position: 'Senior Software Engineer',
department: 'Engineering',
startDate: '2020-01-15',
employmentType: 'Full-time',
salary: 120000, // Optional, can be hidden in presentations
clearanceLevel: 'Confidential'
}
});How do I verify employment for background checks?
typescript
// Request employment verification with selective disclosure
const presentation = await client.vc.createPresentation({
credentials: [{
credential: employmentCredential,
disclose: ['employer', 'position', 'startDate', 'employmentType'],
hide: ['salary', 'clearanceLevel'] // Keep sensitive info private
}],
holder: employeeDid,
verifier: backgroundCheckDid
});Access Control & Permissions
How do I implement credential-gated access?
typescript
async function checkAccess(presentation: VerifiablePresentation) {
// Verify presentation
const result = await client.verifier.verifyVP(presentation);
if (!result.valid) {
throw new Error('Invalid presentation');
}
// Check for required credentials
const kycCredential = result.credentials.find(c =>
c.type.includes('KYCCredential')
);
const membershipCredential = result.credentials.find(c =>
c.type.includes('MembershipCredential')
);
// Grant access based on credentials
if (kycCredential && membershipCredential) {
const tier = membershipCredential.credentialSubject.tier;
return {
granted: true,
permissions: tier === 'premium'
? ['read', 'write', 'admin']
: ['read']
};
}
return { granted: false };
}DAO Governance
How do I implement DID-based voting?
typescript
// Issue voting credential
const votingCredential = await client.vc.issue({
type: ['VerifiableCredential', 'VotingCredential'],
issuer: 'did:emp:dao-01',
credentialSubject: {
id: memberDid,
votingPower: 100,
delegatedFrom: [],
eligibleProposals: ['all']
}
});
// Cast vote with ZK proof (private voting)
const voteProof = await zkp.prove({
circuit: 'private-vote',
privateInputs: {
votingCredential: votingCredential,
vote: 'yes'
},
publicInputs: {
proposalId: 'prop-123',
votingPower: 100
}
});
// Vote is counted without revealing voter identity
await dao.castVote(voteProof);Supply Chain
How do I track product authenticity?
typescript
// Manufacturer issues product credential
const productCredential = await client.vc.issue({
type: ['VerifiableCredential', 'ProductAuthenticity'],
issuer: 'did:emp:manufacturer-01',
credentialSubject: {
id: 'did:emp:product-12345',
productName: 'Luxury Watch',
serialNumber: 'LW-2024-001',
manufactureDate: '2024-01-15',
materials: ['Gold', 'Sapphire'],
certifications: ['ISO-9001', 'Swiss-Made']
}
});
// Retailer verifies authenticity
const result = await client.verifier.verifyVC(productCredential);
if (result.valid && result.issuer === 'did:emp:manufacturer-01') {
console.log('✓ Authentic product verified');
}Real Estate
How do I verify property ownership?
typescript
const propertyCredential = await client.vc.issue({
type: ['VerifiableCredential', 'PropertyOwnership'],
issuer: 'did:emp:land-registry',
credentialSubject: {
id: ownerDid,
propertyAddress: '123 Main St, City, State',
propertyId: 'PROP-2024-001',
ownershipType: 'Full',
purchaseDate: '2024-01-15',
purchasePrice: 500000,
encumbrances: 'None'
}
});Insurance
How do I issue insurance policies?
typescript
const insurancePolicy = await client.vc.issue({
type: ['VerifiableCredential', 'InsurancePolicy'],
issuer: 'did:emp:insurance-company',
credentialSubject: {
id: policyholderDid,
policyNumber: 'INS-2024-001',
policyType: 'Health',
coverage: 'Comprehensive',
coverageAmount: 1000000,
deductible: 5000,
startDate: '2024-01-01',
endDate: '2025-01-01',
beneficiaries: ['did:emp:spouse', 'did:emp:child']
}
});Event Ticketing
How do I issue verifiable event tickets?
typescript
const eventTicket = await client.vc.issue({
type: ['VerifiableCredential', 'EventTicket'],
issuer: 'did:emp:event-organizer',
credentialSubject: {
id: attendeeDid,
eventName: 'Tech Conference 2024',
eventDate: '2024-06-15',
ticketType: 'VIP',
seatNumber: 'A-123',
price: 500,
transferable: false
}
});
// Verify ticket at entrance
const result = await client.verifier.verifyVC(eventTicket);
if (result.valid && !result.revoked) {
console.log('✓ Valid ticket - Grant access');
}Professional Licenses
How do I issue professional certifications?
typescript
const professionalLicense = await client.vc.issue({
type: ['VerifiableCredential', 'ProfessionalLicense'],
issuer: 'did:emp:medical-board',
credentialSubject: {
id: professionalDid,
licenseType: 'Medical Doctor',
licenseNumber: 'MD-123456',
specialty: 'Cardiology',
issueDate: '2020-01-15',
expirationDate: '2025-01-15',
restrictions: 'None',
boardCertified: true
}
});Best Practices
When should I use selective disclosure?
Use selective disclosure when:
- Sharing credentials with different parties
- Privacy is important
- Only specific claims are needed
- Preventing correlation across services
When should I use zero-knowledge proofs?
Use ZK proofs when:
- Proving age without revealing birthdate
- Proving income range without exact amount
- Proving membership without revealing identity
- Private voting in DAOs
How do I choose credential expiration dates?
| Credential Type | Typical Expiration |
|---|---|
| KYC Verification | 1 year |
| Academic Degrees | Never |
| Professional Licenses | 2-5 years |
| Vaccination Records | 6 months - 1 year |
| Employment | While employed |
| Event Tickets | Event date |
Need more examples? Check our GitHub examples repository or join Discord.