ismx-nexo-node-app 0.4.198 → 0.4.199
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -103,10 +103,9 @@ class CryptoUtils {
|
|
|
103
103
|
*/
|
|
104
104
|
static verify(challenge, signature, key, format = 'base64') {
|
|
105
105
|
try {
|
|
106
|
-
const pemKey = `-----BEGIN PUBLIC KEY-----\n${key.match(/.{1,64}/g).join('\n')}\n-----END PUBLIC KEY-----`;
|
|
107
106
|
const verifier = (0, node_crypto_2.createVerify)('sha256');
|
|
108
107
|
verifier.update(Buffer.from(challenge, 'hex'));
|
|
109
|
-
return verifier.verify(
|
|
108
|
+
return verifier.verify(key, signature, format);
|
|
110
109
|
}
|
|
111
110
|
catch (error) {
|
|
112
111
|
console.log(error);
|
package/package.json
CHANGED
|
@@ -80,10 +80,9 @@ export default abstract class CryptoUtils {
|
|
|
80
80
|
static verify(challenge: string, signature: string, key: string, format: BinaryToTextEncoding = 'base64'): boolean
|
|
81
81
|
{
|
|
82
82
|
try {
|
|
83
|
-
const pemKey = `-----BEGIN PUBLIC KEY-----\n${key.match(/.{1,64}/g)!.join('\n')}\n-----END PUBLIC KEY-----`;
|
|
84
83
|
const verifier = createVerify('sha256');
|
|
85
84
|
verifier.update(Buffer.from(challenge, 'hex'));
|
|
86
|
-
return verifier.verify(
|
|
85
|
+
return verifier.verify(key, signature, format);
|
|
87
86
|
|
|
88
87
|
} catch (error) { console.log(error); return false; }
|
|
89
88
|
}
|