# V2 Introduction In this doc, we'll introduce the products, the product concepts, and the technical concepts for our next platform # Products ## SDK A Trinsic SDK available in most major programming languages and frameworks. Initial frameworks: .Net, Node, Python, React Native, Android, iOS ## Docs An interactive docs site for people to test out using the API and run through demos. Maybe: a CLI # Product Concepts ## Provider Service ```plantuml package "Product Concepts" #FFFFFF { class Registry { + Id + List<Organization> + CRUDL() } class Organization { + Id + Name + List<Members> + Wallet + List<CredentialTemplate> + List<PresentationTemplate> + CRUDL() + InviteMember() } class CredentialTemplate { + Id: string + Name: string + Types: string[] + Properties: URI | JSON + Configs: JSON + CRUDL() } class PresentationTemplate { + Id: string + Name: string + Attributes: List<Attributes> + CRUDL() } class Attribute { +Id: string +Name: string +Type: enum +CRUDL() } } ``` ## Other Services ```plantuml package IssuerService { class Credential { + Issuer + CredentialTemplateId + AttributeValues + State + issuanceDate + expirationDate } } package VerifierService { class Presentation { + VerifierId + PresentationTemplateId + VerifiedData + State } } package HolderService { class Individual { + Id + Name + ContactMethod + Wallet } } class Wallet { + Id + List<Roles> + List<Credentials> + List<Presentations> + List<Contacts> } ``` Now we'll walk through Alice getting a vaccination and proving it to her company. We'll show this from a provider's perpective. ## Provider sets up ecosystem Bob wants to create an ecosystem to exchange verifiable credentials, so he signs up with Trinsic. We help him set up a set of credential and presentation templates. If they want a new credential template, we'll help them create one. ```javascript provider.credentialTemplates.create([{ name: "Vaccination Credentials", attributes: [ { context: "https://example.org", type: ["Person", "Verifiable Credential"], properties: ["givenName", "familyName"] }, { context: "https://example2.org", type: ["VaccinationCredential"], properties: ["vaccinationClinic", "vaccinationType"] } ] }]); provider.presentationTemplates.create([{ name: "Proof of Vaccination", attributes: [ { context: "https://example.org", type: ["Person", "Verifiable Credential"], properties: ["givenName", "familyName"] }, { context: "https://example2.org", type: ["VaccinationCredential"], properties: ["vaccinationClinic", "vaccinationType"] } ] }]); ``` Bob can now list the templates he has. ```bash $ trinsic template list ------------------------------------------------------------------- | URI | Name | Type | |-------------------------|------------------------|--------------| | did:123456asdfasdfasd | VaccinationCredential | Credential | |-------------------------|------------------------|--------------| | did:123456asdfasdfasd | Proof of Vaccination | Presentation | |-------------------------|------------------------|--------------| $ trinsic template show --DID=did:trinsic:123456asdfasdfasd ------------------------------------------------------------------- | -> DID: did:trinsic:123456asdfasdfasd | -> Sources: [https://schema.org/Person, https://schema.trinsic.id] ------------------------------------------------------------------------- | Attributes | Value Type | Source | |-------------------------|------------------------|---------------------| | firstName | text | Person | |-------------------------|------------------------|---------------------| | lastName | text | Person | |-------------------------|------------------------|---------------------| | vaccinationDate | date | covid19-vaccination | |-------------------------|------------------------|---------------------| ``` The provider can then create their organizations ```javascript // Create Issuer var vaccinationClinic = provider.organizations.create({ name: "Vaccination Clinic", role: "issuer", credentialTemplates: [ "did:trinsic:123dfgsdfaaer#vaccinationCred" ], presentationTemplates: [ "did:trinsic:123wdasdfagaer#proofOfVaccination" ], members: [ { name: "Michael Boyd", email: "michael@trinsic.id" }, { name: "Riley Hughes", email: "riley@trinsic.id" } ], }); // Create Verifier let ACMECorp = provider.organizations.create({ name: "ACMECorp", role: "verifier", presentationTemplates: [ "did:trinsic:123wdasdfagaer#proofOfVaccinationComplex" ], members: [ { name: "Tomislav Markovski", email:"tomislav@trinsic.id" } ] }); ``` Now the provider has their ecosystem created, let's follow the journey of the issuer organization that was just invited. ## Issue Credential The first step for the vaccination clinic will be add the trinsic sdk to the app. They'll issue a credential whenever a vaccination event occurs ```javascript if(event.type === EventTypes.Vaccination) { let issuedCredential = issuer.credentials.issue({ receiverId: "+8013616818", templateId: "did:trinsic:123123123123#vaccinationCredential", attributes: { "firstName": user.firstName, "lastName:": user.lastName, "atx": event.atxRecord } }) } ``` ## Receive and Store Credential The issuer needs to now add code to their user's app so that they can view their credentials ```javascript let templateId = "did:trinsic:123123123#vaccinationCredential"; let credential = holder.credentials.retrieve(templateId).first(); let firstName = credential.attributes["firstName"]; let lastName = credential.attributes["lastName"]; ``` ## Present Credential When alice is ready to present her credential, she can generate a presentation. ```javascript let presentationTemplateId = "did:trinsic:123123123123#proofOfVaccinationCredential" let presentation = holder.generatePresentation(presentationTemplateId); let QR = createQR(presentation.data); ``` ## Submit Verification When Alice shows the PR to her work, the workplace scans her credential and sumbits verification ```javascript let presentationData = await scanQRCode(); let presentationResult = verifier.presentations.submit(presentationData); ```