forwardemail / forwardemail/superagent

There is no ability to provide passphrase for a private key

Open
#1,558 0 comments 12 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

There should be an ability to provide a passphrase for a private key. Https.request supports it.
From https://nodejs.org/api/https.html#https_https_request_options_callback
> The following additional options from tls.connect() are also accepted: ca, cert, ciphers, clientCertEngine, crl, dhparam, ecdhCurve, honorCipherOrder, key, passphrase, pfx, rejectUnauthorized, secureOptions, secureProtocol, servername, sessionIdContext.

```
// Example piece of https code
const key,cert,passphrase, ca; //Will have correct values. Leaving it blank for brevity.
const options = {
host: 'https',
path: '',
method: post,
headers: {
'Content-Type': 'application/json',
'Contentlength': 100
},
key,
cert,
passphrase,
ca,
rejectUnauthorized: false,
checkServerIdentity: function (host, cert) {
return undefined;
}
};
options.agent = new https.Agent(options);

const req = https.request(options, (res) => {
console.log('All OK. Server matched our pinned cert or public key');
console.log('statusCode:', res.statusCode);
console.log('headers:', res.headers);
res.on('data', console.log);
});
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing how superagent handles private-key options and compare that path with the passphrase option accepted by Node.js https.request and https.Agent. Done means callers can provide a passphrase alongside key and cert for HTTPS requests, with coverage for the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.