Skip to content

Commit 48d6970

Browse files
committed
updated readme
1 parent 12f5101 commit 48d6970

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var key = new NodeRSA([key], [options]);
3030
```
3131
**key** - parameters of a generated key or the key in PEM format.<br/>
3232
**options** - additional settings
33-
* **signingAlgorithm** - algorithm used for signing and verifying. Default _'RSA-SHA256'_
33+
* **signingAlgorithm** - algorithm used for signing and verifying. Default *'RSA-SHA256'*
3434

3535
#### "Empty" key
3636
```js
@@ -82,17 +82,32 @@ key.isPublic([strict]);
8282
```js
8383
key.encrypt(buffer, [encoding], [source_encoding]);
8484
```
85+
Return encrypted data.<br/>
8586
**buffer** - data for encrypting, may be string, Buffer, or any object/array. Arrays and objects will encoded to JSON string first.<br/>
8687
**encoding** - encoding for output result, may be 'buffer', 'binary', 'hex' or 'base64'. Default *buffer*.
87-
**source_encoding** - source encoding, works only with string buffer. Can take standard Node.js Buffer encodings (hex, utf8, base64, etc). *Utf8* by default.<br/>
88+
**source_encoding** - source encoding, works only with string buffer. Can take standard Node.js Buffer encodings (hex, utf8, base64, etc). *'utf8'* by default.<br/>
8889

8990
```js
9091
key.decrypt(buffer, [encoding]);
9192
```
93+
Return decrypted data.<br/>
9294
**buffer** - data for decrypting. Takes Buffer object or base64 encoded string.<br/>
93-
**encoding** - encoding for result string. Can also take 'buffer' for raw Buffer object, or 'json' for automatic JSON.parse result. Default 'buffer'.
95+
**encoding** - encoding for result string. Can also take 'buffer' for raw Buffer object, or 'json' for automatic JSON.parse result. Default *'buffer*.
9496

9597
### Signing/Verifying
98+
```js
99+
key.sign(buffer, [encoding], [source_encoding]);
100+
```
101+
Return signature for data. All the arguments are the same as for `encrypt` method.
102+
103+
```js
104+
key.verify(buffer, signature, [source_encoding], [signature_encoding])
105+
```
106+
Return result of check, _true_ or _false_.<br/>
107+
**buffer** - data for check, same as `encrypt` method.<br/>
108+
**signature** - signature for check, result of `sign` method.<br/>
109+
**source_encoding** - same as for`encrypt` method.<br/>
110+
**signature_encoding** - encoding of given signature. May be 'buffer', 'binary', 'hex' or 'base64'. Default *'buffer'*.
96111

97112
## Contributing
98113

0 commit comments

Comments
 (0)