question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support private key as authentication vs file?

See original GitHub issue

I currently find the library to be a bit inconsistent when it comes to private keys. As a user I am left to write a key to file:

var Nexmo = require('nexmo');

var nexmo = new Nexmo({
    apiKey: 'key',
    apiSecret: 'secret',
});


nexmo.app.create(
  'First Voice App',
  'voice',
  'http://example.com/answer',
  'http://example.com/event',
  {},
  function(err, res) {
    var appId = res.id;
    var privateKey = res.keys.private_key;
    var privateKeyFile = __dirname + '/' + appId;
    require('fs').writeFileSync(privateKeyFile, privateKey);
  }
);

But then when I try to configure the library with a key it requires a filename and reads the file:

  nexmo = new Nexmo({
      apiKey: 'key',
      apiSecret: 'secret',
      applicationId: appId,
      privateKey: privateKeyFile
    });

I somehow think it would make a lot more sense for the initializer to just accept the key itself and not bother itself with reading from disc. This would also make it possible to create an app and then reinitialize the library in a few lines of code without having to write the key to disc.

Final note: I might want to save my API key somewhere else on the disk (another volume, database, etc) so having this option would be useful regardless.

Thoughts @leggetter @tjlytle ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cbettacommented, Oct 25, 2016

@leggetter check, I just figured that out. I was going to suggest similar behaviour for the node library indeed.

0reactions
leggettercommented, Mar 20, 2017

Closed via #80

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is SSH Public Key Authentication?
With SSH, public key authentication improves security considerably as it frees the users from remembering complicated passwords.
Read more >
Setting Up Public-Private Keys For SSH Authentication
The more pedantic in the tech community argue about the merits of public-private key authentication vs. simple password authentication when ...
Read more >
Are SSH Keys or Passwords Better for SFTP Authentication?
Which is better for SFTP authentication: SSH keys or passwords? Explore the pros and cons of each method in this post.
Read more >
What Is an SSH Key? | Sectigo® Official
The SSH key pair is used to authenticate the identity of a user or process that wants to access a remote system using...
Read more >
Public and Private Key Based Authentication
File Processor Connector supports public and private key based authentication for an FTP server (FTP over SSH). File Processor Connector supports FTP over...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found