Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrome ext: validate privkey #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions chrome-extension/src/PrivateKeyForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Default imports
import React, { useState, useEffect } from 'react'
import { InputGroup, FormControl, Button } from 'react-bootstrap'
import bcrypto from 'bcrypto'

// Custom imports
// None
Expand All @@ -17,6 +18,11 @@ const PrivateKeyForm = (props) => {

function handleOnClick () {
const privateKey = state.privateKey
// TODO: handle UX
if (!bcrypto.browser.valid(privateKey)) {
console.error('invalid key');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@yvsssantosh can you use this to show an error message that the key is invalid?

return;
}
chrome.storage.local.set({ privateKey })
props.rerenderParentCallback()
setState({ privateKey: '' })
Expand Down
2 changes: 1 addition & 1 deletion chrome-extension/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ [email protected]:

bcrypto@tuxcanfly/bcrypto#verify:
version "5.1.0"
resolved "https://codeload.github.com/tuxcanfly/bcrypto/tar.gz/ca69a700cfb56be1efac3155ba6b747d322677ad"
resolved "https://codeload.github.com/tuxcanfly/bcrypto/tar.gz/b5cecc95fecb4398411915cb3b6fb8c52373832c"
dependencies:
bufio "~1.0.6"
loady "~0.0.1"
Expand Down