GithubHelp home page GithubHelp logo

digitalbitbox / bitbox02-api-js Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 9.0 8.66 MB

BitBox02 JavaScript library

License: Other

Dockerfile 0.55% Makefile 0.23% Go 20.16% JavaScript 71.27% CSS 4.89% HTML 2.90%

bitbox02-api-js's People

Contributors

benma avatar briancraig avatar stadicus avatar thisconnect avatar tomasvrba avatar x1ddos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitbox02-api-js's Issues

Signing a message with Bitcoin address?

Bity SA would love to support BitBox02, but it appears only message signing is possible with Ethereum. Does BitBox02 have the ability to do message signing for Bitcoin addresses? Really this is a huge blocker for us. We use it as a way to verify users own the wallet address.

Warn users of Browsers that block the Bridge when Bridge is attempted to be used

MyEtherWallet/MyEtherWallet#3636
safari blocks the mixed content even if the target is localhost (where using http is reasonable), only possible avenue would be switching to webHID if possible (iirc it isnt tho), or use a different browser
MyEtherWallet/MyEtherWallet#3338
Browsers with tracking protections, such as brave might block requests from public Websites to localhost, notably Brave.
Main Solutions are either changing to WebUSB or alternatively turning off the protection for the given site(s)

react-native compatibility

I was already expecting while reading the README.md that I won't be lucky with react-native.

But I tried the sample integration and already hit the first error that happens somewhere here: bitbox02-api-go.js:

ERROR Error: runtime error: makeslice: len out of range

Is react-native compatibility planned or do you suggest including a webview as a workaround?

React build takes very long

Adding the bitbox02-api package to a React project (created with create-react-app) has drastically increased the build time, from under 2 minutes to 20-30 minutes (using a Github workflow).

Any ideas on how to speed up the build?

WebHID dialog shows no devices after the device connected to the BitBoxApp

  1. Open sandbox in Chrome. Click 'Run demo'. The dialog should show a BitBox02. Cancel the process.
  2. Open the BitBoxApp, have it get a BitBox02 connection. Close the BitBoxApp.
  3. Try step 1 again. No devices are shown anymore. Reloading the page doesn't help. Only reconnecting the BitBox02 seems to help.

What could be going wrong here? It is a bad user experience and could be responsible for some of the user reports about not being able to connect.

Get the last unused address from an xpub key

It would be very useful to request from the wallet the next unused address from an xpub key derivation. Otherwise the only other way to request the wallet do something is with the first account using the first address. Maybe the BitBoxBridge can query a blockchain explorer which BitBox owns?

Error after inactivity

Hi, some of our users (https://adalite.io) are reporting getting the following error after some time of inactivity in the app originating from this library:

Error: runtime error: cannot block in JavaScript callback, fix by wrapping code in goroutine
  at $callDeferred(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:4:22730)
  at $panic(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:4:23334)
  at AR(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:8:6488)
  at $block(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:4:24776)
  at $send(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:4:25163)
  at Object.push.5824.$packages.bitbox02-api-js.AL.ptr.OnRead(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:90:39864)
  at Object.e.$externalizeWrapper.e.$externalizeWrapper(./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:4:29372)
  at ? (./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:6:4331)
  at Object.e.$externalizeWrapper.e.$externalizeWrapper [as OnRead](./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js:4:29372)
  at onMessage(./app/node_modules/bitbox02-api/lib/bitbox02.js:391:1)
  at HIDDevice.onInputReport(./app/node_modules/bitbox02-api/lib/bitbox02.js:310:1)

Do you know what can be causing it and how to prevent that from happening? Is that possibly something that needs to be addressed in the library itself?

Invalid Input error when btcSignSimple

Error detail: {ErrorType: 'firmware', Code: 101, Message: 'invalid input'}

And I find the AsyncBTCSignSimple in gowrapper main file call the BTCSign like this:

	go func() {
		theInputs, theOutputs, err := convertInputsAndOutputs(inputs, outputs)
		if err != nil {
			done(nil, toJSError(err))
			return
		}
		signatures, err := device.device.BTCSign(
			coin,
			[]*messages.BTCScriptConfigWithKeypath{{
				ScriptConfig: firmware.NewBTCScriptConfigSimple(simpleType),
				Keypath:      keypathAccount,
			}},
			&firmware.BTCTx{
				Version:  version,
				Inputs:   theInputs,
				Outputs:  theOutputs,
				Locktime: locktime,
			},
		)
		done(signatures, toJSError(err))
	}()

The BTCSign function call miss a param named formatUnit that may be result in errors.

Why btcDisplayAddressSimple doesn't return the address?

The documentation says btcDisplayAddressSimple will display the address on the device, but why not also return it to the caller? Otherwise I have to include extra code to derive the address after obtaining the xpub from calling btcXPub.

I imagine there is probably some explanation for this design, but I think it should be reconsidered!

turn the sandbox demo into a react project

You can run the sandbox demo using:

make builddemo
make servedemo

The demo code lives in sandbox/.

This subproject is messy:

  • it does manual DOM manipulation
  • make builddemo takes minutes because it webpacks the big bitbox02-api-js
  • there is no hot reloading
  • hard to maintain, hard to read

It would be great to turn it into a react project with nice components. Webpack should also be configured to do code splitting, so the big bitbox02-api-js is not bundled in the main bundle but copied to a separate one. Here is a commit in adalite that does the same: vacuumlabs/adalite@aa2a8f9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.