Last active
November 14, 2018 18:15
-
-
Save zgorizzo69/1476a7dfbaa2510582918d02a6de4b9f to your computer and use it in GitHub Desktop.
blockstack authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Every app that uses multi-player storage must add itself to the user's profile.json file. | |
The Blockstack Browser will handle this part automatically when the publish_data scope is requested during authentication. | |
to read a another user file, you just need to call getFile with the appropriate options: | |
const options = { username: username, decrypt: false, zoneFileLookupURL: 'https://core.blockstack.org/v1/names/'} | |
getFile(statusFileName, options) | |
*/ | |
signIn() { | |
const origin = window.location.origin; | |
blockstack.redirectToSignIn(origin, origin + '/manifest.json', ['store_write', 'publish_data']); | |
} | |
signOut() { | |
blockstack.signUserOut(window.location.origin); | |
console.log('sign out'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment