Comparing version 0.3.1 to 0.3.2
@@ -24,10 +24,12 @@ 'use strict'; | ||
const createKeyPair = function (callback) { | ||
/* eslint-disable id-length */ | ||
const key = new NodeRSA({ b: 2048, e: 65537 }, { environment: 'node', signingAlgorithm: 'sha256' }); | ||
/* eslint-enable id-length */ | ||
process.nextTick(() => { | ||
/* eslint-disable id-length */ | ||
const key = new NodeRSA({ b: 2048, e: 65537 }, { environment: 'node', signingAlgorithm: 'sha256' }); | ||
/* eslint-enable id-length */ | ||
const privateKey = key.exportKey(), | ||
publicKey = key.exportKey('public'); | ||
const privateKey = key.exportKey(), | ||
publicKey = key.exportKey('public'); | ||
callback(null, privateKey, publicKey); | ||
callback(null, privateKey, publicKey); | ||
}); | ||
}; | ||
@@ -98,13 +100,17 @@ | ||
const rsaEncrypt = function (text, publicKey, callback) { | ||
const key = new NodeRSA(publicKey); | ||
const encryptedText = key.encrypt(text, 'base64', 'utf8'); | ||
process.nextTick(() => { | ||
const key = new NodeRSA(publicKey); | ||
const encryptedText = key.encrypt(text, 'base64', 'utf8'); | ||
callback(null, encryptedText); | ||
callback(null, encryptedText); | ||
}); | ||
}; | ||
const rsaDecrypt = function (text, privateKey, callback) { | ||
const key = new NodeRSA(privateKey); | ||
const decryptedText = key.decrypt(text, 'utf8'); | ||
process.nextTick(() => { | ||
const key = new NodeRSA(privateKey); | ||
const decryptedText = key.decrypt(text, 'utf8'); | ||
callback(null, decryptedText); | ||
callback(null, decryptedText); | ||
}); | ||
}; | ||
@@ -111,0 +117,0 @@ |
{ | ||
"name": "crypto2", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "crypto2 is a convenience wrapper around Node.js' crypto module.", | ||
@@ -13,2 +13,6 @@ "contributors": [ | ||
"email": "matthias.wagler@thenativeweb.io" | ||
}, | ||
{ | ||
"name": "Joe Bell", | ||
"email": "joe@jb-labs.uk" | ||
} | ||
@@ -15,0 +19,0 @@ ], |
@@ -191,3 +191,3 @@ # crypto2 | ||
```bash | ||
$ bot build-server | ||
$ bot | ||
``` | ||
@@ -198,3 +198,3 @@ | ||
The MIT License (MIT) | ||
Copyright (c) 2013-2016 the native web. | ||
Copyright (c) 2013-2017 the native web. | ||
@@ -201,0 +201,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27324
416
0