conseiljs-softsigner
Advanced tools
Comparing version 5.0.3 to 5.0.4-beta.0
@@ -20,2 +20,3 @@ /// <reference types="node" /> | ||
function checkTextSignature(signature: string, message: string, publicKey: string, prehash?: boolean): Promise<boolean>; | ||
function checkSignature(signature: string, bytes: Buffer, publicKey: string): Promise<boolean>; | ||
} |
@@ -20,2 +20,3 @@ "use strict"; | ||
const bip39 = __importStar(require("bip39")); | ||
const secp256k1 = __importStar(require("secp256k1")); | ||
const conseiljs_1 = require("conseiljs"); | ||
@@ -109,9 +110,36 @@ const conseiljs_2 = require("conseiljs"); | ||
} | ||
const sig = conseiljs_2.TezosMessageUtils.writeSignatureWithHint(signature, 'edsig'); | ||
const pk = conseiljs_2.TezosMessageUtils.writeKeyWithHint(publicKey, 'edpk'); | ||
return yield CryptoUtils_1.CryptoUtils.checkSignature(sig, messageBytes, pk); | ||
return checkSignature(signature, messageBytes, publicKey); | ||
}); | ||
} | ||
KeyStoreUtils.checkTextSignature = checkTextSignature; | ||
function checkSignature(signature, bytes, publicKey) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const sigPrefix = signature.slice(0, 5); | ||
const keyPrefix = publicKey.slice(0, 4); | ||
let curve = conseiljs_1.SignerCurve.ED25519; | ||
if (sigPrefix === 'edsig' && keyPrefix === 'edpk') { | ||
curve = conseiljs_1.SignerCurve.ED25519; | ||
} | ||
else if (sigPrefix === 'spsig' && keyPrefix === 'sppk') { | ||
curve = conseiljs_1.SignerCurve.SECP256K1; | ||
} | ||
else if (sigPrefix === 'p2sig' && keyPrefix === 'p2pk') { | ||
throw new Error('secp256r1 curve is not currently supported'); | ||
} | ||
else { | ||
throw new Error(`Signature/key prefix mismatch ${sigPrefix}/${keyPrefix}`); | ||
} | ||
const sig = conseiljs_2.TezosMessageUtils.writeSignatureWithHint(signature, sigPrefix); | ||
const pk = conseiljs_2.TezosMessageUtils.writeKeyWithHint(publicKey, keyPrefix); | ||
if (curve === conseiljs_1.SignerCurve.ED25519) { | ||
return yield CryptoUtils_1.CryptoUtils.checkSignature(sig, bytes, pk); | ||
} | ||
if (curve === conseiljs_1.SignerCurve.SECP256K1) { | ||
return secp256k1.ecdsaVerify(sig, bytes, pk); | ||
} | ||
return false; | ||
}); | ||
} | ||
KeyStoreUtils.checkSignature = checkSignature; | ||
})(KeyStoreUtils = exports.KeyStoreUtils || (exports.KeyStoreUtils = {})); | ||
//# sourceMappingURL=KeyStoreUtils.js.map |
{ | ||
"name": "conseiljs-softsigner", | ||
"version": "5.0.3", | ||
"version": "5.0.4-beta.0", | ||
"description": "ConseilJS software signer plugin for ConseilJS-core. Supports the ED25519 curve via libsodium for tz1-address operations.", | ||
@@ -67,14 +67,14 @@ "browser": "dist/index.js", | ||
"bip39": "3.0.2", | ||
"conseiljs": "5.0.3", | ||
"conseiljs": "5.0.5", | ||
"generate-password": "1.5.1", | ||
"libsodium-wrappers-sumo": "0.7.6" | ||
"libsodium-wrappers-sumo": "0.7.8", | ||
"secp256k1": "4.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "4.2.11", | ||
"@types/chai-as-promised": "7.1.2", | ||
"@types/mocha": "7.0.2", | ||
"@types/chai": "4.2.12", | ||
"@types/chai-as-promised": "7.1.3", | ||
"@types/mocha": "8.0.3", | ||
"@types/nock": "11.1.0", | ||
"@types/node": "14.0.13", | ||
"@typescript-eslint/eslint-plugin": "3.2.0", | ||
"@typescript-eslint/parser": "3.2.0", | ||
"@typescript-eslint/parser": "4.3.0", | ||
"awesome-typescript-loader": "5.2.1", | ||
@@ -85,18 +85,12 @@ "chai": "4.2.0", | ||
"coveralls": "3.1.0", | ||
"eslint": "7.2.0", | ||
"eslint-config-airbnb-base": "14.2.0", | ||
"eslint-plugin-import": "2.21.2", | ||
"mocha": "7.2.0", | ||
"eslint": "7.10.0", | ||
"mocha": "8.1.3", | ||
"nyc": "15.1.0", | ||
"request-promise": "4.2.5", | ||
"terser-webpack-plugin": "3.0.3", | ||
"ts-loader": "7.0.5", | ||
"ts-node": "8.10.2", | ||
"tsconfig-paths-webpack-plugin": "3.2.0", | ||
"typedoc": "0.17.7", | ||
"typedoc-plugin-markdown": "2.3.1", | ||
"tsconfig-paths-webpack-plugin": "3.3.0", | ||
"typedoc": "0.17.8", | ||
"typescript": "3.8.3", | ||
"webpack": "4.43.0", | ||
"webpack-cli": "3.3.11", | ||
"webpack-node-externals": "1.7.2" | ||
"webpack": "4.44.2", | ||
"webpack-cli": "3.3.12" | ||
}, | ||
@@ -103,0 +97,0 @@ "engines": { |
@@ -51,3 +51,3 @@ # ConseilJS-softsigner | ||
<script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs-softsigner/dist-web/conseiljs-softsigner.min.js" | ||
integrity="sha384-V1iaajn0x/SMFcZ9Y/xNQmqQSKyll6Dzt27U6OWiv8NdbHTVaHOGHdQ8g0G68HPd" | ||
integrity="sha384-sv6LkGbuz78mVckOK+Fhy/wJXzO/5Bmo/SDp+l+/yrjlgasQ+3rOKZxXGvIDQsKN" | ||
crossorigin="anonymous"></script> | ||
@@ -54,0 +54,0 @@ <script> |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
46497
21
412
5
1
+ Addedsecp256k1@4.0.2
+ Addedbn.js@4.12.1(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedconseiljs@5.0.5(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedlibsodium-sumo@0.7.15(transitive)
+ Addedlibsodium-wrappers-sumo@0.7.8(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addednode-addon-api@2.0.2(transitive)
+ Addednode-gyp-build@4.8.4(transitive)
+ Addedsecp256k1@4.0.2(transitive)
- Removedconseiljs@5.0.3(transitive)
- Removedlibsodium-sumo@0.7.6(transitive)
- Removedlibsodium-wrappers-sumo@0.7.6(transitive)
Updatedconseiljs@5.0.5