Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Add support to browser for gaiahub and keyfiles #833

Closed
wants to merge 33 commits into from

Conversation

kantai
Copy link
Collaborator

@kantai kantai commented Sep 28, 2017

Okay -- here's some instructions for getting this running with blockstack-core, browser, and blockstack todos using docker containers:

Get these repos:

git clone https://github.com/blockstack/blockstack-browser -b feature/multi-reader-storage
git clone https://github.com/blockstack/blockstack-core -b feature/multi-reader-storage
git clone https://github.com/kantai/blockstack-todos -b feature/multi-reader-storage

Now -- build your containers:

cd blockstack-browser && docker build . -f Dockerfile.keyfile.sources --tag browser:multi-reader-storage
cd ../blockstack-core && docker build . -f integration_tests/deployment/docker/Dockerfile.tests --tag blockstack-core:multi-reader-storage
cd ../blockstack-todos && docker build . --tag todos:multi-reader-storage

Now, run your containers:

docker run -dt --name blockstack-core-multi-reader -p 6270:6270 -e BLOCKSTACK_TEST_CLIENT_RPC_PORT=6270 -e BLOCKSTACK_TEST_CLIENT_BIND=0.0.0.0 blockstack-core:multi-reader-storage blockstack-test-scenario --interactive 2 blockstack_integration_tests.scenarios.portal_test_env
docker run -d --name blockstack-todos-multi-reader -p 5000:5000 -e BSK_TODOS_PORT=5000 -e BSK_TODOS_BINDADDR=0.0.0.0 todos:multi-reader-storage npm run start
docker run -d --name blockstack-browser-multi-reader -p 8888:8888 browser:keyfile blockstack-browser
docker run -d --name blockstack-cors-multi-reader -e CORSPROXY_HOST="0.0.0.0" -p 1337:1337 browser:multi-reader-storage blockstack-cors-proxy

Open your browser to localhost:8888, make a profile, etc. and use blockstack-todos from localhost:5000

This works for me in regtest (and mainnet without a username) -- would be good to get other people testing this out as well.

See (now closed) PRs #739 #808

jcnelson and others added 30 commits September 10, 2017 17:56
…d signing key, which will be used to generate key files for profiles.
…der datastore for the application for the given account, and (2) will re-generate the account's profile to add/update the key file with the datastore's routing information.
…r has a blockchain ID, create a multi-reader datastore and update the user's profile's keyfile with the datastore's routing information. Upload the profile to the user's storage providers, and update the locally-cached profile state to reflect the newly-created profile.
…locktack.js + fix dockerfile and add support to select gaiahub as an allowed driver
@kantai kantai added the feature label Sep 28, 2017
@CLAassistant
Copy link

CLAassistant commented Sep 28, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ kantai
✅ jcnelson
❌ larrysalibra
You have signed the CLA already but the status is still pending? Let us recheck it.

This was referenced Sep 28, 2017
Copy link
Collaborator

@larrysalibra larrysalibra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! I made a few style comments. Given our tight timeline, I think we can get way with leaving the asserts for the moment - I'll open an issue to clean them up in the future. I'll clean up the lint during my testing. Thanks for all of your hard work on this @jcnelson @kantai and @jackzampolin !

import { signProfileForUpload } from './index'

import { keyFileCreate, keyFileParse, keyFileProfileSerialize, keyFileUpdateApps, keyFileMakeDelegationPrivateKeys, keyFileICANNToAppName, getPubkeyHex, datastoreMountOrCreate } from 'blockstack'
const jsontokens = require('jsontokens')
const assert = require('assert')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the assert package is for unit testing and isn't intended to be used in shipped code: see https://www.npmjs.com/package/assert

@@ -143,15 +146,20 @@ function profileInsertStorageRoutingInfo(profile, driverName, indexUrl) {
export function setCoreStorageConfig(api,
blockchainId = null, profile = null, profileSigningKeypair = null) {
return new Promise((resolve, reject) => {
var driverName = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of lint here. can we clean this up?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll clean it up during testing.


assert(deviceId, 'Invalid session: missing device ID')
assert(appName, 'Invalid session: missing application name')
assert(datastoreId, 'Invalid session: missing datastore ID')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better way to handle this than using assert is to check for the value and if it is missing, log a useful error message and reject() the promise.

accountCreated: !!this.props.encryptedBackupPhrase,
storageConnected: !!this.props.dropboxAccessToken,
coreConnected: !!this.props.api.coreAPIPassword,
accountCreated: this.props.encryptedBackupPhrase ? true : false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes introduce lint and break the automated test suite. (npm run test tests for lint in files that were previously verified as lint-free)

@kantai
Copy link
Collaborator Author

kantai commented Sep 28, 2017

I made a few style comments.

Thanks! I'll be sure my javascript lints okay in the future.

@jackzampolin
Copy link
Contributor

I have this is working for both no username and for users with names.

@larrysalibra
Copy link
Collaborator

Moving this to backlog - it's on hold for a while.

@larrysalibra
Copy link
Collaborator

larrysalibra commented Dec 15, 2017

@kantai I'm going to close this pull request since we're going with the apps write directly to gaia hubs and light weight multi-reader storage approaches. If it should stay open, please re-open!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants