-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: persist keys on disk, closes #145
feat: add test set up
- Loading branch information
1 parent
12bd3bf
commit b7906ae
Showing
39 changed files
with
1,700 additions
and
1,002 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Linting | ||
|
||
on: | ||
push: | ||
branches: ['release/stacking'] | ||
pull_request: | ||
branches: ['release/stacking'] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Build prod | ||
run: yarn build | ||
|
||
- name: Run jest | ||
run: yarn test |
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useState } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { useHistory } from 'react-router'; | ||
import { Input } from '@blockstack/ui'; | ||
|
||
import { Onboarding, OnboardingTitle, OnboardingButton } from '../../components/onboarding'; | ||
import { ErrorLabel } from '../../components/error-label'; | ||
import { ErrorText } from '../../components/error-text'; | ||
import { decryptWallet, selectKeysSlice } from '../../store/keys'; | ||
|
||
export const SignIn: React.FC = () => { | ||
const history = useHistory(); | ||
const dispatch = useDispatch(); | ||
const [password, setPassword] = useState<string | null>(null); | ||
const [hasSubmitted, setHasSubmitted] = useState(false); | ||
const keysState = useSelector(selectKeysSlice); | ||
|
||
const handlePasswordInput = (e: React.FormEvent<HTMLInputElement>) => { | ||
e.preventDefault(); | ||
const pass = e.currentTarget.value; | ||
setPassword(pass); | ||
}; | ||
|
||
const handleSubmit = (e: React.FormEvent) => { | ||
e.preventDefault(); | ||
setHasSubmitted(true); | ||
if (!password) return; | ||
dispatch(decryptWallet({ password, history })); | ||
}; | ||
|
||
return ( | ||
<Onboarding as="form" onSubmit={handleSubmit}> | ||
<OnboardingTitle>Enter your password</OnboardingTitle> | ||
<Input type="password" mt="extra-loose" onChange={handlePasswordInput} /> | ||
{hasSubmitted && keysState.decryptionError && ( | ||
<ErrorLabel> | ||
<ErrorText>Password entered is incorrect</ErrorText> | ||
</ErrorLabel> | ||
)} | ||
<OnboardingButton type="submit" mt="loose" isLoading={keysState.decrypting}> | ||
Continue | ||
</OnboardingButton> | ||
</Onboarding> | ||
); | ||
}; |
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
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
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
Oops, something went wrong.