Comparing version 2.0.0 to 2.0.1
@@ -1,2 +0,2 @@ | ||
import { getKeyPair, getStarkKey, sign } from '../../src/utils/ellipticCurve'; | ||
import { getKeyPair, getStarkKey, sign, verify, ec } from '../../src/utils/ellipticCurve'; | ||
import { removeHexPrefix } from '../../src/utils/encode'; | ||
@@ -51,1 +51,13 @@ import { hashCalldata, hashMessage, pedersen } from '../../src/utils/hash'; | ||
}); | ||
test('verify signed message()', () => { | ||
const pk = '0x019800ea6a9a73f94aee6a3d2edf018fc770443e90c7ba121e8303ec6b349279'; | ||
const account = '0x33f45f07e1bd1a51b45fc24ec8c8c9908db9e42191be9e169bfcac0c0d99745'; | ||
const price = '1'; | ||
const hashMsg = pedersen([account, price]); | ||
const keyPair = getKeyPair(pk); | ||
const signature = sign(keyPair, removeHexPrefix(hashMsg)); | ||
const pubKey = keyPair.getPublic('hex'); | ||
const pubKeyPair = ec.keyFromPublic(pubKey, 'hex'); | ||
expect(verify(pubKeyPair, removeHexPrefix(hashMsg), signature)).toBe(true); | ||
}); |
@@ -0,1 +1,7 @@ | ||
## [2.0.1](https://github.com/seanjameshan/starknet.js/compare/v2.0.0...v2.0.1) (2021-11-18) | ||
### Bug Fixes | ||
- msgHash length fix in signature verify function ([589b126](https://github.com/seanjameshan/starknet.js/commit/589b126b2b87bf7d0b2730f53a40ee2d9ef9aca0)) | ||
# [2.0.0](https://github.com/seanjameshan/starknet.js/compare/v1.7.0...v2.0.0) (2021-11-18) | ||
@@ -26,4 +32,10 @@ | ||
- add invokeFunction ([7e04b5e](https://github.com/seanjameshan/starknet.js/commit/7e04b5ec383fa6d466e9e06d9fa02e2d0c36b020)) | ||
- add signer and provider v1 ([909fdc0](https://github.com/seanjameshan/starknet.js/commit/909fdc0b2b211755b9124b62f97476d89b655de1)) | ||
- # add signer and provider v1 ([909fdc0](https://github.com/seanjameshan/starknet.js/commit/909fdc0b2b211755b9124b62f97476d89b655de1)) | ||
## [1.5.5](https://github.com/seanjameshan/starknet.js/compare/v1.5.4...v1.5.5) (2021-11-13) | ||
### Bug Fixes | ||
- msgHash length fix in signature verify function ([589b126](https://github.com/seanjameshan/starknet.js/commit/589b126b2b87bf7d0b2730f53a40ee2d9ef9aca0)) | ||
## [1.5.4](https://github.com/seanjameshan/starknet.js/compare/v1.5.3...v1.5.4) (2021-11-05) | ||
@@ -30,0 +42,0 @@ |
@@ -87,4 +87,4 @@ "use strict"; | ||
(0, number_1.assertInRange)(w, constants_1.ONE, (0, number_1.toBN)((0, encode_1.addHexPrefix)(constants_1.MAX_ECDSA_VAL)), 'w'); | ||
return keyPair.verify(msgHash, sig); | ||
return keyPair.verify(fixMessage(msgHash), sig); | ||
} | ||
exports.verify = verify; |
{ | ||
"name": "starknet", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "JavaScript library for StarkNet", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -59,10 +59,21 @@ <!-- logo --> | ||
## Contributing | ||
## đ Powered by Starknet.js | ||
- [Argent X - the first StarkNet wallet](https://github.com/argentlabs/argent-x) | ||
- [React + Starknet.js boilerplate](https://github.com/fracek/starknet-react-example) | ||
## âī¸ Contributing | ||
If you consider to contribute to this project please read [CONTRIBUTING.md](https://github.com/seanjameshan/starknet.js/blob/main/CONTRIBUTING.md) first. | ||
## License | ||
## â¤ī¸ Special Thanks | ||
Special thanks to all the [contributors](https://github.com/seanjameshan/starknet.js/graphs/contributors), and especially Janek ([@janek26](https://github.com/janek26)) from [Argent](https://github.com/argentlabs) for driving the development of Starknet.js. | ||
This library would not be possible without these rockstars. | ||
## đ License | ||
Copyright (c) 2021 Sean James Han | ||
Licensed under the [MIT license](https://github.com/seanjameshan/starknet.js/blob/main/LICENSE). |
@@ -91,3 +91,3 @@ import { ec as EC, curves } from 'elliptic'; | ||
return keyPair.verify(msgHash, sig); | ||
return keyPair.verify(fixMessage(msgHash), sig); | ||
} |
@@ -141,4 +141,4 @@ 'use strict'; | ||
); | ||
return keyPair.verify(msgHash, sig); | ||
return keyPair.verify(fixMessage(msgHash), sig); | ||
} | ||
exports.verify = verify; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5348053
138960
79