Privy 🛠Intro to Privy
ETHGlobal·Sun, Oct 9, 2022, 12:00 AM
Join Privy for a demo titled, "Intro to Privy." This workshop is part of ETHNewYork 2022, a three-day in person hackathon that will feature hackers, mentors, enthusiasts, sponsors and speakers who are all gathering in New York June 24-26, 2022 to talk about the future of money, finance, the web, ownership, the way software works and the way power is distributed. We're excited about a new frontier. ---------------------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
[Music] privy is the easiest way for developers to integrate user data into their apps without having to take it into their stack or silo it away privy enables you to build delightful products while keeping your users safe and in control of their data using privy you can secure your user's data off chain this could be names emails or even sensitive documents all of this is powered by two simple calls privy get and privy put let's see how easy getting started with privy is imagine we're building equifox an nft marketplace this is our admin dashboard here we can see all of our sellers indexed by their wallet address we're associating some amount of private data to each address we're taking on usernames bios websites the sorts of things we'd want to display on a seller's page along with an email and a phone number maybe so we can reach out whenever there's relevant activity on chain we have a birthday here to get them a special nft on that day and maybe we also want to take on a bank account which you can see right here along with an ssn so we can enable them to get paid out not just in crypto but also in fiat now we know better than to put this data on chain this is obviously private real world data what we've done instead is take on this data and silo postgres on our servers yikes thankfully there's a better way we can use privy to take on ssns here without having to put our user data at risk compromise their data sovereignty or write a single line of back-end code i'll show you how let's do this in a couple simple steps to start let me log into my privy console the console is a gui on top of the api where i can manage my data schemas what data i want to take on as well as my data permissions who can access what data i'm gonna go to my settings right now to get my api keys for use of the preview browser client the browser client is an open source node package i can use to interact with the api from the user's browser directly hold on while i copy my api key and secret into my app alright we're ready to code we'll come back to the console later the page here on the right is a simple react app it runs the echo fox admin dashboard you can see on the left to start i'll just add an ssn field here you can see it appear on the admin dashboard we're ready to integrate preview into our app the first line of code i'll copy imports the preview browser client the privy client is going to fetch the appropriate user encryption keys to encrypt user data in the browser directly the data is encrypted and then the cipher text is sent up to the data store no private data ever leaves the browser unencrypted next i'm going to copy the privy put call this makes it so when i click the save button down here data gets saved to the data store here it is now what do we have here this call says to associate a field called ssn to this user id in this case the user wallet and to pull in the appropriate value from the admin dashboard the last thing i want to do is update my schema in the privy data store to tell it i'm going to take on a new piece of data in this case an ssn so now we can come back to our console here we can see a list of all the fields my app can take on i'll just go ahead and create a new field the ssn and i'll add the description here it's the user social i can give it a permission access group here i'll pick the admin group admin self access groups determine who has read and write access to a given piece of data in this case data in the admin self access group can be read and written both by self the user whose data this is and by admin the developer me in this case we have no data in the user data store yet as you can see but from here we can go back to our app enter an ssn click save and going back to the preview console we now see our users ssn in question now if i reload my app here you can see the ssn disappears and that's because we're currently trying to pull data in from our captive db not pretty we've sent data up to our private data store we now need to pull it down this is where privy dot get will come in handy coming back to my react app i can just add the call we ask for this user's ssn and set it in our ui here and here here we go you can see the ssn appear back in the admin dashboard awesome so with three simple lines of code importing the client privy put to encrypt and store data privy get to retrieve and decrypt it i've taken on user data into my web3 app without writing one line of back end code or adding any data to my db no data itself ever leaves the client unencrypted privy can never see any of now in the preview console we can see the data admin has access to but why would we want to see a user's ssn maybe we intend to give docusign or third party crypto offramp access to it with the user's consent but we certainly don't want to look at it so here i can just go back to the console and change the default access group for ssns to self for instance and voila the ssn is now only available to the user themselves and no longer available to the developer that's how easy it is to change permissions in privy so here you have it a relatively simple example of how we can use privy to take on sensitive data but prove you can do so much more privy is really the easiest way for you to take on user data for your app it's simple fast and private you can use privy as a secure data store so you can associate user preferences to their wallets and have them persist across browsers and devices you can associate user emails to their wallets to send them emails without ever looking at personal identifiers you can create richer user profiles privately link user wallets together across chains and so much more using privy thanks for watching and get your api keys at privy.i o so you can build better products with safer data
Automatic transcript — names and jargon may be misspelled.