Home Update JavaScript dapps: Public and personal information on Blockstack

JavaScript dapps: Public and personal information on Blockstack

243


Over the previous couple of weeks we’ve constructed up a decentralized utility with Blockstack that permits you to create and save net utility snippets. So far, these snippets have been saved privately to your personal private storage. Not even the creator of the app can entry them! But the net is about collaboration, too, so we have to incorporate the power to make snippets publicly obtainable.

In order to make use of among the extra subtle options of Blockstack persistence in our utility, we’ll must request permission to take action from the person. This is a security immediate you’re most likely used to seeing when utilizing federated authentication and authorization. It will appear like this:

blockstack select idIDG

You could not discover a distinction from our present blockstack log-in immediate, however if you happen to look extra intently, you’ll see that “publish data stored for this app” is a brand new permission we’re requesting.

In order to make this request, we merely must specify that we wish the publish_data scope when redirecting to the Blockstack log-in. Scopes are the primary argument of the AppConfig object in Blockstack.js, so our new log-in code would require solely a one-line change:

const appConfig = new blockstack.AppConfig(
    ['store_write', 'publish_data'],
    undefined,
    '/callback',
  );
  const userSession = new blockstack.UserSession({ appConfig })
  userSession.redirectToSignIn();



Source hyperlink

LEAVE A REPLY

Please enter your comment!
Please enter your name here