Skip to main content

Generate the private and public keys pair

First of all, you need to generate the private and public keys pair. The following code samples illustrate how to generate new keys.

note

Node.js >= 15 is required.

const crypto = require('crypto');

const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 2048,
publicKeyEncoding: {
type: 'pkcs1',
format: 'der'
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'der'
}
});

console.log('The private key is: ', privateKey.toString('hex'));
console.log();
console.log('The public key is: ', publicKey.toString('base64'));
console.log();
console.log('Api Key Base64 is: ', crypto.createHash('sha256').update(publicKey).digest('base64'));
warning

Keep your private key in a safe place and don't share it with anyone, not even us.

You need to share with us only your:

  • Public key;
  • API key Base64.