@@ -10,6 +10,7 @@ import { ROUTE_NAMES } from '../lib/router'
10import { DEFAULT_HD_PATH, urbitWalletFromTicket,
10import { DEFAULT_HD_PATH, urbitWalletFromTicket,
11 walletFromMnemonic, addressFromSecp256k1Public } from '../lib/wallet'
11 walletFromMnemonic, addressFromSecp256k1Public } from '../lib/wallet'
12import { BRIDGE_ERROR } from '../lib/error'
12import { BRIDGE_ERROR } from '../lib/error'
13+import { INVITE_STAGES, WALLET_STATES } from '../lib/invite'
13import { generateWallet } from '../lib/invite'
14import { generateWallet } from '../lib/invite'
15const placeholder = (len) => {
16const placeholder = (len) => {
@@ -21,20 +22,6 @@ const placeholder = (len) => {
21 return ob.hex2patq(hex)
22 return ob.hex2patq(hex)
24−const INVITE_STAGES = {
25− INVITE_LOGIN: "invite login",
26− INVITE_WALLET: "invite wallet",
27− INVITE_VERIFY: "invite verify",
28− INVITE_TRANSACTIONS: "invite transactions"
31−const WALLET_STATES = {
32− UNLOCKING: "Unlocking invite wallet",
33− GENERATING: "Generating your wallet",
34− GENERATED: "Wallet generation complete",
35− DOWNLOADED: "Wallet downloaded"
38class InviteLogin extends React.Component {
25class InviteLogin extends React.Component {
40 constructor(props) {
27 constructor(props) {
@@ -46,7 +33,6 @@ class InviteLogin extends React.Component {
46 realPoint: Nothing(),
33 realPoint: Nothing(),
47 realWallet: Nothing(),
34 realWallet: Nothing(),
48 walletReady: false,
35 walletReady: false,
50 stage: INVITE_STAGES.INVITE_LOGIN,
36 stage: INVITE_STAGES.INVITE_LOGIN,
51 walletStates: []
37 walletStates: []
@@ -57,9 +43,16 @@ class InviteLogin extends React.Component {
57 this.handleInviteTicketInput = this.handleInviteTicketInput.bind(this)
43 this.handleInviteTicketInput = this.handleInviteTicketInput.bind(this)
58 this.handleVerifyTicketInput = this.handleVerifyTicketInput.bind(this)
44 this.handleVerifyTicketInput = this.handleVerifyTicketInput.bind(this)
59 this.confirmWalletDownload = this.confirmWalletDownload.bind(this)
45 this.confirmWalletDownload = this.confirmWalletDownload.bind(this)
46+ this.pushWalletState = this.pushWalletState.bind(this)
60 this.navigateLogin = this.navigateLogin.bind(this)
47 this.navigateLogin = this.navigateLogin.bind(this)
50+ pushWalletState(walletState) {
52+ walletStates: this.state.walletStates.concat(walletState)
63 navigateLogin() {
56 navigateLogin() {
64 this.props.popRoute()
57 this.props.popRoute()
65 this.props.pushRoute(ROUTE_NAMES.NETWORK)
58 this.props.pushRoute(ROUTE_NAMES.NETWORK)
@@ -75,13 +68,12 @@ class InviteLogin extends React.Component {
76 confirmWalletDownload() {
69 confirmWalletDownload() {
77 this.setState({
70 this.setState({
78− continueReady: true
71+ walletStates: this.state.walletStates.concat(WALLET_STATES.DOWNLOADED),
82 async unlockInviteWallet(inviteTicket) {
75 async unlockInviteWallet(inviteTicket) {
83 this.setState({
76 this.setState({
84− continueReady: false,
85 walletStates: this.state.walletStates.concat(WALLET_STATES.UNLOCKING),
77 walletStates: this.state.walletStates.concat(WALLET_STATES.UNLOCKING),
86 stage: INVITE_STAGES.INVITE_WALLET
78 stage: INVITE_STAGES.INVITE_WALLET
@@ -172,12 +164,20 @@ class InviteLogin extends React.Component {
172 case INVITE_STAGES.INVITE_WALLET:
164 case INVITE_STAGES.INVITE_WALLET:
175− <h1 className="fs-6 lh-8">Welcome</h1>
167+ <h1 className="fs-6 lh-8 mb-3">Passport</h1>
176 <p>A passport is your digital identity. You will use your passport to access your true computer, send payments, and administer your identity. So naturally, you must keep this secure.</p>
168 <p>A passport is your digital identity. You will use your passport to access your true computer, send payments, and administer your identity. So naturally, you must keep this secure.</p>
177 <p>After you’ve downloaded your passport, back up the ticket manually or store on a trusted device.</p>
169 <p>After you’ve downloaded your passport, back up the ticket manually or store on a trusted device.</p>
173+ case INVITE_STAGES.INVITE_VERIFY:
176+ <h1 className="fs-6 lh-8 mb-3">Verify Passport</h1>
177+ <p>Afer you download your passport, verify your custody. Your passport should be a folder of image files. One of them is your Master Ticket. Open it and enter the 4 word phrase below (with hyphens).</p>
@@ -185,18 +185,27 @@ class InviteLogin extends React.Component {
185 if (this.state.stage === INVITE_STAGES.INVITE_TRANSACTIONS) return null
185 if (this.state.stage === INVITE_STAGES.INVITE_TRANSACTIONS) return null
187 let clickHandler
187 let clickHandler
188− let btnColor
188+ let btnColor = this.state.walletStates.includes(WALLET_STATES.PAPER_READY)
190 switch(this.state.stage) {
193 switch(this.state.stage) {
191 case INVITE_STAGES.INVITE_LOGIN:
194 case INVITE_STAGES.INVITE_LOGIN:
192 clickHandler = () => {
195 clickHandler = () => {
193 this.unlockInviteWallet(this.state.inviteTicket)
196 this.unlockInviteWallet(this.state.inviteTicket)
195− btnColor = "black"
198+ continueReady = true
197− case INVITE_STAGES.INVITE_VERIFY:
198 case INVITE_STAGES.INVITE_WALLET:
200 case INVITE_STAGES.INVITE_WALLET:
199− btnColor = "green"
201+ clickHandler = () => {
203+ stage: INVITE_STAGES.INVITE_VERIFY
206+ continueReady = this.state.walletStates.includes(WALLET_STATES.DOWNLOADED)
208+ case INVITE_STAGES.INVITE_VERIFY:
@@ -205,7 +214,7 @@ class InviteLogin extends React.Component {
205 className={'mt-4'}
214 className={'mt-4'}
206 prop-size={'lg'}
215 prop-size={'lg'}
207 prop-color={btnColor}
216 prop-color={btnColor}
208− disabled={!this.state.continueReady}
217+ disabled={!continueReady}
209 onClick={clickHandler}
218 onClick={clickHandler}
211 { 'Continue →' }
220 { 'Continue →' }
@@ -258,6 +267,7 @@ class InviteLogin extends React.Component {
258 point={this.state.realPoint}
267 point={this.state.realPoint}
259 wallet={this.state.realWallet}
268 wallet={this.state.realWallet}
260 walletStates={this.state.walletStates}
269 walletStates={this.state.walletStates}
270+ pushWalletState={this.pushWalletState}
261 confirmWalletDownload={this.confirmWalletDownload}
271 confirmWalletDownload={this.confirmWalletDownload}