diff --git a/types/node-rsa/index.d.ts b/types/node-rsa/index.d.ts index f7e92c071b..e0730eef74 100644 --- a/types/node-rsa/index.d.ts +++ b/types/node-rsa/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-rsa 0.4 // Project: https://github.com/rzcoder/node-rsa // Definitions by: Ali Taheri +// Christian Moniz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -17,6 +18,11 @@ declare class NodeRSA { */ constructor(key: NodeRSA.Key, format?: NodeRSA.Format, options?: NodeRSA.Options); + /** + * Set and validate options for key instance. + */ + setOptions(options: NodeRSA.Options): void; + /** * @param bits Key size in bits. 2048 by default. * @param exponent public exponent. 65537 by default. diff --git a/types/node-rsa/node-rsa-tests.ts b/types/node-rsa/node-rsa-tests.ts index eac9a0397b..88d8bdcb2e 100644 --- a/types/node-rsa/node-rsa-tests.ts +++ b/types/node-rsa/node-rsa-tests.ts @@ -2,6 +2,11 @@ import NodeRSA = require('node-rsa'); const key = new NodeRSA({ b: 512 }); +key.setOptions({ + encryptionScheme: 'pkcs1_oaep', + signingScheme: 'pkcs1' +}); + const text = 'Hello RSA!'; const encrypted = key.encrypt(text, 'base64'); const decrypted = key.decrypt(encrypted, 'utf8');