From 5104d46ff772bdb80ef7666028eadbb5c7d0f098 Mon Sep 17 00:00:00 2001 From: Christian Moniz Date: Mon, 19 Mar 2018 15:59:55 -0700 Subject: [PATCH 1/3] Add `setOptions` to `node-rsa` class definition --- types/node-rsa/index.d.ts | 6 ++++++ types/node-rsa/node-rsa-tests.ts | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/types/node-rsa/index.d.ts b/types/node-rsa/index.d.ts index 63d569378d..c697ee0db4 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 0f8defacbd..4a2360ce14 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'); From 7ad3c1e81cf65d5b355d20a636b1e194943c3ff2 Mon Sep 17 00:00:00 2001 From: Christian Moniz Date: Mon, 19 Mar 2018 16:06:04 -0700 Subject: [PATCH 2/3] Bump version in `index.d.ts` to 0.4.2 --- types/node-rsa/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-rsa/index.d.ts b/types/node-rsa/index.d.ts index c697ee0db4..05ebb24547 100644 --- a/types/node-rsa/index.d.ts +++ b/types/node-rsa/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-rsa 0.4 +// Type definitions for node-rsa 0.4.2 // Project: https://github.com/rzcoder/node-rsa // Definitions by: Ali Taheri // Christian Moniz From 94ae11d0d90af7f7cd877d2dae5b77b3d85a6c4b Mon Sep 17 00:00:00 2001 From: Christian Moniz Date: Mon, 19 Mar 2018 16:11:22 -0700 Subject: [PATCH 3/3] Remove patch version from header --- types/node-rsa/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node-rsa/index.d.ts b/types/node-rsa/index.d.ts index 05ebb24547..c697ee0db4 100644 --- a/types/node-rsa/index.d.ts +++ b/types/node-rsa/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-rsa 0.4.2 +// Type definitions for node-rsa 0.4 // Project: https://github.com/rzcoder/node-rsa // Definitions by: Ali Taheri // Christian Moniz