digitalbitbox / bitbox02-api-js Goto Github PK
View Code? Open in Web Editor NEWBitBox02 JavaScript library
License: Other
BitBox02 JavaScript library
License: Other
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.
But btcDisplayAddressSimple does...
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?
Simply put, this is the call causing issues:
const BTC_BECH32_1ST_ADDRESS_PATH = "m/84'/0'/0'/0/0";
return this.client.btcDisplayAddressSimple(
constants.messages.BTCCoin.BTC,
BTC_BECH32_1ST_ADDRESS_PATH,
constants.messages.BTCScriptConfig_SimpleType.P2WPKH,
);
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.
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!
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?
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?
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)
Since 8.0.0 the previous tx of each input must be streamed. The JS package and demo need to be fixed up for this.
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.
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?
You can run the sandbox demo using:
make builddemo
make servedemo
The demo code lives in sandbox/
.
This subproject is messy:
make builddemo
takes minutes because it webpacks the big bitbox02-api-jsIt 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.