Comments (4)
+1!
from bitcore-message.
+1
from bitcore-message.
I'm working on this now. Would it be best to call a new constructor and let that handle the conversion? The constructor would also throw a TypeError for bad arguments.
Message.prototype.sign = function sign(privateKey) {
privateKey = new PrivateKey(privateKey);
...
}
from bitcore-message.
I'd use PrivateKey.fromString()
and PrivateKey.fromBuffer()
and throw an error early. The code path that is taken within type recognition in PrivateKey (and others) can be unpredictable, and lead to some very strange bugs that are not very clear to what went wrong.
Likewise, it may be better to only accept one type of private key, and have less automatic type handling, for similar reasons. Type handling can be done prior to that and will be more visible and flexible to implementation.
There are multiple was that a private key can be represented as a string, and thus could be better handled prior via using:
var privateKey = bitcore.PrivateKey.fromWIF(someWIF); //wif
// or
var privateKey = bitcore.PrivateKey.fromString(someString); //hexa
from bitcore-message.
Related Issues (11)
- Support uncompress format
- Using with Bitcore HOT 4
- Can't verify testnet signature HOT 10
- Make bitcore-lib a peer dependency
- broken image link at top of readme HOT 2
- Error: More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency. HOT 1
- [REQ] Add Segwit Sign/Verify support HOT 1
- breaks if you use this with bitcore-lib-cash HOT 1
- Uncaught Error: Non-base58 character
- Encryption/Decryption? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitcore-message.