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

Commit

Permalink
App is working
Browse files Browse the repository at this point in the history
The app is now stable, however device registration is still error-prone
These are crypto errors pertaining to RLP encoding and possibly the
way I'm generating private keys
  • Loading branch information
alex-miller-0 committed Aug 7, 2017
1 parent be0a524 commit 728fc09
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 25 deletions.
12 changes: 5 additions & 7 deletions Components/LaunchScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default class LaunchScreen extends Component {
registry_addr: null,
}

/*componentDidMount() {
componentDidMount() {
const { navigation } = this.props;
const { navigate } = navigation;
const { params } = navigation.state;
const params = navigation.state.params || {};
this.state.navigate = navigate;
Keys.getAddress()
.then((addr) => {
Expand All @@ -53,15 +53,13 @@ export default class LaunchScreen extends Component {
(params.enter_phrase === false && (!params.seed_written || !params.double_check))
)
) {
x=1
//navigate('Setup', params)
navigate('Setup', params)
}
else if (!this.state.s || !this.state.device_addr) {
//navigate('RegisterDevice', params)
x=2
navigate('RegisterDevice', params)
}
})
}*/
}

//openDevices() { this.state.navigate('Devices') }

Expand Down
27 changes: 16 additions & 11 deletions Components/Screens/SetupScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,29 @@ export default class RegisterScreen extends Component {
renderProceed() {
if (!this.state.seed_written) {
return (
<Button onPress={() => {
this.state.seed_written = true;
this.forceUpdate();
}}>
I have written this down
</Button>
<Button
title="I have written this down"
onPress={() => {
this.state.seed_written = true;
this.forceUpdate();
}}
/>
);
} else if (!this.state.double_check) {
return (
<View style={{ 'marginTop': 30}}>
<Text style={Styles.centerBoldText}>We're not kidding, you really need to write this down. We can't help you if you lose it.</Text>
<Button onPress={() => { this.state.double_check = true; this.forceUpdate(); }}>
<Button
title="I promise I have written it down"
onPress={() => { this.state.double_check = true; this.forceUpdate(); }}>
I promise I have written it down
</Button>
</View>
);
} else {
this.props.navigation.navigate('RegisterDevice');
this.state.seed_written = true;
this.state.double_check = true;
return;
}
}

Expand All @@ -69,7 +74,7 @@ export default class RegisterScreen extends Component {
Your secret backup phrase
</Text>
<View style={{'marginTop': 50, 'backgroundColor': '#1a1a1a', 'marginRight': 10, 'marginLeft': 10, 'borderRadius': 10}}>
<Text style={styles.sectionText}>
<Text style={{textAlign: 'center', color: 'white'}}>
{this.state.m}
</Text>
</View>
Expand Down Expand Up @@ -179,10 +184,10 @@ export default class RegisterScreen extends Component {
)
} else if (params.enter_phrase && params.phrase_matches == false) {
return this.renderEnterPhrase()
} else if (!params.enter_phrase && (!params.seed_written || !params.double_check)) {
} else if (!params.enter_phrase && (!this.state.seed_written || !this.state.double_check)) {
return this.renderBackupPhrase()
} else {
navigate('RegisterDevice')
this.props.navigation.navigate('LaunchScreen');
}
}

Expand Down
1 change: 1 addition & 0 deletions Components/Util/Fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function write(path, data, encoding) {

function read(path) {
return new Promise((resolve, reject) => {
console.log('bas_dir', ifs.DocumentDirectoryPath)
ifs.exists(path)
.then((exists) => {
if (exists) { return ifs.readFile(path) }
Expand Down
2 changes: 1 addition & 1 deletion Components/Util/Keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function generateKey() {
}

function hash(s) {
sha3(s)
return sha3(s)
}

// See if a key exists. Returns the mnemonic or null
Expand Down
6 changes: 3 additions & 3 deletions Navigation/AppNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ let init_route = 'LaunchScreen';
// Manifest of possible screens
const PrimaryNav = StackNavigator({
LaunchScreen: { screen: LaunchScreen },
// Devices: { screen: DevicesScreen },
// Setup: { screen: SetupScreen },
// RegisterDevice: { screen: RegisterDeviceScreen },
Devices: { screen: DevicesScreen },
Setup: { screen: SetupScreen },
RegisterDevice: { screen: RegisterDeviceScreen },
}, {
// Default config for all screens
headerMode: 'none',
Expand Down
29 changes: 26 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"ethjs-signer": "^0.1.1",
"events": "^1.1.1",
"https-browserify": "0.0.1",
"js-sha3": "^0.6.1",
"path-browserify": "0.0.0",
"process": "^0.11.10",
"react": "16.0.0-alpha.12",
Expand All @@ -34,6 +35,7 @@
"react-navigation": "^1.0.0-beta.11",
"readable-stream": "^1.0.33",
"rlp": "^2.0.0",
"stream": "0.0.2",
"stream-browserify": "^1.0.0",
"url": "^0.10.3",
"vm-browserify": "0.0.4"
Expand Down

0 comments on commit 728fc09

Please sign in to comment.