ConsentFlow
ConsentFlow contracts allow you to read and write to a LearnCard with the consent of the LearnCard owner
Creating a ConsentFlow Contract
1. Start up the LearnCard CLI
pnpm dlx @learncard/cli
2. Create a Network LearnCard
const networkLearnCard = await initLearnCard({ seed: '[your secure key]', network: true })
3. Create a service profile (docs)
4. Create a contract
If you'd like to set an expiration for your contract you can use the expiresAt
parameter e.g.
Supported values for credential categories are:
Achievement
Accommodation
Accomplishment
Course
ID
Job
Learning History
Membership
Merit Badge
Skill
Social Badge
Work History
5. Generate URL
This is the url that users will use to consent to this contract
const url = `https://learncard.app/consent-flow?uri=${contractUri}`
Additionally, you can specify a url to return to after the user has consented to the contract (note: redirect urls must begin with http://
or https://
)
const urlWithRedirect = `https://learncard.app/consent-flow?uri=${contractUri}&returnTo=${redirectUrl}`
6. (optional) Get Listed in LearnCard
If you want your ConsentFlow contract to be displayed in learncard.app/launchpad, please contact LearningEconomy (support@learningeconomy.io) with the uri of your contract
Reading From a ConsentFlow Contract
1. Retrieve the ConsentFlow data for a contract
let data = await networkLearnCard.invoke.getConsentFlowData(contractUri)
This will return paginated records in the form of:
To retrieve the next page of paginated results use
2. Read Credential
Use the credential uri to read the user's credential
3. (optional) Do a little dance
✨💃🪩🕺✨
Last updated