@@ -12,13 +12,13 @@ Based on jsbn library from Tom Wu http://www-cs-students.stanford.edu/~tjw/jsbn/
1212## Example
1313
1414``` javascript
15- var NodeRSA = require (' node-rsa' );
16- var key = new NodeRSA ({b: 512 });
15+ const NodeRSA = require (' node-rsa' );
16+ const key = new NodeRSA ({b: 512 });
1717
18- var text = ' Hello RSA!' ;
19- var encrypted = key .encrypt (text, ' base64' );
18+ const text = ' Hello RSA!' ;
19+ const encrypted = key .encrypt (text, ' base64' );
2020console .log (' encrypted: ' , encrypted);
21- var decrypted = key .decrypt (encrypted, ' utf8' );
21+ const decrypted = key .decrypt (encrypted, ' utf8' );
2222console .log (' decrypted: ' , decrypted);
2323```
2424
@@ -43,9 +43,9 @@ This library developed and tested primary for Node.js, but it still can work in
4343
4444### Create instance
4545``` javascript
46- var NodeRSA = require (' node-rsa' );
46+ const NodeRSA = require (' node-rsa' );
4747
48- var key = new NodeRSA ([keyData, [format]], [options]);
48+ const key = new NodeRSA ([keyData, [format]], [options]);
4949```
5050
5151* keyData — ` {string|buffer|object} ` — parameters for generating key or the key in one of supported formats.<br />
@@ -67,12 +67,12 @@ You can specify some options by second/third constructor argument, or over `key.
6767
6868#### Creating "empty" key
6969``` javascript
70- var key = new NodeRSA ();
70+ const key = new NodeRSA ();
7171```
7272
7373#### Generate new 512bit-length key
7474``` javascript
75- var key = new NodeRSA ({b: 512 });
75+ const key = new NodeRSA ({b: 512 });
7676```
7777
7878Also you can use next method:
@@ -87,7 +87,7 @@ key.generateKeyPair([bits], [exp]);
8787#### Load key from PEM string
8888
8989``` javascript
90- var key = new NodeRSA (' -----BEGIN RSA PRIVATE KEY-----\n ' +
90+ const key = new NodeRSA (' -----BEGIN RSA PRIVATE KEY-----\n ' +
9191 ' MIIBOQIBAAJAVY6quuzCwyOWzymJ7C4zXjeV/232wt2ZgJZ1kHzjI73wnhQ3WQcL\n ' +
9292 ' DFCSoi2lPUW8/zspk0qWvPdtp6Jg5Lu7hwIDAQABAkBEws9mQahZ6r1mq2zEm3D/\n ' +
9393 ' VM9BpV//xtd6p/G+eRCYBT2qshGx42ucdgZCYJptFoW+HEx/jtzWe74yK6jGIkWJ\n ' +
@@ -138,10 +138,10 @@ Output type — can be:
138138** Code example**
139139
140140``` javascript
141- var keyData = ' -----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----' ;
141+ const keyData = ' -----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----' ;
142142key .importKey (keyData, ' pkcs8' );
143- var publicDer = key .exportKey (' pkcs8-public-der' );
144- var privateDer = key .exportKey (' pkcs1-der' );
143+ const publicDer = key .exportKey (' pkcs8-public-der' );
144+ const privateDer = key .exportKey (' pkcs1-der' );
145145```
146146
147147``` javascript
@@ -155,7 +155,7 @@ key.importKey({
155155 dmq1: new Buffer (' 1a7370470e0f8a4095df40922a430fe498720e03e1f70d257c3ce34202249d21' , ' hex' ),
156156 coeff: new Buffer (' 00b399675e5e81506b729a777cc03026f0b2119853dfc5eb124610c0ab82999e45' , ' hex' )
157157}, ' components' );
158- var publicComponents = key .exportKey (' components-public' );
158+ const publicComponents = key .exportKey (' components-public' );
159159console .log (publicComponents);
160160
161161/*
@@ -239,10 +239,10 @@ Questions, comments, bug reports, and pull requests are all welcome.
239239
240240### 1.0.0
241241 * Using semver now 🎉
242- * ** Possible breaking change** : Drop support nodejs < 8.11.1
242+ * ** Breaking change** : Drop support nodejs < 8.11.1
243+ * ** Possible breaking change** : ` new Buffer() ` call as deprecated was replaced by ` Buffer.from ` & ` Buffer.alloc ` .
243244 * ** Possible breaking change** : Drop support for hash scheme ` sha ` (was removed in node ~ 10). ` sha1 ` , ` sha256 ` and others still works.
244245 * ** Possible breaking change** : Little change in environment detect algorithm.
245-
246246
247247### 0.4.2
248248 * ` no padding ` scheme will padded data with zeros on all environments.
0 commit comments