parent
57882825a5
commit
be75a54a53
@ -0,0 +1,48 @@ |
||||
<!-- |
||||
!!! |
||||
REMOVE EVERYTHING WRITTEN IN UPPERCASE BEFORE YOU CLICK SUBMIT |
||||
!!! |
||||
--> |
||||
|
||||
<!-- IMPORTANT: |
||||
If you have a common question which cannot be solved with a PR, |
||||
DO NOT CREATE AN ISSUE! |
||||
You can go here these to ask for help: |
||||
- https://www.reddit.com/r/ethdev/ |
||||
- https://gitter.im/ethereum/web3.js |
||||
--> |
||||
|
||||
<!-- DID YOU KNOW? |
||||
Over 50% of our bug-issues are not bugs. |
||||
When you reproduce the bug in our bug-template |
||||
you do not have to wait for the maintainers answer |
||||
and very likely solve your problem in the next 15 minutes. |
||||
https://github.com/pubkey/eth-crypto/blob/master/test/bug-template.test.js |
||||
--> |
||||
|
||||
## Case |
||||
<!-- IS IT A BUG OR A REQUEST FOR A NEW FEATURE OR SOMETHING ELSE? --> |
||||
|
||||
## Issue |
||||
<!-- DESCRIBE WHY YOU OPEN THIS ISSUE --> |
||||
|
||||
## Info <!-- ONLY NEEDED FOR BUGS --> |
||||
- Environment: (Node.js/browser/electron/etc..) |
||||
- Adapter: (IndexedDB/Localstorage/LevelDB/etc..) |
||||
- Stack: (Typescript, Babel, Angular, React, etc..) |
||||
|
||||
## Code |
||||
|
||||
```js |
||||
const messageHash = EthCrypto.hash.keccak256(message); |
||||
const signature = EthCrypto.sign(testData.privateKey, messageHash); |
||||
/* ... */ |
||||
``` |
||||
|
||||
<!-- |
||||
IF YOU HAVE A BUG, WRITE CODE HERE TO REPRODUCE IT. |
||||
BUGS WONT BE TOUCHED BY THE MAINTAINER UNTIL THERE IS SOME CODE! |
||||
|
||||
OPTIMALLY YOU SHOULD ADD A PULL-REQUEST WHICH REPRODUCES THE BUG |
||||
BY MODIFYING THIS FILE: https://github.com/pubkey/eth-crypto/blob/master/test/bug-template.test.js |
||||
--> |
@ -0,0 +1,27 @@ |
||||
const AsyncTestUtil = require('async-test-util'); |
||||
const assert = require('assert'); |
||||
const EthCrypto = require('../dist/lib/index'); |
||||
|
||||
/** |
||||
* If you have found a bug, edit this test to reproduce it |
||||
* You can run it with: 'npm run test:node' |
||||
* If you have successfully reproduced it, make a pull request with this file |
||||
*/ |
||||
describe('bug-template.test.js', () => { |
||||
it('should reproduce the bug', () => { |
||||
const testData = { |
||||
address: '0x3f243FdacE01Cfd9719f7359c94BA11361f32471', |
||||
privateKey: '0x107be946709e41b7895eea9f2dacf998a0a9124acbb786f0fd1a826101581a07', |
||||
publicKey: 'bf1cc3154424dc22191941d9f4f50b063a2b663a2337e5548abea633c1d06eceacf2b81dd326d278cd992d5e03b0df140f2df389ac9a1c2415a220a4a9e8c046' |
||||
}; |
||||
|
||||
// do things with eth-crypto
|
||||
const message = AsyncTestUtil.randomString(12); |
||||
const messageHash = EthCrypto.hash.keccak256(message); |
||||
const signature = EthCrypto.sign(testData.privateKey, messageHash); |
||||
|
||||
// assert things that should be ok
|
||||
assert.equal(typeof signature, 'string'); |
||||
assert.ok(signature.length > 10); |
||||
}); |
||||
}); |
Loading…
Reference in new issue